1
1
apply plugin : ' com.android.library'
2
2
apply plugin : ' kotlin-android'
3
3
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
-
14
4
android {
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
-
27
5
compileSdkVersion versions. compileSdk
28
6
defaultConfig {
29
7
minSdkVersion versions. minSdk
30
8
targetSdkVersion versions. targetSdk
31
- versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
32
- versionName " ${ versionMajor} .${ versionMinor} .${ versionPatch} "
33
- version = versionName
34
- group = " jp.studyplus.android.sdk"
35
9
36
10
consumerProguardFiles ' lib-proguard-rules.txt'
37
11
@@ -40,24 +14,10 @@ android {
40
14
41
15
buildTypes {
42
16
debug {
43
- buildConfigField " String" , " API_ENDPOINT" , quote(debugApiEndpoint)
44
- }
45
- debugTest {
46
- initWith(buildTypes. debug)
17
+ buildConfigField(" String" , " API_ENDPOINT" , " \"\" " )
47
18
}
48
19
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\" " )
61
21
}
62
22
}
63
23
@@ -89,4 +49,27 @@ dependencies {
89
49
testImplementation " com.squareup.okhttp3:mockwebserver:$okhttp "
90
50
}
91
51
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