Bug 1104855 - Don't rebuild the omnijar on every Gradle build. rs=margaret

This ticket splits a new omnijar project off of base.  The new
project's omnijar task knows the inputs (well, those under
mobile/android) and the omni.ja output and only re-packages the
omnijar when the task's output is out of date.

With this modification, local building and most importantly the
Android JUnit test cycle is much improved, because the APK is not
re-deployed when only test code is modified.

In addition, the new project lists the omnijar inputs as "Java" source
directories.  Previously, they were listed as "Java resource" source
directories, which meant that the omnijar inputs were packaged into
the final APK.  This wasted time and space.

--HG--
extra : rebase_source : 12c94fdfbee9b7c319d5cfb4d7faad254e90abfc
This commit is contained in:
Nick Alexander 2014-11-25 09:54:31 -08:00
Родитель 7aa14436a6
Коммит 9414bc9e09
7 изменённых файлов: 61 добавлений и 20 удалений

Просмотреть файл

@ -422,10 +422,11 @@ $(abspath $(DIST)/fennec/$(OMNIJAR_NAME)): FORCE
$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
# Targets built very early during a Gradle build.
gradle-targets: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
gradle-targets: .aapt.deps
.PHONY: gradle-targets
gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
.PHONY: gradle-targets gradle-omnijar
libs:: geckoview_resources.zip classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
$(INSTALL) geckoview_resources.zip $(FINAL_TARGET)

Просмотреть файл

@ -61,29 +61,22 @@ android {
srcDir "crashreporter/res"
}
}
resources {
srcDir '../locales'
srcDir '../chrome'
srcDir '../components'
srcDir '../modules'
srcDir '../app'
srcDir '../themes/core'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':thirdparty')
compile 'com.android.support:support-v4:19.1.+'
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:mediarouter-v7:19.1.+'
compile 'com.google.android.gms:play-services:5.+'
compile project(':thirdparty')
compile project(':omnijar')
}
task prepareObjDir(type:Exec) {
task generateCodeAndResources(type:Exec) {
workingDir "${topobjdir}"
commandLine "${topsrcdir}/mach"
@ -94,5 +87,5 @@ task prepareObjDir(type:Exec) {
}
android.libraryVariants.all { variant ->
variant.checkManifest.dependsOn prepareObjDir
variant.checkManifest.dependsOn generateCodeAndResources
}

Двоичные данные
mobile/android/gradle/gradle/wrapper/gradle-wrapper.jar поставляемый

Двоичный файл не отображается.

Просмотреть файл

@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Tue Nov 25 10:01:42 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip

Просмотреть файл

@ -0,0 +1,42 @@
project.buildDir = "${topobjdir}/mobile/android/gradle/omnijar/build"
apply plugin: 'java'
sourceSets {
main {
java {
// Remove the default directories entirely.
srcDirs = []
// Depend on everything in mobile/android that goes into
// the omnijar.
srcDir '../../locales'
srcDir '../../chrome'
srcDir '../../components'
srcDir '../../modules'
srcDir '../../themes/core'
}
}
}
/**
* This task runs when any input file is newer than the omnijar.
*/
task rebuildOmnijar(type:Exec) {
// Depend on all the inputs labeled as Java sources.
project.sourceSets.main.java.srcDirs.each { srcDir ->
inputs.sourceDir srcDir
}
// Produce a single output file.
outputs.file "${topobjdir}/dist/fennec/assets/omni.ja"
workingDir "${topobjdir}"
commandLine "${topsrcdir}/mach"
args 'build'
args '-C'
args 'mobile/android/base'
args 'gradle-omnijar'
}
// Rebuild the omnijar before the earliest Java task.
tasks.compileJava.dependsOn rebuildOmnijar

Просмотреть файл

@ -0,0 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mozilla.gecko.omnijar">
</manifest>

Просмотреть файл

@ -1,8 +1,9 @@
include ':app'
project(':app').projectDir = new File("${topsrcdir}/mobile/android/app")
include ':base'
project(':base').projectDir = new File("${topsrcdir}/mobile/android/base")
include ':omnijar'
include ':thirdparty'
project(':app').projectDir = new File("${topsrcdir}/mobile/android/app")
project(':base').projectDir = new File("${topsrcdir}/mobile/android/base")
project(':omnijar').projectDir = new File("${topsrcdir}/mobile/android/gradle/omnijar")
project(':thirdparty').projectDir = new File("${topsrcdir}/mobile/android/thirdparty")