plugin: update gradle plugin to support gradle and gradlew
Metadata
Current evaluation
System Gradle and gradlew support, configurable output directories, and expanded tests were merged in snapcore/snapcraft#1024 via commit 8f601ff93.
Resolution: closed resolved
Reason: The plugin update was merged through snapcore/snapcraft#1024 at commit 8f601ff93, adding both build modes, configurable output directories, and tests for each mode.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Updated gradle plugin to check if ./gradlew exists in os.cwd().
If it does not, then 'gradle' is added to the get_build_dependencies() list.
If it does, then ./gradlew is called, if it does not, then gradle is called.
Updated tests to use both gradle and gradlew (so a complete duplication of all tests).
Added an option to specify the gradle-output-dir which will by copied to the installdir.
The default value here is 'build/libs' which is what the old default was hard-coded to be.
https://github.com/snapcore/snapcraft/pull/1024
EDIT:
Gradle is a build system for Java applications. Currently, snapcraft supports the gradle wrapper (graldlew) which is what is used so that developers can build the source without the full gradle suite installed.
However, the plugin to snapcraft is limited to supporting only this wrapper. There are other applications that support/require using the full gradle suite.
Changes:
Within snapcraft, the invocation of gradle v. ./gradlew is determined by the existence of the wrapper script. Same goes for if there is a build dependency which snapcraft must install.
The arguments passed to wrapper and to gradle are the same.
On top of these changes, I have added in the ability to specify what the target output directory is from gradle. Gradle has default output directories, but it is very flexible and is possible to change the output directory to be anything. Thus, snapping the data from the gradle plugin is not always easily done. The default is build/libs which works if nothing is altered.
EX:
On the snapcraft mailing list, there was a request for help building a gradle application. The output of this application was 'BUILD/'.
This modification would bring in the full support of gradle or gradlew into being where before it was only 'gradlew'.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | System Gradle and gradlew support, configurable output directories, and expanded tests were merged in snapcore/snapcraft#1024 via commit 8f601ff93. | |
| stealth/space-bunny-alpha | — | closed resolved | System Gradle and ./gradlew support, configurable output directories, and expanded tests were merged in #1024 via commit 8f601ff93. | |
| stealth/space-bunny-alpha | — | closed resolved | Gradle wrapper and system Gradle support was merged in PR #1024 (commit 8f601ff93), adding wrapper detection, configurable output directories, and tests for both modes. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #1024 in commit 8f601ff93: the Gradle plugin now supports system Gradle or ./gradlew, configurable output directories, and expanded tests. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged via PR #1024. The Gradle plugin now auto-detects and uses either the gradle wrapper or full gradle suite based on script presence. A configurable output directory option was added to support non-standard build layouts. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged via PR #1024. The Gradle plugin now auto-detects and uses either the gradle wrapper or system gradle, manages corresponding build dependencies, and supports configurable output directories defaulting to build/libs. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged via PR #1024. The snapcraft gradle plugin now auto-detects and invokes either gradle or ./gradlew based on wrapper existence, introduces a configurable gradle-output-dir option, and includes comprehensive test updates. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged via PR #1024. The Gradle plugin now detects and uses gradlew or gradle based on wrapper availability, supports configurable output directories, and includes comprehensive test updates. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcore/snapcraft#1024
(confidence 100%)
PR #1024 was merged as commit 8f601ff93 and directly implements the requested Gradle and gradlew support.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1024 gradle plugin: update gradle plugin to support both gradle and gradlew | snapcraft | merged | Merged in #1024 (commit 8f601ff93): Gradle builds now use ./gradlew when present, otherwise system Gradle, with configurable output directories and expanded tests. | |
| #1600492 Add gradle plugin and test | snapcraft (launchpad) | closed | Gradle plugin support was merged in snapcraft#651 (48cb3adc6); snapcraft#912 (a1aee9da5) later added the demo and test. | |
| #1642432 The gradle plugin only has unit tests | snapcraft (launchpad) | closed | Added a user-level Gradle demo and integration test; snapcore/snapcraft#912 was merged as commit a1aee9da5. |