From bd57fb86b6d50c559250e4b61a8f696e5b833b33 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 14:46:10 +0100 Subject: [PATCH 1/6] complete build.gradle's config and replace 'implementation' by 'api' for sentry dependency --- app/build.gradle | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index f0b4833..4ff044a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,40 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + //id 'maven-publish' } + +def versionMajor = 0 +def versionMinor = 0 +def versionPatch = 1 +def releasePatch = "alpha" + + android { namespace 'foundation.e.lib.telemetry' compileSdk 32 + defaultConfig { + minSdk 21 // is it correct value? just pasted from elib + targetSdk 32 + versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch + versionName "${versionMajor}.${versionMinor}.${versionPatch}-${releasePatch}" + } + + libraryVariants.all{ variant -> + variant.outputs.each{ output-> + output.outputFileName = "telemetry-${defaultConfig.versionName}.aar" + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -16,6 +44,23 @@ android { } } + + +/*publishing { + publications { + maven(MavenPublication) { + groupId = 'foundation.e.lib.' // or io.murena? + artifactId = 'telemetry' + version = '1.1' + + from components.java + } + } +}*/ + + + + dependencies { - implementation 'io.sentry:sentry-android:6.10.0' + api 'io.sentry:sentry-android:6.10.0' } \ No newline at end of file -- GitLab From 27179d26530a962d008f6da66643d0665073d840 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 14:58:48 +0100 Subject: [PATCH 2/6] add maven-publish plugin and config for it to work --- app/build.gradle | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4ff044a..7cb1bc3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' - //id 'maven-publish' + id 'maven-publish' } @@ -46,17 +46,46 @@ android { -/*publishing { +publishing { publications { maven(MavenPublication) { groupId = 'foundation.e.lib.' // or io.murena? artifactId = 'telemetry' - version = '1.1' + version android.defaultConfig.versionName + artifact "$buildDir/outputs/aar/telemetry-${android.defaultConfig.versionName}.aar" + + + pom.withXml { + def dependenciesNode = asNode().appendNode('dependencies') + configurations.implementation.allDependencies.each { dependency -> + if (dependency.name != 'unspecified') { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', dependency.group) + dependencyNode.appendNode('artifactId', dependency.name) + dependencyNode.appendNode('version', dependency.version) + } + } + } + + + repositories { + maven { + url "https://gitlab.e.foundation/api/v4/projects/1391/packages/maven" // Not sure about this URL + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = System.getenv("CI_JOB_TOKEN") + } + authentication { + header(HttpHeaderAuthentication) + } + } + } + - from components.java } } -}*/ +} -- GitLab From f756490194dd2af627d192268b3dd7c543fae37b Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 15:13:13 +0100 Subject: [PATCH 3/6] add gitlab-ci.yml --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f88da22 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" + +stages: +- lib +- publish + +before_script: +- export GRADLE_USER_HOME=$(pwd)/.gradle +- chmod +x ./gradlew + +cache: + key: ${CI_PROJECT_ID} + paths: + - .gradle/ + +lib: + stage: lib + script: + - ./gradlew :lib:assembleRelease + artifacts: + paths: + - lib/build/outputs/aar/ + +publish: + stage: publish + script: + - ./gradlew :lib:publish -- GitLab From e2a78ca92d7f31c69f934254b0bc4dcefbaacfbc Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 16:53:52 +0100 Subject: [PATCH 4/6] rename 'app' dir in 'lib' --- {app => lib}/build.gradle | 0 {app => lib}/proguard-rules.pro | 0 {app => lib}/src/main/AndroidManifest.xml | 0 .../src/main/java/foundation/e/lib/telemetry/Constants.kt | 0 .../src/main/java/foundation/e/lib/telemetry/Telemetry.kt | 0 settings.gradle | 2 +- 6 files changed, 1 insertion(+), 1 deletion(-) rename {app => lib}/build.gradle (100%) rename {app => lib}/proguard-rules.pro (100%) rename {app => lib}/src/main/AndroidManifest.xml (100%) rename {app => lib}/src/main/java/foundation/e/lib/telemetry/Constants.kt (100%) rename {app => lib}/src/main/java/foundation/e/lib/telemetry/Telemetry.kt (100%) diff --git a/app/build.gradle b/lib/build.gradle similarity index 100% rename from app/build.gradle rename to lib/build.gradle diff --git a/app/proguard-rules.pro b/lib/proguard-rules.pro similarity index 100% rename from app/proguard-rules.pro rename to lib/proguard-rules.pro diff --git a/app/src/main/AndroidManifest.xml b/lib/src/main/AndroidManifest.xml similarity index 100% rename from app/src/main/AndroidManifest.xml rename to lib/src/main/AndroidManifest.xml diff --git a/app/src/main/java/foundation/e/lib/telemetry/Constants.kt b/lib/src/main/java/foundation/e/lib/telemetry/Constants.kt similarity index 100% rename from app/src/main/java/foundation/e/lib/telemetry/Constants.kt rename to lib/src/main/java/foundation/e/lib/telemetry/Constants.kt diff --git a/app/src/main/java/foundation/e/lib/telemetry/Telemetry.kt b/lib/src/main/java/foundation/e/lib/telemetry/Telemetry.kt similarity index 100% rename from app/src/main/java/foundation/e/lib/telemetry/Telemetry.kt rename to lib/src/main/java/foundation/e/lib/telemetry/Telemetry.kt diff --git a/settings.gradle b/settings.gradle index df3fbd7..85b319c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,4 +13,4 @@ dependencyResolutionManagement { } } rootProject.name = "e-telemetry" -include ':app' +include ':lib' -- GitLab From f782f8588aace86bcf0ae4c4ea9bcc57c45ff4ba Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 17:17:45 +0100 Subject: [PATCH 5/6] fix error due to extra '.' --- lib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build.gradle b/lib/build.gradle index 7cb1bc3..8a42240 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -49,7 +49,7 @@ android { publishing { publications { maven(MavenPublication) { - groupId = 'foundation.e.lib.' // or io.murena? + groupId = 'foundation.e.lib' // or io.murena? artifactId = 'telemetry' version android.defaultConfig.versionName artifact "$buildDir/outputs/aar/telemetry-${android.defaultConfig.versionName}.aar" -- GitLab From e0648d3f485d345a2eefaa6e3a5936efaef741e3 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 2 Jan 2023 17:35:12 +0100 Subject: [PATCH 6/6] bump to 0.0.2 and remove comment --- lib/build.gradle | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/build.gradle b/lib/build.gradle index 8a42240..9517970 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -7,7 +7,7 @@ plugins { def versionMajor = 0 def versionMinor = 0 -def versionPatch = 1 +def versionPatch = 2 def releasePatch = "alpha" @@ -16,7 +16,7 @@ android { compileSdk 32 defaultConfig { - minSdk 21 // is it correct value? just pasted from elib + minSdk 21 targetSdk 32 versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch versionName "${versionMajor}.${versionMinor}.${versionPatch}-${releasePatch}" @@ -70,7 +70,7 @@ publishing { repositories { maven { - url "https://gitlab.e.foundation/api/v4/projects/1391/packages/maven" // Not sure about this URL + url "https://gitlab.e.foundation/api/v4/projects/1391/packages/maven" name "GitLab" credentials(HttpHeaderCredentials) { name = 'Job-Token' @@ -81,15 +81,10 @@ publishing { } } } - - } } } - - - dependencies { api 'io.sentry:sentry-android:6.10.0' } \ No newline at end of file -- GitLab