-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathconvention.gradle
83 lines (68 loc) · 2.58 KB
/
convention.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
// For Artifactory
rootProject.status = version.contains('-SNAPSHOT')?'snapshot':'release'
subprojects { project ->
apply plugin: 'java' // Plugin as major conventions
version = rootProject.version
sourceCompatibility = 1.6
// GRADLE-2087 workaround, perform after java plugin
status = rootProject.status
task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
classifier 'sources'
extension 'jar'
}
task javadocJar(type: Jar, dependsOn:javadoc) {
from javadoc.destinationDir
classifier 'javadoc'
extension 'jar'
}
configurations.add('sources')
configurations.add('javadoc')
configurations.archives {
extendsFrom configurations.sources
extendsFrom configurations.javadoc
}
// When outputing to an Ivy repo, we want to use the proper type field
gradle.taskGraph.whenReady {
def isNotMaven = !it.hasTask(project.uploadMavenCentral)
if (isNotMaven) {
def artifacts = project.configurations.sources.artifacts
def sourceArtifact = artifacts.iterator().next()
sourceArtifact.type = 'sources'
}
}
artifacts {
sources(sourcesJar) {
// Weird Gradle quirk where type will be used for the extension, but only for sources
type 'jar'
}
javadoc(javadocJar) {
type 'javadoc'
}
}
// Ensure output is on a new line
javadoc.doFirst { println "" }
configurations {
provided {
description = 'much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.'
transitive = true
visible = true
}
}
project.sourceSets {
main.compileClasspath += project.configurations.provided
main.runtimeClasspath -= project.configurations.provided
test.compileClasspath += project.configurations.provided
test.runtimeClasspath += project.configurations.provided
}
}
task aggregateJavadoc(type: Javadoc) {
description = 'Aggregate all subproject docs into a single docs directory'
source subprojects.collect {project -> project.sourceSets.main.allJava }
classpath = files(subprojects.collect {project -> project.sourceSets.main.compileClasspath})
destinationDir = new File(projectDir, 'doc')
}
// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
task createWrapper(type: Wrapper) {
gradleVersion = '1.1'
}