Skip to content

ADFA-3224: ensure java is available in PATH when invoking D8#1052

Merged
itsaky-adfa merged 6 commits intostagefrom
fix/ADFA-3224
Mar 13, 2026
Merged

ADFA-3224: ensure java is available in PATH when invoking D8#1052
itsaky-adfa merged 6 commits intostagefrom
fix/ADFA-3224

Conversation

@itsaky-adfa
Copy link
Contributor

@itsaky-adfa itsaky-adfa commented Mar 9, 2026

See ADFA-3224 for more details.

Signed-off-by: Akash Yadav <akashyadav@appdevforall.org>
Signed-off-by: Akash Yadav <akashyadav@appdevforall.org>
@itsaky-adfa itsaky-adfa requested a review from a team March 9, 2026 14:08
@itsaky-adfa itsaky-adfa self-assigned this Mar 9, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3723a74c-81f7-4efa-921e-761df1370cd6

📥 Commits

Reviewing files that changed from the base of the PR and between 9a9024b and ad3097b.

📒 Files selected for processing (1)
  • app/build.gradle.kts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/build.gradle.kts

📝 Walkthrough

Release Notes

  • Fixes D8 invocation on systems without Java in PATH: Adds automatic PATH augmentation that prepends JAVA_HOME/bin to the PATH environment variable when executing D8 during asset assembly, ensuring Java can be resolved on systems where it is not already configured in the user's PATH.

  • Platform-aware implementation: Uses File.separator and File.pathSeparator for proper cross-platform compatibility (Windows and Unix-like systems).

  • Preserves existing PATH: The implementation correctly preserves any existing PATH entries by appending the current PATH after the Java binary directory, maintaining system configuration integrity.

Considerations

  • Limited scope: The fix only applies to D8 execution within the Gradle build process. Users invoking D8 directly outside the build system will not benefit from this change.

  • Dependency on system property: The fix relies on System.getProperty("java.home") being properly set. While the code includes a check for blank values, this could theoretically fail in unusual JVM configurations.

Walkthrough

The Gradle build script was changed to prepend JAVA_HOME/bin to the PATH before invoking D8 during asset-creation, ensuring Java is resolvable; minor whitespace/indentation adjustments were also made.

Changes

Cohort / File(s) Summary
Build Environment Configuration
app/build.gradle.kts
Prepends JAVA_HOME/bin to the PATH environment variable for D8 invocations in the asset-creation task; only environmental PATH augmentation and minor formatting/indentation edits were introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nudged JAVA_HOME into PATH today,
So D8 can find its hop and play.
A tiny tweak, no fuss or fray—
Builds hum along in joyful sway. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: ensuring Java is available in PATH when invoking D8, which aligns with the raw summary of adding PATH augmentation.
Description check ✅ Passed The description references a related issue (ADFA-3224) which provides context for the change, though minimal details are provided directly in the PR description.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ADFA-3224
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/build.gradle.kts (1)

506-515: Comment says "prepend" but code appends.

The comment on line 507 states "Prepend JAVA_HOME/bin to PATH", but the implementation appends java.home/bin to the end of the existing PATH:

<existing_PATH>:<java.home>/bin

For the stated goal of making java resolvable, this works fine. However, if the intent were to override a potentially incompatible system java, prepending would be necessary.

🔧 Proposed fix to actually prepend (if that's the intent)
 environment(
     "PATH",
-    (System.getenv("PATH")?.let { it + File.pathSeparator } ?: "") +
-        System.getProperty(
-            "java.home",
-        ) + File.separator + "bin",
+    System.getProperty("java.home") + File.separator + "bin" +
+        (System.getenv("PATH")?.let { File.pathSeparator + it } ?: ""),
 )

Alternatively, just fix the comment to say "append" if the current behavior is intentional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/build.gradle.kts` around lines 506 - 515, The comment claims we "Prepend
JAVA_HOME/bin to PATH" but the environment(...) call currently appends
java.home/bin; either update the comment to "Append JAVA_HOME/bin to PATH" or
change the PATH expression to actually prepend: construct PATH as java.home +
File.separator + "bin" + (File.pathSeparator + existing PATH if present) inside
the environment("PATH", ...) call so that java.home/bin comes before the
existing System.getenv("PATH"); refer to the environment(...) invocation and the
"PATH" / System.getProperty("java.home") usages when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/build.gradle.kts`:
- Around line 506-515: The comment claims we "Prepend JAVA_HOME/bin to PATH" but
the environment(...) call currently appends java.home/bin; either update the
comment to "Append JAVA_HOME/bin to PATH" or change the PATH expression to
actually prepend: construct PATH as java.home + File.separator + "bin" +
(File.pathSeparator + existing PATH if present) inside the environment("PATH",
...) call so that java.home/bin comes before the existing System.getenv("PATH");
refer to the environment(...) invocation and the "PATH" /
System.getProperty("java.home") usages when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0ceceae-e64d-46b3-bb44-bf5cebaa9de5

📥 Commits

Reviewing files that changed from the base of the PR and between 5a56a46 and 9a9024b.

📒 Files selected for processing (1)
  • app/build.gradle.kts

Signed-off-by: Akash Yadav <akashyadav@appdevforall.org>
Signed-off-by: Akash Yadav <akashyadav@appdevforall.org>
@itsaky-adfa itsaky-adfa merged commit 4755d0b into stage Mar 13, 2026
2 checks passed
@itsaky-adfa itsaky-adfa deleted the fix/ADFA-3224 branch March 13, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants