Skip to content

Fix build error caused by outdated jacoco gradle plugin#34

Merged
tuancoltech merged 2 commits intomainfrom
build/replace_jacoco_plugin
Feb 20, 2025
Merged

Fix build error caused by outdated jacoco gradle plugin#34
tuancoltech merged 2 commits intomainfrom
build/replace_jacoco_plugin

Conversation

@tuancoltech
Copy link
Copy Markdown
Member

@tuancoltech tuancoltech commented Feb 20, 2025

@tuancoltech tuancoltech requested a review from jo-elimu February 20, 2025 10:00
@tuancoltech tuancoltech self-assigned this Feb 20, 2025
@tuancoltech tuancoltech requested a review from a team as a code owner February 20, 2025 10:00
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request updates several Gradle configuration files. In app/build.gradle, the Jacoco plugin and tool version have been updated, the Java compatibility moved from version 11 to 17, and build features have been enabled. In build.gradle, the Android Gradle plugin and Jacoco dependency versions have also been upgraded. Additionally, the Gradle wrapper distribution URL in gradle/wrapper/gradle-wrapper.properties has been updated to a newer Gradle version.

Changes

Files Changes Summary
app/build.gradle
build.gradle
- Jacoco Plugin/Dependency: Plugin changed from com.dicedmelon.gradle.jacoco-android to com.mxalbert.gradle.jacoco-android; tool/dependency version updated from 0.8.4/0.1.5 to 0.8.10/0.2.1.
- Java Compatibility & AGP: Java source and target compatibility upgraded from VERSION_11 to VERSION_17; Android Gradle plugin upgraded from 7.4.2 to 8.0.2.
gradle/wrapper/gradle-wrapper.properties - Gradle Wrapper: Updated the distributionUrl from Gradle 7.5 to Gradle 8.8; added networkTimeout set to 10000 and validateDistributionUrl set to true.
gradlew
gradlew.bat
- Scripts: Enhanced comments, error handling, and execution flow; improved compatibility with POSIX-compliant shells in gradlew; refined error handling and command execution in gradlew.bat.

Poem

Hoppin' through the build files in a joyful spree,
Upgrading plugins and tools so merrily.
Java leaps from eleven to seventeen’s light,
Gradle and Jacoco dancing in delight.
I, a clever rabbit, cheer these changes grand—
Hopping forward in our code-filled wonderland! 🐇

Suggested labels

bug

Suggested reviewers

  • jo-elimu

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tuancoltech
Copy link
Copy Markdown
Member Author

This PR depends on: #33

@tuancoltech tuancoltech force-pushed the build/replace_jacoco_plugin branch from a18079a to e6523a2 Compare February 20, 2025 11:42
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.55%. Comparing base (6cb6348) to head (236d10a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #34   +/-   ##
=========================================
  Coverage     11.55%   11.55%           
  Complexity        9        9           
=========================================
  Files            10       10           
  Lines           199      199           
  Branches         37       37           
=========================================
  Hits             23       23           
  Misses          175      175           
  Partials          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
gradlew (1)

71-81: Consider using readlink instead of ls -ld for symlink resolution.
While this approach should work on many systems, scripting with ls -ld can be unpredictable on some shells or environments (e.g., BusyBox). Using readlink -f (if available) is often more robust for resolving symlinks.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6523a2 and 236d10a.

📒 Files selected for processing (3)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • gradlew (2 hunks)
  • gradlew.bat (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (macos-latest, 17)
  • GitHub Check: build (ubuntu-latest, 17)
🔇 Additional comments (9)
gradlew (3)

1-18: Good move to make the script strictly POSIX compliant.
The addition of explicit license headers and switching the shebang to #!/bin/sh promotes better portability. This also eases maintenance by discouraging Bash- or ksh-specific features.


134-140: Great validation of the user’s environment when JAVA_HOME is not set.
The fallback to java in PATH plus the explicit error message if it isn't found improves user experience.


218-248: Be mindful of environment variables containing newlines or special characters.
The process of splitting and reassembling via xargs and sed can break if variables contain multiline data or unmatched quotes. For most use cases this is acceptable, but just be aware of potential edge cases.

gradlew.bat (4)

28-34: Nice cleanup of directory resolution logic.
Resolving APP_HOME via a simple for %%i ... loop reduces ambiguity in relative paths and ensures the correct resolution of “.” and “..”.


37-37: Default JVM options
Defining initial heap settings (-Xmx64m / -Xms64m) here provides a safe baseline. If users need more memory in certain builds, they can override via JAVA_OPTS or GRADLE_OPTS.


74-74: Streamlined execution flow
Passing all command-line arguments (%*) directly to Gradle avoids potential parsing errors and simplifies the script. This is a clean approach.


79-87: Exit code handling
Storing the ERRORLEVEL in EXIT_CODE prevents zero-exit overshadowing genuine errors from preceding commands. This ensures the script exits with the correct code.

gradle/wrapper/gradle-wrapper.properties (2)

3-3: Upgrade to Gradle 8.8
Upgrading from 7.5 to 8.8 may introduce changes in plugin compatibility. Make sure your Jacoco and other plugins support Gradle 8.x.


4-5: Improved security and resilience with new properties
The networkTimeout and validateDistributionUrl properties help mitigate slow or tampered downloads. Setting them here is a good practice when dealing with remote Gradle distributions.

@tuancoltech
Copy link
Copy Markdown
Member Author

@jo-elimu Please review this.

matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
java: [11, 17]
java: [17]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
java: [17]
java: [17, 21]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jo-elimu I'll do this in separate changes since the main purpose of this PR is to resolve build error because of Jacoco plugin.
Anyway, some notes regarding this:
1/ Since Android Gradle build tool is currently 8.0.x, building with Java 21 will fail because it's unsupported yet with this version.
2/ Upgrading Android Gradle build tool to 8.5.x will probably cause build to fail because the new Jacoco plugin doesn't seem to support Gradle 8.5 yet.

So, for now. we should merge this PR and look for solution of this in another one.

@tuancoltech tuancoltech merged commit 90b6304 into main Feb 20, 2025
5 checks passed
@tuancoltech tuancoltech deleted the build/replace_jacoco_plugin branch February 20, 2025 12:37
@coderabbitai coderabbitai bot mentioned this pull request Apr 14, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ☑️

Development

Successfully merging this pull request may close these issues.

Upgrade to Gradle 8.x

2 participants