11apply plugin : ' com.android.library'
22apply plugin : ' kotlin-android'
33
4- def versionMajor = 0
5- def versionMinor = 0
6- def versionPatch = 0
7- def debugApiEndpoint = " "
8-
9- def buildPropsFile = file(' build.properties' )
10- def buildProps = new Properties ()
11-
12- def quote = { ' "' + it + ' "' }
13-
144android {
15- testBuildType " debugTest"
16-
17- if (buildPropsFile. canRead()) {
18- buildProps. load(new FileInputStream (buildPropsFile))
19- versionMajor = buildProps[' VERSION_MAJOR' ]. toInteger()
20- versionMinor = buildProps[' VERSION_MINOR' ]. toInteger()
21- versionPatch = buildProps[' VERSION_PATCH' ]. toInteger()
22- debugApiEndpoint = buildProps[' DEBUG_API_ENDPOINT' ]. toString()
23- } else {
24- throw new GradleException (" Could not read build.properties" )
25- }
26-
275 compileSdkVersion versions. compileSdk
286 defaultConfig {
297 minSdkVersion versions. minSdk
308 targetSdkVersion versions. targetSdk
31- versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
32- versionName " ${ versionMajor} .${ versionMinor} .${ versionPatch} "
33- version = versionName
34- group = " jp.studyplus.android.sdk"
359
3610 consumerProguardFiles ' lib-proguard-rules.txt'
3711
@@ -40,24 +14,10 @@ android {
4014
4115 buildTypes {
4216 debug {
43- buildConfigField " String" , " API_ENDPOINT" , quote(debugApiEndpoint)
44- }
45- debugTest {
46- initWith(buildTypes. debug)
17+ buildConfigField(" String" , " API_ENDPOINT" , " " )
4718 }
4819 release {
49- buildConfigField " String" , " API_ENDPOINT" , quote(" https://external-api.studyplus.jp" )
50- }
51- }
52-
53- libraryVariants. all { variant ->
54- variant. outputs. all { output ->
55- output. packageLibrary. exclude(" libs/*" )
56- if (variant. name == android. buildTypes. release. name) {
57- outputFileName = output. outputFile. name. replace((" -release.aar" ), " -${ version} .aar" )
58- } else if (variant. name == android. buildTypes. debug. name) {
59- outputFileName = output. outputFile. name. replace((" .aar" ), " -${ version} .aar" )
60- }
20+ buildConfigField(" String" , " API_ENDPOINT" , " https://external-api.studyplus.jp" )
6121 }
6222 }
6323
@@ -88,5 +48,3 @@ dependencies {
8848 testImplementation " org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version "
8949 testImplementation " com.squareup.okhttp3:mockwebserver:$okhttp "
9050}
91-
92- apply from : ' build.publish.gradle'
0 commit comments