-
Notifications
You must be signed in to change notification settings - Fork 837
/
build.gradle
65 lines (59 loc) · 1.88 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.8.0"
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
// setting release property breaks maven plugin
// so instead we indicate snapshots with -Psnapshot
isSnapshot = project.hasProperty('snapshot')
isSnapCi = System.getenv('SNAP_CI') != null
isSnapPullRequest = System.getenv('SNAP_PULL_REQUEST_NUMBER') != null
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName = {
version = ""
def stdout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
version = stdout.toString().trim()
}
catch (e) {
println("Can't get version from git: " + e);
version = "adhoc"
}
version = "${version}${isSnapshot ? "-SNAPSHOT" : ""}"
return version
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
version = getVersionName()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
if (getGradle().getStartParameter().getTaskRequests().toString().contains("release") ||
getGradle().getStartParameter().getTaskRequests().toString().contains("mavenPublish") ||
getGradle().getStartParameter().getTaskRequests().toString().contains("closeAndReleaseRepository")) {
apply plugin: 'io.codearte.nexus-staging'
}