Skip to content

Commit 4dacb8d

Browse files
author
huangx
committed
转换成kts
1 parent cf90181 commit 4dacb8d

6 files changed

Lines changed: 98 additions & 83 deletions

File tree

app/build.gradle

Lines changed: 0 additions & 63 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
plugins {
2+
id("com.android.application")
3+
id("kotlin-android")
4+
id("android-junk-code")
5+
id("kotlin-kapt")
6+
id("com.getkeepsafe.dexcount")
7+
}
8+
9+
android {
10+
compileSdkVersion(31)
11+
12+
defaultConfig {
13+
applicationId = "cn.hx.plugin.junkcode.demo"
14+
minSdkVersion(16)
15+
targetSdkVersion(31)
16+
versionCode(1)
17+
versionName("1.0")
18+
multiDexEnabled = true
19+
testInstrumentationRunner("androidx.test.runner.AndroidJUnitRunner")
20+
}
21+
buildFeatures {
22+
dataBinding = true
23+
viewBinding = true
24+
}
25+
buildTypes {
26+
val release by getting {
27+
isMinifyEnabled = true
28+
proguardFiles(
29+
getDefaultProguardFile("proguard-android-optimize.txt"),
30+
"proguard-rules.pro"
31+
)
32+
}
33+
}
34+
lintOptions {
35+
isCheckReleaseBuilds = false
36+
isAbortOnError = false
37+
}
38+
}
39+
40+
androidJunkCode {
41+
variantConfig {
42+
create("debug") {
43+
packageBase = "cn.hx.plugin.ui"
44+
packageCount = 30
45+
activityCountPerPackage = 3
46+
excludeActivityJavaFile = false
47+
otherCountPerPackage = 50
48+
methodCountPerClass = 20
49+
resPrefix = "junk_"
50+
drawableCount = 300
51+
stringCount = 300
52+
}
53+
create("release") {
54+
packageBase = "cn.hx.plugin.ui"
55+
packageCount = 30
56+
activityCountPerPackage = 3
57+
excludeActivityJavaFile = false
58+
otherCountPerPackage = 50
59+
methodCountPerClass = 20
60+
resPrefix = "junk_"
61+
drawableCount = 300
62+
stringCount = 300
63+
}
64+
}
65+
}
66+
67+
dependencies {
68+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
69+
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.31")
70+
implementation("androidx.multidex:multidex:2.0.1")
71+
implementation("androidx.core:core-ktx:1.7.0")
72+
implementation("androidx.appcompat:appcompat:1.4.1")
73+
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
74+
testImplementation("junit:junit:4.13.2")
75+
androidTestImplementation("androidx.test.ext:junit:1.1.3")
76+
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
77+
}
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = "1.5.31"
43
repositories {
54
google()
65
mavenCentral()
76
mavenLocal()
87
}
98
dependencies {
10-
classpath 'com.android.tools.build:gradle:4.2.1'
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12-
classpath "com.github.qq549631030:android-junk-code:1.1.2"
13-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
14-
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1"
9+
classpath("com.android.tools.build:gradle:4.2.1")
10+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
11+
classpath("com.github.qq549631030:android-junk-code:1.1.3")
12+
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
13+
classpath("com.getkeepsafe.dexcount:dexcount-gradle-plugin:3.0.1")
1514

1615
// NOTE: Do not place your application dependencies here; they belong
1716
// in the individual module build.gradle files
@@ -25,6 +24,6 @@ allprojects {
2524
}
2625
}
2726

28-
task clean(type: Delete) {
29-
delete rootProject.buildDir
27+
tasks.register<Delete> ("clean") {
28+
delete(rootProject.buildDir)
3029
}

library/build.gradle

Lines changed: 0 additions & 10 deletions
This file was deleted.

library/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plugins {
2+
id("groovy")
3+
id("com.vanniktech.maven.publish")
4+
}
5+
6+
dependencies {
7+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
8+
implementation(gradleApi())
9+
implementation(localGroovy())
10+
implementation("com.squareup:javapoet:1.13.0")
11+
implementation("com.android.tools.build:gradle:3.0.0")
12+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
include ':library'
2-
include ':app'
1+
include(":library")
2+
include(":app")
33
rootProject.name = "AndroidJunkCode"

0 commit comments

Comments
 (0)