Backed out 4 changesets (bug 1509573) for unexpected bustages a=backout.

Backed out changeset ace2d2ada8ef (bug 1509573)
Backed out changeset 059741f95cf4 (bug 1509573)
Backed out changeset 36cf7b9ce095 (bug 1509573)
Backed out changeset d7e0661e34c2 (bug 1509573)

--HG--
extra : amend_source : b2bd61c3d8c9db3686bf0d9773f0b53e69174789
This commit is contained in:
Razvan Maries 2018-11-30 01:40:06 +02:00
Родитель b38ee74e4d
Коммит 326dd87a7b
7 изменённых файлов: 120 добавлений и 144 удалений

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

@ -58,122 +58,44 @@ buildscript {
classpath 'org.mozilla.apilint:apilint:0.1.4' classpath 'org.mozilla.apilint:apilint:0.1.4'
classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath 'org.apache.commons:commons-exec:1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
// A stream that processes bytes line by line, prepending a tag before sending if ('multi' == System.env.AB_CD) {
// each line to Gradle's logging.
class TaggedLogOutputStream extends org.apache.commons.exec.LogOutputStream {
String tag
Logger logger
TaggedLogOutputStream(tag, logger) {
this.tag = tag
this.logger = logger
}
void processLine(String line, int level) {
logger.lifecycle("${this.tag} ${line}")
}
}
ext.geckoBinariesOnlyIf = { task ->
// Never for official builds.
if (mozconfig.substs.MOZILLA_OFFICIAL) {
rootProject.logger.lifecycle("Skipping task ${task.path} because: MOZILLA_OFFICIAL")
return false
}
// Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale. This // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale. This
// causes the // causes the
// //
// |mach build| > |mach gradle| > AndroidManifest.xml > strings.xml > multi/brand.dtd // |mach build| > |mach gradle| > |make gradle-targets| > AndroidManifest.xml > strings.xml > multi/brand.dtd
// //
// dependency chain to fail, since multi isn't a real locale. To avoid // dependency chain to fail, since multi isn't a real locale. To avoid
// this, if Gradle is invoked with AB_CD=multi, we don't invoke Make at all. // this, if Gradle is invoked with AB_CD=multi, we don't invoke Make at all.
if ('multi' == System.env.AB_CD) { task generateCodeAndResources()
rootProject.logger.lifecycle("Skipping task ${task.path} because: AB_CD=multi") } else if (System.env.IS_LANGUAGE_REPACK == '1') {
return false
}
// Single-locale l10n repacks set `IS_LANGUAGE_REPACK=1` and handle resource // Single-locale l10n repacks set `IS_LANGUAGE_REPACK=1` and handle resource
// and code generation themselves. // and code generation themselves.
if ('1' == System.env.IS_LANGUAGE_REPACK) { task generateCodeAndResources()
rootProject.logger.lifecycle("Skipping task ${task.path} because: IS_LANGUAGE_REPACK") } else {
return false task generateCodeAndResources(type:Exec) {
}
rootProject.logger.lifecycle("Executing task ${task.path}")
return true
}
task machBuildFaster(type: Exec) {
onlyIf rootProject.ext.geckoBinariesOnlyIf
workingDir "${topsrcdir}"
commandLine mozconfig.substs.PYTHON
args "${topsrcdir}/mach"
args 'build'
args 'faster'
// Add `-v` if we're running under `--info` (or `--debug`).
if (project.logger.isEnabled(LogLevel.INFO)) {
args '-v'
}
// `path` is like `:machBuildFaster`.
standardOutput = new TaggedLogOutputStream("${path}>", logger)
errorOutput = standardOutput
}
def createMachStagePackageTask(name) {
return task(name, type: Exec) {
onlyIf rootProject.ext.geckoBinariesOnlyIf
dependsOn rootProject.machBuildFaster
// We'd prefer to take these from the :omnijar project directly, but
// it's awkward to reach across projects at evaluation time, so we
// duplicate the list here.
inputs.dir "${topsrcdir}/mobile/android/chrome"
inputs.dir "${topsrcdir}/mobile/android/components"
inputs.dir "${topsrcdir}/mobile/android/locales"
inputs.dir "${topsrcdir}/mobile/android/modules"
inputs.dir "${topsrcdir}/mobile/android/themes"
inputs.dir "${topsrcdir}/toolkit"
workingDir "${topobjdir}" workingDir "${topobjdir}"
// We'd prefer this to be a `mach` invocation, but `mach build
// mobile/android/installer/stage-package` doesn't work as expected.
commandLine mozconfig.substs.GMAKE commandLine mozconfig.substs.GMAKE
args '-C' args '-C'
args "${topobjdir}/mobile/android/installer" args "${topobjdir}/mobile/android/base"
args 'stage-package' args 'gradle-targets'
outputs.file "${topobjdir}/dist/fennec/assets/${mozconfig.substs.ANDROID_CPU_ARCH}/libxul.so" // Only show the output if something went wrong.
outputs.file "${topobjdir}/dist/fennec/lib/${mozconfig.substs.ANDROID_CPU_ARCH}/libmozglue.so" ignoreExitValue = true
standardOutput = new ByteArrayOutputStream()
// `path` is like `:machStagePackage`.
standardOutput = new TaggedLogOutputStream("${path}>", logger)
errorOutput = standardOutput errorOutput = standardOutput
doLast {
if (execResult.exitValue != 0) {
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
}
}
} }
} }
createMachStagePackageTask("machStagePackageForFennec").with {
outputs.file "${topobjdir}/dist/fennec/assets/omni.ja"
}
createMachStagePackageTask("machStagePackageForGeckoview").with {
args 'MOZ_GECKOVIEW_JAR=1'
outputs.file "${topobjdir}/dist/geckoview/assets/omni.ja"
// Avoid races between stage-package invocations.
mustRunAfter tasks["machStagePackageForFennec"]
}
afterEvaluate { afterEvaluate {
subprojects { project -> subprojects { project ->
if (project.name != 'thirdparty') { if (project.name != 'thirdparty') {
@ -209,10 +131,10 @@ afterEvaluate {
return return
} }
android.applicationVariants.all { android.applicationVariants.all {
preBuild.dependsOn rootProject.machBuildFaster preBuild.dependsOn rootProject.generateCodeAndResources
} }
android.libraryVariants.all { android.libraryVariants.all {
preBuild.dependsOn rootProject.machBuildFaster preBuild.dependsOn rootProject.generateCodeAndResources
} }
} }
} }

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

@ -66,13 +66,6 @@ ACDEFINES += -DBUILD_FASTER
# fallback # fallback
$(TOPOBJDIR)/faster/%: ; $(TOPOBJDIR)/faster/%: ;
ifeq ($(MOZ_BUILD_APP),mobile/android)
# The generic rule doesn't handle relative directories, which are used
# extensively in mobile/android/base.
$(TOPOBJDIR)/mobile/android/base/% : $(TOPOBJDIR)/buildid.h FORCE
$(MAKE) -C $(TOPOBJDIR)/mobile/android/base $*
endif
# Generic rule to fall back to the recursive make backend. # Generic rule to fall back to the recursive make backend.
# This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make # This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make
# <3.82 apply pattern rules in definition order, not stem length like # <3.82 apply pattern rules in definition order, not stem length like

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

@ -338,7 +338,7 @@ android.applicationVariants.all { variant ->
// what we want for Fennec, however, with applicationId. To use the same // what we want for Fennec, however, with applicationId. To use the same
// manifest as moz.build, we replace the package with org.mozilla.gecko (the // manifest as moz.build, we replace the package with org.mozilla.gecko (the
// eventual package) here. // eventual package) here.
def rewriteManifestPackage = task("rewriteManifestPackageFor${variant.name.capitalize()}", type: Copy, dependsOn: rootProject.machBuildFaster) { def rewriteManifestPackage = task("rewriteManifestPackageFor${variant.name.capitalize()}", type: Copy, dependsOn: rootProject.generateCodeAndResources) {
into("${project.buildDir}/moz.build/src/${variant.name}") into("${project.buildDir}/moz.build/src/${variant.name}")
from("${topobjdir}/mobile/android/base/AndroidManifest.xml") from("${topobjdir}/mobile/android/base/AndroidManifest.xml")
filter { it.replaceFirst(/package=".*?"/, 'package="org.mozilla.gecko"') } filter { it.replaceFirst(/package=".*?"/, 'package="org.mozilla.gecko"') }
@ -359,9 +359,9 @@ android.applicationVariants.all { variant ->
// re-entrant. Official builds are driven by the moz.build system and // re-entrant. Official builds are driven by the moz.build system and
// should never be re-entrant in this way. // should never be re-entrant in this way.
if (!mozconfig.substs.MOZILLA_OFFICIAL) { if (!mozconfig.substs.MOZILLA_OFFICIAL) {
syncPreprocessedJava.dependsOn rootProject.machBuildFaster syncPreprocessedJava.dependsOn rootProject.generateCodeAndResources
syncPreprocessedRes.dependsOn rootProject.machBuildFaster syncPreprocessedRes.dependsOn rootProject.generateCodeAndResources
rewriteManifestPackage.dependsOn rootProject.machBuildFaster rewriteManifestPackage.dependsOn rootProject.generateCodeAndResources
} }
// When driven from moz.build via |mach build|, Gradle does not require or // When driven from moz.build via |mach build|, Gradle does not require or

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

@ -2,19 +2,18 @@ buildDir "${topobjdir}/gradle/build/mobile/android/omnijar"
apply plugin: 'java' apply plugin: 'java'
// This project is a dummy project; the JAR produced is not used. The root // This project is a dummy project; the JAR produced is not used. The :app
// project uses the set of inputs here to check if the omnijar needs to be // project uses the set of inputs here to check if the omnijar needs to be
// rebuilt. By listing them here as resource directories, IntelliJ labels each // rebuilt. By listing them here as resource directories, IntelliJ labels each
// checked directly nicely. Why list the directories here? There's a mismatch // checked directly nicely. Why list the directories here? There's a mismatch
// between SourceDirectorySet and TaskInputs: the former is directory oriented, // between SourceDirectorySet and TaskInputs: the former is directory oriented,
// while the latter is more general. That means its easy to convert this list // while the latter is more general. That means its easy to convert this list
// into inputs for the root project, but not vice-versa. Sadly this would mean // into inputs for :app, but not vice-versa. Sadly this implies that :app
// that the root project evaluation depends on :omnijar, so we duplicate in the // evaluation depends on :omnijar, but the evaluation overhead is low enough
// root project. // that we accept it.
sourceSets { sourceSets {
main { main {
// These are supposed to be files that go into the omnijar. But yes, // Depend on the Gecko resources in mobile/android.
// toolkit/ has lots of native code.
resources { resources {
srcDir "${topsrcdir}/mobile/android/chrome" srcDir "${topsrcdir}/mobile/android/chrome"
srcDir "${topsrcdir}/mobile/android/components" srcDir "${topsrcdir}/mobile/android/components"

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

@ -6,6 +6,19 @@
# find and create .mozconfig files and to generate targets. # find and create .mozconfig files and to generate targets.
.NOTPARALLEL: .NOTPARALLEL:
generated_resources := \
AndroidManifest.xml \
res/raw/suggestedsites.json \
res/values/strings.xml \
$(NULL)
generated_files := \
AndroidManifest.xml \
generated/preprocessed/org/mozilla/gecko/AdjustConstants.java \
generated/preprocessed/org/mozilla/gecko/AppConstants.java \
generated/preprocessed/org/mozilla/gecko/MmaConstants.java \
$(NULL)
include $(topsrcdir)/config/AB_rCD.mk include $(topsrcdir)/config/AB_rCD.mk
chrome-%:: AB_CD=$* chrome-%:: AB_CD=$*
@ -17,4 +30,36 @@ chrome-%::
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
# This target is only used by IDE integrations. It rebuilds resources
# that end up in omni.ja using the equivalent of |mach build faster|,
# does most of the packaging step, and then updates omni.ja in
# place. If you're not using an IDE, you should be using |mach build
# mobile/android && mach package|.
$(ABS_DIST)/fennec/$(OMNIJAR_NAME): FORCE
$(REPORT_BUILD)
$(MAKE) -C ../../../faster
$(MAKE) -C ../installer stage-package
$(MKDIR) -p $(@D)
rsync --update $(DIST)/fennec/$(notdir $(OMNIJAR_NAME)) $@
$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
ifndef MOZILLA_OFFICIAL
# Targets built very early during a Gradle build. In automation,
# these are built before Gradle is invoked, and gradle-targets is not
# made at all. This is required to avoid building gradle-targets with
# AB_CD=multi during multi-l10n builds.
gradle-targets: $(generated_resources) $(generated_files)
# Local developers update omni.ja during their builds. There's a
# chicken-and-egg problem here.
gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
else
# In automation, omni.ja is built only during packaging.
gradle-omnijar:
gradle-targets:
endif
.PHONY: gradle-targets gradle-omnijar
export:: android_apks export:: android_apks

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

@ -183,19 +183,6 @@ for f in ['res/values/strings.xml',
'locales/en-US/sync_strings.dtd', 'locales/en-US/sync_strings.dtd',
] ]
generated_inputs = [
'!AndroidManifest.xml',
'!generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
'!generated/preprocessed/org/mozilla/gecko/AppConstants.java',
'!generated/preprocessed/org/mozilla/gecko/CrashReporterConstants.java',
'!generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
# These all depend on AB_CD, which isn't captured in this definition. Due
# to subtle RecursiveMake details, everything works out. In the future we
# can try to express the APKs themselves as LOCALIZED_GENERATED_FILES.
'!res/raw/suggestedsites.json',
'!res/values/strings.xml',
]
# The recursive make backend treats the first output specially: it's passed as # The recursive make backend treats the first output specially: it's passed as
# an open FileAvoidWrite to the invoked script. That doesn't work well with # an open FileAvoidWrite to the invoked script. That doesn't work well with
# the Gradle task that generates all of the outputs, so we add a dummy first # the Gradle task that generates all of the outputs, so we add a dummy first
@ -207,9 +194,15 @@ t = ('android_apks',
GENERATED_FILES += [t] GENERATED_FILES += [t]
GENERATED_FILES[t].force = True GENERATED_FILES[t].force = True
GENERATED_FILES[t].script = '/mobile/android/gradle.py:assemble_app' GENERATED_FILES[t].script = '/mobile/android/gradle.py:assemble_app'
GENERATED_FILES[t].inputs += generated_inputs GENERATED_FILES[t].inputs += [
'!AndroidManifest.xml',
# This makes |mach build faster| build these files. See the workaround in '!generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
# config/faster/rules.mk. None of these files appear in package-manifest.in, '!generated/preprocessed/org/mozilla/gecko/AppConstants.java',
# so they're not packaged. '!generated/preprocessed/org/mozilla/gecko/CrashReporterConstants.java',
FINAL_TARGET_FILES.android += generated_inputs '!generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
# These all depend on AB_CD, which isn't captured in this definition. Due
# to subtle RecursiveMake details, everything works out. In the future we
# can try to express the APKs themselves as LOCALIZED_GENERATED_FILES.
'!res/raw/suggestedsites.json',
'!res/values/strings.xml',
]

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

@ -3,9 +3,42 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// The omnijar inputs are listed as resource directory inputs to a dummy JAR.
// That arrangement labels them nicely in IntelliJ. See the comment in the
// :omnijar project for more context.
evaluationDependsOn(':omnijar')
// The JNI wrapper generation tasks depend on the JAR creation task of the :annotations project. // The JNI wrapper generation tasks depend on the JAR creation task of the :annotations project.
evaluationDependsOn(':annotations') evaluationDependsOn(':annotations')
task buildOmnijars(type:Exec) {
dependsOn rootProject.generateCodeAndResources
// See comment in :omnijar project regarding interface mismatches here.
inputs.file(project(':omnijar').sourceSets.main.resources.srcDirs).skipWhenEmpty()
// Produce both the Fennec and the GeckoView omnijars.
outputs.file "${topobjdir}/dist/fennec/assets/omni.ja"
outputs.file "${topobjdir}/dist/geckoview/assets/omni.ja"
workingDir "${topobjdir}"
commandLine mozconfig.substs.GMAKE
args '-C'
args "${topobjdir}/mobile/android/base"
args 'gradle-omnijar'
// Only show the output if something went wrong.
ignoreExitValue = true
standardOutput = new ByteArrayOutputStream()
errorOutput = standardOutput
doLast {
if (execResult.exitValue != 0) {
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
}
}
}
ext.configureVariantWithGeckoBinaries = { variant -> ext.configureVariantWithGeckoBinaries = { variant ->
// :app needs the full Fennec omni.ja, whereas other projects need the // :app needs the full Fennec omni.ja, whereas other projects need the
// GeckoView-specific omni.ja. // GeckoView-specific omni.ja.
@ -50,20 +83,11 @@ ext.configureVariantWithGeckoBinaries = { variant ->
} }
// Local (read, not 'official') builds want to reflect developer changes to // Local (read, not 'official') builds want to reflect developer changes to
// the omnijar sources, and (when compiling) to reflect developer changes to // the Omnijar sources. To do this, the Gradle build calls out to the
// the native binaries. To do this, the Gradle build calls out to the
// moz.build system, which can be re-entrant. Official builds are driven by // moz.build system, which can be re-entrant. Official builds are driven by
// the moz.build system and should never be re-entrant in this way. // the moz.build system and should never be re-entrant in this way.
if (!mozconfig.substs.MOZILLA_OFFICIAL) { if (!mozconfig.substs.MOZILLA_OFFICIAL) {
if ("app".equals(project.name)) { syncOmnijarFromDistDir.dependsOn buildOmnijars
syncOmnijarFromDistDir.dependsOn rootProject.machStagePackageForFennec
syncLibsFromDistDir.dependsOn rootProject.machStagePackageForFennec
syncAssetsFromDistDir.dependsOn rootProject.machStagePackageForFennec
} else {
syncOmnijarFromDistDir.dependsOn rootProject.machStagePackageForGeckoview
syncLibsFromDistDir.dependsOn rootProject.machStagePackageForGeckoview
syncAssetsFromDistDir.dependsOn rootProject.machStagePackageForGeckoview
}
} }
def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets") def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets")