зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1745246 - Move org/mozilla/thirdparty to it's own module. r=calu
This allows us to decouple GeckoView from exoplayer2, have it's own Java settings and not pollute GeckoView's dependencies. Differential Revision: https://phabricator.services.mozilla.com/D133792
This commit is contained in:
Родитель
b27078be09
Коммит
53378a9401
79
build.gradle
79
build.gradle
|
@ -42,6 +42,12 @@ allprojects {
|
|||
" found ${getRustVersionFor("glean")}")
|
||||
}
|
||||
|
||||
artifactSuffix = getArtifactSuffix()
|
||||
versionName = getVersionName()
|
||||
versionCode = computeVersionCode()
|
||||
versionNumber = getVersionNumber()
|
||||
buildId = getBuildId()
|
||||
|
||||
buildToolsVersion = mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
|
||||
compileSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
|
||||
targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
|
||||
|
@ -165,6 +171,79 @@ ext.geckoBinariesOnlyIf = { task ->
|
|||
return true
|
||||
}
|
||||
|
||||
// Non-official versions are like "61.0a1", where "a1" is the milestone.
|
||||
// This simply strips that off, leaving "61.0" in this example.
|
||||
def getAppVersionWithoutMilestone() {
|
||||
return project.ext.mozconfig.substs.MOZ_APP_VERSION.replaceFirst(/a[0-9]/, "")
|
||||
}
|
||||
|
||||
// This converts MOZ_APP_VERSION into an integer
|
||||
// version code.
|
||||
//
|
||||
// We take something like 58.1.2a1 and come out with 5800102
|
||||
// This gives us 3 digits for the major number, and 2 digits
|
||||
// each for the minor and build number. Beta and Release
|
||||
//
|
||||
// This must be synchronized with _compute_gecko_version(...) in /taskcluster/gecko_taskgraph/transforms/task.py
|
||||
def computeVersionCode() {
|
||||
String appVersion = getAppVersionWithoutMilestone()
|
||||
|
||||
// Split on the dot delimiter, e.g. 58.1.1a1 -> ["58, "1", "1a1"]
|
||||
String[] parts = appVersion.split('\\.')
|
||||
|
||||
assert parts.size() == 2 || parts.size() == 3
|
||||
|
||||
// Major
|
||||
int code = Integer.parseInt(parts[0]) * 100000
|
||||
|
||||
// Minor
|
||||
code += Integer.parseInt(parts[1]) * 100
|
||||
|
||||
// Build
|
||||
if (parts.size() == 3) {
|
||||
code += Integer.parseInt(parts[2])
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
def getVersionName() {
|
||||
return "${mozconfig.substs.MOZ_APP_VERSION}-${mozconfig.substs.MOZ_UPDATE_CHANNEL}"
|
||||
}
|
||||
|
||||
// Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
|
||||
def getBuildId() {
|
||||
return file("${topobjdir}/buildid.h").getText('utf-8').split()[2]
|
||||
}
|
||||
|
||||
def getVersionNumber() {
|
||||
def appVersion = getAppVersionWithoutMilestone()
|
||||
def parts = appVersion.split('\\.')
|
||||
def version = parts[0] + "." + parts[1] + "." + getBuildId()
|
||||
def substs = project.ext.mozconfig.substs
|
||||
if (!substs.MOZILLA_OFFICIAL && !substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
|
||||
// Use -SNAPSHOT versions locally to enable the local GeckoView substitution flow.
|
||||
version += "-SNAPSHOT"
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
def getArtifactSuffix() {
|
||||
def substs = project.ext.mozconfig.substs
|
||||
|
||||
def suffix = ""
|
||||
// Release artifacts don't specify the channel, for the sake of simplicity.
|
||||
if (substs.MOZ_UPDATE_CHANNEL != 'release') {
|
||||
suffix += "-${mozconfig.substs.MOZ_UPDATE_CHANNEL}"
|
||||
}
|
||||
|
||||
if (!substs.MOZ_ANDROID_GECKOVIEW_LITE) {
|
||||
suffix += "-omni"
|
||||
}
|
||||
|
||||
return suffix
|
||||
}
|
||||
|
||||
class MachExec extends Exec {
|
||||
def MachExec() {
|
||||
// Bug 1543982: When invoking `mach build` recursively, the outer `mach
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
buildDir "${topobjdir}/gradle/build/mobile/android/exoplayer2"
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
// For exoplayer.
|
||||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
compileOnly "org.checkerframework:checker-compat-qual:2.5.0"
|
||||
compileOnly "org.checkerframework:checker-qual:2.5.0"
|
||||
compileOnly "org.jetbrains.kotlin:kotlin-annotations-jvm:1.3.70"
|
||||
|
||||
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
implementation "androidx.annotation:annotation:1.1.0"
|
||||
}
|
||||
|
||||
android {
|
||||
buildToolsVersion project.ext.buildToolsVersion
|
||||
compileSdkVersion project.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
versionCode project.ext.versionCode
|
||||
versionName project.ext.versionName
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir "${topsrcdir}/mobile/android/exoplayer2/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = getVersionNumber()
|
||||
group = 'org.mozilla.geckoview'
|
||||
|
||||
android.libraryVariants.all { variant ->
|
||||
def javadoc = task "javadoc${name.capitalize()}"(type: Javadoc) {
|
||||
}
|
||||
task("javadocJar${name.capitalize()}", type: Jar, dependsOn: javadoc) {
|
||||
archiveClassifier = 'javadoc'
|
||||
destinationDirectory = javadoc.destinationDir
|
||||
}
|
||||
task("sourcesJar${name.capitalize()}", type: Jar) {
|
||||
classifier 'sources'
|
||||
description = "Generate Javadoc for build variant $name"
|
||||
destinationDirectory =
|
||||
file("${topobjdir}/mobile/android/geckoview-exoplayer2/sources/${variant.baseName}")
|
||||
from files(variant.sourceSets.collect({ it.java.srcDirs }).flatten())
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
android.libraryVariants.all { variant ->
|
||||
"${variant.name}"(MavenPublication) {
|
||||
from components.findByName(variant.name)
|
||||
|
||||
pom {
|
||||
afterEvaluate {
|
||||
artifactId = "geckoview-exoplayer2" + project.ext.artifactSuffix
|
||||
}
|
||||
|
||||
url = 'https://geckoview.dev'
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name = 'The Mozilla Public License, v. 2.0'
|
||||
url = 'http://mozilla.org/MPL/2.0/'
|
||||
distribution = 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
if (mozconfig.substs.MOZ_INCLUDE_SOURCE_INFO) {
|
||||
// URL is like "https://hg.mozilla.org/mozilla-central/rev/1e64b8a0c546a49459d404aaf930d5b1f621246a".
|
||||
connection = "scm::hg::${mozconfig.substs.MOZ_SOURCE_REPO}"
|
||||
url = mozconfig.substs.MOZ_SOURCE_URL
|
||||
tag = mozconfig.substs.MOZ_SOURCE_CHANGESET
|
||||
} else {
|
||||
// Default to mozilla-central.
|
||||
connection = 'scm::hg::https://hg.mozilla.org/mozilla-central/'
|
||||
url = 'https://hg.mozilla.org/mozilla-central/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Javadoc and sources for developer ergononomics.
|
||||
artifact tasks["javadocJar${variant.name.capitalize()}"]
|
||||
artifact tasks["sourcesJar${variant.name.capitalize()}"]
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url = "${topobjdir}/gradle/maven"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.mozilla.geckoview.thirdparty">
|
||||
</manifest>
|
|
@ -12,58 +12,6 @@ apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
|
|||
// :annotations project.
|
||||
evaluationDependsOn(':annotations')
|
||||
|
||||
// Non-official versions are like "61.0a1", where "a1" is the milestone.
|
||||
// This simply strips that off, leaving "61.0" in this example.
|
||||
def getAppVersionWithoutMilestone() {
|
||||
return mozconfig.substs.MOZ_APP_VERSION.replaceFirst(/a[0-9]/, "")
|
||||
}
|
||||
|
||||
// This converts MOZ_APP_VERSION into an integer
|
||||
// version code.
|
||||
//
|
||||
// We take something like 58.1.2a1 and come out with 5800102
|
||||
// This gives us 3 digits for the major number, and 2 digits
|
||||
// each for the minor and build number. Beta and Release
|
||||
//
|
||||
// This must be synchronized with _compute_gecko_version(...) in /taskcluster/gecko_taskgraph/transforms/task.py
|
||||
def computeVersionCode() {
|
||||
String appVersion = getAppVersionWithoutMilestone()
|
||||
|
||||
// Split on the dot delimiter, e.g. 58.1.1a1 -> ["58, "1", "1a1"]
|
||||
String[] parts = appVersion.split('\\.')
|
||||
|
||||
assert parts.size() == 2 || parts.size() == 3
|
||||
|
||||
// Major
|
||||
int code = Integer.parseInt(parts[0]) * 100000
|
||||
|
||||
// Minor
|
||||
code += Integer.parseInt(parts[1]) * 100
|
||||
|
||||
// Build
|
||||
if (parts.size() == 3) {
|
||||
code += Integer.parseInt(parts[2])
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// Mimic Python: open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
|
||||
def getBuildId() {
|
||||
return file("${topobjdir}/buildid.h").getText('utf-8').split()[2]
|
||||
}
|
||||
|
||||
android {
|
||||
buildToolsVersion project.ext.buildToolsVersion
|
||||
compileSdkVersion project.ext.compileSdkVersion
|
||||
|
@ -78,8 +26,8 @@ android {
|
|||
manifestPlaceholders = project.ext.manifestPlaceholders
|
||||
multiDexEnabled true
|
||||
|
||||
versionCode computeVersionCode()
|
||||
versionName "${mozconfig.substs.MOZ_APP_VERSION}-${mozconfig.substs.MOZ_UPDATE_CHANNEL}"
|
||||
versionCode project.ext.versionCode
|
||||
versionName project.ext.versionName
|
||||
consumerProguardFiles 'proguard-rules.txt'
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
@ -90,7 +38,7 @@ android {
|
|||
// For the benefit of future archaeologists:
|
||||
// GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
|
||||
// on XULRunner, which is never the case on Android.
|
||||
buildConfigField 'String', "MOZ_APP_BUILDID", "\"${getBuildId()}\"";
|
||||
buildConfigField 'String', "MOZ_APP_BUILDID", "\"${project.ext.buildId}\"";
|
||||
buildConfigField 'String', "MOZ_APP_ID", "\"${mozconfig.substs.MOZ_APP_ID}\"";
|
||||
buildConfigField 'String', "MOZ_APP_NAME", "\"${mozconfig.substs.MOZ_APP_NAME}\"";
|
||||
buildConfigField 'String', "MOZ_APP_VENDOR", "\"${mozconfig.substs.MOZ_APP_VENDOR}\"";
|
||||
|
@ -152,10 +100,7 @@ android {
|
|||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir "${topsrcdir}/mobile/android/geckoview/src/thirdparty/java"
|
||||
|
||||
if (!mozconfig.substs.MOZ_ANDROID_HLS_SUPPORT) {
|
||||
exclude 'com/google/android/exoplayer2/**'
|
||||
exclude 'org/mozilla/gecko/media/GeckoHlsAudioRenderer.java'
|
||||
exclude 'org/mozilla/gecko/media/GeckoHlsPlayer.java'
|
||||
exclude 'org/mozilla/gecko/media/GeckoHlsRendererBase.java'
|
||||
|
@ -244,7 +189,7 @@ configurations {
|
|||
}
|
||||
afterEvaluate {
|
||||
// Implicit capability
|
||||
capability("org.mozilla.geckoview:${getArtifactId()}:${getVersionNumber()}")
|
||||
capability("org.mozilla.geckoview:${getArtifactId()}:${project.ext.versionNumber}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,19 +201,13 @@ configurations {
|
|||
outgoing {
|
||||
afterEvaluate {
|
||||
// Implicit capability
|
||||
capability("org.mozilla.geckoview:geckoview:${getVersionNumber()}")
|
||||
capability("org.mozilla.geckoview:geckoview:${project.ext.versionNumber}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// For exoplayer.
|
||||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
compileOnly "org.checkerframework:checker-compat-qual:2.5.0"
|
||||
compileOnly "org.checkerframework:checker-qual:2.5.0"
|
||||
compileOnly "org.jetbrains.kotlin:kotlin-annotations-jvm:1.3.70"
|
||||
|
||||
implementation "androidx.annotation:annotation:1.1.0"
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
|
||||
|
@ -278,6 +217,10 @@ dependencies {
|
|||
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.0.0"
|
||||
|
||||
if (mozconfig.substs.MOZ_ANDROID_HLS_SUPPORT) {
|
||||
implementation project(":exoplayer2")
|
||||
}
|
||||
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.robolectric:robolectric:4.7.3'
|
||||
|
@ -384,7 +327,7 @@ android.libraryVariants.all { variant ->
|
|||
}
|
||||
|
||||
def javadocJar = task("javadocJar${name.capitalize()}", type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
archiveClassifier = 'javadoc'
|
||||
destinationDirectory = javadoc.destinationDir
|
||||
}
|
||||
|
||||
|
@ -447,15 +390,7 @@ 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"
|
||||
}
|
||||
def id = "geckoview" + project.ext.artifactSuffix
|
||||
|
||||
if (mozconfig.substs.MOZILLA_OFFICIAL && !mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
|
||||
// In automation, per-architecture artifacts identify
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
package org.mozilla.gecko.util;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.mozilla.gecko.annotation.RobocopTarget;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.geckoview.GeckoResult;
|
||||
|
|
|
@ -378,6 +378,7 @@ def gradle_android_archive_geckoview_tasks(build_config, aab_enabled):
|
|||
"geckoview:publish{geckoview.variant.name}PublicationToMavenRepository".format(
|
||||
geckoview=build_config.geckoview
|
||||
),
|
||||
"exoplayer2:publishDebugPublicationToMavenRepository",
|
||||
]
|
||||
|
||||
if aab_enabled:
|
||||
|
|
|
@ -54,12 +54,14 @@ include ':annotations', ':messaging_example', ':port_messaging_example'
|
|||
include ':geckoview'
|
||||
include ':geckoview_example'
|
||||
include ':test_runner'
|
||||
include ':exoplayer2'
|
||||
include ':omnijar'
|
||||
|
||||
project(':annotations').projectDir = new File("${json.topsrcdir}/mobile/android/annotations")
|
||||
project(':geckoview').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview")
|
||||
project(':geckoview_example').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview_example")
|
||||
project(':test_runner').projectDir = new File("${json.topsrcdir}/mobile/android/test_runner")
|
||||
project(':exoplayer2').projectDir = new File("${json.topsrcdir}/mobile/android/exoplayer2")
|
||||
project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
|
||||
|
||||
// The Gradle instance is shared between settings.gradle and all the
|
||||
|
|
|
@ -19,8 +19,6 @@ transforms:
|
|||
job-defaults:
|
||||
attributes:
|
||||
artifact_map: taskcluster/gecko_taskgraph/manifests/fennec_geckoview.yml
|
||||
maven_packages:
|
||||
- geckoview
|
||||
index:
|
||||
product: mobile
|
||||
worker-type: b-linux
|
||||
|
@ -97,6 +95,8 @@ jobs:
|
|||
shippable: true
|
||||
enable-full-crashsymbols: true
|
||||
disable-push-apk: true
|
||||
maven_packages:
|
||||
- geckoview
|
||||
shipping-phase: build
|
||||
shipping-product: fennec
|
||||
index:
|
||||
|
@ -131,6 +131,9 @@ jobs:
|
|||
shippable: true
|
||||
enable-full-crashsymbols: true
|
||||
disable-push-apk: true
|
||||
maven_packages:
|
||||
- geckoview
|
||||
- geckoview-exoplayer2
|
||||
shipping-phase: build
|
||||
shipping-product: fennec
|
||||
index:
|
||||
|
|
Загрузка…
Ссылка в новой задаче