Browse Source

upgrade build.gradle in lib module to build.gradle.kts

dev-kts
andywu91 3 years ago
parent
commit
b1d30eccbe
  1. 9
      build.gradle.kts
  2. 7
      buildSrc/build.gradle.kts
  3. 6
      buildSrc/src/main/kotlin/Versions.kt
  4. 35
      lib/build.gradle.kts
  5. 2
      lib/proguard-rules.pro

9
build.gradle.kts

@ -2,7 +2,6 @@
buildscript { buildscript {
val kotlin_version = "1.5.20"
repositories { repositories {
google() google()
maven("https://mirrors.tencent.com/nexus/repository/maven-public/") maven("https://mirrors.tencent.com/nexus/repository/maven-public/")
@ -11,7 +10,7 @@ buildscript {
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:4.2.2") classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
@ -26,6 +25,6 @@ allprojects {
} }
} }
//task(clean(type: Delete) { tasks.register<Delete>("clean"){
// delete = rootProject.buildDir delete(rootProject.buildDir)
//}) }

7
buildSrc/build.gradle.kts

@ -0,0 +1,7 @@
plugins{
`kotlin-dsl`
}
repositories {
maven("https://mirrors.tencent.com/nexus/repository/maven-public/")
}

6
buildSrc/src/main/kotlin/Versions.kt

@ -0,0 +1,6 @@
/**
* created by Andy
* on 2023/9/21
*/
const val kotlinVersion = "1.5.20"
const val appCompatVersion = "1.1.0"

35
lib/build.gradle → lib/build.gradle.kts

@ -5,14 +5,14 @@ plugins{
} }
group = "com.wuliang.lib" group = "com.wuliang.lib"
version = "1.0.0" version = "1.0.1"
android { android {
compileSdkVersion = 28 compileSdkVersion(28)
defaultConfig { defaultConfig {
minSdkVersion = 14 minSdkVersion(14)
targetSdkVersion = 28 targetSdkVersion(28)
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"
@ -21,46 +21,41 @@ android {
} }
buildTypes { buildTypes {
release { val release by getting {
minifyEnabled = false isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
} }
} }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildToolsVersion = "28.0.3" buildToolsVersion = "28.0.3"
} }
def appcompat_version = "1.1.0"
def kotlin_version = "1.5.20"
dependencies { dependencies {
implementation (fileTree(dir: "libs", include: ["*.jar"])) // implementation (fileTree(dir to "libs", include to ["*.jar"]))
implementation( "androidx.appcompat:appcompat:$appcompat_version") implementation( "androidx.appcompat:appcompat:$appCompatVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
testImplementation( "junit:junit:4.12") testImplementation( "junit:junit:4.12")
implementation("org.zeroturnaround:zt-zip:1.13") implementation("org.zeroturnaround:zt-zip:1.13")
} }
// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate { afterEvaluate {
publishing { publishing {
publications { publications {
// Creates a Maven publication called "release". // Creates a Maven publication called "release".
release(MavenPublication) { create<MavenPublication>("release"){
// Applies the component for the release build variant. // Applies the component for the release build variant.
from(components.release) from(components["release"])
// You can then customize attributes of the publication as shown below. // You can then customize attributes of the publication as shown below.
artifactId = "xapkinstaller" artifactId = "xapkinstaller"
} }
} }
} }
}
}

2
lib/proguard-rules.pro

@ -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

Loading…
Cancel
Save