How do I get the root directory of a referenced project in apt?


    override fun process(set: Set<TypeElement>, roundEnvironment: RoundEnvironment): Boolean {

        if (once.compareAndSet(false, true)) {
            log("once!!")
            val rootProject = File("").absoluteFile
            val build = File(rootProject, "build/keep-build.txt")
            log(build.absolutePath)
            if (build.exists()) {
                build.delete()
            }
            build.createNewFile()
        }


        return false
    }

I wrote a apt project A , and I want to generate a non- java file in process () .
then my other java project B uses this apt project A .

I want to get the root directory of the project B that uses it in this A project.

I tried to get File (""). AbsoluteFile

) in process () .

but the return is Warning:Note: / Applications/Android Studio.app/Contents/bin/build/keep-build.txt

Aug.12,2021

use

kapt {
    arguments {
        arg("key", "value")
    }
}

get

from ProcessingEnvironment-sharpoptions
Menu