Skip to content

Commit

Permalink
Backed out 5 changesets (bug 1727438, bug 1727577) for causing Androi…
Browse files Browse the repository at this point in the history
…d bustage. CLOSED TREE

Backed out changeset 552d8919435c (bug 1727577)
Backed out changeset 59d1a463178b (bug 1727438)
Backed out changeset 8cba5f574196 (bug 1727438)
Backed out changeset 00d32a3af979 (bug 1727438)
Backed out changeset efda82445d85 (bug 1727438)
  • Loading branch information
Butkovits Atila committed Aug 26, 2021
1 parent 0d4e9aa commit e42d7aa
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 100 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ buildscript {
}
}

ext.kotlin_version = '1.5.20'
ext.kotlin_version = '1.3.50'

dependencies {
classpath 'org.mozilla.apilint:apilint:0.4.3'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'org.mozilla.apilint:apilint:0.4.1'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath 'org.apache.commons:commons-exec:1.3'
classpath 'org.tomlj:tomlj:1.0.0'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
# Bug 1596208, Android Studio has a bug that prevents us from using this
# distributionSha256Sum=53b71812f18cdb2777e9f1b2a0f2038683907c90bdc406bc64d8b400e1fb2c3b
4 changes: 2 additions & 2 deletions mobile/android/annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ buildDir "${topobjdir}/gradle/build/mobile/android/annotations"
apply plugin: 'java'

dependencies {
implementation 'com.android.tools.lint:lint:26.2.1'
implementation 'com.android.tools.lint:lint-checks:26.2.1'
compile 'com.android.tools.lint:lint:26.2.1'
compile 'com.android.tools.lint:lint-checks:26.2.1'
}

sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
138 changes: 67 additions & 71 deletions mobile/android/geckoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,10 @@ def computeVersionCode() {
return code;
}

def getVersionNumber() {
def appVersion = getAppVersionWithoutMilestone()
def parts = appVersion.split('\\.')
def version = parts[0] + "." + parts[1] + "." + getBuildId()
if (!mozconfig.substs.MOZILLA_OFFICIAL && !mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
// Use -SNAPSHOT versions locally to enable the local GeckoView substitution flow.
version += "-SNAPSHOT"
}
return version
def computeVersionNumber() {
def appVersion = getAppVersionWithoutMilestone()
def parts = appVersion.split('\\.')
return parts[0] + "." + parts[1] + "." + getBuildId()
}

// Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
Expand Down Expand Up @@ -233,30 +228,10 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
}

configurations {
withGeckoBinariesApi {
outgoing {
if (!mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE) {
// The omni build provides glean-native
capability("org.mozilla.telemetry:glean-native:${project.ext.gleanVersion}")
}
afterEvaluate {
// Implicit capability
capability("org.mozilla.geckoview:${getArtifactId()}:${getVersionNumber()}")
}
}
}
// TODO: This is a workaround for a bug that was fixed in Gradle 7.
// The variant resolver _should_ pick the RuntimeOnly configuration when building
// the tests as those define the implicit :geckoview capability but it doesn't,
// so we manually define it here.
withGeckoBinariesRuntimeOnly {
outgoing {
afterEvaluate {
// Implicit capability
capability("org.mozilla.geckoview:geckoview:${getVersionNumber()}")
}
}
}
// No need to include libglean_ffi.so here or for GeckoView consumers.
// If those consumers use Glean, they'll get the FFI through GeckoView anyway.
all*.exclude group: 'org.mozilla.telemetry', module: 'glean-native'
all*.exclude group: 'net.java.dev.jna', module: 'jna'
}

dependencies {
Expand All @@ -266,6 +241,11 @@ dependencies {
compileOnly "org.checkerframework:checker-qual:2.5.0"
compileOnly "org.jetbrains.kotlin:kotlin-annotations-jvm:1.3.70"

// The Glean Kotlin, which will be re-exported.
if (!mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE) {
api "org.mozilla.telemetry:glean:${project.ext.gleanVersion}"
}

implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"

Expand Down Expand Up @@ -360,13 +340,9 @@ android.libraryVariants.all { variant ->
exclude '**/R.java', '**/BuildConfig.java'
include 'org/mozilla/geckoview/**.java'
options.addPathOption('sourcepath', ':').setValue(
variant.sourceSets.collect({ it.java.srcDirs }).flatten() +
variant.generateBuildConfigProvider.get().sourceOutputDir.asFile.get() +
variant.aidlCompileProvider.get().sourceOutputDir.asFile.get()
)

classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += variant.javaCompileProvider.get().classpath
variant.sourceSets.collect({ it.java.srcDirs }).flatten() +
variant.generateBuildConfigProvider.get().sourceOutputDir +
variant.aidlCompileProvider.get().sourceOutputDir)

// javadoc 8 has a bug that requires the rt.jar file from the JRE to be
// in the bootclasspath (https://stackoverflow.com/a/30458820).
Expand Down Expand Up @@ -416,7 +392,7 @@ android.libraryVariants.all { variant ->
}

checkstyle {
configDirectory = file(".")
configDir = file(".")
configFile = file("checkstyle.xml")
toolVersion = "8.36.2"
}
Expand All @@ -443,45 +419,43 @@ android.libraryVariants.all { variant ->

apply plugin: 'maven-publish'

version = getVersionNumber()
group = 'org.mozilla.geckoview'

def getArtifactId() {
def id = "geckoview"
// Release artifacts don't specify the channel, for the sake of simplicity.
if (mozconfig.substs.MOZ_UPDATE_CHANNEL != 'release') {
id += "-${mozconfig.substs.MOZ_UPDATE_CHANNEL}"
}

if (!mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE) {
id += "-omni"
}

if (mozconfig.substs.MOZILLA_OFFICIAL && !mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
// In automation, per-architecture artifacts identify
// the architecture; multi-architecture artifacts don't.
// When building locally, we produce a "skinny AAR" with
// one target architecture masquerading as a "fat AAR"
// to enable Gradle composite builds to substitute this
// project into consumers easily.
id += "-${mozconfig.substs.ANDROID_CPU_ARCH}"
}

return id
version = computeVersionNumber()
if (!mozconfig.substs.MOZILLA_OFFICIAL && !mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
// Use -SNAPSHOT versions locally to enable the local GeckoView substitution flow.
version = "${version}-SNAPSHOT"
}

publishing {
publications {
android.libraryVariants.all { variant ->
"${variant.name}"(MavenPublication) {
from components.findByName(variant.name)

pom {
afterEvaluate {
artifactId = getArtifactId()
groupId = 'org.mozilla.geckoview'

def omniSuffix = ""
if (!mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE) {
omniSuffix = "-omni"
}

def channelSuffix = ""
// Release artifacts don't specify the channel, for the sake of simplicity.
if (mozconfig.substs.MOZ_UPDATE_CHANNEL != 'release') {
channelSuffix = "-${mozconfig.substs.MOZ_UPDATE_CHANNEL}"
}

url = 'https://geckoview.dev'
artifactId = "geckoview$channelSuffix$omniSuffix"

if (mozconfig.substs.MOZILLA_OFFICIAL && !mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
// In automation, per-architecture artifacts identify
// the architecture; multi-architecture artifacts don't.
// When building locally, we produce a "skinny AAR" with
// one target architecture masquerading as a "fat AAR"
// to enable Gradle composite builds to substitute this
// project into consumers easily.
artifactId = "${artifactId}-${mozconfig.substs.ANDROID_CPU_ARCH}"
}

url = 'https://wiki.mozilla.org/Mobile/GeckoView'

licenses {
license {
Expand All @@ -503,8 +477,30 @@ publishing {
url = 'https://hg.mozilla.org/mozilla-central/'
}
}

// Unfortunately Gradle does not provide a way to expose dependencies for custom
// project types like Android plugins. So we need to add them manually to the POM
// XML here, or use a plugin that achieves the same (like
// https://github.com/wupdigital/android-maven-publish). We elect to do this
// manually since our dependencies are simple and plugins increase our complexity
// surface. This workaround can be removed after this issue is fixed:
// https://github.com/gradle/gradle/issues/1842
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

for (configurationName in ["implementation", "api"]) {
configurations.getByName(configurationName).dependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}

artifact tasks["bundle${variant.name.capitalize()}Aar"]

// Javadoc and sources for developer ergononomics.
artifact tasks["javadocJar${variant.name.capitalize()}"]
artifact tasks["sourcesJar${variant.name.capitalize()}"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ class AccessibilityTest : BaseSessionTest() {
id: Int = View.NO_ID): Int {
val info = createNodeInfo(id)
return (if (cond(info) && info.className != "android.webkit.WebView" ) 1 else 0) + (if (info.childCount > 0)
(0 until info.childCount).sumOf {
(0 until info.childCount).sumBy {
countAutoFillNodes(cond, info.getChildId(it))
} else 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class AutofillDelegateTest : BaseSessionTest() {
root: Autofill.Node? = null): Int {
val node = if (root !== null) root else mainSession.autofillSession.root
return (if (cond(node)) 1 else 0) +
node.children.sumOf {
node.children.sumBy {
countAutofillNodes(cond, it) }
}

Expand Down
10 changes: 5 additions & 5 deletions mobile/android/gradle.configure
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ def gradle_android_intermediates_folder(build_config):
)
buildType = uncapitalize(build_config.geckoview.variant.buildType)

return (
"gradle/build/mobile/android/geckoview/intermediates/javac/{}{}/classes".format(
productFlavor,
capitalize(buildType),
)
return "gradle/build/mobile/android/geckoview/intermediates/javac/{}{}/compile{}{}JavaWithJavac/classes".format(
productFlavor,
capitalize(buildType),
capitalize(productFlavor),
capitalize(buildType),
)


Expand Down
6 changes: 3 additions & 3 deletions mobile/android/gradle/with_gecko_binaries.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class SyncLibsAndUpdateGenerationID extends DefaultTask {
@OutputDirectory
File destinationDir

@InputDirectory
@Input
File llvmBin = project.ext.getLlvmBinFolder()

// Sibling to `.note.gnu.build-id`.
Expand Down Expand Up @@ -222,7 +222,7 @@ ext.configureVariantWithGeckoBinaries = { variant ->
}()

def syncLibsFromDistDir = { if (shouldUpdateGenerationID) {
def jarTask = tasks["bundleLibRuntimeToJar${variant.name.capitalize()}"]
def jarTask = tasks["bundleLibRuntime${variant.name.capitalize()}"]
def bundleJar = jarTask.outputs.files.find({ it.name == 'classes.jar' })

task("syncLibsAndUpdateGenerationIDFromDistDirFor${variant.name.capitalize()}", type: SyncLibsAndUpdateGenerationID) {
Expand Down Expand Up @@ -292,7 +292,7 @@ ext.configureVariantWithGeckoBinaries = { variant ->
ext.configureLibraryVariantWithJNIWrappers = { variant, module ->
// BundleLibRuntime prepares the library for further processing to be
// incorporated in an app. We use this version to create the JNI wrappers.
def jarTask = tasks["bundleLibRuntimeToJar${variant.name.capitalize()}"]
def jarTask = tasks["bundleLibRuntime${variant.name.capitalize()}"]
def bundleJar = jarTask.outputs.files.find({ it.name == 'classes.jar' })

def annotationProcessorsJarTask = project(':annotations').jar
Expand Down
9 changes: 1 addition & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ proc.waitFor()

// Only show the output if something went wrong.
if (proc.exitValue() != 0) {
logger.info("Error running ./mach environment: \n\n"
+ "Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n"
+ "stdout:\n"
+ "${standardOutput.toString()}\n\n"
+ "stderr:\n"
+ "${standardError.toString()}")
throw new StopExecutionException(
"Could not run ./mach environment. Try running ./mach build first.")
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\nstdout:\n${standardOutput.toString()}\n\nstderr:\n${standardError.toString()}")
}

import groovy.json.JsonSlurper
Expand Down
7 changes: 2 additions & 5 deletions taskcluster/ci/source-test/mozlint-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ lints:
name: public/code-review/mozlint.json
path: /builds/worker/mozlint.json
- name: public/android/geckoview/api.txt
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/intermediates/javac/withGeckoBinariesDebug/classes/api.txt
type: file
- name: public/android/geckoview/api.txt.map
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/intermediates/javac/withGeckoBinariesDebug/classes/api.txt.map
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/intermediates/javac/withGeckoBinariesDebug/compileWithGeckoBinariesDebugJavaWithJavac/classes/api.txt
type: file
- name: public/android/geckoview/apilint-result.json
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/intermediates/javac/withGeckoBinariesDebug/classes/apilint-result.json
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/intermediates/javac/withGeckoBinariesDebug/compileWithGeckoBinariesDebugJavaWithJavac/classes/apilint-result.json
type: file
- name: public/android/geckoview/javadoc-results.json
path: /builds/worker/checkouts/gecko/obj-firefox/gradle/build/mobile/android/geckoview/reports/javadoc-results-withGeckoBinariesDebug.json
Expand Down

0 comments on commit e42d7aa

Please sign in to comment.