Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Issue mozilla-mobile#19662: Use Java 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo authored and czlucius committed Aug 22, 2021
1 parent 373f79b commit 05535c9
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-contributor-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: "Clean & Assemble Debug"
uses: eskatos/gradle-command-action@v1
with:
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: "Test Debug Unit Tests"
uses: eskatos/gradle-command-action@v1
with:
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: "Detekt"
uses: eskatos/gradle-command-action@v1
with:
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: "Ktlint"
uses: eskatos/gradle-command-action@v1
with:
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: "Lint Debug"
uses: eskatos/gradle-command-action@v1
with:
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ dependencies {
if (project.hasProperty("coverage")) {
tasks.withType(Test).configureEach {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}

jacoco {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ class HistoryMetadataMiddlewareTest {
// Now, test that we'll record metadata for the same tab after url is changed.
store.dispatch(ContentAction.UpdateUrlAction(tab.id, "https://firefox.com")).joinBlocking()
store.dispatch(ContentAction.UpdateHistoryStateAction(tab.id, emptyList(), currentIndex = 0)).joinBlocking()
verify(exactly = 2) { service.createMetadata(capture(capturedTab)) }

assertEquals(tab.id, capturedTab.captured.id)
val capturedTabs = mutableListOf<TabSessionState>()
verify(exactly = 2) { service.createMetadata(capture(capturedTabs)) }

assertEquals(2, capturedTabs.size)

capturedTabs[0].apply() {
assertEquals(tab.id, id)
}

assertEquals(expectedKey, store.state.findTab(tab.id)?.historyMetadata)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class LocaleViewHoldersTest {
localeViewHolder.bind(otherLocale)

assertEquals("Vèneto", view.locale_title_text.text)
assertEquals("Venitian", view.locale_subtitle_text.text)
assertEquals("Venetian", view.locale_subtitle_text.text)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SyncedTabsTitleDecorationTest {
every { viewHolder.itemViewType }.answers { ErrorViewHolder.LAYOUT_ID }
every { viewHolder.bindingAdapterPosition }
.answers { 1 }
.andThen { 0 }
.andThenAnswer { 0 }

decoration.getItemOffsets(rect, mockk(), recyclerView, state)

Expand Down Expand Up @@ -92,7 +92,7 @@ class SyncedTabsTitleDecorationTest {
every { viewHolder.itemViewType }.answers { ErrorViewHolder.LAYOUT_ID }
every { viewHolder.bindingAdapterPosition }
.answers { 1 }
.andThen { 0 }
.andThenAnswer { 0 }

decoration.onDraw(canvas, recyclerView, state)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TrackingProtectionPanelInteractorTest {
val interactor = TrackingProtectionPanelInteractor(
mockk(),
{ trackingProtectionNewValue = it },
mockk()
{ }
)
interactor.trackingProtectionToggled(true)
assertEquals(true, trackingProtectionNewValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ManufacturerCodesTest {
private fun enableManufacturerModifications() {
// Mocking, which might be simpler, doesn't seem to work so we use reflection.
// Methodology via https://stackoverflow.com/a/3301720/2219998
manufacturerField.isAccessible = true
val modifiers = manufacturerField.javaClass.getDeclaredField("modifiers")
modifiers.isAccessible = true
modifiers.setInt(manufacturerField, manufacturerField.modifiers and Modifier.FINAL.inv())
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object Versions {
const val installreferrer = "1.0"

const val junit = "5.5.2"
const val mockk = "1.10.0"
const val mockk = "1.10.6"

const val mockwebserver = "4.9.0"
const val uiautomator = "2.2.0"
Expand Down
1 change: 1 addition & 0 deletions taskcluster/docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN apt-get update -qq \
# we cannot navigate while building the Docker image.
&& apt-get install -y tzdata \
&& apt-get install -y openjdk-8-jdk \
openjdk-11-jdk \
wget \
expect \
git \
Expand Down
1 change: 0 additions & 1 deletion taskcluster/docker/ui-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ RUN URL_FLANK_BIN="$($CURL --silent 'https://api.github.com/repos/Flank/flank/re
&& $CURL --output "${TEST_TOOLS}/flank.jar" "${URL_FLANK_BIN}" \
&& chmod +x "${TEST_TOOLS}/flank.jar"


# run-task expects to run as root
USER root
7 changes: 5 additions & 2 deletions taskcluster/scripts/decision-install-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ ANDROID_SDK_VERSION='3859397'
ANDROID_SDK_SHA256='444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0'
SDK_ZIP_LOCATION="$HOME/sdk-tools-linux.zip"

# For the Android build system we want Java 11. However this version of sdkmanager requires Java 8.
JAVA8PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/:$PATH"

$CURL --output "$SDK_ZIP_LOCATION" "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip"
echo "$ANDROID_SDK_SHA256 $SDK_ZIP_LOCATION" | sha256sum --check
unzip -d "$ANDROID_SDK_ROOT" "$SDK_ZIP_LOCATION"
rm "$SDK_ZIP_LOCATION"

export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
yes | "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --licenses
yes | PATH=$JAVA8PATH "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --licenses

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -v
mkdir -p ${NEXUS_WORK}/conf
cp /builds/worker/checkouts/src/taskcluster/scripts/toolchain/android-gradle-dependencies/nexus.xml ${NEXUS_WORK}/conf/nexus.xml

RUN_AS_USER=worker /opt/sonatype/nexus/bin/nexus restart
PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/:$PATH" RUN_AS_USER=worker /opt/sonatype/nexus/bin/nexus restart

# Wait "a while" for Nexus to actually start. Don't fail if this fails.
wget --quiet --retry-connrefused --waitretry=2 --tries=100 \
Expand Down
7 changes: 5 additions & 2 deletions taskcluster/scripts/toolchain/repack-android-sdk-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

export ANDROID_SDK_ROOT=$MOZ_FETCHES_DIR

yes | "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --licenses
# For the Android build system we want Java 11. However this version of sdkmanager requires Java 8.
JAVA8PATH="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/:$PATH"

yes | PATH=$JAVA8PATH "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --licenses

# It's nice to have the build logs include the state of the world upon completion.
"${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --list
PATH=$JAVA8PATH "${ANDROID_SDK_ROOT}/tools/bin/sdkmanager" --list

tar cf - -C "$ANDROID_SDK_ROOT" . --transform 's,^\./,android-sdk-linux/,' | xz > "$UPLOAD_DIR/android-sdk-linux.tar.xz"

0 comments on commit 05535c9

Please sign in to comment.