Bug 1098239 - Rewrite mobile/android Gradle integration. r=me

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.

--HG--
rename : mobile/android/base/gradle_AndroidManifest.xml => mobile/android/gradle/base/AndroidManifest.xml
rename : mobile/android/base/gradle_AndroidManifest.xml => mobile/android/gradle/branding/AndroidManifest.xml
rename : mobile/android/gradle/omnijar/gradle_AndroidManifest.xml => mobile/android/gradle/omnijar/AndroidManifest.xml
rename : mobile/android/base/gradle_AndroidManifest.xml => mobile/android/gradle/preprocessed_code/AndroidManifest.xml
rename : mobile/android/base/gradle_AndroidManifest.xml => mobile/android/gradle/preprocessed_resources/AndroidManifest.xml
rename : mobile/android/thirdparty/gradle_AndroidManifest.xml => mobile/android/gradle/thirdparty/AndroidManifest.xml
This commit is contained in:
Nick Alexander 2014-12-22 19:49:04 -08:00
parent b55dfdb095
commit 4f3f4284e1
30 changed files with 448 additions and 230 deletions

3
.gitignore vendored
View file

@ -67,3 +67,6 @@ GPATH
# Git clone directory for updating web-platform-tests
testing/web-platform/sync/
# Android Gradle artifacts.
mobile/android/gradle/.gradle

View file

@ -93,3 +93,6 @@ GPATH
# including the following three lines
^browser/components/loop/standalone/content/legal/styles/.*\.css$
^browser/components/loop/standalone/content/legal/terms/en_US\.html$
# Android Gradle artifacts.
^mobile/android/gradle/.gradle

View file

@ -1,61 +0,0 @@
project.buildDir = "${topobjdir}/mobile/android/gradle/app/build"
apply plugin: 'android'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
android {
lintOptions {
abortOnError false
}
}
sourceSets {
main {
manifest {
srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
}
assets {
srcDir "${topobjdir}/dist/fennec/assets"
}
jniLibs {
srcDir "${topobjdir}/dist/fennec/lib"
}
}
androidTest {
java {
srcDir "${topobjdir}/mobile/android/gradle/app/src/androidTest/robocop_harness/java"
srcDir "${topobjdir}/mobile/android/gradle/app/src/androidTest/robocop/java"
srcDir "${topobjdir}/mobile/android/gradle/app/src/androidTest/background/java"
srcDir "${topobjdir}/mobile/android/gradle/app/src/androidTest/browser/java"
}
}
}
}
dependencies {
compile project(':base')
androidTestCompile fileTree(dir: "../../../build/mobile/robocop", include: ['*.jar'])
}

View file

@ -1,6 +1,6 @@
project.buildDir = "${topobjdir}/mobile/android/gradle/base/build"
apply plugin: 'android-library'
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@ -14,7 +14,7 @@ android {
buildTypes {
release {
runProguard false
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}

View file

@ -18,10 +18,10 @@ The debug APK will be at
The ``$OBJDIR/mobile/android/gradle`` directory can be imported into IntelliJ as
follows:
- File > Import Project
- File > Import Project...
- [select ``$OBJDIR/mobile/android/gradle``]
- Import project from external model > Gradle
- [select Use default Gradle wrapper]
- [select Use customizable Gradle wrapper]
When prompted, do not add any files to git. You may need to re-open the
project, or restart IntelliJ, to pick up a compiler language-level change.
@ -42,11 +42,11 @@ Caveats
How the Gradle project is laid out
----------------------------------
To the greatest extent possible, the Gradle configuration lives in the source
directory. The only Gradle configuration that lives in the object directory is
installed when building the ``mobile/android/gradle`` directory.
To the greatest extent possible, the Gradle configuration lives in the object
directory.
At the time of writing, their are three sub-modules: *app*, *base*, and *thirdparty*.
At the time of writing, their are three main sub-modules: *app*, *base*, and
*thirdparty*, and several smaller sub-modules.
*app* is the Fennec wrapper; it generates the **org.mozilla.fennec.R** resource
package. *base* is the Gecko code; it generates the **org.mozilla.gecko.R**

View file

@ -1,59 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
gradle := \
local.properties.in \
gradle.properties.in \
$(NULL)
gradle_PATH := $(CURDIR)
gradle_FLAGS += -Dtopsrcdir=$(abspath $(topsrcdir))
gradle_FLAGS += -Dtopobjdir=$(abspath $(DEPTH))
gradle_FLAGS += -DANDROID_SDK_ROOT=$(ANDROID_SDK_ROOT)
gradle_KEEP_PATH := 1
PP_TARGETS += gradle
wrapper_FILES := \
build.gradle \
settings.gradle \
gradle/wrapper/gradle-wrapper.jar \
gradle/wrapper/gradle-wrapper.properties \
gradlew \
$(NULL)
wrapper_DEST := $(CURDIR)
wrapper_KEEP_PATH := 1
INSTALL_TARGETS += wrapper
base/src/main/java/org/mozilla/gecko:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/mobile/android/base $@
libs:: base/src/main/java/org/mozilla/gecko
base/src/main/res:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/mobile/android/base/resources $@
libs:: base/src/main/res
app/src/androidTest/robocop_harness/java/org/mozilla/gecko:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/build/mobile/robocop $@
libs:: app/src/androidTest/robocop_harness/java/org/mozilla/gecko
app/src/androidTest/robocop/java/org/mozilla/gecko/tests:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/mobile/android/base/tests $@
libs:: app/src/androidTest/robocop/java/org/mozilla/gecko/tests
app/src/androidTest/browser/java/org/mozilla/gecko:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/mobile/android/tests/browser/junit3/src $@
libs:: app/src/androidTest/browser/java/org/mozilla/gecko
app/src/androidTest/background/java/org/mozilla/gecko/background:
$(NSINSTALL) -D ${@D}
ln -s $(topsrcdir)/mobile/android/tests/background/junit3/src $@
libs:: app/src/androidTest/background/java/org/mozilla/gecko/background
include $(topsrcdir)/config/rules.mk

View file

@ -0,0 +1,29 @@
// Configure shared Android settings. This should be run (using "apply from")
// immediately after applying the Android plugin. Be aware that IntelliJ does
// not parse these values correctly: the Android-Gradle facet panel manually
// parses build.gradle rather than interrogating the Gradle model.
android {
compileSdkVersion "android-${mozconfig.defines.ANDROID_TARGET_SDK}"
// Turn "android-sdk/build-tools/21.1.1" into "21.1.1".
buildToolsVersion (new File(mozconfig.substs.ANDROID_BUILD_TOOLS).getName())
defaultConfig {
targetSdkVersion mozconfig.defines.ANDROID_TARGET_SDK
minSdkVersion mozconfig.defines.MOZ_ANDROID_MIN_SDK_VERSION
if (mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION) {
maxSdkVersion mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
android {
lintOptions {
abortOnError false
}
}
}

View file

@ -0,0 +1,28 @@
apply plugin: 'com.android.application'
apply from: rootProject.file("${topsrcdir}/mobile/android/gradle/android.gradle")
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
androidTest {
java {
srcDir "${topobjdir}/mobile/android/gradle/app/src/robocop_harness"
srcDir "${topobjdir}/mobile/android/gradle/app/src/robocop"
srcDir "${topobjdir}/mobile/android/gradle/app/src/background"
srcDir "${topobjdir}/mobile/android/gradle/app/src/browser"
}
}
}
}
dependencies {
compile project(':base')
androidTestCompile fileTree(dir: 'libs', include: ['*.jar'])
}

View file

@ -0,0 +1,66 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
defaultConfig {
applicationId 'org.mozilla.gecko'
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
java {
exclude 'org/mozilla/gecko/tests/**'
exclude 'org/mozilla/gecko/resources/**'
if (!mozconfig.substs.MOZ_CRASHREPORTER) {
exclude 'org/mozilla/gecko/CrashReporter.java'
}
}
res {
if (mozconfig.substs.MOZ_CRASHREPORTER) {
srcDir "src/crashreporter/res"
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.+'
if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
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(':branding')
compile project(':omnijar')
compile project(':preprocessed_code')
compile project(':preprocessed_resources')
compile project(':thirdparty')
}
android.libraryVariants.all { variant ->
variant.checkManifest.dependsOn generateCodeAndResources
}
apply plugin: 'idea'
idea {
module {
// excludeDirs = []
excludeDirs += file('src/main/java/org/mozilla/gecko/tests')
excludeDirs += file('org/mozilla/gecko/tests')
excludeDirs += file('tests')
}
}

View file

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

View file

@ -0,0 +1,16 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
defaultConfig {
applicationId 'org.mozilla.gecko.branding'
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}

View file

@ -1,23 +1,34 @@
buildDir = "${topobjdir}/mobile/android/gradle/build"
ext {
compileSdkVersion = "${compileSdkVersion}"
buildToolsVersion = "${buildToolsVersion}"
targetSdkVersion = "${targetSdkVersion}"
minSdkVersion = "${minSdkVersion}"
allprojects {
// Expose the per-object-directory configuration to all projects.
ext {
mozconfig = gradle.mozconfig
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir
}
}
buildDir "${topobjdir}/mobile/android/gradle/build"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
classpath 'com.android.tools.build:gradle:0.14.4'
}
}
repositories {
jcenter()
}
subprojects {
task generateCodeAndResources(type:Exec) {
workingDir "${topobjdir}"
commandLine "${topsrcdir}/mach"
args 'build'
args 'mobile/android/base/gradle-targets'
}
}

View file

@ -0,0 +1,2 @@
org.gradle.parallel=true
org.gradle.daemon=true

View file

@ -1,15 +1,5 @@
#filter substitution
#include gradle.properties
topsrcdir=@topsrcdir@
topobjdir=@topobjdir@
compileSdkVersion=android-@ANDROID_TARGET_SDK@
buildToolsVersion=20.0.0
targetSdkVersion=@ANDROID_TARGET_SDK@
minSdkVersion=@MOZ_ANDROID_MIN_SDK_VERSION@
#ifdef MOZ_ANDROID_MAX_SDK_VERSION
maxSdkVersion=@MOZ_ANDROID_MAX_SDK_VERSION@
#endif
#if MOZ_CRASHREPORTER
MOZ_CRASHREPORTER=true
#else
MOZ_CRASHREPORTER=false
#endif

View file

@ -1,6 +1,6 @@
#Tue Nov 25 10:01:42 PST 2014
#Sun Dec 21 20:16:49 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip

View file

@ -1,5 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View file

@ -1,31 +1,36 @@
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'
}
}
}
// sourceSets {
// main {
// java {
// // Remove the default directories entirely.
// srcDirs = []
// // Depend on everything in mobile/android that goes into
// // the omnijar.
// srcDir 'src/main/java/locales'
// srcDir 'src/main/java/chrome'
// srcDir 'src/main/java/components'
// srcDir 'src/main/java/modules'
// srcDir 'src/main/java/themes'
// }
// }
// }
/**
* 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
}
// project.sourceSets.main.java.srcDirs.each { srcDir ->
// inputs.sourceDir srcDir
// }
inputs.sourceDir 'src/main/java/locales'
inputs.sourceDir 'src/main/java/chrome'
inputs.sourceDir 'src/main/java/components'
inputs.sourceDir 'src/main/java/modules'
inputs.sourceDir 'src/main/java/themes'
// Produce a single output file.
outputs.file "${topobjdir}/dist/fennec/assets/omni.ja"
@ -40,3 +45,10 @@ task rebuildOmnijar(type:Exec) {
// Rebuild the omnijar before the earliest Java task.
tasks.compileJava.dependsOn rebuildOmnijar
apply plugin: 'idea'
idea {
module {
}
}

View file

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

View file

@ -0,0 +1,16 @@
apply plugin: 'android-library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}
android.libraryVariants.all { variant ->
variant.checkManifest.dependsOn generateCodeAndResources
}

View file

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

View file

@ -0,0 +1,24 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
defaultConfig {
applicationId 'org.mozilla.gecko.preprocessed_resources'
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}
android.libraryVariants.all { variant ->
variant.checkManifest.dependsOn generateCodeAndResources
}
dependencies {
compile project(':branding')
}

View file

@ -1,9 +1,50 @@
// If our root project is in the object directory, we expect to be given
// topsrcdir from our environment via gradle.properties. If we don't get it,
// our root project is in the source directory, so we extract topsrcdir relative
// to the location of this script.
if (!hasProperty('topsrcdir')) {
// In the source directory, we're not worried about links crossing directories.
binding.variables['topsrcdir'] = new File("../../..").getCanonicalPath()
logger.warn("topsrcdir is undefined: assuming source directory Gradle invocation with topsrcdir=${topsrcdir}.")
}
def command = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
def proc = command.execute(null, new File(topsrcdir))
def sout = new StringBuffer()
def serr = new StringBuffer()
proc.consumeProcessOutput(sout, serr)
proc.waitFor()
if (proc.exitValue() != 0) {
throw new GradleException("Could not extract mozconfig/build environment from |${topsrcdir}/mach environment|!");
}
import groovy.json.JsonSlurper
def slurper = new JsonSlurper()
def json = slurper.parseText(sout.toString())
include ':app'
include ':base'
include ':branding'
include ':omnijar'
include ':preprocessed_code'
include ':preprocessed_resources'
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")
def gradleRoot = new File("${json.topobjdir}/mobile/android/gradle")
project(':app').projectDir = new File(gradleRoot, 'app')
project(':base').projectDir = new File(gradleRoot, 'base')
project(':branding').projectDir = new File(gradleRoot, 'branding')
project(':omnijar').projectDir = new File(gradleRoot, 'omnijar')
project(':preprocessed_code').projectDir = new File(gradleRoot, 'preprocessed_code')
project(':preprocessed_resources').projectDir = new File(gradleRoot, 'preprocessed_resources')
project(':thirdparty').projectDir = new File(gradleRoot, 'thirdparty')
// The Gradle instance is shared between settings.gradle and all the
// other build.gradle files (see
// http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
// We use this ext property to pass the per-object-directory mozconfig
// between scripts. This lets us execute set-up code before we gradle
// tries to configure the project even once, and as a side benefit
// saves invoking |mach environment| multiple times.
gradle.ext.mozconfig = json

View file

@ -0,0 +1,21 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
defaultConfig {
applicationId 'org.mozilla.gecko.thirdparty'
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.+'
}

View file

@ -6,6 +6,8 @@ from __future__ import print_function, unicode_literals
import argparse
import logging
import os
import mozpack.path as mozpath
from mozbuild.base import (
@ -13,12 +15,25 @@ from mozbuild.base import (
MachCommandConditions as conditions,
)
from mozbuild.util import (
FileAvoidWrite,
)
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
SUCCESS = '''
You should be ready to build with Gradle and import into IntelliJ! Test with
./mach gradle build
and in IntelliJ select File > Import project... and choose
{topobjdir}/mobile/android/gradle
'''
@CommandProvider
class MachCommands(MachCommandBase):
@ -30,7 +45,111 @@ class MachCommands(MachCommandBase):
# Avoid logging the command
self.log_manager.terminal_handler.setLevel(logging.CRITICAL)
code = self.gradle_install(quiet=True)
if code:
return code
return self.run_process(['./gradlew'] + args,
pass_thru=True, # Allow user to run gradle interactively.
ensure_exit_code=False, # Don't throw on non-zero exit code.
cwd=mozpath.join(self.topobjdir, 'mobile', 'android', 'gradle'))
@Command('gradle-install', category='devenv',
description='Install gradle environment.',
conditions=[conditions.is_android])
def gradle_install(self, quiet=False):
import mozpack.manifests
m = mozpack.manifests.InstallManifest()
def srcdir(dst, src):
m.add_symlink(os.path.join(self.topsrcdir, src), dst)
def objdir(dst, src):
m.add_symlink(os.path.join(self.topobjdir, src), dst)
srcdir('build.gradle', 'mobile/android/gradle/build.gradle')
srcdir('settings.gradle', 'mobile/android/gradle/settings.gradle')
m.add_pattern_copy(os.path.join(self.topsrcdir, 'mobile/android/gradle/gradle/wrapper'), '**', 'gradle/wrapper')
m.add_copy(os.path.join(self.topsrcdir, 'mobile/android/gradle/gradlew'), 'gradlew')
defines = {
'topsrcdir': self.topsrcdir,
'topobjdir': self.topobjdir,
'ANDROID_SDK_ROOT': self.substs['ANDROID_SDK_ROOT'],
}
m.add_preprocess(os.path.join(self.topsrcdir, 'mobile/android/gradle/gradle.properties.in'),
'gradle.properties',
defines=defines,
deps=os.path.join(self.topobjdir, 'mobile/android/gradle/.deps/gradle.properties.pp'))
m.add_preprocess(os.path.join(self.topsrcdir, 'mobile/android/gradle/local.properties.in'),
'local.properties',
defines=defines,
deps=os.path.join(self.topobjdir, 'mobile/android/gradle/.deps/local.properties.pp'))
srcdir('branding/build.gradle', 'mobile/android/gradle/branding/build.gradle')
srcdir('branding/src/main/AndroidManifest.xml', 'mobile/android/gradle/branding/AndroidManifest.xml')
srcdir('branding/src/main/res', os.path.join(self.substs['MOZ_BRANDING_DIRECTORY'], 'res'))
srcdir('preprocessed_code/build.gradle', 'mobile/android/gradle/preprocessed_code/build.gradle')
srcdir('preprocessed_code/src/main/AndroidManifest.xml', 'mobile/android/gradle/preprocessed_code/AndroidManifest.xml')
objdir('preprocessed_code/src/main/java', 'mobile/android/base/generated/preprocessed')
srcdir('preprocessed_resources/build.gradle', 'mobile/android/gradle/preprocessed_resources/build.gradle')
srcdir('preprocessed_resources/src/main/AndroidManifest.xml', 'mobile/android/gradle/preprocessed_resources/AndroidManifest.xml')
objdir('preprocessed_resources/src/main/res', 'mobile/android/base/res')
srcdir('thirdparty/build.gradle', 'mobile/android/gradle/thirdparty/build.gradle')
srcdir('thirdparty/src/main/AndroidManifest.xml', 'mobile/android/gradle/thirdparty/AndroidManifest.xml')
srcdir('thirdparty/src/main/java', 'mobile/android/thirdparty')
srcdir('omnijar/build.gradle', 'mobile/android/gradle/omnijar/build.gradle')
srcdir('omnijar/src/main/java/locales', 'mobile/android/locales')
srcdir('omnijar/src/main/java/chrome', 'mobile/android/chrome')
srcdir('omnijar/src/main/java/components', 'mobile/android/components')
srcdir('omnijar/src/main/java/modules', 'mobile/android/modules')
srcdir('omnijar/src/main/java/themes', 'mobile/android/themes')
srcdir('app/build.gradle', 'mobile/android/gradle/app/build.gradle')
objdir('app/src/main/AndroidManifest.xml', 'mobile/android/base/AndroidManifest.xml')
objdir('app/src/main/assets', 'dist/fennec/assets')
objdir('app/src/main/jniLibs', 'dist/fennec/lib')
# Test code.
srcdir('app/src/robocop_harness/org/mozilla/gecko', 'build/mobile/robocop')
srcdir('app/src/robocop/org/mozilla/gecko/tests', 'mobile/android/base/tests')
srcdir('app/src/background/org/mozilla/gecko', 'mobile/android/tests/background/junit3/src')
srcdir('app/src/browser/org/mozilla/gecko', 'mobile/android/tests/browser/junit3/src')
# Test libraries.
srcdir('app/libs', 'build/mobile/robocop')
srcdir('base/build.gradle', 'mobile/android/gradle/base/build.gradle')
srcdir('base/src/main/AndroidManifest.xml', 'mobile/android/gradle/base/AndroidManifest.xml')
srcdir('base/src/main/java/org/mozilla/gecko', 'mobile/android/base')
srcdir('base/src/main/java/org/mozilla/mozstumbler', 'mobile/android/stumbler/java/org/mozilla/mozstumbler')
srcdir('base/src/main/java/org/mozilla/search', 'mobile/android/search/java/org/mozilla/search')
srcdir('base/src/main/res', 'mobile/android/base/resources')
srcdir('base/src/newtablet/res', 'mobile/android/base/newtablet/res')
srcdir('base/src/crashreporter/res', 'mobile/android/base/crashreporter/res')
manifest_path = os.path.join(self.topobjdir, 'mobile', 'android', 'gradle.manifest')
with FileAvoidWrite(manifest_path) as f:
m.write(fileobj=f)
self.virtualenv_manager.ensure()
code = self.run_process([
self.virtualenv_manager.python_path,
os.path.join(self.topsrcdir, 'python/mozbuild/mozbuild/action/process_install_manifest.py'),
'--no-remove',
'--no-remove-all-directory-symlinks',
'--no-remove-empty-directories',
os.path.join(self.topobjdir, 'mobile', 'android', 'gradle'),
manifest_path],
pass_thru=True, # Allow user to run gradle interactively.
ensure_exit_code=False, # Don't throw on non-zero exit code.
cwd=mozpath.join(self.topsrcdir, 'mobile', 'android'))
if not quiet:
if not code:
print(SUCCESS.format(topobjdir=self.topobjdir))
return code

View file

@ -24,7 +24,6 @@ DIRS += [
'fonts',
'geckoview_library',
'extensions',
'gradle',
]
if not CONFIG['LIBXUL_SDK']:

View file

@ -1,49 +0,0 @@
project.buildDir = "${topobjdir}/mobile/android/gradle/thirdparty/build"
apply plugin: 'android-library'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId 'org.mozilla.gecko.thirdparty'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
}
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
android {
lintOptions {
abortOnError false
}
}
sourceSets {
main {
manifest {
srcFile 'gradle_AndroidManifest.xml'
}
java {
srcDir "."
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.+'
}