Merge pull request #388 from cyb3rko/gradle-kotlin-dsl
Use Kotlin DSL for build.gradle files
This commit is contained in:
102
app/build.gradle
102
app/build.gradle
@@ -1,102 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.android.application'
|
|
||||||
id 'kotlin-android'
|
|
||||||
id 'org.jmailen.kotlinter' version "4.3.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace "com.github.gotify"
|
|
||||||
compileSdk 34
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "com.github.gotify"
|
|
||||||
minSdk 23
|
|
||||||
targetSdk 34
|
|
||||||
versionCode 32
|
|
||||||
versionName "2.8.1"
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
|
||||||
signingConfig signingConfigs.debug
|
|
||||||
resValue "string", "app_name", "Gotify"
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
development {
|
|
||||||
applicationIdSuffix ".dev"
|
|
||||||
debuggable true
|
|
||||||
resValue "string", "app_name", "Gotify DEV"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildFeatures {
|
|
||||||
viewBinding true
|
|
||||||
buildConfig true
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = '17'
|
|
||||||
}
|
|
||||||
packagingOptions {
|
|
||||||
resources {
|
|
||||||
excludes += ['META-INF/DEPENDENCIES']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lint {
|
|
||||||
disable 'GoogleAppIndexingWarning'
|
|
||||||
lintConfig file('../lint.xml')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (project.hasProperty('sign')) {
|
|
||||||
android {
|
|
||||||
signingConfigs {
|
|
||||||
release {
|
|
||||||
storeFile file(System.getenv("RELEASE_STORE_FILE"))
|
|
||||||
storePassword System.getenv("RELEASE_STORE_PASSWORD")
|
|
||||||
keyAlias System.getenv("RELEASE_KEY_ALIAS")
|
|
||||||
keyPassword System.getenv("RELEASE_KEY_PASSWORD")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
android.buildTypes.release.signingConfig android.signingConfigs.release
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
def coil_version = "2.6.0"
|
|
||||||
def markwon_version = "4.6.2"
|
|
||||||
def tinylog_version = "2.7.0"
|
|
||||||
implementation project(':client')
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
||||||
implementation 'androidx.core:core-splashscreen:1.0.1'
|
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
|
||||||
implementation 'androidx.vectordrawable:vectordrawable:1.2.0'
|
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
|
||||||
|
|
||||||
implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.1.3'
|
|
||||||
implementation "io.coil-kt:coil:$coil_version"
|
|
||||||
implementation "io.coil-kt:coil-svg:$coil_version"
|
|
||||||
implementation "io.noties.markwon:core:$markwon_version"
|
|
||||||
implementation "io.noties.markwon:image-coil:$markwon_version"
|
|
||||||
implementation "io.noties.markwon:image:$markwon_version"
|
|
||||||
implementation "io.noties.markwon:ext-tables:$markwon_version"
|
|
||||||
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
|
|
||||||
|
|
||||||
implementation "org.tinylog:tinylog-api-kotlin:$tinylog_version"
|
|
||||||
implementation "org.tinylog:tinylog-impl:$tinylog_version"
|
|
||||||
|
|
||||||
implementation 'com.google.code.gson:gson:2.11.0'
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.11.0'
|
|
||||||
implementation 'org.threeten:threetenbp:1.7.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
configureEach {
|
|
||||||
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
111
app/build.gradle.kts
Normal file
111
app/build.gradle.kts
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.android.application")
|
||||||
|
id("kotlin-android")
|
||||||
|
id("org.jmailen.kotlinter") version "4.3.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "com.github.gotify"
|
||||||
|
compileSdk = 34
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.github.gotify"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 34
|
||||||
|
versionCode = 32
|
||||||
|
versionName = "2.8.1"
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
|
resValue("string", "app_name", "Gotify")
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
register("development") {
|
||||||
|
applicationIdSuffix = ".dev"
|
||||||
|
isDebuggable = true
|
||||||
|
resValue("string", "app_name", "Gotify DEV")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_17)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packaging {
|
||||||
|
resources {
|
||||||
|
excludes.add("META-INF/DEPENDENCIES")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lint {
|
||||||
|
disable.add("GoogleAppIndexingWarning")
|
||||||
|
lintConfig = file("../lint.xml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty("sign")) {
|
||||||
|
android {
|
||||||
|
signingConfigs {
|
||||||
|
create("release") {
|
||||||
|
storeFile = file(System.getenv("RELEASE_STORE_FILE"))
|
||||||
|
storePassword = System.getenv("RELEASE_STORE_PASSWORD")
|
||||||
|
keyAlias = System.getenv("RELEASE_KEY_ALIAS")
|
||||||
|
keyPassword = System.getenv("RELEASE_KEY_PASSWORD")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
android.buildTypes.getByName("release").signingConfig = android.signingConfigs.getByName("release")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
val coilVersion = "2.6.0"
|
||||||
|
val markwonVersion = "4.6.2"
|
||||||
|
val tinylogVersion = "2.7.0"
|
||||||
|
implementation(project(":client"))
|
||||||
|
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||||
|
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||||
|
implementation("com.google.android.material:material:1.12.0")
|
||||||
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||||
|
implementation("androidx.vectordrawable:vectordrawable:1.2.0")
|
||||||
|
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||||
|
|
||||||
|
implementation("com.github.cyb3rko:QuickPermissions-Kotlin:1.1.3")
|
||||||
|
implementation("io.coil-kt:coil:$coilVersion")
|
||||||
|
implementation("io.coil-kt:coil-svg:$coilVersion")
|
||||||
|
implementation("io.noties.markwon:core:$markwonVersion")
|
||||||
|
implementation("io.noties.markwon:image-coil:$markwonVersion")
|
||||||
|
implementation("io.noties.markwon:image:$markwonVersion")
|
||||||
|
implementation("io.noties.markwon:ext-tables:$markwonVersion")
|
||||||
|
implementation("io.noties.markwon:ext-strikethrough:$markwonVersion")
|
||||||
|
|
||||||
|
implementation("org.tinylog:tinylog-api-kotlin:$tinylogVersion")
|
||||||
|
implementation("org.tinylog:tinylog-impl:$tinylogVersion")
|
||||||
|
|
||||||
|
implementation("com.google.code.gson:gson:2.11.0")
|
||||||
|
implementation("com.squareup.retrofit2:retrofit:2.11.0")
|
||||||
|
implementation("org.threeten:threetenbp:1.7.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
configureEach {
|
||||||
|
exclude(group = "androidx.lifecycle", module = "lifecycle-viewmodel-ktx")
|
||||||
|
}
|
||||||
|
}
|
||||||
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@@ -1,6 +1,6 @@
|
|||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# You can control the set of applied configuration files using the
|
||||||
# proguardFiles setting in build.gradle.
|
# proguardFiles setting in build.gradle.kts.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|||||||
48
build.gradle
48
build.gradle
@@ -1,48 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id 'com.android.application' version '8.5.0' apply false
|
|
||||||
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
|
|
||||||
id 'org.hidetake.swagger.generator' version '2.19.2'
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register('clean', Delete) {
|
|
||||||
delete rootProject.layout.buildDirectory
|
|
||||||
}
|
|
||||||
|
|
||||||
static def download(String url, String filename ) {
|
|
||||||
new URI(url).toURL().openConnection().with { conn ->
|
|
||||||
new File(filename).withOutputStream { out ->
|
|
||||||
conn.inputStream.with { inp ->
|
|
||||||
out << inp
|
|
||||||
inp.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register('downloadSpec') {
|
|
||||||
def gotifyVersion = 'master'
|
|
||||||
def url = "https://raw.githubusercontent.com/gotify/server/$gotifyVersion/docs/spec.json"
|
|
||||||
def buildDir = project.layout.buildDirectory.get()
|
|
||||||
def specLocation = buildDir.file('gotify.spec.json').asFile.absolutePath
|
|
||||||
doFirst {
|
|
||||||
buildDir.asFile.mkdirs()
|
|
||||||
download(url, specLocation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
swaggerSources {
|
|
||||||
gotify {
|
|
||||||
inputFile = "$projectDir/build/gotify.spec.json" as File
|
|
||||||
code {
|
|
||||||
configFile = "$projectDir/swagger.config.json" as File
|
|
||||||
language = 'java'
|
|
||||||
outputDir = "$projectDir/client" as File
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.63'
|
|
||||||
}
|
|
||||||
|
|
||||||
generateSwaggerCode.dependsOn downloadSpec
|
|
||||||
47
build.gradle.kts
Normal file
47
build.gradle.kts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import com.android.build.gradle.internal.tasks.factory.dependsOn
|
||||||
|
import java.io.File
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("com.android.application") version "8.5.0" apply false
|
||||||
|
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
|
||||||
|
id("org.hidetake.swagger.generator") version "2.19.2"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun download(url: String, filename: String) {
|
||||||
|
URI(url).toURL().openConnection().let { conn ->
|
||||||
|
File(filename).outputStream().use { out ->
|
||||||
|
conn.inputStream.use { inp ->
|
||||||
|
inp.copyTo(out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("downloadSpec") {
|
||||||
|
val gotifyVersion = "master"
|
||||||
|
val url = "https://raw.githubusercontent.com/gotify/server/$gotifyVersion/docs/spec.json"
|
||||||
|
val buildDir = project.layout.buildDirectory.get()
|
||||||
|
val specLocation = buildDir.file("gotify.spec.json").asFile.absolutePath
|
||||||
|
doFirst {
|
||||||
|
buildDir.asFile.mkdirs()
|
||||||
|
download(url, specLocation)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swaggerSources {
|
||||||
|
create("swagger") {
|
||||||
|
setInputFile(file("$projectDir/build/gotify.spec.json"))
|
||||||
|
code.apply {
|
||||||
|
language = "java"
|
||||||
|
configFile = file("$projectDir/swagger.config.json")
|
||||||
|
outputDir = file("$projectDir/client")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"swaggerCodegen"("io.swagger.codegen.v3:swagger-codegen-cli:3.0.63")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("generateSwaggerCode").dependsOn("downloadSpec")
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@@ -9,9 +11,9 @@ dependencyResolutionManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven { url "https://jitpack.io/" }
|
maven { url = uri("https://jitpack.io/") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootProject.name = "Gotify Android"
|
rootProject.name = "Gotify Android"
|
||||||
include ':app'
|
include(":app")
|
||||||
include ':client'
|
include(":client")
|
||||||
Reference in New Issue
Block a user