1
1
// GRADLE-2087 workaround, perform after java plugin
2
- status = project. hasProperty(' preferredStatus' )? project. preferredStatus: (version. contains(' SNAPSHOT' )? ' snapshot' : ' release' )
2
+ status = project. hasProperty(' preferredStatus' ) ? project. preferredStatus : (version. contains(' SNAPSHOT' ) ? ' snapshot' : ' release' )
3
3
4
4
subprojects { project ->
5
+
5
6
apply plugin : ' java' // Plugin as major conventions
6
7
7
8
sourceCompatibility = 1.6
8
9
9
10
// Restore status after Java plugin
10
11
status = rootProject. status
11
12
12
- task sourcesJar(type : Jar , dependsOn :classes) {
13
+ task sourcesJar(type : Jar , dependsOn : classes) {
13
14
from sourceSets. main. allSource
14
15
classifier ' sources'
15
16
extension ' jar'
16
17
}
17
18
18
- task javadocJar(type : Jar , dependsOn :javadoc) {
19
+ task javadocJar(type : Jar , dependsOn : javadoc) {
19
20
from javadoc. destinationDir
20
21
classifier ' javadoc'
21
22
extension ' jar'
22
23
}
23
24
24
- configurations. create(' sources' )
25
- configurations. create(' javadoc' )
26
- configurations. archives {
27
- extendsFrom configurations. sources
28
- extendsFrom configurations. javadoc
25
+ configurations {
26
+ create(" sources" )
27
+ create(" javadoc" )
28
+ archives {
29
+ extendsFrom configurations. sources
30
+ extendsFrom configurations. javadoc
31
+ }
29
32
}
30
33
31
34
// When outputing to an Ivy repo, we want to use the proper type field
@@ -56,26 +59,72 @@ subprojects { project ->
56
59
}
57
60
}
58
61
59
- project. sourceSets {
60
- main. compileClasspath + = project. configurations. provided
61
- main. runtimeClasspath - = project. configurations. provided
62
- test. compileClasspath + = project. configurations. provided
63
- test. runtimeClasspath + = project. configurations. provided
62
+ sourceSets {
63
+ main {
64
+ compileClasspath + = configurations. provided
65
+ runtimeClasspath - = configurations. provided
66
+ }
67
+ test {
68
+ compileClasspath + = configurations. provided
69
+ runtimeClasspath + = configurations. provided
70
+ }
71
+ examples {
72
+ compileClasspath + = configurations. provided + main. output
73
+ }
74
+ perf {
75
+ compileClasspath + = configurations. provided + main. output
76
+ }
77
+ }
78
+
79
+ configurations {
80
+ examplesCompile. extendsFrom testCompile
81
+ examplesRuntime. extendsFrom testRuntime
82
+ perfCompile. extendsFrom testCompile
83
+ perfRuntime. extendsFrom testRuntime
84
+ }
85
+
86
+ build {
87
+ dependsOn examplesClasses
64
88
}
89
+
90
+ // Individual projects will apply specific language plugins which add to source sets…
91
+ // do this late so we get those additions
92
+ afterEvaluate {
93
+ idea {
94
+ module {
95
+ [sourceSets. examples, sourceSets. perf]. each {
96
+ [it. allSource. srcDirs, it. resources. srcDirs]. each {
97
+ testSourceDirs + = it
98
+ }
99
+ }
100
+ scopes. PROVIDED . plus + = configurations. provided
101
+ }
102
+ }
103
+
104
+ eclipse {
105
+ classpath {
106
+ plusConfigurations + = configurations. provided
107
+ downloadJavadoc = true
108
+ }
109
+ }
110
+ }
111
+
65
112
}
66
113
67
114
apply plugin : ' github-pages' // Used to create publishGhPages task
68
115
69
116
def docTasks = [:]
70
- [Javadoc ,ScalaDoc ,Groovydoc ]. each { Class docClass ->
71
- def allSources = allprojects. tasks* . withType(docClass). flatten()* . source
117
+ [Javadoc , ScalaDoc , Groovydoc ]. each { Class docClass ->
118
+ def allSources = allprojects. tasks* . withType(docClass). flatten()* . source
72
119
if (allSources) {
73
120
def shortName = docClass. simpleName. toLowerCase()
74
121
def docTask = task " aggregate${ shortName.capitalize()} " (type : docClass, description : " Aggregate subproject ${ shortName} s" ) {
75
122
source = allSources
76
123
destinationDir = file(" ${ project.buildDir} /docs/${ shortName} " )
77
124
doFirst {
78
- def classpaths = allprojects. findAll { it. plugins. hasPlugin(JavaPlugin ) }. collect { it. sourceSets. main. compileClasspath }
125
+ def classpaths = allprojects. findAll { it. plugins. hasPlugin(JavaPlugin ) }. collect {
126
+ it. sourceSets. main. compileClasspath
127
+ }
79
128
classpath = files(classpaths)
80
129
}
81
130
}
@@ -93,9 +142,4 @@ githubPages {
93
142
}
94
143
}
95
144
}
96
- }
97
-
98
- // Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle
99
- task createWrapper (type : Wrapper ) {
100
- gradleVersion = ' 1.6'
101
- }
145
+ }
0 commit comments