This repository was archived by the owner on Mar 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathbuild.gradle
138 lines (119 loc) · 4.64 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' // Can't use 2.0 yet due to code.google.com/p/android/issues/detail?id=194996
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.novoda:bintray-release:0.3.4' // clean build bintrayUpload -PdryRun={true|false}
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
}
}
ext {
if (file("private.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("private.properties")))
BINTRAY_KEY = props.getProperty('BINTRAY_KEY')
} else {
BINTRAY_KEY = ""
}
VERSION_NAME = version()
VERSION_CODE = versionCode().toInteger()
SITE_URL = 'https://github.com/hzsweers/barber'
GIT_URL = 'https://github.com/hzsweers/barber.git'
BINTRAY_USER = 'pandanomic'
GROUP_NAME = 'io.sweers.barber'
COMPILE_SDK = 23
BUILD_TOOLS = '23.0.2'
IS_UPLOADING = project.getGradle().startParameter.taskNames.any{it.contains('bintrayUpload')}
}
subprojects {
repositories {
jcenter()
}
apply plugin: 'com.github.ben-manes.versions' // ./gradlew dependencyUpdates -Drevision=release
group = GROUP_NAME
version = VERSION_NAME
if (IS_UPLOADING && project.name in ['compiler', 'api']) {
println project.name
apply plugin: 'maven'
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.getAllTasks().find{it.path == ":$project.name:generatePomFileForMavenPublication"}.doLast {
file("build/publications/maven/pom-default.xml").delete()
pom {
//noinspection GroovyAssignabilityCheck
project {
name "barber-$project.name"
artifactId "barber-$project.name"
packaging project.name == 'compiler' ? 'jar' : 'aar'
description 'An annotation processor library for styling custom views.'
url SITE_URL
version VERSION_NAME
scm {
url GIT_URL
connection GIT_URL
developerConnection GIT_URL
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
}
}
developers {
developer {
id 'pandanomic'
name 'Henri Z. Sweers'
email '[email protected]'
}
}
}
}.writeTo("build/publications/maven/pom-default.xml")
}
}
}
}
task bumpMajor << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'major', type: 'int', operation: '+', value: 1)
entry(key: 'minor', type: 'int', operation: '=', value: 0)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
entry(key: 'code', type: 'int', operation: '+', value: 1)
}
}
task bumpMinor << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'minor', type: 'int', operation: '+', value: 1)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
entry(key: 'code', type: 'int', operation: '+', value: 1)
}
}
task bumpPatch << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'patch', type: 'int', operation: '+', value: 1)
entry(key: 'code', type: 'int', operation: '+', value: 1)
}
}
task genReadMe << {
def template = file('README.md.template').text
def result = template.replaceAll("%%version%%", version())
file("README.md").withWriter{ it << result }
}
task version << {
println version()
}
def String version() {
def versionPropsFile = file('version.properties')
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
return versionProps['major'] + "." + versionProps['minor'] + "." + versionProps['patch']
}
def String versionCode() {
def versionPropsFile = file('version.properties')
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
return versionProps['code']
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}