Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Use the Rust implementation of the Glean SDK
Browse files Browse the repository at this point in the history
This removes the Kotlin implementation from this repository
and introduces type aliases that point to the Rust implementation,
which is now a new dependency.
  • Loading branch information
Dexterp37 committed Oct 24, 2019
1 parent 321d499 commit dd1c78d
Show file tree
Hide file tree
Showing 111 changed files with 135 additions and 16,981 deletions.
4 changes: 4 additions & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object Versions {

const val mozilla_appservices = "0.42.0"

const val mozilla_glean = "19.0.0"

const val material = "1.0.0"

object AndroidX {
Expand Down Expand Up @@ -120,6 +122,8 @@ object Dependencies {

const val mozilla_fxa = "org.mozilla.appservices:fxaclient:${Versions.mozilla_appservices}"

const val mozilla_glean_forUnitTests = "org.mozilla.telemetry:glean-forUnitTests:${Versions.mozilla_glean}"

const val mozilla_sync_logins = "org.mozilla.appservices:logins:${Versions.mozilla_appservices}"
const val mozilla_places = "org.mozilla.appservices:places:${Versions.mozilla_appservices}"
const val mozilla_sync_manager = "org.mozilla.appservices:syncmanager:${Versions.mozilla_appservices}"
Expand Down
1 change: 1 addition & 0 deletions components/lib/crash/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
testImplementation Dependencies.testing_mockito
testImplementation Dependencies.testing_coroutines
testImplementation Dependencies.testing_mockwebserver
testImplementation Dependencies.mozilla_glean_forUnitTests
}

ext.gleanGenerateMarkdownDocs = true
Expand Down
51 changes: 25 additions & 26 deletions components/service/glean/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,15 @@
* 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/. */

plugins {
id "com.jetbrains.python.envs" version "0.0.26"
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

/*
* This defines the location of the JSON schema used to validate the pings
* created during unit testing.
* This uses a specific version of the schema identified by a git commit hash.
*/
String GLEAN_PING_SCHEMA_GIT_HASH = "c566160"
String GLEAN_PING_SCHEMA_URL = "https://raw.githubusercontent.com/mozilla-services/mozilla-pipeline-schemas/$GLEAN_PING_SCHEMA_GIT_HASH/schemas/glean/baseline/baseline.1.schema.json"

android {
compileSdkVersion config.compileSdkVersion

defaultConfig {
minSdkVersion config.minSdkVersion
targetSdkVersion config.targetSdkVersion

buildConfigField("String", "LIBRARY_VERSION", "\"" + config.componentsVersion + "\"")
buildConfigField("String", "GLEAN_PING_SCHEMA_URL", "\"" + GLEAN_PING_SCHEMA_URL + "\"")
}

buildTypes {
Expand All @@ -36,27 +21,41 @@ android {
}
}

configurations {
// There's an interaction between Gradle's resolution of dependencies with different types
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
// what's happening is that @aar type in `implementation` resolves to the @jar type in
// `testImplementation`, and that it wins the dependency resolution battle.
//
// A workaround is to add a new configuration which depends on the @jar type and to reference
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
// Success!
jnaForTest
}

// Define library names and version constants.
String GLEAN_LIBRARY = "org.mozilla.telemetry:glean:${Versions.mozilla_glean}"
String GLEAN_LIBRARY_FORUNITTESTS = "org.mozilla.telemetry:glean-forUnitTests:${Versions.mozilla_glean}"

dependencies {
implementation Dependencies.kotlin_stdlib
implementation Dependencies.kotlin_coroutines
implementation Dependencies.androidx_lifecycle_extensions
implementation Dependencies.androidx_work_runtime

api GLEAN_LIBRARY

implementation project(':support-ktx')
implementation project(':support-base')
implementation project(':concept-fetch')
implementation project(':lib-fetch-httpurlconnection')
implementation project(':support-utils')

// We need a compileOnly dependency on the following block of testing
// libraries in order to expose the GleanTestRule to applications/libraries
// using the Glean SDK.
// We can't simply create a separate package otherwise we would need
// to provide a public API for the testing package to access the
// Glean internals, which is something we would not want to do.
compileOnly Dependencies.testing_junit
compileOnly Dependencies.androidx_work_testing

testImplementation Dependencies.androidx_test_core

testImplementation Dependencies.testing_junit
Expand All @@ -67,9 +66,9 @@ dependencies {

testImplementation project(':support-test')
testImplementation project(':lib-fetch-okhttp')

testImplementation GLEAN_LIBRARY_FORUNITTESTS
}

apply from: '../../../publish.gradle'
ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)

apply from: './scripts/sdk_generator.gradle'
243 changes: 0 additions & 243 deletions components/service/glean/metrics.yaml

This file was deleted.

Loading

0 comments on commit dd1c78d

Please sign in to comment.