This repository has been archived by the owner on Sep 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
114 lines (96 loc) · 3.34 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.github.ben-manes.versions'
final ANDROID_SDK_PATH = {
final localProperties = new Properties()
try {
localProperties.load(new FileInputStream("${project.rootProject.projectDir}/local.properties"))
} catch (IOException e) { /* ignore errors */
}
def androidSdkPath = localProperties['sdk.dir'] ?: System.getenv('ANDROID_HOME')
if (!androidSdkPath) {
throw new RuntimeException("Missing local.properties")
}
androidSdkPath
}()
buildscript {
apply from: "${rootDir.absolutePath}/ext.gradle"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
//classpath 'com.novoda:bintray-release:0.8.1' // https://github.com/novoda/bintray-release
// classpath "guru.stefma.bintrayrelease:bintrayrelease:1.0.0"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5"
}
}
def generatePomFilesTask = tasks.create("generatePomFiles")
allprojects {
repositories {
google()
jcenter()
}
tasks.whenTaskAdded {
if (it.name.matches("generatePomFileFor([A-Z][a-zA-Z]*)Publication")) {
generatePomFilesTask.dependsOn it
}
}
}
ext {
deps = [// Android
android : 'com.google.android:android:4.1.1.4',
appcompat : 'androidx.appcompat:appcompat:1.0.0',
androidxAnnotations: 'androidx.annotation:annotation:1.0.0',
// Square
javapoet : 'com.squareup:javapoet:1.11.1',
// Test dependencies
junit : 'junit:junit:4.12',
truth : 'com.google.truth:truth:0.42',
robolectric : 'org.robolectric:robolectric:3.1.2',
compiletesting : 'com.google.testing.compile:compile-testing:0.15',
autoservice : 'com.google.auto.service:auto-service:1.0-rc4',
autocommon : 'com.google.auto:auto-common:0.10',
commonsio : 'commons-io:commons-io:2.6'
]
ANDROID_JAR = fileTree(dir: "${ANDROID_SDK_PATH}/platforms/android-28/", include: 'android.jar')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
String shell(String command) {
def proc = ["sh", "-c", "cd ${project.rootDir} ; ${command}"].execute()
if (proc.waitFor() != 0) {
throw new RuntimeException("Failed to run: ${command}\n${proc.err.text}")
} else {
def err = proc.err.text
if (err) {
System.err.println(err)
}
}
return proc.in.text;
}
task releng {
doLast {
def tag = "v" + VERSION
println "Release engineering for ${tag}"
def changes = shell "git status -s"
if (changes.trim()) {
throw new RuntimeException("There are changes not commited yet.\n${changes}")
}
println "> git tag ${tag}"
shell "git tag ${tag}"
println "> git push origin ${tag}"
shell "git push origin ${tag}"
shell "git push origin master"
}
}
wrapper {
gradleVersion = '4.10.2'
//noinspection UnnecessaryQualifiedReference
distributionType = Wrapper.DistributionType.ALL
}