Repository navigation
Fix Gradle source root in included builds and index Java in Android modules - #1045
Open
christoph-sg wants to merge 2 commits into
Open
christoph-sg wants to merge 2 commits into
christoph-sg wants to merge 2 commits into
Conversation
ScipGradlePlugin used project.getRootDir() as the source root for the javac plugin and scip-kotlinc. buildSrc and included builds have their own root directory, so their documents got paths relative to it: kotlinx-datetime's buildSrc/src/main/kotlin/KotlinUserProjectInfra.kt was indexed as src/main/kotlin/KotlinUserProjectInfra.kt, and thunderbird-android's included build components/ui/bolt/... as ui/bolt/... The init script now passes the CLI's working directory as scipSourceroot, and the plugin uses it for every build. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a178a8-3c2c-75e0-bfa6-7417585d4372
The javac plugin was only attached in projects with the `java` plugin, so Java sources in Android modules were never indexed (#177). Android JavaCompile tasks always get -processorpath from the variant's annotation processor configurations, and javac only looks for -Xplugin plugins there when it is set. In com.android.* projects the plugin jar is now added to annotationProcessor, testAnnotationProcessor and androidTestAnnotationProcessor, and -Xplugin:scip is added to their JavaCompile tasks like for `java` projects. The default scipCompileAll still only triggers compileJava, so Android variants need an explicit build command such as `scip-java index -- compileDebugJavaWithJavac`. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a178a8-3c2c-75e0-bfa6-7417585d4372
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Gradle plugin fixes found while indexing real-world projects for the Kotlin Analysis API work (#1044). Neither depends on that work: both apply to the javac plugin and scip-kotlinc as they are on
main.Source root in
buildSrcand included builds.ScipGradlePluginusedproject.getRootDir()as the source root, which forbuildSrcand included builds is their own directory, so their documents got paths relative to it. The init script now passes the CLI's working directory asscipSourceroot. With nowinandroid'sbuild-logicincluded build:convention/src/main/kotlin/HiltConventionPlugin.ktbuild-logic/convention/src/main/kotlin/HiltConventionPlugin.ktJava in Android modules (#177). The javac plugin was only attached in
javaprojects. AGP'sJavaCompiletasks always get-processorpathfrom the annotation processor configurations, so incom.android.*projects the plugin jar is now added toannotationProcessor,testAnnotationProcessorandandroidTestAnnotationProcessor. Withscip-java index -- :timber-sample:compileDebugJavaWithJavacon JakeWharton/timber:timber-sampleBuildConfigand data binding classesscipCompileAllstill doesn't trigger Android compile tasks, so Android variants need an explicit build command.Verified with
GradleBuildToolTestandspotlessCheck.