Merge pull request #541 from oxen-io/gradle

Clean Gradle Files
This commit is contained in:
Niels Andriesse 2021-05-18 13:47:32 +10:00 committed by GitHub
commit f0b2ff5b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 277 deletions

View File

@ -1,17 +1,14 @@
buildscript {
ext.kovenant_version = "3.3.0"
repositories {
mavenLocal()
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath files('libs/gradle-witness.jar')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
classpath "com.google.gms:google-services:4.3.3"
}
}
@ -26,10 +23,6 @@ apply plugin: 'kotlinx-serialization'
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
exclude group: "org.whispersystems", module: "signal-protocol-java"
exclude group: "org.whispersystems", module: "signal-protocol-android"
exclude group: "org.signal", module: "signal-metadata-java"
exclude group: "org.signal", module: "signal-metadata-android"
exclude module: "commons-logging"
}
@ -54,7 +47,6 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.3.2'
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.work:work-runtime-ktx:2.4.0"
implementation ("com.google.firebase:firebase-messaging:18.0.0") {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
@ -112,11 +104,8 @@ dependencies {
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'org.freemarker'
}
// Loki
// Local:
implementation project(":libsignal")
implementation project(":libsession")
// Remote:
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1"
implementation "org.whispersystems:curve25519-java:$curve25519Version"
implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar"
@ -124,7 +113,7 @@ dependencies {
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion"
@ -134,7 +123,6 @@ dependencies {
implementation "com.github.tbruyelle:rxpermissions:0.10.2"
implementation "com.github.ybq:Android-SpinKit:1.4.0"
implementation "com.opencsv:opencsv:4.6"
testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.11.1'
testImplementation 'org.mockito:mockito-core:1.10.8'
@ -209,25 +197,18 @@ android {
versionCode canonicalVersionCode * postFixSize
versionName canonicalVersionName
minSdkVersion androidMinSdkVersion
targetSdkVersion androidCompileSdkVersion
minSdkVersion 21
targetSdkVersion 30
multiDexEnabled = true // Even though we're running API 21+, this is still needed for release builds
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
project.ext.set("archivesBaseName", "session")
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
buildConfigField "String", "SIGNAL_URL", "\"\""
buildConfigField "String", "SIGNAL_CDN_URL", "\"\""
buildConfigField "String", "SIGNAL_CONTACT_DISCOVERY_URL", "\"\""
buildConfigField "String", "SIGNAL_SERVICE_STATUS_URL", "\"\""
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
buildConfigField "String", "USER_AGENT", "\"OWA\""
buildConfigField "boolean", "DEV_BUILD", "false"
buildConfigField "String", "MRENCLAVE", "\"cd6cfc342937b23b1bdd3bbf9721aa5615ac9ff50a75c5527d441cd3276826c9\""
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF\""
buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}'
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"
@ -237,39 +218,9 @@ android {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard/proguard-dagger.pro',
'proguard/proguard-jackson.pro',
'proguard/proguard-jna.pro',
'proguard/proguard-sqlite.pro',
'proguard/proguard-appcompat-v7.pro',
'proguard/proguard-square-okhttp.pro',
'proguard/proguard-square-okio.pro',
'proguard/proguard-spongycastle.pro',
'proguard/proguard-rounded-image-view.pro',
'proguard/proguard-glide.pro',
'proguard/proguard-shortcutbadger.pro',
'proguard/proguard-retrofit.pro',
'proguard/proguard-webrtc.pro',
'proguard/proguard-klinker.pro',
'proguard/proguard-retrolambda.pro',
'proguard/proguard-okhttp.pro',
'proguard/proguard-ez-vcard.pro',
'proguard/proguard.pro'
testProguardFiles 'proguard/proguard-automation.pro'
// Uncomment for testing this build type without signing.
// signingConfig signingConfigs.debug
}
debug {
minifyEnabled false
proguardFiles = buildTypes.release.proguardFiles + [
'proguard/proguard-debug.pro'
]
testProguardFiles = buildTypes.release.testProguardFiles
}
}
@ -282,7 +233,7 @@ android {
}
website {
ext.websiteUpdateUrl = "https://updates.signal.org/android"
ext.websiteUpdateUrl = "https://github.com/oxen-io/session-android/releases"
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
}
@ -316,14 +267,8 @@ android {
}
}
def getLastCommitTimestamp() {
static def getLastCommitTimestamp() {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'git'
args = ['log', '-1', '--pretty=format:%ct']
standardOutput = os
}
return os.toString() + "000"
}
}
@ -340,9 +285,3 @@ def autoResConfig() {
.collect { matcher -> matcher.group(1) }
.sort()
}
task qa {
group 'Verification'
description 'Quality Assurance. Run before pushing.'
dependsOn ':testPlayReleaseUnitTest', ':lintPlayRelease', ':assemblePlayDebug'
}

View File

@ -3,7 +3,6 @@ buildscript {
mavenLocal()
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
@ -15,7 +14,6 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven {
url "https://raw.github.com/signalapp/maven/master/photoview/releases/"
content {
@ -40,7 +38,7 @@ allprojects {
includeGroupByRegex "org\\.signal.*"
}
}
maven { // textdrawable
maven {
url 'https://dl.bintray.com/amulyakhare/maven'
content {
includeGroupByRegex "com\\.amulyakhare.*"
@ -53,14 +51,5 @@ allprojects {
}
}
google()
jcenter()
maven { url "https://jitpack.io" }
}
project.ext {
kotlin_version = "1.4.31"
androidBuildToolsVersion = '29.0.3'
androidCompileSdkVersion = 29 // This is also our target SDK.
androidMinSdkVersion = 21
}
}

View File

@ -3,42 +3,10 @@ plugins {
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
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'
}
}
dependencies {
// Local:
implementation project(":libsignal")
// Remote:
implementation 'org.greenrobot:eventbus:3.0.0'
implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
@ -47,30 +15,18 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.annimon:stream:1.1.8'
implementation 'com.makeramen:roundedimageview:2.1.0'
implementation 'com.esotericsoftware:kryo:4.0.1'
// from libsignal:
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.googlecode.libphonenumber:libphonenumber:8.10.7"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "org.whispersystems:curve25519-java:$curve25519Version"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "org.threeten:threetenbp:1.3.6"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
testImplementation "junit:junit:3.8.2"
testImplementation "org.assertj:assertj-core:1.7.1"
testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0"
implementation 'org.greenrobot:eventbus:3.0.0'
}

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,16 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'kotlin-android'
archivesBaseName = "signal-service-android"
version = "1.0.0"
group = "org.session"
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
@ -18,31 +10,6 @@ configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
android {
compileSdkVersion 30
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion androidMinSdkVersion
targetSdkVersion androidCompileSdkVersion
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${archivesBaseName}-${version}.aar"
output.outputFileName = fileName
}
}
}
}
dependencies {
implementation "androidx.annotation:annotation:1.2.0"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
@ -57,78 +24,3 @@ dependencies {
testImplementation "org.assertj:assertj-core:1.7.1"
testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0"
}
tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) {
task.enabled = false
}
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return ""
}
def getRepositoryUsername() {
return ""
}
def getRepositoryPassword() {
return ""
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
pom.project {
name 'signal-service-android'
packaging 'aar'
description 'Signal service communication library for Android'
url 'https://github.com/loki-project/session-android-service'
scm {
url 'scm:git@github.com:loki-project/session-android-service.git'
connection 'scm:git@github.com:loki-project/session-android-service.git'
developerConnection 'scm:git@github.com:loki-project/session-android-service.git'
}
licenses {
license {
name 'GPLv3'
url 'https://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
name 'Niels Andriesse'
}
}
}
}
}
task installArchives(type: Upload) {
description "Installs the artifacts to the local Maven repository."
configuration = configurations['archives']
repositories {
mavenDeployer {
repository url: "file://${System.properties['user.home']}/.m2/repository"
}
}
}

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile