-
Notifications
You must be signed in to change notification settings - Fork 96
/
build.gradle
215 lines (184 loc) · 5.47 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'signing'
version = '1.2.2-SNAPSHOT'
group = 'org.gradle.api.plugins'
def artifact = 'gradle-android-plugin'
project.ext.set('artifact', artifact)
def isReleaseVersion = !version.endsWith('SNAPSHOT')
configurations {
sshDeploy
integrationTestCompile {
extendsFrom testCompile
}
integrationTestRuntime {
extendsFrom integrationTestCompile, testRuntime
}
}
repositories {
mavenCentral()
}
dependencies {
sshDeploy 'org.apache.maven.wagon:wagon-ssh:1.0-beta-7'
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { deployment ->
signing.signPom(deployment)
}
//configuration = configurations.sshDeploy
//repository(url: "scp://[email protected]/web/public/maven2")
//repository(url: "file:///tmp/maven2")
def repositoryUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : ''
def repositoryPassword = project.hasProperty('sonatypePassword') ? sonatypePassword : ''
if (isReleaseVersion) {
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: repositoryUsername, password: repositoryPassword)
}
} else {
repository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
authentication(userName: repositoryUsername, password: repositoryPassword)
}
}
pom.project(pomConfiguration)
}
}
}
dependencies {
// Add all JAR files in the lib directory of theGradle installation directory
// to the groovy configuration (is also used by compile configuration)
groovy fileTree(dir: new File(gradle.gradleHomeDir, 'lib'), includes: ['**/*.jar'])
}
// Make sure all code is compiled, tested and checked before uploadArchives.
uploadArchives.dependsOn ':build'
sourceSets {
integrationTest {
groovy.srcDir file('src/integTest/groovy')
resources.srcDir file('src/integTest/resources')
compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
}
}
task integrationTest(type: Test, dependsOn: jar) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
systemProperties['integTest.androidProjects'] = new File(sourceSets.integrationTest.output.resourcesDir, 'androidProjects').absolutePath
doFirst {
if (!System.getenv('ANDROID_HOME')) {
throw new GradleException('ANDROID_HOME environment variable must be defined to run integration tests')
}
}
}
task developerBuild {
dependsOn build, integrationTest
}
idea {
module {
downloadSources = true
downloadJavadoc = true
testSourceDirs += file('src/integTest/groovy')
testSourceDirs += file('src/integTest/resources')
}
project {
jdkName = '1.6'
languageLevel = '1.6'
}
}
clean << {
//TODO: will this work on Windows? I intentionally used the file() method so as
// to be platform independent, but I didn't test this outside MacOS/Linux
def gradleCacheDir = file("${System.properties['user.home']}/.gradle/cache")
def pluginCacheDir = file("$gradleCacheDir/$project.group/$project.name")
logger.warn "Clearing Gradle artifact cache at $pluginCacheDir"
ant.delete dir: pluginCacheDir
}
jar {
baseName = artifact
}
task sourcesJar(type: Jar, dependsOn: classes) {
baseName = artifact
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
baseName = artifact
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
if (isReleaseVersion) {
sign configurations.archives
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0-rc-3'
}
task generatePom << {
def generatedPomFileName = 'pom.xml'
pom {
project(pomConfiguration)
}.writeTo("$buildDir/$generatedPomFileName")
}
def getPomConfiguration() {
return {
groupId project.group
artifactId project.artifact
version project.version
packaging 'jar'
name 'Gradle Android Plugin'
description 'Android plugin for the Gradle build system.'
url 'https://github.com/jvoegele/gradle-android-plugin'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/jvoegele/gradle-android-plugin'
connection 'scm:git://github.com/jvoegele/gradle-android-plugin.git'
developerConnection 'scm:[email protected]:jvoegele/gradle-android-plugin.git'
}
developers {
developer {
id 'jvoegele'
name 'Jason Voegele'
email '[email protected]'
}
developer {
id 'kaeppler'
name 'Matthias Käppler'
email '[email protected]'
}
developer {
id 'think01'
name 'Fabio Da Soghe'
email '[email protected]'
}
developer {
id 'Ladicek'
name 'Ladislav Thon'
email '[email protected]'
}
developer {
id 'ealden'
name 'Ealden Esto E. Escanan'
email '[email protected]'
}
developer {
id 'erdi'
name 'Marcin Erdmann'
email '[email protected]'
}
}
}
}