diff --git a/.circleci/config.yml b/.circleci/config.yml index c1ac780978..6801c3f37c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,6 +93,15 @@ commands: rustup target add i686-linux-android rustup target add x86_64-linux-android + install-android-ndk: + steps: + - run: + name: Install missing Android SDK & NDK + command: | + sdkmanager \ + "build-tools;28.0.3" \ + "ndk;21.3.6528147" + android-setup: steps: - checkout @@ -100,10 +109,7 @@ commands: - setup-rust-toolchain: rust-version: stable - install-android-targets - - run: - name: Install missing Android SDK - command: | - sdkmanager 'build-tools;28.0.3' + - install-android-ndk test-python: steps: @@ -436,16 +442,17 @@ jobs: Lint Android with ktlint and detekt: docker: - - image: circleci/android:api-28-ndk + - image: circleci/android:api-28 steps: - checkout + - install-android-ndk - run: ./gradlew --no-daemon lint - run: ./gradlew --no-daemon ktlint - run: ./gradlew --no-daemon detekt Android tests: docker: - - image: circleci/android:api-28-ndk + - image: circleci/android:api-28 steps: - android-setup - skip-if-doc-only @@ -488,18 +495,13 @@ jobs: destination: coredumps - store_test_results: path: ~/test-results - - Generate Kotlin documentation: - docker: - - image: circleci/android:api-28-ndk - steps: - - android-setup - run: - name: Build Kotlin documentation - command: ./gradlew --no-daemon docs - - persist_to_workspace: - root: build/ - paths: docs/javadoc + name: Build Android Sample App + command: | + ./gradlew :glean-sample-app:assembleAndroidTest + environment: + GRADLE_OPTS: -Xmx2048m + TARGET_CFLAGS: -DNDEBUG ########################################################################### # Swift / iOS / macOS @@ -1180,14 +1182,12 @@ workflows: - Generate Rust documentation: requires: - docs-spellcheck - - Generate Kotlin documentation - Generate Python documentation: requires: - Python 3_8 tests - docs-linkcheck: requires: - Generate Rust documentation - - Generate Kotlin documentation - Generate Python documentation - docs-spellcheck - docs-deploy: diff --git a/Makefile b/Makefile index 2c2169c868..7002948d4b 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ build-swift: ## Build all Swift code bin/run-ios-build.sh build-apk: build-kotlin ## Build an apk of the Glean sample app - ./gradlew glean-sample-app:build + ./gradlew glean-sample-app:build glean-sample-app:assembleAndroidTest build-python: python-setup ## Build the Python bindings $(GLEAN_PYENV)/bin/python3 glean-core/python/setup.py build install @@ -72,6 +72,9 @@ test-kotlin: ## Run all Kotlin tests test-swift: ## Run all Swift tests bin/run-ios-tests.sh +test-android-sample: build-apk ## Run the Android UI tests on the sample app + ./gradlew :glean-sample-app:connectedAndroidTest + test-ios-sample: ## Run the iOS UI tests on the sample app bin/run-ios-sample-app-test.sh @@ -127,21 +130,18 @@ fmt-python: python-setup ## Run black to format Python code # Docs -docs: rust-docs kotlin-docs ## Build the Rust and Kotlin API documentation +docs: rust-docs ## Build the Rust API documentation rust-docs: ## Build the Rust documentation bin/build-rust-docs.sh -kotlin-docs: ## Build the Kotlin documentation - ./gradlew docs - swift-docs: ## Build the Swift documentation bin/build-swift-docs.sh python-docs: build-python ## Build the Python documentation $(GLEAN_PYENV)/bin/python3 -m pdoc --html glean --force -o build/docs/python --config show_type_annotations=True -.PHONY: docs rust-docs kotlin-docs swift-docs +.PHONY: docs rust-docs swift-docs metrics-docs: python-setup ## Build the internal metrics documentation $(GLEAN_PYENV)/bin/pip install glean_parser==3.6.0 diff --git a/build.gradle b/build.gradle index d9bdf37614..ac09184fb1 100644 --- a/build.gradle +++ b/build.gradle @@ -11,17 +11,16 @@ buildscript { // changing them. Please note that, for using in Android-Components, the // versions below must match the ones in that repository. ext.versions = [ - android_gradle_plugin: '4.0.1', + android_gradle_plugin: '4.2.2', android_maven_publish_plugin: '3.6.2', - coroutines: '1.3.5', - dokka: '0.9.17', + coroutines: '1.5.0', jna: '5.6.0', junit: '4.12', mockito: '2.28.2', // This is different than a-c, but we're fine, it's only tests. mockwebserver: '4.9.1', // This is different than a-c, but we're fine, it's only tests. - kotlin: '1.4.10', + kotlin: '1.5.20', robolectric: '4.5.1', // This is different than a-c, but we're fine, it's only tests. - rust_android_plugin: '0.8.3', + rust_android_plugin: '0.8.7', // Android X dependencies androidx_annotation: '1.1.0', @@ -37,6 +36,7 @@ buildscript { ] ext.build = [ + ndkVersion: "21.3.6528147", // Keep it in sync in TC Dockerfile. compileSdkVersion: 29, targetSdkVersion: 28, minSdkVersion: 21, // So that we can publish for aarch64. @@ -56,15 +56,12 @@ buildscript { // Publish. classpath "digital.wup:android-maven-publish:$versions.android_maven_publish_plugin" - classpath "gradle.plugin.org.mozilla.rust-android-gradle:plugin:$versions.rust_android_plugin" + classpath "org.mozilla.rust-android-gradle:plugin:$versions.rust_android_plugin" // Yes, this is unusual. We want to access some host-specific // computation at build time. classpath "net.java.dev.jna:jna:$versions.jna" - // Docs generation - classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$versions.dokka" - // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/docs/dev/api/index.md b/docs/dev/api/index.md index a58862f842..f9e5049de9 100644 --- a/docs/dev/api/index.md +++ b/docs/dev/api/index.md @@ -1,6 +1,5 @@ The following language-specific API docs are available: -- [Kotlin API docs](../../javadoc/glean/index.html) - [Swift API docs](../../swift/index.html) - [Python API docs](../../python/glean/index.html) - [Rust core (internal) API docs](../../docs/index.html) diff --git a/docs/dev/docs.md b/docs/dev/docs.md index 33aaa9241b..dcb1868789 100644 --- a/docs/dev/docs.md +++ b/docs/dev/docs.md @@ -33,20 +33,7 @@ The built narrative documentation is saved in `build/docs/book`, and the Rust AP {{#include ../shared/tab_header.md}} -
- -Kotlin API documentation is generated using [dokka](https://github.com/Kotlin/dokka). -It is automatically installed by Gradle. - -To build the Kotlin API documentation: - -```sh -make kotlin-docs -``` - -The generated documentation is saved in `build/docs/javadoc`. - -
+
diff --git a/docs/user/reference/general/experiments-api.md b/docs/user/reference/general/experiments-api.md index 00dac8fca2..6b6d4db7f2 100644 --- a/docs/user/reference/general/experiments-api.md +++ b/docs/user/reference/general/experiments-api.md @@ -177,5 +177,4 @@ Assert.Equal( ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean/-glean.html). * [Python API docs](../../../python/glean/glean.html) diff --git a/docs/user/reference/metrics/boolean.md b/docs/user/reference/metrics/boolean.md index 846b52eef1..0de9e6291c 100644 --- a/docs/user/reference/metrics/boolean.md +++ b/docs/user/reference/metrics/boolean.md @@ -270,7 +270,6 @@ N/A ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-boolean-metric-type/index.html) * [Swift API docs](../../../swift/Classes/BooleanMetricType.html) * [Python API docs](../../../python/glean/metrics/boolean.html) * [Rust API docs](../../../docs/glean/private/boolean/struct.BooleanMetric.html) diff --git a/docs/user/reference/metrics/counter.md b/docs/user/reference/metrics/counter.md index 0c69f48d2e..27fb029158 100644 --- a/docs/user/reference/metrics/counter.md +++ b/docs/user/reference/metrics/counter.md @@ -373,7 +373,6 @@ N/A ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-counter-metric-type/index.html) * [Swift API docs](../../../swift/Classes/CounterMetricType.html) * [Python API docs](../../../python/glean/metrics/counter.html) * [Rust API docs](../../../docs/glean/private/counter/struct.CounterMetric.html) diff --git a/docs/user/reference/metrics/custom_distribution.md b/docs/user/reference/metrics/custom_distribution.md index 5d64cf1997..1b0f7f5a3d 100644 --- a/docs/user/reference/metrics/custom_distribution.md +++ b/docs/user/reference/metrics/custom_distribution.md @@ -244,7 +244,6 @@ Custom distributions have the following optional parameters: ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-custom-distribution-metric-type/index.html) * [Rust API docs](../../../docs/glean/private/struct.CustomDistributionMetric.html) ## Simulator diff --git a/docs/user/reference/metrics/datetime.md b/docs/user/reference/metrics/datetime.md index 892169d739..ef116dabee 100644 --- a/docs/user/reference/metrics/datetime.md +++ b/docs/user/reference/metrics/datetime.md @@ -461,7 +461,6 @@ Carefully consider the required resolution for recording your metric, and choose ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-datetime-metric-type/index.html) * [Swift API docs](../../../swift/Classes/DatetimeMetricType.html) * [Python API docs](../../../python/glean/metrics/datetime.html) * [Rust API docs](../../../docs/glean/private/struct.DatetimeMetric.html) diff --git a/docs/user/reference/metrics/event.md b/docs/user/reference/metrics/event.md index 211cb15b45..d7216adb2e 100644 --- a/docs/user/reference/metrics/event.md +++ b/docs/user/reference/metrics/event.md @@ -506,7 +506,6 @@ Each extra key contains additional metadata: ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-event-metric-type/index.html) * [Swift API docs](../../../swift/Classes/EventMetricType.html) * [Python API docs](../../../python/glean/metrics/event.html) * [Rust API docs](../../../docs/glean/private/event/struct.EventMetric.html) diff --git a/docs/user/reference/metrics/labeled_booleans.md b/docs/user/reference/metrics/labeled_booleans.md index 6adbcaae74..eab90cda10 100644 --- a/docs/user/reference/metrics/labeled_booleans.md +++ b/docs/user/reference/metrics/labeled_booleans.md @@ -367,7 +367,6 @@ accessibility: ## Reference -* Kotlin API docs [`LabeledMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-labeled-metric-type/index.html), [`BooleanMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-boolean-metric-type/index.html) * Swift API docs: [`LabeledMetricType`](../../../swift/Classes/LabeledMetricType.html), [`BooleanMetricType`](../../../swift/Classes/BooleanMetricType.html) * Python API docs: [`LabeledMetricBase`](../../../python/glean/metrics/labeled.html), [`BooleanMetricType`](../../../python/glean/metrics/boolean.html) * Rust API docs: [`LabeledMetric`](../../../docs/glean/private/struct.LabeledMetric.html), [`BooleanMetricType`](../../../docs/glean/private/struct.BooleanMetric.html) diff --git a/docs/user/reference/metrics/labeled_counters.md b/docs/user/reference/metrics/labeled_counters.md index e6cca21fad..64dcca1963 100644 --- a/docs/user/reference/metrics/labeled_counters.md +++ b/docs/user/reference/metrics/labeled_counters.md @@ -383,7 +383,6 @@ accessibility: ## Reference -* Kotlin API docs [`LabeledMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-labeled-metric-type/index.html), [`CounterMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-counter-metric-type/index.html) * Swift API docs: [`LabeledMetricType`](../../../swift/Classes/LabeledMetricType.html), [`CounterMetricType`](../../../swift/Classes/CounterMetricType.html) * Python API docs: [`LabeledMetricBase`](../../../python/glean/metrics/labeled.html), [`CounterMetricType`](../../../python/glean/metrics/counter.html) * Rust API docs: [`LabeledMetric`](../../../docs/glean/private/struct.LabeledMetric.html), [`CounterMetricType`](../../../docs/glean/private/struct.CounterMetric.html) diff --git a/docs/user/reference/metrics/labeled_strings.md b/docs/user/reference/metrics/labeled_strings.md index 7a8db8c4d7..202513c566 100644 --- a/docs/user/reference/metrics/labeled_strings.md +++ b/docs/user/reference/metrics/labeled_strings.md @@ -352,7 +352,6 @@ login: ## Reference -* Kotlin API docs: [`LabeledMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-labeled-metric-type/index.html), [`StringMetricType`](../../../javadoc/glean/mozilla.telemetry.glean.private/-string-metric-type/index.html) * Swift API docs: [`LabeledMetricType`](../../../swift/Classes/LabeledMetricType.html), [`StringMetricType`](../../../swift/Classes/StringMetricType.html) * Python API docs: [`LabeledMetricBase`](../../../python/glean/metrics/labeled.html), [`StringMetricType`](../../../python/glean/metrics/string.html) * Rust API docs: [`LabeledMetric`](../../../docs/glean/private/struct.LabeledMetric.html), [`StringMetricType`](../../../docs/glean/private/struct.StringMetric.html) diff --git a/docs/user/reference/metrics/memory_distribution.md b/docs/user/reference/metrics/memory_distribution.md index 889872a7d6..18500ecd01 100644 --- a/docs/user/reference/metrics/memory_distribution.md +++ b/docs/user/reference/metrics/memory_distribution.md @@ -275,7 +275,6 @@ Assert.equal(1, Object.entries(data.values).reduce(([bucket, count], sum) => cou ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-memory-distribution-metric-type/index.html) * [Swift API docs](../../../swift/Classes/MemoryDistributionMetricType.html) * [Python API docs](../../../python/glean/metrics/timing_distribution.html) * [Rust API docs](../../../docs/glean/private/struct.MemoryDistributionMetric.html) diff --git a/docs/user/reference/metrics/quantity.md b/docs/user/reference/metrics/quantity.md index cf93e37157..19b75fe5a3 100644 --- a/docs/user/reference/metrics/quantity.md +++ b/docs/user/reference/metrics/quantity.md @@ -371,7 +371,6 @@ Quantities have the required `unit` parameter, which is a free-form string for d ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-quantity-metric-type/index.html) * [Swift API docs](../../../swift/Classes/QuantityMetricType.html) * [Python API docs](../../../python/glean/metrics/quantity.html) * [Rust API docs](../../../docs/glean/private/quantity/struct.QuantityMetric.html) diff --git a/docs/user/reference/metrics/string.md b/docs/user/reference/metrics/string.md index 1d6d131951..03616ef9c4 100644 --- a/docs/user/reference/metrics/string.md +++ b/docs/user/reference/metrics/string.md @@ -410,7 +410,6 @@ N/A ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-string-metric-type/index.html) * [Swift API docs](../../../swift/Classes/StringMetricType.html) * [Python API docs](../../../python/glean/metrics/string.html) * [Rust API docs](../../../docs/glean/private/struct.StringMetric.html) diff --git a/docs/user/reference/metrics/string_list.md b/docs/user/reference/metrics/string_list.md index 01232c6d40..387581e477 100644 --- a/docs/user/reference/metrics/string_list.md +++ b/docs/user/reference/metrics/string_list.md @@ -403,7 +403,6 @@ N/A ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-string-list-metric-type/index.html) * [Swift API docs](../../../swift/Classes/StringListMetricType.html) * [Python API docs](../../../python/glean/metrics/string_list.html) * [Rust API docs](../../../docs/glean/private/struct.StringListMetric.html) diff --git a/docs/user/reference/metrics/timespan.md b/docs/user/reference/metrics/timespan.md index bf481ddc84..eae20176fc 100644 --- a/docs/user/reference/metrics/timespan.md +++ b/docs/user/reference/metrics/timespan.md @@ -727,7 +727,6 @@ and use the largest possible value that will provide useful information so as to ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-timespan-metric-type/index.html) * [Swift API docs](../../../swift/Classes/TimespanMetricType.html) * [Python API docs](../../../python/glean/metrics/timespan.html) * [Rust API docs](../../../docs/glean/private/struct.TimespanMetric.html) diff --git a/docs/user/reference/metrics/timing_distribution.md b/docs/user/reference/metrics/timing_distribution.md index 727360ca08..0a026b82f5 100644 --- a/docs/user/reference/metrics/timing_distribution.md +++ b/docs/user/reference/metrics/timing_distribution.md @@ -394,7 +394,6 @@ Assert.ok(Glean.pages.pageLoad.testGetValue().sum > 0); ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-timing-distribution-metric-type/index.html) * [Swift API docs](../../../swift/Classes/TimingDistributionMetricType.html) * [Python API docs](../../../python/glean/metrics/timing_distribution.html) diff --git a/docs/user/reference/metrics/uuid.md b/docs/user/reference/metrics/uuid.md index 8633025a45..f1f59abe4b 100644 --- a/docs/user/reference/metrics/uuid.md +++ b/docs/user/reference/metrics/uuid.md @@ -475,7 +475,6 @@ N/A ## Reference -* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean.private/-uuid-metric-type/index.html). * [Swift API docs](../../../swift/Classes/UuidMetricType.html) * [Python API docs](../../../python/glean/metrics/uuid.html) * [Rust API docs](../../../docs/glean/private/uuid/struct.UuidMetric.html) diff --git a/glean-core/android-native/build.gradle b/glean-core/android-native/build.gradle index 6839aaf276..1992133d9b 100644 --- a/glean-core/android-native/build.gradle +++ b/glean-core/android-native/build.gradle @@ -11,6 +11,7 @@ apply plugin: 'com.android.library' apply plugin: 'org.mozilla.rust-android-gradle.rust-android' android { + ndkVersion rootProject.ext.build.ndkVersion compileSdkVersion rootProject.ext.build.compileSdkVersion defaultConfig { diff --git a/glean-core/android/build.gradle b/glean-core/android/build.gradle index de0c122fc6..a719509c58 100644 --- a/glean-core/android/build.gradle +++ b/glean-core/android/build.gradle @@ -14,7 +14,6 @@ plugins { apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -apply plugin: 'org.jetbrains.dokka-android' apply plugin: 'jacoco' /* @@ -101,7 +100,7 @@ android { afterEvaluate { jacoco { - toolVersion = "0.8.4" + toolVersion = "0.8.7" } task jacocoTestReport(type: JacocoReport) { @@ -156,7 +155,7 @@ dependencies { implementation project(":glean-native") // Note: the following version must be kept in sync - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutines" implementation "androidx.annotation:annotation:$versions.androidx_annotation" @@ -211,14 +210,6 @@ afterEvaluate { apply from: "$projectDir/publish.gradle" ext.configurePublish() -tasks.register("docs", org.jetbrains.dokka.gradle.DokkaAndroidTask) { - moduleName = "glean" - outputDirectory = "$buildDir/../../../build/docs/javadoc" - outputFormat = "html" - jdkVersion = 7 - reportUndocumented = true -} - // Generate markdown docs for the collected metrics. ext.gleanGenerateMarkdownDocs = true ext.gleanDocsDirectory = "$rootDir/docs/user/user/collected-metrics" diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt index dcf4f80bf2..7c55e072e8 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt @@ -62,7 +62,7 @@ object GleanBuildInfo { * @throws AssertionError If the JSON content is not valid */ internal fun checkPingSchema(content: JSONObject) { - val os = System.getProperty("os.name")?.toLowerCase() + val os = System.getProperty("os.name")?.lowercase() val pythonExecutable = if (os?.indexOf("win")?.compareTo(0) == 0) "${BuildConfig.GLEAN_MINICONDA_DIR}/python" diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt index 3f6dc5b459..ae4fc99d6a 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt @@ -81,7 +81,7 @@ class MetricsPingSchedulerTest { fakeNow.set(2015, 6, 11, 3, 0, 0) // We expect the function to return 1 hour, in milliseconds. - assertEquals(60 * 60 * 1000, + assertEquals(60 * 60 * 1000L, metricsPingScheduler.getMillisecondsUntilDueTime( sendTheNextCalendarDay = false, now = fakeNow, dueHourOfTheDay = 4) ) @@ -104,7 +104,7 @@ class MetricsPingSchedulerTest { // With `sendTheNextCalendarDay` true, we expect the function to return 23 hours // and 55 minutes, in milliseconds. - assertEquals(23 * 60 * 60 * 1000 + 55 * 60 * 1000, + assertEquals(23 * 60 * 60 * 1000L + 55 * 60 * 1000L, metricsPingScheduler.getMillisecondsUntilDueTime( sendTheNextCalendarDay = true, now = fakeNow, dueHourOfTheDay = 4) ) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc26b..4d9ca16491 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/android/app/build.gradle b/samples/android/app/build.gradle index 17ddf511ad..d56fc55162 100644 --- a/samples/android/app/build.gradle +++ b/samples/android/app/build.gradle @@ -39,7 +39,7 @@ android { dependencies { implementation project(':glean') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$rootProject.versions.kotlin" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$rootProject.versions.kotlin" implementation "androidx.appcompat:appcompat:$rootProject.versions.androidx_appcompat" implementation "androidx.browser:browser:$rootProject.versions.androidx_browser" diff --git a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/MainActivityTest.kt b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/MainActivityTest.kt index 0a22fc3169..9bcd1a8269 100644 --- a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/MainActivityTest.kt +++ b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/MainActivityTest.kt @@ -4,6 +4,8 @@ package org.mozilla.samples.gleancore +import android.content.Context +import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.matcher.ViewMatchers.withId @@ -12,6 +14,7 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.mozilla.samples.gleancore.GleanMetrics.Test as GleanTestMetrics +import mozilla.telemetry.glean.testing.GleanTestLocalServer import org.junit.Rule import org.junit.Test @@ -22,6 +25,12 @@ class MainActivityTest { @get:Rule val activityRule: ActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java) + @get:Rule + val gleanRule = GleanTestLocalServer(context, 0) + + private val context: Context + get() = ApplicationProvider.getApplicationContext() + @Test fun checkGleanClickData() { // We don't reset the storage in this test as the GleanTestRule does not diff --git a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt index aecd4f6442..32ed79e092 100644 --- a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt +++ b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt @@ -21,7 +21,7 @@ import java.util.zip.GZIPInputStream */ internal fun createMockWebServer(): MockWebServer { val server = MockWebServer() - server.setDispatcher(object : Dispatcher() { + server.dispatcher = (object : Dispatcher() { override fun dispatch(request: RecordedRequest): MockResponse { return MockResponse().setBody("OK") } @@ -72,7 +72,7 @@ fun waitForPingContent( var parsedPayload: JSONObject? = null for (attempts in 1..maxAttempts) { val request = server.takeRequest(20L, TimeUnit.SECONDS) ?: break - val docType = request.path.split("/")[3] + val docType = request.path!!.split("/")[3] if (pingName == docType) { parsedPayload = JSONObject(request.getPlainBody()) if (pingReason == null) { diff --git a/taskcluster/docker/linux/Dockerfile b/taskcluster/docker/linux/Dockerfile index 7624567efc..aca112d680 100644 --- a/taskcluster/docker/linux/Dockerfile +++ b/taskcluster/docker/linux/Dockerfile @@ -141,26 +141,11 @@ RUN curl -sfSL --retry 5 --retry-delay 10 https://dl.google.com/android/reposito "platforms;android-${ANDROID_PLATFORM_VERSION}" \ "build-tools;${ANDROID_BUILD_TOOLS}" \ "extras;android;m2repository" \ - "extras;google;m2repository" + "extras;google;m2repository" \ + "ndk;21.3.6528147" RUN chown -R worker:worker /builds/worker/android-sdk -# Android NDK - -ENV ANDROID_NDK_VERSION "r21" - -# $ANDROID_NDK_ROOT is the preferred name, but the android gradle plugin uses $ANDROID_NDK_HOME. -ENV ANDROID_NDK_ROOT /builds/worker/android-ndk -ENV ANDROID_NDK_HOME /builds/worker/android-ndk - -RUN curl -sfSL --retry 5 --retry-delay 10 https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip > ndk.zip \ - && unzip -q ndk.zip -d /builds/worker \ - && rm ndk.zip \ - && mv /builds/worker/android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_ROOT} - -ENV ANDROID_NDK_TOOLCHAIN_DIR /builds/worker/.android-ndk-r21-toolchain -ENV ANDROID_NDK_API_VERSION 21 - # sccache RUN \ curl -sfSL --retry 5 --retry-delay 10 \