Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ksp] java.lang.IllegalArgumentException: this and base files have different roots #1079

Open
mtrakal opened this issue Aug 26, 2022 · 3 comments · May be fixed by #1143
Open

[ksp] java.lang.IllegalArgumentException: this and base files have different roots #1079

mtrakal opened this issue Aug 26, 2022 · 3 comments · May be fixed by #1143
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mtrakal
Copy link

mtrakal commented Aug 26, 2022

KSP didn't respect gradle buildDir variable.

Using RAM disk (Z: drive) for build folders:

USER_HOME/.gradle/init.gradle

allprojects {
    buildDir="Z:/build/$group/$name/"
}

app/build.gradle

android {
    sourceSets {
        androidTest.assets.srcDirs += files("$projectDir/schemas".toString())

        main.kotlin.srcDirs += '$buildDir/generated/ksp/$name/kotlin/'
        test.kotlin.srcDirs += '$buildDir/generated/ksp/$name/kotlin/'
    }

    buildTypes {
       // https://github.com/InsertKoinIO/koin-annotations
        applicationVariants.all { variant ->
            variant.sourceSets.java.each {
                it.srcDirs += "$buildDir/generated/ksp/${variant.name}/kotlin/"
            }
        }
   }
}

But build failed with:

e: [ksp] java.lang.IllegalArgumentException: this and base files have different roots: Z:\build\ProjectX\app\generated\ksp\stagingDebug\java\cz\packagename\data\database\dao\UserOauthDao_Impl.java and D:\Projects\company\ProjectX\app.
	at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
	at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
	at com.google.devtools.ksp.processing.impl.CodeGeneratorImpl.associate(CodeGeneratorImpl.kt:119)
	at com.google.devtools.ksp.processing.impl.CodeGeneratorImpl.createNewFile(CodeGeneratorImpl.kt:92)
	at androidx.room.compiler.processing.ksp.KspFiler.createNewFile(KspFiler.kt:106)
	at androidx.room.compiler.processing.ksp.KspFiler.write(KspFiler.kt:41)
	at androidx.room.compiler.processing.XFilerKt.writeTo(XFiler.kt:44)
	at androidx.room.compiler.processing.XFilerKt.writeTo$default(XFiler.kt:43)
	at androidx.room.writer.ClassWriter.write(ClassWriter.kt:75)
	at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:111)
	at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:42)
@ting-yuan ting-yuan added this to the 1.0.7 milestone Aug 26, 2022
@ting-yuan ting-yuan added the bug Something isn't working label Aug 26, 2022
@neetopia neetopia self-assigned this Sep 15, 2022
@neetopia neetopia linked a pull request Oct 11, 2022 that will close this issue
@ting-yuan ting-yuan modified the milestones: 1.0.7, 1.0.9 Jan 6, 2023
@changfeng1050
Copy link

I have come across this problem too. And found no method to solve it. So I have to continue to use kapt. I prefer to use ramdisk other then ksp.

@xBlackCat
Copy link

Any progress on the issue?

@mtrakal
Copy link
Author

mtrakal commented Mar 12, 2024

@neetopia could you, please, set new milestone? 1.0.9 was already released (with only 56% complete) and this was not fixed... Still valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants