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
@@ -89,4 +49,27 @@ dependencies {
8949 testImplementation " com.squareup.okhttp3:mockwebserver:$okhttp "
9050}
9151
92- apply from : ' build.publish.gradle'
52+ task sourcesJar (type : Jar ) {
53+ classifier = ' sources'
54+ from android. sourceSets. main. java. sourceFiles
55+ }
56+
57+ task javadoc (type : Javadoc ) {
58+ source = android. sourceSets. main. java. sourceFiles
59+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
60+ }
61+
62+ task javadocJar (type : Jar , dependsOn : javadoc) {
63+ classifier = ' javadoc'
64+ from javadoc. destinationDir
65+ }
66+
67+ task classesJar (type : Jar ) {
68+ from " $buildDir /intermediates/classes/release"
69+ }
70+
71+ artifacts {
72+ archives classesJar
73+ archives javadocJar
74+ archives sourcesJar
75+ }
0 commit comments