forked from sharewire/google-maps-clustering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
139 lines (119 loc) · 4.04 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.3'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
versionCode = 1
versionName = '0.1.3'
minSdkVersion = 16
targetSdkVersion = 27
compileSdkVersion = 27
supportVersion = '27.1.1'
playServicesVersion = '15.0.1'
masterBranch = "master"
}
subprojects { subproject ->
repositories {
google()
jcenter()
}
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
afterEvaluate { project ->
if (runningInCIServer()) {
println("Running in CI Server")
if (project.hasProperty('androidArtifactType')) {
println("androidArtifactType == " + androidArtifactType)
println("gitBranch() == " + gitBranch())
if (androidArtifactType == "aar" && uploadToArtifactory()) {
println("Uploading to Artifactory")
println("ARTIFACTORY_USERNAME " + isVariableSet("ARTIFACTORY_USERNAME"))
println("ARTIFACTORY_PASSWORD " + isVariableSet("ARTIFACTORY_PASSWORD"))
artifactoryPublish.dependsOn('assembleDebug', 'assembleRelease')
publishing.publications {
debugaar(MavenPublication) {
groupId = "co.intersection.debug"
artifactId = "google-maps-clustering-debug"
version = majorVersion
artifact("$buildDir/outputs/aar/${project.getName()}-debug.aar")
}
releaseaar(MavenPublication) {
groupId = "co.intersection.release"
artifactId = "google-maps-clustering-release"
version = majorVersion
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
artifactoryPublish {
publications(publishing.publications.debugaar)
publications(publishing.publications.releaseaar)
}
}
}
}
}
}
artifactory {
contextUrl = 'https://intersection.jfrog.io/intersection'
publish {
repository {
repoKey = 'google-maps-clustering'
username = System.getenv("ARTIFACTORY_USERNAME")
password = System.getenv("ARTIFACTORY_PASSWORD")
maven = true
}
defaults {
publishBuildInfo = true
publishArtifacts = true
publishPom = false
}
}
resolve {
repoKey = 'google-maps-clustering'
username = System.getenv("ARTIFACTORY_USERNAME")
password = System.getenv("ARTIFACTORY_PASSWORD")
maven = true
}
}
static def isVariableSet(String variableName) {
def variableValue = System.getenv(variableName)
return variableValue == null ? "null" : variableValue == "" ? "missing" : "set"
}
static def runningInCIServer() {
// return System.env['BUILDKITE'] as boolean
return true;
}
def uploadToArtifactory() {
return true
}
static def gitBranch() {
//buildkite checks out a specific commit instead of a branch, branch info is available in an env var
if (System.getenv("BUILDKITE_BRANCH") != null) {
return System.getenv("BUILDKITE_BRANCH")
}
def branch = ""
def proc = "git rev-parse --abbrev-ref HEAD".execute()
proc.in.eachLine { line -> branch = line }
proc.err.eachLine { line -> println line }
proc.waitFor()
return branch
}