Closed Bug 1098239 Opened 10 years ago Closed 9 years ago

Use latest gradle and android plugin

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: lucasr, Assigned: nalexander)

References

Details

Attachments

(2 files, 3 obsolete files)

Latest Android Studio depends on latest gradle and plugin.
Comment on attachment 8522150 [details] [diff] [review]
Use latest gradle and android plugin (r=nalexander)

Any objections? I assume this doesn't break IntelliJ.
Attachment #8522150 - Flags: review?(nalexander)
Comment on attachment 8522150 [details] [diff] [review]
Use latest gradle and android plugin (r=nalexander)

Review of attachment 8522150 [details] [diff] [review]:
-----------------------------------------------------------------

I have nothing against this but it seems these versions do break between IDEs :/  I'll need to test against IntelliJ 13 and possibly 14.  So f+ (really r+) but please hold off landing until I can test IntelliJ and update my blog post.
Attachment #8522150 - Flags: feedback+
Blocks: intellij
Attachment #8522150 - Flags: review?(nalexander) → review+
I think I spoke to soon; this regresses things locally:

2014-11-13 16:46:59,753 [ 125129]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home 
2014-11-13 16:46:59,754 [ 125130]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home 
2014-11-13 16:46:59,755 [ 125131]   INFO - .project.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [--init-script, /private/var/folders/8r/5fffr4ys61j691ly5_05q5l00000gn/T/wrap317656633028967065.gradle] 
2014-11-13 16:47:01,002 [ 126378]   INFO - .project.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [-Pandroid.injected.build.model.only=true, -Pandroid.injected.invoked.from.ide=true, --init-script, /private/var/folders/8r/5fffr4ys61j691ly5_05q5l00000gn/T/ijinit8295520997320752547.gradle] 
2014-11-13 16:47:02,831 [ 128207]  ERROR - vice.AndroidProjectDataService - Failed to set up Android modules in project 'gradle' 
org.gradle.tooling.model.UnsupportedMethodException: Unsupported method: SourceProvider.getJniDirectories().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
	at org.gradle.tooling.model.internal.Exceptions.unsupportedMethod(Exceptions.java:33)

I might back this out.
Regression triggered from command-line or within an IDE?
https://hg.mozilla.org/mozilla-central/rev/19fdbc7ad829
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 36
(In reply to Lucas Rocha (:lucasr) from comment #6)
> Regression triggered from command-line or within an IDE?

Within IDEA Ultimate 13.  I think the IDEA JetGradle plugin only works with specific Gradle versions; it's essentially inspecting Gradle's project model.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: lucasr.at.mozilla → nobody
Attachment #8537480 - Flags: review?(michael.l.comella)
/r/1519 - Bug 1098239 - Bump Gradle and Android-Gradle plugin versions. r=mcomella

Pull down this commit:

hg pull review -r e2734df319e953732acc053daf1e6c427bd10848
To resume this at a later point.
Flags: needinfo?(michael.l.comella)
Oh, I have the r? anyway.
Flags: needinfo?(michael.l.comella)
I've had this applied in a patch for the past week on OSX, and it's been working great for me with IntelliJ. I'd actually like to see this in the tree if it doesn't break anything else terribly (NI? mcomella) because it's a little annoying to mix bookmarks and mq workflow for me.

mcomella, what are the issues that you're running into? Does this patch make it worse than what's currently in the tree?
Flags: needinfo?(michael.l.comella)
Assignee: nobody → nalexander
Comment on attachment 8537480 [details]
MozReview Request: bz://1098239/nalexander

(In reply to Chenxia Liu [:liuche] from comment #14)
> mcomella, what are the issues that you're running into? Does this patch make
> it worse than what's currently in the tree?

This is probably a local issue - it appears the support library cannot be imported which causes many things not to compile. I think there are also other issues.

I'm not sure what the changes from the patch are but I can't get a good compile going either way. I'm fine landing it and cleaning up my Linux/my local copy in a followup. We may wish to get some feedback from other Linux Intellij users before landing though... mhaigh (but PTO) is one option.
Flags: needinfo?(michael.l.comella)
Attachment #8537480 - Flags: review?(michael.l.comella) → review?(liuche)
This is a big patch, but it's essentially NPOTB.  The part that is POTB
is ... removing Gradle integration from the build.  I've implemented
|mach gradle-install| as a substitute for the build system stuff; it's
just so much easier to iterate on a mach command than a moz.build and
Makefile.in.

I'm landing this with self-review because this lessens the impact of the
Gradle integration on the build system and because I am the only person
who understands either the old or the new system.

You'll need to run |mach gradle-install| at top level to configure the
new Gradle integration.  But |mach gradle ...| does the right thing
configuration steps too.

This patch rewrites most of the Gradle integration.  The major changes
are:

* all .gradle files move into mobile/android/gradle;
* all the Gradle projects live in the object directory;
* mozconfig exposed to all build.gradle files;
* simplification of Android configuration between build.gradle files;
* support for user-specified version of build tools;
* first steps towards supporting builds from the source directory;
* bumps Gradle to 2.2.1;
* bumps the Android-Gradle plugin to 0.14.4.

This is seemingly a step backwards given that we'd prefer to ship the
.idea directory in the source directory.  But in fact we get closer to
that; it's possible to run ./gradlew in the source directory and get a
reasonable build.  We'll progress with this in time.  The win right now
is that the projects are nested, which makes importing work better on
Linux machines.

Unfortunately IntelliJ 13 and 14 now have conflicting Android-Gradle
plugin version requirements, so we now only support IntelliJ 14.0.2 and
above.
Attachment #8522150 - Attachment is obsolete: true
Attachment #8540430 - Flags: feedback?(michael.l.comella)
This is a big patch, but it's essentially NPOTB.  The part that is POTB
is ... removing Gradle integration from the build.  I've implemented
|mach gradle-install| as a substitute for the build system stuff; it's
just so much easier to iterate on a mach command than a moz.build and
Makefile.in.

I'm landing this with self-review because this lessens the impact of the
Gradle integration on the build system and because I am the only person
who understands either the old or the new system.

You'll need to run |mach gradle-install| at top level to configure the
new Gradle integration.  But |mach gradle ...| does the right thing
configuration steps too.

This patch rewrites most of the Gradle integration.  The major changes
are:

* all .gradle files move into mobile/android/gradle;
* all the Gradle projects live in the object directory;
* mozconfig exposed to all build.gradle files;
* simplification of Android configuration between build.gradle files;
* support for user-specified version of build tools;
* first steps towards supporting builds from the source directory;
* bumps Gradle to 2.2.1;
* bumps the Android-Gradle plugin to 0.14.4.

This is seemingly a step backwards given that we'd prefer to ship the
.idea directory in the source directory.  But in fact we get closer to
that; it's possible to run ./gradlew in the source directory and get a
reasonable build.  We'll progress with this in time.  The win right now
is that the projects are nested, which makes importing work better on
Linux machines.

Unfortunately IntelliJ 13 and 14 now have conflicting Android-Gradle
plugin version requirements, so we now only support IntelliJ 14.0.2 and
above.
Attachment #8540430 - Attachment is obsolete: true
Attachment #8540430 - Flags: feedback?(michael.l.comella)
With IntelliJ 14.0.2, the Gradle project works perfectly for me.
https://hg.mozilla.org/mozilla-central/rev/6d4ab59f9764
Status: REOPENED → RESOLVED
Closed: 10 years ago9 years ago
Resolution: --- → FIXED
Depends on: 1115064
Attachment #8537480 - Flags: review?(liuche)
Depends on: 1120032
Attachment #8537480 - Attachment is obsolete: true
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 36 → mozilla36
You need to log in before you can comment on or make changes to this bug.