forked from spotify/android-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
66 lines (58 loc) · 1.8 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
allprojects {
if (rootProject.name.equalsIgnoreCase('spotify-sdk') && project.projectDir.name.endsWith('-sample')) {
Properties props = new Properties()
File propsFile = new File("${project.projectDir}/gradle.properties")
['androidCompileSdk',
'androidBuildTools',
'androidMinSdk',
'androidTargetSdk',
'appCompatVersion',
getVersionName(project.projectDir.name),
getVersionCode(project.projectDir.name)].each
{ propName ->
project.ext."${propName}" = rootProject."${propName}"
props.setProperty(propName, project."${propName}".toString())
}
props.store(propsFile.newWriter(), "Automatically generated")
}
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
static def getVersionName(sampleName) {
if (sampleName.equalsIgnoreCase('app-remote-sample')) {
return 'appRemoteSampleVersionName'
} else if (sampleName.equalsIgnoreCase('auth-sample')) {
return 'authSampleVersionName'
}
return ''
}
static def getVersionCode(sampleName) {
if (sampleName.equalsIgnoreCase('app-remote-sample')) {
return 'appRemoteSampleVersionCode'
} else if (sampleName.equalsIgnoreCase('auth-sample')) {
return 'authSampleVersionCode'
}
return ''
}
task clean(type: Delete) {
delete rootProject.buildDir
}