fix(build): the build follows --project-root-path, and a missing Gradle is a message, not an NPE - #268
Open
rahlk wants to merge 1 commit into
Open
fix(build): the build follows --project-root-path, and a missing Gradle is a message, not an NPE#268rahlk wants to merge 1 commit into
rahlk wants to merge 1 commit into
Conversation
…le is a message, not an NPE Two defects in BuildProject, both of which reached the user as a degraded overlay on a run that still exited 0. gradleBuild dereferenced GRADLE_CMD with no null guard, while mavenBuild guards on isMavenInstalled(). On a machine with neither Gradle on PATH nor a wrapper the command resolves to null, so the compile raised a NullPointerException, the caller caught it and degraded, and the user was told the RTA call graph was unavailable because a private field they have never heard of was null. A package-private overload takes the command explicitly so the missing-Gradle path is reachable from a test. --project-root-path redirected downloadLibraryDependencies but not the build. An input at the repository root over a module carrying the only pom.xml therefore resolved dependencies correctly and then compiled against a directory with no build file, fell through to Gradle, and emitted declared edges only. resolveBuildRoot tries the input first, so a module carrying its own build file builds exactly where it did before and no existing invocation changes behaviour; the root pom is consulted only when the input has nothing to build, and when neither has one the input is returned unchanged. The custom-build-command branch is guarded against a null MAVEN_CMD for the same reason: String.replace would throw rather than report the missing tool.
This was referenced Sep 17, 2026
Document --project-root-path and the multi-module story for codeanalyzer-java
codellm-devkit/docs#11
Open
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 defects in
BuildProject, both of which reached the user the same way: as a degraded overlay on a run that still exited 0.1.
gradleBuilddereferenced a null commandmavenBuildguards onisMavenInstalled()before it touchesMAVEN_CMD.gradleBuildhad no counterpart, so on a machine with neither Gradle onPATHnor a wrapper the command resolves to null and the compile raised:The caller catches that and degrades, so the user is told the RTA call graph is unavailable because a private field they have never heard of was null — and the run exits 0. Now:
A package-private
gradleBuild(String, String)overload takes the command explicitly so the missing-Gradle path is reachable from a test.2.
--project-root-pathredirected dependencies but not the build-freacheddownloadLibraryDependenciesand stopped there. For an input at the repository root over a module carrying the onlypom.xml, dependency resolution therefore succeeded while the compile ran against a directory with no build file at all, fell through to Gradle, and emitted declared edges only.resolveBuildRoottries the input first:-icarries a build file?-i-fdoes-f-iDeliberately conservative: only the currently broken case moves. The custom-build-command branch is guarded against a null
MAVEN_CMDfor the same reason as (1) —String.replacewould throw rather than report the missing tool.Tests
BuildProjectTestwas an empty stub; it now carries six cases, written failing first:gradleBuildReportsAMissingGradleInsteadOfThrowingbuildRootPrefersTheInputWhenItCarriesItsOwnBuildFilebuildRootFallsBackToProjectRootPomWhenTheInputHasNoBuildFilebuildRootFallsBackToAGradleProjectRootPombuildRootKeepsTheInputWhenNeitherCarriesABuildFilebuildRootToleratesAnAbsentProjectRootPomVerification
./gradlew testCodeAnalyzerIntegrationTestTestcontainers/DockerinitializationError, confirmed by re-running on a pristine tree-a 1/2/3/4onmvnw-working-testall validate againstanalysis.v2.schema.json, exit 0, zero warningsjson(-a 1) ⊆ (-a 2) ⊆ (-a 3) ⊆ (-a 4), no violations-a 4 --eagerruns byte-identical--emit neo4jvs JSON at full depth +--external-calls: no JSON id absent from the cypher; the 13 cypher-only ids are ordinal body vertices plus the app rootAfter the fix, the previously broken invocation builds and projects cleanly:
Follow-ons
python-sdkpinscodeanalyzer-java==3.3.3exactly (pyproject.toml:46); the pin needs a bump once this releases, or no SDK user receives the fix.-fis undocumented on both docs fronts and in the README beyond the usage synopsis, and it now has a second effect.Not addressed
gradleCmd.equals("gradlew")is dead —getGradleCommand()returns an absolute wrapper path, never the bare name, so that branch cannot fire. Preserved as-is rather than widened into this fix.