Bug 1724480 - Upgrade JDK to Java 17. r=glandium,ahal,calu

Differential Revision: https://phabricator.services.mozilla.com/D131972
This commit is contained in:
Agi Sferro 2022-01-11 19:16:01 +00:00
parent 10649c9480
commit 024994e801
27 changed files with 170 additions and 134 deletions

View file

@ -57,6 +57,9 @@ allprojects {
gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
maven {
url repository
if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
allowInsecureProtocol = true
}
}
}
}
@ -94,15 +97,18 @@ buildscript {
gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
maven {
url repository
if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
allowInsecureProtocol = true
}
}
}
}
ext.kotlin_version = '1.5.20'
ext.kotlin_version = '1.5.31'
dependencies {
classpath 'org.mozilla.apilint:apilint:0.5.1'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath 'org.apache.commons:commons-exec:1.3'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.16.0'

View file

@ -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-7.3-all.zip
# Bug 1596208, Android Studio has a bug that prevents us from using this
# distributionSha256Sum=53b71812f18cdb2777e9f1b2a0f2038683907c90bdc406bc64d8b400e1fb2c3b

View file

@ -3,9 +3,9 @@ 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'
implementation 'com.android.tools.lint:lint:30.0.3'
implementation 'com.android.tools.lint:lint-checks:30.0.3'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

View file

@ -56,6 +56,7 @@ package org.mozilla.gecko.annotationProcessors;
*/
import com.android.tools.lint.LintCliClient;
import com.android.tools.lint.checks.ApiLookup;
import com.android.tools.lint.client.api.LintClient;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
@ -211,7 +212,7 @@ public class SDKProcessor {
sMaxSdkVersion = Integer.parseInt(args[1]);
final String outdir = args[2];
final LintCliClient lintClient = new LintCliClient();
final LintCliClient lintClient = new LintCliClient(LintClient.CLIENT_CLI);
sApiLookup = ApiLookup.get(lintClient);
for (int argIndex = 3; argIndex < args.length; argIndex += 2) {

View file

@ -13,6 +13,8 @@ NO_NDK=1
ac_add_options --with-gradle
# We want to use (and populate!) the local Nexus repositories.
export GRADLE_MAVEN_REPOSITORIES="http://localhost:8081/nexus/content/repositories/mozilla/","http://localhost:8081/nexus/content/repositories/google/","http://localhost:8081/nexus/content/repositories/central/","http://localhost:8081/nexus/content/repositories/gradle-plugins/"
# Nexus runs on HTTP
ac_add_options --allow-insecure-gradle-repositories
# From here on, just like ../android-arm/nightly.

View file

@ -23,8 +23,8 @@ You need to add or edit four stanzas inside your module's ``build.gradle`` file.
.. code-block:: groovy
ext {
geckoviewChannel = "nightly"
geckoviewVersion = "70.0.20190712095934"
geckoviewChannel = <channel>
geckoviewVersion = <version>
}
@ -39,15 +39,15 @@ You need to add or edit four stanzas inside your module's ``build.gradle`` file.
}
**3. Java 8 required support**
**3. Java 11 required support**
As GeckoView uses some Java 8 APIs, it requires these compatibility flags:
As GeckoView uses some Java 11 APIs, it requires these compatibility flags:
.. code-block:: groovy
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
**4. Add GeckoView Implementations**

View file

@ -9,8 +9,8 @@ android {
compileSdkVersion project.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
dexOptions {
javaMaxHeapSize "32g"

View file

@ -9,8 +9,8 @@ android {
compileSdkVersion project.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
dexOptions {
javaMaxHeapSize "32g"

View file

@ -137,8 +137,8 @@ android {
project.configureProductFlavors()
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
dexOptions {
@ -224,6 +224,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
allWarningsAsErrors = true
jvmTarget = JavaVersion.VERSION_11
}
doFirst {
@ -279,7 +280,7 @@ dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation 'org.robolectric:robolectric:4.7.3'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
@ -328,7 +329,7 @@ android.libraryVariants.all { variant ->
def results = []
def listener = {
if (!it.toLowerCase().contains("warning") && !it.toLowerCase().contains("error")) {
if (!it.toLowerCase().contains("warning:") && !it.toLowerCase().contains("error:")) {
// Likely not an error or a warning
return
}
@ -366,45 +367,42 @@ android.libraryVariants.all { variant ->
variant.generateBuildConfigProvider.get().sourceOutputDir.asFile.get() +
variant.aidlCompileProvider.get().sourceOutputDir.asFile.get()
)
options.addStringOption("Xmaxwarns", "1000")
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += variant.javaCompileProvider.get().classpath
// javadoc 8 has a bug that requires the rt.jar file from the JRE to be
// in the bootclasspath (https://stackoverflow.com/a/30458820).
options.bootClasspath = [
file("${System.properties['java.home']}/lib/rt.jar")] + android.bootClasspath
options.memberLevel = JavadocMemberLevel.PROTECTED
options.source = 8
options.links("https://d.android.com/reference/")
options.source = 11
options.links("https://developer.android.com/reference")
options.docTitle = "GeckoView ${mozconfig.substs.MOZ_APP_VERSION} API"
options.header = "GeckoView ${mozconfig.substs.MOZ_APP_VERSION} API"
options.noTimestamp = true
options.noIndex = true
options.noQualifiers = ['java.lang']
options.tags = ['hide:a:']
}
def javadocJar = task("javadocJar${name.capitalize()}", type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
destinationDirectory = javadoc.destinationDir
}
// This task is used by `mach android geckoview-docs`.
task("javadocCopyJar${name.capitalize()}", type: Copy) {
from(javadocJar.destinationDir) {
from(javadocJar.destinationDirectory) {
include 'geckoview-*-javadoc.jar'
rename { _ -> 'geckoview-javadoc.jar' }
}
into javadocJar.destinationDir
into javadocJar.destinationDirectory
dependsOn javadocJar
}
def sourcesJar = task("sourcesJar${name.capitalize()}", type: Jar) {
classifier 'sources'
description = "Generate Javadoc for build variant $name"
destinationDir = new File(destinationDir, variant.baseName)
destinationDirectory =
file("${topobjdir}/mobile/android/geckoview/sources/${variant.baseName}")
from files(variant.sourceSets.collect({ it.java.srcDirs }).flatten())
}
@ -561,6 +559,7 @@ android.libraryVariants.all configureVariantDebugLevel
task("generateSDKBindings", type: JavaExec) {
classpath project(':annotations').jar.archivePath
classpath project(':annotations').compileJava.classpath
classpath project(':annotations').sourceSets.main.runtimeClasspath
// To use the lint APIs: "Lint must be invoked with the System property
// com.android.tools.lint.bindir pointing to the ANDROID_SDK tools
@ -569,7 +568,7 @@ task("generateSDKBindings", type: JavaExec) {
'com.android.tools.lint.bindir': "${android.sdkDirectory}/tools",
]
main = 'org.mozilla.gecko.annotationProcessors.SDKProcessor'
mainClass = 'org.mozilla.gecko.annotationProcessors.SDKProcessor'
// We only want to generate bindings for the main framework JAR,
// but not any of the additional android.test libraries.
args android.bootClasspath.findAll { it.getName().startsWith('android.jar') }

View file

@ -15,6 +15,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import androidx.annotation.RequiresApi;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@ -31,6 +32,7 @@ import java.util.UUID;
import org.mozilla.gecko.util.ProxySelector;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
protected final String LOGTAG;
private static final String INVALID_SESSION_ID = "Invalid";

View file

@ -6,6 +6,7 @@
package org.mozilla.geckoview;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@ -518,7 +519,7 @@ public class ContentBlocking {
*
* @return The categories of resources to be blocked.
*/
public @CBAntiTracking int getSafeBrowsingCategories() {
public @CBSafeBrowsing int getSafeBrowsingCategories() {
return ContentBlocking.sbMalwareToSbCat(mSbMalware.get())
| ContentBlocking.sbPhishingToSbCat(mSbPhishing.get());
}
@ -528,6 +529,7 @@ public class ContentBlocking {
*
* @return The assigned behavior, as one of {@link CookieBehavior} flags.
*/
@SuppressLint("WrongConstant")
public @CBCookieBehavior int getCookieBehavior() {
return mCookieBehavior.get();
}
@ -549,6 +551,7 @@ public class ContentBlocking {
*
* @return The assigned behavior, as one of {@link CookieBehavior} flags.
*/
@SuppressLint("WrongConstant")
public @CBCookieBehavior int getCookieBehaviorPrivateMode() {
return mCookieBehaviorPrivateMode.get();
}
@ -570,6 +573,7 @@ public class ContentBlocking {
*
* @return The assigned lifetime, as one of {@link CookieLifetime} flags.
*/
@SuppressLint("WrongConstant")
public @CBCookieLifetime int getCookieLifetime() {
return mCookieLifetime.get();
}

View file

@ -149,7 +149,7 @@ public class ContentBlockingController {
}
protected BlockingData() {
category = 0;
category = Event.BLOCKED_TRACKING_CONTENT;
blocked = false;
count = 0;
}

View file

@ -2789,9 +2789,9 @@ public class GeckoSession {
/** Empty constructor for tests */
protected SecurityInformation() {
mixedModePassive = 0;
mixedModeActive = 0;
securityMode = 0;
mixedModePassive = CONTENT_UNKNOWN;
mixedModeActive = CONTENT_UNKNOWN;
securityMode = SECURITY_MODE_UNKNOWN;
isSecure = false;
isException = false;
origin = "";
@ -3449,7 +3449,11 @@ public class GeckoSession {
@Retention(RetentionPolicy.SOURCE)
@IntDef(
flag = true,
value = {SelectionActionDelegate.FLAG_IS_COLLAPSED, SelectionActionDelegate.FLAG_IS_EDITABLE})
value = {
SelectionActionDelegate.FLAG_IS_COLLAPSED,
SelectionActionDelegate.FLAG_IS_EDITABLE,
SelectionActionDelegate.FLAG_IS_PASSWORD
})
/* package */ @interface SelectionActionDelegateFlag {}
@Retention(RetentionPolicy.SOURCE)
@ -3535,7 +3539,7 @@ public class GeckoSession {
protected LoadRequest() {
uri = "";
triggerUri = null;
target = 0;
target = TARGET_WINDOW_NONE;
isRedirect = false;
hasUserGesture = false;
isDirectNavigation = false;
@ -4059,7 +4063,7 @@ public class GeckoSession {
protected AuthOptions() {
flags = 0;
uri = "";
level = 0;
level = Level.NONE;
username = "";
password = "";
}
@ -5534,8 +5538,8 @@ public class GeckoSession {
id = null;
rawId = null;
name = null;
source = 0;
type = 0;
source = SOURCE_CAMERA;
type = TYPE_VIDEO;
}
}

View file

@ -8,9 +8,6 @@ package org.mozilla.geckoview;
import android.content.Context;
import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Build;
import android.widget.EdgeEffect;
@ -75,28 +72,12 @@ public final class OverscrollEdgeEffect {
}
private void setBlendMode(final EdgeEffect edgeEffect) {
if (Build.VERSION.SDK_INT >= 29) {
edgeEffect.setBlendMode(BlendMode.SRC);
if (Build.VERSION.SDK_INT < 29) {
// setBlendMode is only supported on SDK_INT >= 29 and above.
return;
}
if (sPaintField == null) {
try {
sPaintField = EdgeEffect.class.getDeclaredField("mPaint");
sPaintField.setAccessible(true);
} catch (final NoSuchFieldException e) {
// Cannot get the field, nothing we can do here
return;
}
}
try {
final Paint paint = (Paint) sPaintField.get(edgeEffect);
final PorterDuffXfermode mode = new PorterDuffXfermode(PorterDuff.Mode.SRC);
paint.setXfermode(mode);
} catch (final IllegalAccessException ex) {
// Nothing we can do
}
edgeEffect.setBlendMode(BlendMode.SRC);
}
/**

View file

@ -4,6 +4,7 @@
package org.mozilla.geckoview;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.util.Log;
import androidx.annotation.AnyThread;
@ -1398,6 +1399,9 @@ public class WebExtension {
return;
}
// The .accept method will be called from the UIThread in this case because
// the GeckoResult instance was created on the UIThread
@SuppressLint("WrongThread")
final GeckoResult<GeckoSession> popup = delegate.onTogglePopup(mExtension, this);
openPopup(popup, uri);
});
@ -2515,7 +2519,6 @@ public class WebExtension {
}
@NonNull
@UiThread
/* package */ static GeckoBundle downloadInfoToBundle(final @NonNull Info data) {
final GeckoBundle dataBundle = new GeckoBundle();

View file

@ -4,6 +4,7 @@
package org.mozilla.geckoview;
import android.annotation.SuppressLint;
import android.os.Build;
import android.util.Log;
import android.util.SparseArray;
@ -870,6 +871,7 @@ public class WebExtensionController {
}));
}
@SuppressLint("WrongThread") // for .toGeckoBundle
private void getSettings(final Message message, final WebExtension extension) {
final WebExtension.BrowsingDataDelegate delegate = mListener.getBrowsingDataDelegate(extension);
if (delegate == null) {

View file

@ -21,8 +21,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
dexOptions {

View file

@ -544,21 +544,10 @@ set_config(
)
@dependable
def gradle_android_dependencies():
"""Gradle tasks that download all dependencies."""
# These tasks download most dependencies from each configuration, the
# notable exception is dependencies added at runtime by gradle plugins
return [
"downloadDependencies",
]
@depends(
gradle_android_api_lint_tasks,
gradle_android_format_lint_check_tasks,
gradle_android_checkstyle_tasks,
gradle_android_dependencies,
)
@imports(_from="itertools", _import="chain")
def gradle_android_dependencies_tasks(*tasks):
@ -600,6 +589,17 @@ option(
help="Comma-separated URLs of Maven repositories containing Gradle dependencies.",
)
option(
"--allow-insecure-gradle-repositories",
help="Gradle is allowed to connect to insecure Maven repositories.",
)
set_config(
"ALLOW_INSECURE_GRADLE_REPOSITORIES",
True,
when="--allow-insecure-gradle-repositories",
)
@depends("GRADLE_MAVEN_REPOSITORIES")
@imports(_from="os.path", _import="isdir")

View file

@ -192,19 +192,22 @@ ext.configureVariantWithGeckoBinaries = { variant ->
def omnijarDir = "${topobjdir}/dist/geckoview"
def distDir = "${topobjdir}/dist/geckoview"
def syncOmnijarFromDistDir = task("syncOmnijarFromDistDirFor${variant.name.capitalize()}", type: Sync) {
onlyIf {
if (source.empty) {
throw new StopExecutionException("Required omnijar not found in ${omnijarDir}/{omni.ja,assets/omni.ja}. Have you built and packaged?")
def syncOmnijarFromDistDir
if (mozconfig.substs.COMPILE_ENVIRONMENT) {
syncOmnijarFromDistDir = task("syncOmnijarFromDistDirFor${variant.name.capitalize()}", type: Sync) {
onlyIf {
if (source.empty) {
throw new StopExecutionException("Required omnijar not found in ${omnijarDir}/{omni.ja,assets/omni.ja}. Have you built and packaged?")
}
return true
}
return true
}
into("${project.buildDir}/moz.build/src/${variant.name}/omnijar")
from("${omnijarDir}/omni.ja",
"${omnijarDir}/assets/omni.ja") {
// Throw an exception if we find multiple, potentially conflicting omni.ja files.
duplicatesStrategy 'fail'
into("${project.buildDir}/moz.build/src/${variant.name}/omnijar")
from("${omnijarDir}/omni.ja",
"${omnijarDir}/assets/omni.ja") {
// Throw an exception if we find multiple, potentially conflicting omni.ja files.
duplicatesStrategy 'fail'
}
}
}
@ -264,31 +267,33 @@ 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
// 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) {
syncOmnijarFromDistDir.dependsOn rootProject.machStagePackage
syncLibsFromDistDir.dependsOn rootProject.machStagePackage
syncAssetsFromDistDir.dependsOn rootProject.machStagePackage
}
if (mozconfig.substs.COMPILE_ENVIRONMENT) {
// 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
// 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) {
syncOmnijarFromDistDir.dependsOn rootProject.machStagePackage
syncLibsFromDistDir.dependsOn rootProject.machStagePackage
syncAssetsFromDistDir.dependsOn rootProject.machStagePackage
}
def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets")
def jniLibFoldersTask = tasks.findByName("merge${variant.name.capitalize()}JniLibFolders")
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
assetGenTask.dependsOn syncOmnijarFromDistDir
assetGenTask.dependsOn syncAssetsFromDistDir
jniLibFoldersTask.dependsOn syncLibsFromDistDir
def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets")
def jniLibFoldersTask = tasks.findByName("merge${variant.name.capitalize()}JniLibFolders")
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
assetGenTask.dependsOn syncOmnijarFromDistDir
assetGenTask.dependsOn syncAssetsFromDistDir
jniLibFoldersTask.dependsOn syncLibsFromDistDir
android.sourceSets."${variant.name}".assets.srcDir syncOmnijarFromDistDir.destinationDir
android.sourceSets."${variant.name}".assets.srcDir syncAssetsFromDistDir.destinationDir
android.sourceSets."${variant.name}".assets.srcDir syncOmnijarFromDistDir.destinationDir
android.sourceSets."${variant.name}".assets.srcDir syncAssetsFromDistDir.destinationDir
if (!mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
android.sourceSets."${variant.name}".jniLibs.srcDir syncLibsFromDistDir.destinationDir
} else {
android.sourceSets."${variant.name}".jniLibs.srcDir "${topobjdir}/dist/fat-aar/output/jni"
if (!mozconfig.substs.MOZ_ANDROID_FAT_AAR_ARCHITECTURES) {
android.sourceSets."${variant.name}".jniLibs.srcDir syncLibsFromDistDir.destinationDir
} else {
android.sourceSets."${variant.name}".jniLibs.srcDir "${topobjdir}/dist/fat-aar/output/jni"
}
}
}
}
@ -314,11 +319,9 @@ ext.configureLibraryVariantWithJNIWrappers = { variant, module ->
// configuration-time: see above comment.
doFirst {
classpath variant.javaCompileProvider.get().classpath
// Include android.jar.
classpath variant.javaCompileProvider.get().options.bootstrapClasspath
}
main = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'
mainClass = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'
args module
args bundleJar

View file

@ -21,8 +21,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
dexOptions {

View file

@ -47,9 +47,9 @@ AVD_MANIFEST_ARM64 = os.path.abspath(
os.path.join(os.path.dirname(__file__), "android-avds/arm64.json")
)
JAVA_VERSION_MAJOR = "8"
JAVA_VERSION_MINOR = "u312"
JAVA_VERSION_PATCH = "b07"
JAVA_VERSION_MAJOR = "17"
JAVA_VERSION_MINOR = "0.1"
JAVA_VERSION_PATCH = "12"
ANDROID_NDK_EXISTS = """
Looks like you have the correct version of the Android NDK installed at:
@ -840,8 +840,12 @@ def ensure_java(os_name, os_arch):
else:
os_tag = os_name
# One we migrate to Java 17 we will be able to use native arm64 binaries
arch = "x64"
if os_arch == "x86_64":
arch = "x64"
elif os_arch == "arm64":
arch = "aarch64"
else:
arch = os_arch
ext = "zip" if os_name == "windows" else "tar.gz"
@ -850,12 +854,12 @@ def ensure_java(os_name, os_arch):
raise NotImplementedError(f"Could not bootstrap java for {os_name}.")
if not os.path.exists(java_path):
# e.g. https://github.com/adoptium/temurin8-binaries/releases/
# download/jdk8u312-b07/OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz
# e.g. https://github.com/adoptium/temurin17-binaries/releases/
# download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz
java_url = (
"https://github.com/adoptium/temurin{major}-binaries/releases/"
"download/jdk{major}{minor}-{patch}/"
"OpenJDK{major}U-jdk_{arch}_{os}_hotspot_{major}{minor}{patch}.{ext}"
"download/jdk-{major}.{minor}%2B{patch}/"
"OpenJDK{major}U-jdk_{arch}_{os}_hotspot_{major}.{minor}_{patch}.{ext}"
).format(
major=JAVA_VERSION_MAJOR,
minor=JAVA_VERSION_MINOR,
@ -869,7 +873,8 @@ def ensure_java(os_name, os_arch):
def java_bin_path(os_name, toolchain_path):
jdk_folder = "jdk{major}{minor}-{patch}".format(
# Like jdk-17.0.1+12
jdk_folder = "jdk-{major}.{minor}+{patch}".format(
major=JAVA_VERSION_MAJOR, minor=JAVA_VERSION_MINOR, patch=JAVA_VERSION_PATCH
)

View file

@ -596,7 +596,7 @@ class TestChecksConfigure(unittest.TestCase):
javac = mozpath.abspath("/usr/bin/javac")
paths = {java: None, javac: None}
expected_error_message = (
"ERROR: Could not locate Java at /mozbuild/jdk/jdk8u312-b07/bin, "
"ERROR: Could not locate Java at /mozbuild/jdk/jdk-17.0.1+12/bin, "
"please run ./mach bootstrap --no-system-changes\n"
)

View file

@ -461,6 +461,17 @@ sonatype-nexus:
strip-components: 1
add-prefix: sonatype-nexus/
jdk-8-linux64:
description: Java 8 JDK
fetch:
type: static-url
url: https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u312-b07/OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz
sha256: 699981083983b60a7eeb511ad640fae3ae4b879de5a3980fe837e8ade9c34a08
size: 103016010
artifact-name: jdk-8.tar.zst
strip-components: 1
add-prefix: jdk-8/
makecab:
description: makecab source code
fetch:

View file

@ -114,7 +114,7 @@ linux64-jdk-repack:
toolchain-artifact: project/gecko/jdk/jdk-linux.tar.zst
toolchain-alias: linux64-jdk
toolchain-env:
JAVA_HOME: "/builds/worker/fetches/jdk/jdk8u312-b07"
JAVA_HOME: "/builds/worker/fetches/jdk/jdk-17.0.1+12"
linux64-android-sdk-linux-repack:
description: "Android SDK (Linux) repack toolchain build"
@ -194,6 +194,8 @@ linux64-android-gradle-dependencies:
fetches:
fetch:
- sonatype-nexus
# Nexus needs Java 8
- jdk-8-linux64
toolchain:
# Aliases aren't allowed for toolchains depending on toolchains.
- linux64-android-sdk-linux-repack
@ -222,6 +224,8 @@ linux64-android-gradle-dependencies-lite:
fetches:
fetch:
- sonatype-nexus
# Nexus needs Java 8
- jdk-8-linux64
toolchain:
# Aliases aren't allowed for toolchains depending on toolchains.
- linux64-android-sdk-linux-repack

View file

@ -9,12 +9,13 @@ set -v
cd $GECKO_PATH
# Needed for Nexus
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$MOZ_FETCHES_DIR/jdk-8/bin:$PATH
. taskcluster/scripts/misc/android-gradle-dependencies/before.sh
export MOZCONFIG=mobile/android/config/mozconfigs/android-arm-gradle-dependencies/nightly-lite
./mach build
./mach gradle downloadDependencies
./mach android gradle-dependencies
. taskcluster/scripts/misc/android-gradle-dependencies/after.sh

View file

@ -8,13 +8,14 @@ set -v
cd $GECKO_PATH
# Needed for Nexus
export PATH=$JAVA_HOME/bin:$PATH
# Nexus needs Java 8
export PATH=$MOZ_FETCHES_DIR/jdk-8/bin:$PATH
. taskcluster/scripts/misc/android-gradle-dependencies/before.sh
export MOZCONFIG=mobile/android/config/mozconfigs/android-arm-gradle-dependencies/nightly
./mach build
./mach gradle downloadDependencies
./mach android gradle-dependencies
. taskcluster/scripts/misc/android-gradle-dependencies/after.sh

View file

@ -194,7 +194,10 @@ def javadoc(config, **lintargs):
for issue in issues:
issue["path"] = issue["path"].replace(lintargs["root"], "")
# We want warnings to be errors for linting purposes.
issue["level"] = "error"
# TODO: Bug 1316188 - resolve missing javadoc comments
issue["level"] = (
"error" if issue["message"] != ": no comment" else "warning"
)
results.append(result.from_config(config, **issue))
return results
@ -229,6 +232,10 @@ def lint(config, **lintargs):
for issue in root.findall("issue"):
location = issue[0]
if "third_party" in location.get("file") or "thirdparty" in location.get(
"file"
):
continue
err = {
"level": issue.get("severity").lower(),
"rule": issue.get("id"),