diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..f88da22725da85f2ae58b6ec4dcbbb8f4bc3eea9 --- /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 diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index f0b483374efa6c555f3bd6a2a690f3caa5d08f55..0000000000000000000000000000000000000000 --- a/app/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -android { - namespace 'foundation.e.lib.telemetry' - compileSdk 32 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } -} - -dependencies { - implementation 'io.sentry:sentry-android:6.10.0' -} \ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..951797089d981c6137b8f1716c6dcdcd23c49348 --- /dev/null +++ b/lib/build.gradle @@ -0,0 +1,90 @@ +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'maven-publish' +} + + +def versionMajor = 0 +def versionMinor = 0 +def versionPatch = 2 +def releasePatch = "alpha" + + +android { + namespace 'foundation.e.lib.telemetry' + compileSdk 32 + + defaultConfig { + minSdk 21 + 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 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + + + +publishing { + publications { + maven(MavenPublication) { + groupId = 'foundation.e.lib' // or io.murena? + artifactId = 'telemetry' + 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" + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = System.getenv("CI_JOB_TOKEN") + } + authentication { + header(HttpHeaderAuthentication) + } + } + } + } + } +} + +dependencies { + api 'io.sentry:sentry-android:6.10.0' +} \ No newline at end of file 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 df3fbd7b56ad9a516edb3f777bb450e62546f9d2..85b319cd69dc5785edd80a6558c72b29d4b6babd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,4 +13,4 @@ dependencyResolutionManagement { } } rootProject.name = "e-telemetry" -include ':app' +include ':lib'