@@ -31,11 +31,23 @@ subprojects {
3131
3232 apply (plugin = if (isApp) " com.android.application" else " com.android.library" )
3333
34+ fun queryConfigProperty (key : String ): Any? {
35+ val localProperties = Properties ()
36+ val localPropertiesFile = rootProject.file(" local.properties" )
37+ if (localPropertiesFile.exists()) {
38+ localProperties.load(localPropertiesFile.inputStream())
39+ } else {
40+ return null
41+ }
42+ return localProperties.getProperty(key)
43+ }
44+
3445 extensions.configure<BaseExtension > {
3546 buildFeatures.buildConfig = true
3647 defaultConfig {
3748 if (isApp) {
38- applicationId = " com.github.metacubex.clash"
49+ val customApplicationId = queryConfigProperty(" custom.application.id" ) as ? String?
50+ applicationId = customApplicationId.takeIf { it?.isNotBlank() == true } ? : " com.github.metacubex.clash"
3951 }
4052
4153 project.name.let { name ->
@@ -84,32 +96,39 @@ subprojects {
8496 productFlavors {
8597 flavorDimensions(" feature" )
8698
99+ val removeSuffix = (queryConfigProperty(" remove.suffix" ) as ? String )?.toBoolean() == true
100+
87101 create(" alpha" ) {
88102 isDefault = true
89103 dimension = flavorDimensionList[0 ]
90- versionNameSuffix = " .Alpha"
104+ if (! removeSuffix) {
105+ versionNameSuffix = " .Alpha"
106+ }
107+
91108
92109 buildConfigField(" boolean" , " PREMIUM" , " Boolean.parseBoolean(\" false\" )" )
93110
94111 resValue(" string" , " launch_name" , " @string/launch_name_alpha" )
95112 resValue(" string" , " application_name" , " @string/application_name_alpha" )
96113
97- if (isApp) {
114+ if (isApp && ! removeSuffix ) {
98115 applicationIdSuffix = " .alpha"
99116 }
100117 }
101118
102119 create(" meta" ) {
103120
104121 dimension = flavorDimensionList[0 ]
105- versionNameSuffix = " .Meta"
122+ if (! removeSuffix) {
123+ versionNameSuffix = " .Meta"
124+ }
106125
107126 buildConfigField(" boolean" , " PREMIUM" , " Boolean.parseBoolean(\" false\" )" )
108127
109128 resValue(" string" , " launch_name" , " @string/launch_name_meta" )
110129 resValue(" string" , " application_name" , " @string/application_name_meta" )
111130
112- if (isApp) {
131+ if (isApp && ! removeSuffix ) {
113132 applicationIdSuffix = " .meta"
114133 }
115134 }
0 commit comments