Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1722271 - Update to Kotlin 1.5 #1747

Merged
merged 7 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,23 @@ 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
- install-rustup
- 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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
15 changes: 6 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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.
Expand All @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion docs/dev/api/index.md
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 1 addition & 14 deletions docs/dev/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,7 @@ The built narrative documentation is saved in `build/docs/book`, and the Rust AP

{{#include ../shared/tab_header.md}}

<div data-lang="Kotlin" class="tab">

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`.

</div>
<div data-lang="Kotlin" class="tab" data-info="Kotlin API documentation was removed due to tooling issues."></div>

<div data-lang="Swift" class="tab">

Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/general/experiments-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,4 @@ Assert.Equal(

## Reference

* [Kotlin API docs](../../../javadoc/glean/mozilla.telemetry.glean/-glean.html).
* [Python API docs](../../../python/glean/glean.html)
1 change: 0 additions & 1 deletion docs/user/reference/metrics/boolean.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/custom_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/labeled_booleans.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/labeled_counters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/labeled_strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/memory_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/quantity.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/string_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion docs/user/reference/metrics/timespan.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/timing_distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion docs/user/reference/metrics/uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions glean-core/android-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 2 additions & 11 deletions glean-core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

/*
Expand Down Expand Up @@ -101,7 +100,7 @@ android {

afterEvaluate {
jacoco {
toolVersion = "0.8.4"
toolVersion = "0.8.7"
}

task jacocoTestReport(type: JacocoReport) {
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading