1
- import static org.gradle.api.JavaVersion.VERSION_1_7
2
-
3
- apply plugin : ' java'
4
- apply plugin : ' osgi'
5
1
apply plugin : ' signing'
2
+ apply plugin : ' osgi'
6
3
apply plugin : ' maven-publish'
7
4
8
- sourceCompatibility = VERSION_1_7
9
- targetCompatibility = VERSION_1_7
10
-
11
5
group = " org.hamcrest"
12
- version = " 2.0.0.0 "
6
+ version = " 1.4-SNAPSHOT "
13
7
8
+ subprojects {
9
+ apply plugin : ' java-library'
10
+ apply plugin : ' osgi'
14
11
15
- repositories {
16
- mavenCentral()
17
- }
12
+ sourceCompatibility = JavaVersion . VERSION_1_7
13
+ targetCompatibility = JavaVersion . VERSION_1_7
14
+
15
+ version = rootProject. version
18
16
19
- dependencies {
20
- testCompile(group : ' junit' , name : ' junit' , version : ' 4.12' ) {
21
- transitive = false
17
+ repositories {
18
+ mavenCentral()
22
19
}
23
- }
24
20
25
- sourceSets {
26
- main {
27
- java {
28
- srcDirs ' hamcrest-core/src/main/java' , ' hamcrest-library/src/main/java'
21
+ test {
22
+ testLogging {
23
+ exceptionFormat = ' full'
29
24
}
30
-
31
25
}
32
- test {
33
- java {
34
- srcDirs ' hamcrest-core/src/test/java' , ' hamcrest-library/src/test/java'
26
+
27
+ jar {
28
+ manifest {
29
+ attributes ' Implementation-Title' : project. name,
30
+ ' Implementation-Vendor' : ' hamcrest.org' ,
31
+ ' Implementation-Version' : version
32
+ instruction ' Import-Package' , ''' javax.xml.namespace; resolution:=optional,
33
+ javax.xml.xpath; resolution:=optional,
34
+ org.w3c.dom; resolution:=optional,
35
+ *'''
35
36
}
36
37
}
37
- }
38
38
39
- test {
40
- testLogging {
41
- exceptionFormat = ' full'
39
+ task sourcesJar(type : Jar ) {
40
+ classifier = ' sources'
41
+ from sourceSets. main. allSource
42
+ }
43
+
44
+ task javadocJar(type : Jar ) {
45
+ classifier = ' javadoc'
46
+ from javadoc
42
47
}
43
48
}
44
49
45
- jar {
50
+ task allClassesJar (type : Jar , dependsOn : subprojects. tasks[' build' ]) {
51
+ baseName = ' hamcrest-all'
52
+ subprojects. each { subproject ->
53
+ from zipTree(subproject. jar. archivePath)
54
+ }
46
55
manifest {
47
56
attributes ' Implementation-Title' : ' hamcrest-all' ,
48
57
' Implementation-Vendor' : ' hamcrest.org' ,
49
58
' Implementation-Version' : version
50
- instruction ' Import-Package' , ''' javax.xml.namespace; resolution:=optional,
51
- javax.xml.xpath; resolution:=optional,
52
- org.w3c.dom; resolution:=optional,
53
- *'''
54
59
}
55
60
}
56
61
57
- task sourcesJar (type : Jar ) {
62
+
63
+ task allSourcesJar (type : Jar ) {
64
+ baseName = ' hamcrest-all'
58
65
classifier = ' sources'
59
- from sourceSets. main. allSource
66
+ subprojects. each { subproject ->
67
+ from subproject. sourceSets. main. allSource
68
+ }
60
69
}
61
70
62
- task javadocJar (type : Jar ) {
71
+ task allJavadoc (type : Javadoc ) {
72
+ group = ' Documentation'
73
+ description = ' Generate combined Javadoc for all projects'
74
+ title = " Hamcrest All $version API"
75
+ subprojects. each { proj ->
76
+ proj. tasks. withType(Javadoc ). each { javadocTask ->
77
+ source + = javadocTask. source
78
+ classpath + = javadocTask. classpath
79
+ excludes + = javadocTask. excludes
80
+ includes + = javadocTask. includes
81
+ }
82
+ }
83
+ }
84
+
85
+ task allJavadocJar (type : Jar ) {
63
86
classifier = ' javadoc'
64
- from javadoc
87
+ from allJavadoc
88
+ }
89
+
90
+ def pomConfigurationFor (String pomName , String pomDescription ) {
91
+ return {
92
+ name = pomName
93
+ description = pomDescription
94
+ url = ' http://hamcrest.org/JavaHamcrest/'
95
+
96
+ scm {
97
+ connection = ' git@github.com:hamcrest/JavaHamcrest.git'
98
+ url = ' https://github.com/hamcrest/JavaHamcrest'
99
+ }
100
+
101
+ licenses {
102
+ license {
103
+ name = ' BSD Licence 3'
104
+ url = ' http://opensource.org/licenses/BSD-3-Clause'
105
+ }
106
+ }
107
+
108
+ developers {
109
+ developer {
110
+ id = ' joewalnes'
111
+ name = ' Joe Walnes'
112
+ }
113
+ developer {
114
+ id = ' npryce'
115
+ name = ' Nat Pryce'
116
+ }
117
+ developer {
118
+ id = ' sf105'
119
+ name = ' Steve Freeman'
120
+ }
121
+ }
122
+ }
65
123
}
66
124
67
125
publishing {
68
126
publications {
69
- mavenJava(MavenPublication ) {
70
- artifactId = ' java-hamcrest'
71
- from components. java
72
- artifact sourcesJar
73
- artifact javadocJar
74
- pom {
75
- name = ' Java Hamcrest'
76
- description = ' Hamcrest matcher library for Java'
77
- url = ' http://hamcrest.org/JavaHamcrest/'
78
-
79
- scm {
80
- connection = ' git@github.com:hamcrest/JavaHamcrest.git'
81
- url = ' https://github.com/hamcrest/JavaHamcrest'
82
- }
127
+ def coreProject = project(' :hamcrest-core' )
128
+ hamcrestCore(MavenPublication ) {
129
+ from coreProject. components. java
130
+ artifactId coreProject. name
131
+ artifact coreProject. sourcesJar
132
+ artifact coreProject. javadocJar
133
+ pom pomConfigurationFor(
134
+ ' Hamcrest Core' ,
135
+ ' This is the core API of hamcrest matcher framework to be used by third-party framework providers. This includes the a foundation set of matcher implementations for common operations.' )
136
+ }
83
137
84
- licenses {
85
- license {
86
- name = ' BSD Licence 3'
87
- url = ' http://opensource.org/licenses/BSD-3-Clause'
88
- }
89
- }
138
+ def libraryProject = project(' :hamcrest-library' )
139
+ hamcrestLibrary(MavenPublication ) {
140
+ from libraryProject. components. java
141
+ artifactId = libraryProject. name
142
+ artifact libraryProject. sourcesJar
143
+ artifact libraryProject. javadocJar
144
+ pom pomConfigurationFor(
145
+ ' Hamcrest Library' ,
146
+ ' Hamcrest library of matcher implementations.' )
147
+ }
90
148
91
- developers {
92
- developer {
93
- id = ' joewalnes'
94
- name = ' Joe Walnes'
95
- }
96
- developer {
97
- id = ' npryce'
98
- name = ' Nat Pryce'
99
- }
100
- developer {
101
- id = ' sf105'
102
- name = ' Steve Freeman'
103
- }
104
- }
105
- }
149
+ hamcrestAll(MavenPublication ) {
150
+ artifactId = ' hamcrest-all'
151
+ artifact allClassesJar
152
+ artifact allSourcesJar
153
+ artifact allJavadocJar
154
+ pom pomConfigurationFor(
155
+ ' Hamcrest All' ,
156
+ ' A self-contained hamcrest jar containing all of the sub-modules in a single artifact.' )
106
157
}
107
158
}
108
159
repositories {
@@ -122,5 +173,7 @@ publishing {
122
173
123
174
signing {
124
175
required { hasProperty(' ossrhUsername' ) && hasProperty(' ossrhPassword' ) }
125
- sign publishing. publications. mavenJava
176
+ sign publishing. publications. hamcrestCore
177
+ sign publishing. publications. hamcrestLibrary
178
+ sign publishing. publications. hamcrestAll
126
179
}
0 commit comments