plugin: update gradle plugin to support gradle and gradlew

Bug #1653182 reported by Matthew Aguirre on 2016-12-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Matthew Aguirre

Bug Description

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.

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.

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.

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

description: updated
Changed in snapcraft:
assignee: nobody → Matthew Aguirre (matt-aguirre)
Kyle Fazzari (kyrofa) wrote :

@Matthew, you're doing things a little bit in the wrong order here. You need a log a bug describing why this is an issue at all, and then fix it. As it stands, this bug tells me nothing more than your PR does. What is gradlew? Why is it needed? Why is this a shortcoming in the plugin? These are questions that should be answered in the bug.

Matthew Aguirre (matt-aguirre) wrote :

Thanks, hopefully I provided more info.

description: updated
description: updated
Changed in snapcraft:
status: New → In Progress
importance: Undecided → Wishlist
milestone: none → 2.26
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers