forked from spotify/mobius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
124 lines (105 loc) · 3.54 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
import com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormat
import com.github.sherter.googlejavaformatgradleplugin.VerifyGoogleJavaFormat
buildscript {
repositories {
jcenter()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0"
classpath('com.android.tools.build:gradle:3.6.3')
classpath 'net.researchgate:gradle-release:2.8.1'
}
}
plugins {
id 'com.github.sherter.google-java-format' version '0.8'
id 'com.github.hierynomus.license' version '0.15.0'
id 'io.codearte.nexus-staging' version '0.21.2'
}
repositories {
jcenter()
}
apply plugin: 'net.researchgate.release'
static def isAndroidProject(Project p) {
return p.plugins.findPlugin('com.android.library')
}
ext {
minSdkVersion = 14
compileSdkVersion = 25
targetSdkVersion = compileSdkVersion
versions = [
'autoValue' : '1.7',
'assertjcore' : '3.15.0',
'awaitility' : '4.0.2',
'guava' : '28.2-android',
'junit' : '4.13',
'logback' : '1.2.3',
'rxJava' : '1.3.8',
'rxJava2' : '2.2.17',
'rxJava3' : '3.0.0',
'slf4j' : '1.7.25',
'jsr305' : '3.0.2',
'hamcrestLibrary' : '1.3',
'mockito' : '1.10.19',
'androidxLifecycle' : '2.2.0',
'androidXCoreTesting' : '2.1.0'
]
}
subprojects {
ext.VERSION_NAME = properties.version
repositories {
jcenter()
}
group = GROUP
version = VERSION_NAME
afterEvaluate { proj ->
if (isAndroidProject(proj)) {
// for android, auto-format, even though that leads to worse error messages for syntax
// errors
android.libraryVariants.all { variant ->
variant.getJavaCompileProvider().configure {
dependsOn rootProject.tasks.format
}
}
} else if (proj.plugins.findPlugin('java-library')) {
proj.apply from: rootProject.file('gradle/binary_compatibility.gradle')
// for Java (which is easier than android because AGP), ensure compilation is run before
// formatting, since the compiler has much better error messages for syntax errors.
rootProject.tasks.format.dependsOn(proj.tasks.compileTestJava)
}
// ensure that builds fail if code is not formatted properly
proj.tasks.check.dependsOn(rootProject.tasks.verifyFormat)
}
}
task format(type: GoogleJavaFormat) {
exclude '**/package-info.java'
}
task verifyFormat(type: VerifyGoogleJavaFormat) {
exclude '**/package-info.java'
}
task build(dependsOn: getTasksByName('build', true))
task uploadArchivesAggregate(dependsOn: getTasksByName('uploadArchives', true))
release {
failOnUnversionedFiles = false
tagTemplate = 'v$version'
git {
requireBranch = 'master'
pushToRemote = 'upstream'
}
}
afterReleaseBuild.dependsOn uploadArchivesAggregate
allprojects {
apply plugin: 'com.github.hierynomus.license'
license {
header rootProject.file('apache2.header')
exclude("**/AutoValue_*.java")
mapping("java", "SLASHSTAR_STYLE")
}
getTasksByName('check', false).each { checkTask -> checkTask.dependsOn(tasks.withType(Javadoc)) }
}
nexusStaging {
packageGroup = "com.spotify"
}