From 2176437239889851828d5d2915643aa505a0981a Mon Sep 17 00:00:00 2001 From: Maxime Callet <maxime.callet@savoirfairelinux.com> Date: Thu, 2 Dec 2021 17:22:30 -0500 Subject: [PATCH] build: convert gradle to Kotlin script Change-Id: I0ae31705d9cea205a3263895c654504c0845730d --- ring-android/app/build.gradle | 136 ------------------ ring-android/app/build.gradle.kts | 144 ++++++++++++++++++++ ring-android/build.gradle | 22 --- ring-android/build.gradle.kts | 24 ++++ ring-android/libjamiclient/build.gradle | 34 ----- ring-android/libjamiclient/build.gradle.kts | 36 +++++ ring-android/settings.gradle | 1 - ring-android/settings.gradle.kts | 1 + 8 files changed, 205 insertions(+), 193 deletions(-) delete mode 100644 ring-android/app/build.gradle create mode 100644 ring-android/app/build.gradle.kts delete mode 100644 ring-android/build.gradle create mode 100644 ring-android/build.gradle.kts delete mode 100644 ring-android/libjamiclient/build.gradle create mode 100644 ring-android/libjamiclient/build.gradle.kts delete mode 100644 ring-android/settings.gradle create mode 100644 ring-android/settings.gradle.kts diff --git a/ring-android/app/build.gradle b/ring-android/app/build.gradle deleted file mode 100644 index 91eff38fe..000000000 --- a/ring-android/app/build.gradle +++ /dev/null @@ -1,136 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' -apply plugin: 'dagger.hilt.android.plugin' - -def buildFirebase = project.hasProperty('buildFirebase') || getGradle().getStartParameter().getTaskRequests().toString().contains('Firebase') - -android { - compileSdkVersion 31 - buildToolsVersion '31.0.0' - ndkVersion '23.0.7599858' - defaultConfig { - minSdkVersion 21 - targetSdkVersion 31 - versionCode 322 - versionName "20211104-01" - } - sourceSets { - main { - jniLibs.srcDir 'src/main/libs' - } - } - - buildTypes { - debug { - debuggable true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - - packagingOptions{ - doNotStrip "*/armeabi/*.so" - doNotStrip "*/armeabi-v7a/*.so" - doNotStrip "*/arm64-v8a/*.so" - doNotStrip "*/x86/*.so" - doNotStrip "*/x86_64/*.so" - } - } - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - buildFeatures { - viewBinding true - dataBinding true - } - flavorDimensions "push" - productFlavors { - noPush { - dimension "push" - } - withFirebase { - dimension "push" - } - } - signingConfigs { - config { - keyAlias 'ring' - storeFile file('../keystore.bin') - } - } - lintOptions { - disable 'MissingTranslation' - } - splits { - abi { - enable true - reset() - def sp = archs.split(',') - include(sp) - universalApk true - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation fileTree(include: '*.jar', dir: 'libs') - implementation project(':libjamiclient') - - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.2' - implementation "androidx.legacy:legacy-support-core-utils:1.0.0" - implementation "androidx.cardview:cardview:1.0.0" - implementation "androidx.preference:preference-ktx:1.1.1" - implementation "androidx.recyclerview:recyclerview:1.2.1" - implementation "androidx.leanback:leanback:1.2.0-alpha02" - implementation "androidx.leanback:leanback-preference:1.2.0-alpha02" - implementation 'androidx.tvprovider:tvprovider:1.1.0-alpha01' - implementation "androidx.media:media:1.4.3" - implementation "androidx.percentlayout:percentlayout:1.0.0" - implementation 'com.google.android.material:material:1.5.0-beta01' - implementation 'com.google.android.flexbox:flexbox:3.0.0' - implementation 'org.osmdroid:osmdroid-android:6.1.11' - implementation 'androidx.sharetarget:sharetarget:1.2.0-rc01' - - // ORM - implementation 'com.j256.ormlite:ormlite-android:5.6' - - // Barcode scanning - implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false } - implementation 'com.google.zxing:core:3.3.3' - - // Dagger dependency injection - implementation("com.google.dagger:hilt-android:$hilt_version") - kapt("com.google.dagger:hilt-android-compiler:$hilt_version") - - // Glide - implementation 'com.github.bumptech.glide:glide:4.12.0' - kapt 'com.github.bumptech.glide:compiler:4.12.0' - - // RxAndroid - implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' - implementation 'io.reactivex.rxjava3:rxjava:3.1.2' - - implementation 'com.jsibbold:zoomage:1.3.1' - implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3' - - withFirebaseImplementation('com.google.firebase:firebase-messaging:23.0.0') { - exclude group: 'com.google.firebase', module: 'firebase-core' - exclude group: 'com.google.firebase', module: 'firebase-analytics' - exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' - } -} - -if (buildFirebase) { - println 'apply plugin ' + buildFirebase - apply plugin: 'com.google.gms.google-services' -} diff --git a/ring-android/app/build.gradle.kts b/ring-android/app/build.gradle.kts new file mode 100644 index 000000000..9980b3e88 --- /dev/null +++ b/ring-android/app/build.gradle.kts @@ -0,0 +1,144 @@ +val kotlin_version: String by rootProject.extra +val hilt_version: String by rootProject.extra +val dokka_version: String by rootProject.extra +val archs: CharSequence by project +val buildFirebase = project.hasProperty("buildFirebase") || gradle.startParameter.taskRequests.toString().contains("Firebase") + +plugins { + id("com.android.application") + kotlin("android") + kotlin("kapt") + id("dagger.hilt.android.plugin") +} + +android { + compileSdk = 31 + buildToolsVersion = "31.0.0" + ndkVersion = "23.0.7599858" + defaultConfig { + minSdk = 21 + targetSdk = 31 + versionCode = 322 + versionName = "20211104-01" + } + sourceSets { + getByName("main") { + jniLibs.srcDir( "src/main/libs") + } + } + + buildTypes { + getByName("debug") { + isDebuggable = true + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + + packagingOptions{ + doNotStrip("*/armeabi/*.so") + doNotStrip("*/armeabi-v7a/*.so") + doNotStrip("*/arm64-v8a/*.so") + doNotStrip("*/x86/*.so") + doNotStrip("*/x86_64/*.so") + } + } + getByName("release") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + buildFeatures { + viewBinding = true + dataBinding = true + } + flavorDimensions += "push" + productFlavors { + create("noPush") { + dimension = "push" + } + create("withFirebase") { + dimension = "push" + } + } + signingConfigs { + create("config") { + keyAlias = "ring" + storeFile = file("../keystore.bin") + } + } + lint { + disable("MissingTranslation") + } + splits { + abi { + isEnable = true + reset() + val sp = archs.split(",") + include("armeabi-v7a, arm64-v8a, x86_64") + isUniversalApk = true + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation (project(":libjamiclient")) + implementation ("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") + implementation ("androidx.core:core-ktx:1.7.0") + implementation ("androidx.appcompat:appcompat:1.4.0") + implementation ("androidx.constraintlayout:constraintlayout:2.1.2") + implementation ("androidx.legacy:legacy-support-core-utils:1.0.0") + implementation ("androidx.cardview:cardview:1.0.0") + implementation ("androidx.preference:preference-ktx:1.1.1") + implementation( "androidx.recyclerview:recyclerview:1.2.1") + implementation( "androidx.leanback:leanback:1.2.0-alpha02") + implementation ("androidx.leanback:leanback-preference:1.2.0-alpha02") + implementation ("androidx.tvprovider:tvprovider:1.1.0-alpha01") + implementation ("androidx.media:media:1.4.3") + implementation ("androidx.percentlayout:percentlayout:1.0.0") + implementation ("com.google.android.material:material:1.5.0-beta01") + implementation ("com.google.android.flexbox:flexbox:3.0.0") + implementation ("org.osmdroid:osmdroid-android:6.1.11") + implementation ("androidx.sharetarget:sharetarget:1.2.0-rc01") + + // ORM + implementation ("com.j256.ormlite:ormlite-android:5.6") + + // Barcode scanning + implementation("com.journeyapps:zxing-android-embedded:4.3.0") { isTransitive = false } + implementation ("com.google.zxing:core:3.3.3") + + // Dagger dependency injection + implementation("com.google.dagger:hilt-android:$hilt_version") + kapt("com.google.dagger:hilt-android-compiler:$hilt_version") + + // Glide + implementation ("com.github.bumptech.glide:glide:4.12.0") + kapt ("com.github.bumptech.glide:compiler:4.12.0") + + // RxAndroid + implementation ("io.reactivex.rxjava3:rxandroid:3.0.0") + implementation ("io.reactivex.rxjava3:rxjava:3.1.2") + + implementation ("com.jsibbold:zoomage:1.3.1") + implementation ("com.googlecode.ez-vcard:ez-vcard:0.11.3") + + "withFirebaseImplementation"("com.google.firebase:firebase-messaging:23.0.0") { + exclude(group= "com.google.firebase", module= "firebase-core") + exclude(group= "com.google.firebase", module= "firebase-analytics") + exclude(group= "com.google.firebase", module= "firebase-measurement-connector") + } +} + +kapt { + correctErrorTypes = true +} + +if (buildFirebase) { + println ("apply plugin $buildFirebase") + apply(plugin = "com.google.gms.google-services") +} diff --git a/ring-android/build.gradle b/ring-android/build.gradle deleted file mode 100644 index c53d2376e..000000000 --- a/ring-android/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -buildscript { - repositories { - google() - maven { url "https://maven.google.com" } - mavenCentral() - } - ext.kotlin_version = '1.5.31' - ext.hilt_version = '2.40' - dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' - classpath 'com.google.gms:google-services:4.3.10' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" - } -} -allprojects { - repositories { - google() - maven { url "https://maven.google.com" } - mavenCentral() - } -} diff --git a/ring-android/build.gradle.kts b/ring-android/build.gradle.kts new file mode 100644 index 000000000..a04d75aa2 --- /dev/null +++ b/ring-android/build.gradle.kts @@ -0,0 +1,24 @@ +buildscript { + repositories { + google() + maven { url = uri( "https://maven.google.com") } + mavenCentral() + } + + val kotlin_version by extra { "1.6.0" } + val hilt_version by extra { "2.40.3" } + + dependencies { + classpath ("com.android.tools.build:gradle:7.0.3") + classpath ("com.google.gms:google-services:4.3.10") + classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") + classpath ("com.google.dagger:hilt-android-gradle-plugin:$hilt_version") + } +} +allprojects { + repositories { + google() + maven { url = uri("https://maven.google.com") } + mavenCentral() + } +} diff --git a/ring-android/libjamiclient/build.gradle b/ring-android/libjamiclient/build.gradle deleted file mode 100644 index dd9ad09eb..000000000 --- a/ring-android/libjamiclient/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -apply plugin: 'kotlin' -apply plugin: 'java' -apply plugin: 'kotlin-kapt' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - // VCard parsing - implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.3' - - // QRCode encoding - implementation 'com.google.zxing:core:3.4.1' - - // dependency injection - implementation 'javax.inject:javax.inject:1' - - // ORM - implementation 'com.j256.ormlite:ormlite-core:5.6' - - // Required -- JUnit 4 framework - testImplementation 'junit:junit:4.13.2' - - // RxJava - implementation 'io.reactivex.rxjava3:rxjava:3.1.2' - - // gson - implementation 'com.google.code.gson:gson:2.8.9' - - api "com.google.dagger:dagger:$hilt_version" - kapt "com.google.dagger:dagger-compiler:$hilt_version" -} - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 \ No newline at end of file diff --git a/ring-android/libjamiclient/build.gradle.kts b/ring-android/libjamiclient/build.gradle.kts new file mode 100644 index 000000000..55c8a5a6b --- /dev/null +++ b/ring-android/libjamiclient/build.gradle.kts @@ -0,0 +1,36 @@ +val kotlin_version: String by rootProject.extra +val hilt_version: String by rootProject.extra +val dokka_version: String by rootProject.extra + + +plugins { + id("kotlin") + id("java") + kotlin("kapt") +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + // VCard parsing + implementation ("com.googlecode.ez-vcard:ez-vcard:0.11.3") + // QRCode encoding + implementation ("com.google.zxing:core:3.4.1") + // dependency injection + implementation( "javax.inject:javax.inject:1") + // ORM + implementation ("com.j256.ormlite:ormlite-core:5.6") + // Required -- JUnit 4 framework + testImplementation ("junit:junit:4.13.2") + // RxJava + implementation ("io.reactivex.rxjava3:rxjava:3.1.2") + // gson + implementation ("com.google.code.gson:gson:2.8.9") + api("com.google.dagger:dagger:$hilt_version") + kapt("com.google.dagger:dagger-compiler:$hilt_version") +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + diff --git a/ring-android/settings.gradle b/ring-android/settings.gradle deleted file mode 100644 index 424cb3c28..000000000 --- a/ring-android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app', ':libjamiclient' diff --git a/ring-android/settings.gradle.kts b/ring-android/settings.gradle.kts new file mode 100644 index 000000000..fcc7ac7c6 --- /dev/null +++ b/ring-android/settings.gradle.kts @@ -0,0 +1 @@ +include(":app",":libjamiclient") -- GitLab