mirror of
https://codeberg.org/pstorch/F-Droid_Build_Status.git
synced 2025-10-05 15:42:41 +02:00
Migrate build files to kotlin dsl
This commit is contained in:
143
app/build.gradle
143
app/build.gradle
@@ -1,143 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'de.mannodermaus.android-junit5'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
def getVersionCode = { ->
|
||||
try {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'rev-list', 'HEAD', '--count'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return Integer.valueOf(stdout.toString().trim())
|
||||
} catch (ignored) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
defaultConfig {
|
||||
testInstrumentationRunnerArguments runnerBuilder: 'de.mannodermaus.junit5.AndroidJUnit5Builder'
|
||||
applicationId "de.storchp.fdroidbuildstatus"
|
||||
compileSdk 34
|
||||
minSdk 24
|
||||
targetSdk 34
|
||||
versionCode 54
|
||||
versionName "5.0.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
signingConfigs {
|
||||
nightly {
|
||||
if (System.getProperty("nightly_store_file") != null) {
|
||||
storeFile file(System.getProperty("nightly_store_file"))
|
||||
storePassword System.getProperty("nightly_store_password")
|
||||
keyAlias System.getProperty("nightly_key_alias")
|
||||
keyPassword System.getProperty("nightly_key_password")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-debug"
|
||||
}
|
||||
nightly {
|
||||
signingConfig signingConfigs.nightly
|
||||
applicationIdSuffix ".nightly"
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = 17
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
namespace 'de.storchp.fdroidbuildstatus'
|
||||
lint {
|
||||
disable 'MissingTranslation'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
applicationVariants.configureEach { variant ->
|
||||
variant.resValue "string", "applicationId", variant.applicationId
|
||||
|
||||
if (variant.buildType.name == 'nightly') {
|
||||
variant.outputs.configureEach {
|
||||
setVersionCodeOverride(getVersionCode())
|
||||
setVersionNameOverride(versionName + "-" + versionCode)
|
||||
outputFileName = "${applicationId}_${variant.versionCode}.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ext {
|
||||
retrofitVersion = '2.9.0'
|
||||
lifecycle_version = "2.6.2"
|
||||
junitVersion = '5.10.0'
|
||||
assertJVersion = '3.24.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.3"
|
||||
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
||||
implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
||||
|
||||
// Fix #145: https://github.com/FasterXML/jackson-databind/issues/3412
|
||||
// jackson 2.13 is the last supporting Android SDK 21+, 2.14 requires 26+
|
||||
// https://github.com/FasterXML/jackson/wiki/Jackson-Releases
|
||||
//noinspection GradleDependency
|
||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4'
|
||||
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4'
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.10.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
||||
testImplementation "org.assertj:assertj-core:$assertJVersion"
|
||||
testImplementation 'org.mockito:mockito-core:5.6.0'
|
||||
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
|
||||
testImplementation 'org.awaitility:awaitility:4.2.0'
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
androidTestImplementation 'androidx.test:runner:1.5.2'
|
||||
androidTestImplementation 'de.mannodermaus.junit5:android-test-core:1.3.0'
|
||||
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
androidTestImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
||||
androidTestImplementation "org.assertj:assertj-core:$assertJVersion"
|
||||
androidTestRuntimeOnly 'de.mannodermaus.junit5:android-test-runner:1.3.0'
|
||||
}
|
144
app/build.gradle.kts
Normal file
144
app/build.gradle.kts
Normal file
@@ -0,0 +1,144 @@
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("de.mannodermaus.android-junit5")
|
||||
}
|
||||
|
||||
fun getGitVersionCode(): Int {
|
||||
return try {
|
||||
val stdout = ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine("git", "rev-list", "HEAD", "--count")
|
||||
standardOutput = stdout
|
||||
}
|
||||
Integer.valueOf(stdout.toString().trim())
|
||||
} catch (ignored: Exception) {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
defaultConfig {
|
||||
testInstrumentationRunnerArguments +=
|
||||
mutableMapOf("runnerBuilder" to "de.mannodermaus.junit5.AndroidJUnit5Builder")
|
||||
applicationId = "de.storchp.fdroidbuildstatus"
|
||||
compileSdk = 34
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 54
|
||||
versionName = "5.0.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
signingConfigs {
|
||||
register("nightly") {
|
||||
if (System.getProperty("nightly_store_file") != null) {
|
||||
storeFile = file(System.getProperty("nightly_store_file"))
|
||||
storePassword = System.getProperty("nightly_store_password")
|
||||
keyAlias = System.getProperty("nightly_key_alias")
|
||||
keyPassword = System.getProperty("nightly_key_password")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
applicationIdSuffix = ".debug"
|
||||
versionNameSuffix = "-debug"
|
||||
}
|
||||
register("nightly") {
|
||||
signingConfig = signingConfigs.getByName("nightly")
|
||||
applicationIdSuffix = ".nightly"
|
||||
}
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
lint {
|
||||
disable.add("MissingTranslation")
|
||||
}
|
||||
|
||||
namespace = "de.storchp.fdroidbuildstatus"
|
||||
|
||||
applicationVariants.all {
|
||||
resValue("string", "applicationId", applicationId)
|
||||
|
||||
if (name == "nightly") {
|
||||
outputs.forEach { output ->
|
||||
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
output.versionCodeOverride = getGitVersionCode()
|
||||
output.versionNameOverride = "${applicationId}_${output.versionCode}"
|
||||
output.outputFileName = "${applicationId}_${versionCode}.apk"
|
||||
}
|
||||
}
|
||||
outputs.forEach { output ->
|
||||
output as com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||
output.outputFileName = "${applicationId}_${output.versionCode}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
|
||||
|
||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
|
||||
implementation("com.squareup.retrofit2:converter-jackson:2.9.0")
|
||||
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
||||
|
||||
// Fix #145: https://github.com/FasterXML/jackson-databind/issues/3412
|
||||
// jackson 2.13 is the last supporting Android SDK 21+, 2.14 requires 26+
|
||||
// https://github.com/FasterXML/jackson/wiki/Jackson-Releases
|
||||
//noinspection GradleDependency
|
||||
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4")
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4")
|
||||
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
|
||||
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.1.0")
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("com.google.android.material:material:1.10.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
|
||||
testImplementation("org.assertj:assertj-core:3.24.2")
|
||||
testImplementation("org.mockito:mockito-core:5.6.0")
|
||||
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
|
||||
testImplementation("org.awaitility:awaitility:4.2.0")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
|
||||
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation("androidx.test:runner:1.5.2")
|
||||
androidTestImplementation("de.mannodermaus.junit5:android-test-core:1.3.0")
|
||||
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||
androidTestImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
|
||||
androidTestImplementation("org.assertj:assertj-core:3.24.2")
|
||||
androidTestRuntimeOnly("de.mannodermaus.junit5:android-test-runner:1.3.0")
|
||||
}
|
@@ -35,10 +35,6 @@ class AppInfoFragment : DialogFragment() {
|
||||
return builder.create()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun getLastUpdate(buildRuns: Map<BuildCycle, BuildRun>, runType: BuildCycle): String {
|
||||
return buildRuns[runType]?.let {
|
||||
it.lastUpdated.time.let { it1 -> FormatUtils.formatShortDateTime(it1) }
|
||||
|
@@ -21,10 +21,7 @@ data class AppBuild @JvmOverloads constructor(
|
||||
val buildCycleCompare = buildCycle.compareTo(other.buildCycle)
|
||||
return if (buildCycleCompare != 0) {
|
||||
buildCycleCompare
|
||||
} else -Integer.compare(
|
||||
versionCode.toInt(),
|
||||
other.versionCode.toInt()
|
||||
)
|
||||
} else -versionCode.toInt().compareTo(other.versionCode.toInt())
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
@@ -1,7 +0,0 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.1.2' apply false
|
||||
id 'com.android.library' version '8.1.2' apply false
|
||||
id 'de.mannodermaus.android-junit5' version '1.8.2.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
|
||||
}
|
7
build.gradle.kts
Normal file
7
build.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.2" apply false
|
||||
id("com.android.library") version "8.1.2" apply false
|
||||
id("de.mannodermaus.android-junit5") version "1.8.2.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
|
||||
}
|
@@ -6,14 +6,19 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
dependencyResolutionManagement {
|
||||
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven {
|
||||
setUrl("https://jitpack.io")
|
||||
}
|
||||
}
|
||||
}
|
||||
include ':app'
|
||||
|
||||
include(":app")
|
||||
rootProject.name = "F-Droid Build Status"
|
Reference in New Issue
Block a user