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 'com.android.tools.build:gradle:3.1.4'
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"
}
}
// A stream that processes bytes line by line, prepending a tag before sending
// 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
}
if ('multi' == System.env.AB_CD) {
// Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale. This
// 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
// this, if Gradle is invoked with AB_CD=multi, we don't invoke Make at all.
if ('multi' == System.env.AB_CD) {
rootProject.logger.lifecycle("Skipping task ${task.path} because: AB_CD=multi")
return false
}
task generateCodeAndResources()
} else if (System.env.IS_LANGUAGE_REPACK == '1') {
// Single-locale l10n repacks set `IS_LANGUAGE_REPACK=1` and handle resource
// and code generation themselves.
if ('1' == System.env.IS_LANGUAGE_REPACK) {
rootProject.logger.lifecycle("Skipping task ${task.path} because: IS_LANGUAGE_REPACK")
return false
}
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"
task generateCodeAndResources()
} else {
task generateCodeAndResources(type:Exec) {
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
args '-C'
args "${topobjdir}/mobile/android/installer"
args 'stage-package'
args "${topobjdir}/mobile/android/base"
args 'gradle-targets'
outputs.file "${topobjdir}/dist/fennec/assets/${mozconfig.substs.ANDROID_CPU_ARCH}/libxul.so"
outputs.file "${topobjdir}/dist/fennec/lib/${mozconfig.substs.ANDROID_CPU_ARCH}/libmozglue.so"
// `path` is like `:machStagePackage`.
standardOutput = new TaggedLogOutputStream("${path}>", logger)
// 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()}")
}
}
}
}
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 {
subprojects { project ->
if (project.name != 'thirdparty') {
@ -209,10 +131,10 @@ afterEvaluate {
return
}
android.applicationVariants.all {
preBuild.dependsOn rootProject.machBuildFaster
preBuild.dependsOn rootProject.generateCodeAndResources
}
android.libraryVariants.all {
preBuild.dependsOn rootProject.machBuildFaster
preBuild.dependsOn rootProject.generateCodeAndResources
}
}
}

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

@ -66,13 +66,6 @@ ACDEFINES += -DBUILD_FASTER
# fallback
$(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.
# This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make
# <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
// manifest as moz.build, we replace the package with org.mozilla.gecko (the
// 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}")
from("${topobjdir}/mobile/android/base/AndroidManifest.xml")
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
// should never be re-entrant in this way.
if (!mozconfig.substs.MOZILLA_OFFICIAL) {
syncPreprocessedJava.dependsOn rootProject.machBuildFaster
syncPreprocessedRes.dependsOn rootProject.machBuildFaster
rewriteManifestPackage.dependsOn rootProject.machBuildFaster
syncPreprocessedJava.dependsOn rootProject.generateCodeAndResources
syncPreprocessedRes.dependsOn rootProject.generateCodeAndResources
rewriteManifestPackage.dependsOn rootProject.generateCodeAndResources
}
// 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'
// 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
// rebuilt. By listing them here as resource directories, IntelliJ labels each
// checked directly nicely. Why list the directories here? There's a mismatch
// between SourceDirectorySet and TaskInputs: the former is directory oriented,
// 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
// that the root project evaluation depends on :omnijar, so we duplicate in the
// root project.
// into inputs for :app, but not vice-versa. Sadly this implies that :app
// evaluation depends on :omnijar, but the evaluation overhead is low enough
// that we accept it.
sourceSets {
main {
// These are supposed to be files that go into the omnijar. But yes,
// toolkit/ has lots of native code.
// Depend on the Gecko resources in mobile/android.
resources {
srcDir "${topsrcdir}/mobile/android/chrome"
srcDir "${topsrcdir}/mobile/android/components"

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

@ -6,6 +6,19 @@
# find and create .mozconfig files and to generate targets.
.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
chrome-%:: AB_CD=$*
@ -17,4 +30,36 @@ chrome-%::
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

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

@ -183,19 +183,6 @@ for f in ['res/values/strings.xml',
'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
# 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
@ -207,9 +194,15 @@ t = ('android_apks',
GENERATED_FILES += [t]
GENERATED_FILES[t].force = True
GENERATED_FILES[t].script = '/mobile/android/gradle.py:assemble_app'
GENERATED_FILES[t].inputs += generated_inputs
# This makes |mach build faster| build these files. See the workaround in
# config/faster/rules.mk. None of these files appear in package-manifest.in,
# so they're not packaged.
FINAL_TARGET_FILES.android += generated_inputs
GENERATED_FILES[t].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',
]

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

@ -3,9 +3,42 @@
* 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/. */
// 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.
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 ->
// :app needs the full Fennec omni.ja, whereas other projects need the
// GeckoView-specific omni.ja.
@ -50,20 +83,11 @@ ext.configureVariantWithGeckoBinaries = { variant ->
}
// Local (read, not 'official') builds want to reflect developer changes to
// the omnijar sources, and (when compiling) to reflect developer changes to
// the native binaries. To do this, the Gradle build calls out to the
// the Omnijar sources. To do this, the Gradle build calls out to the
// 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.
if (!mozconfig.substs.MOZILLA_OFFICIAL) {
if ("app".equals(project.name)) {
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
}
syncOmnijarFromDistDir.dependsOn buildOmnijars
}
def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets")