1
+ import com.android.build.gradle.AppExtension
1
2
import com.android.build.gradle.BaseExtension
2
- import java.io.FileNotFoundException
3
3
import java.util.*
4
4
5
5
plugins {
6
6
val agp = " 7.1.2"
7
7
val zygote = " 2.6"
8
- val refine = " 3.1.0 "
8
+ val refine = " 3.1.1 "
9
9
10
10
id(" com.android.application" ) version agp apply false
11
11
id(" com.android.library" ) version agp apply false
@@ -14,67 +14,58 @@ plugins {
14
14
}
15
15
16
16
subprojects {
17
- val configureBaseExtension: BaseExtension .(isApp: Boolean ) -> Unit = { isApp: Boolean ->
18
- compileSdkVersion(31 )
17
+ plugins.withId(" com.android.base" ) {
18
+ extensions.configure<BaseExtension > {
19
+ val isApp = this is AppExtension
19
20
20
- defaultConfig {
21
- if (isApp) {
22
- applicationId = " com.github.kr328.clipboard"
23
- }
21
+ println (" Configure $name : isApp = $isApp " )
24
22
25
- minSdk = 29
26
- targetSdk = 31
23
+ compileSdkVersion(31 )
27
24
28
- versionName = " v23"
29
- versionCode = 23
25
+ defaultConfig {
26
+ if (isApp) {
27
+ applicationId = " com.github.kr328.clipboard"
28
+ }
30
29
31
- if (! isApp) {
32
- consumerProguardFiles(" consumer-rules.pro" )
33
- }
34
- }
30
+ minSdk = 29
31
+ targetSdk = 31
35
32
36
- signingConfigs {
37
- val file = rootProject.file(" signing.properties" )
38
- if (! file.exists()) {
39
- throw GradleScriptException (
40
- " signing.properties required" ,
41
- FileNotFoundException (" signing.properties not found" )
42
- )
43
- }
33
+ versionName = " v23"
34
+ versionCode = 23
44
35
45
- create(" release" ) {
46
- val prop = Properties ().apply {
47
- file.reader().use(this ::load)
36
+ if (! isApp) {
37
+ consumerProguardFiles(" consumer-rules.pro" )
48
38
}
49
-
50
- storeFile = rootProject.file(prop.getProperty(" keystore.path" ))
51
- storePassword = prop.getProperty(" keystore.password" )
52
- keyAlias = prop.getProperty(" key.alias" )
53
- keyPassword = prop.getProperty(" key.password" )
54
39
}
55
- }
56
40
57
- buildTypes {
58
- named(" release" ) {
59
- isMinifyEnabled = isApp
60
- isShrinkResources = isApp
61
- signingConfig = signingConfigs.getByName(" release" )
62
- proguardFiles(
63
- getDefaultProguardFile(" proguard-android-optimize.txt" ),
64
- " proguard-rules.pro"
65
- )
41
+ if (isApp) {
42
+ signingConfigs {
43
+ create(" release" ) {
44
+ val prop = Properties ().apply {
45
+ rootProject.file(" signing.properties" ).reader().use(this ::load)
46
+ }
47
+
48
+ storeFile = rootProject.file(prop.getProperty(" keystore.path" ))
49
+ storePassword = prop.getProperty(" keystore.password" )
50
+ keyAlias = prop.getProperty(" key.alias" )
51
+ keyPassword = prop.getProperty(" key.password" )
52
+ }
53
+ }
66
54
}
67
- }
68
- }
69
55
70
- plugins.withId(" com.android.application" ) {
71
- extensions.configure<BaseExtension > {
72
- configureBaseExtension(true )
73
- }
74
- }
75
- plugins.withId(" com.android.library" ) {
76
- extensions.configure<BaseExtension > {
77
- configureBaseExtension(false )
56
+ buildTypes {
57
+ named(" release" ) {
58
+ isMinifyEnabled = isApp
59
+ isShrinkResources = isApp
60
+ proguardFiles(
61
+ getDefaultProguardFile(" proguard-android-optimize.txt" ),
62
+ " proguard-rules.pro"
63
+ )
64
+ if (isApp) {
65
+ signingConfig = signingConfigs.getByName(" release" )
66
+ }
67
+ }
68
+ }
78
69
}
79
70
}
80
71
}
0 commit comments