-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
260 lines (229 loc) · 8.45 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/**
* To create the Eclipse project and classpath files:
* ./gradlew cleanEclipse eclipse
*
* To build Beanfabrics:
* ./gradlew build
*
* To publish a new release of Beanfabrics to Sonatype OSS Maven Repo:
* ./gradlew clean publish
*
* To publish a new release of Beanfabrics to the local maven repo (filesystem):
* ./gradlew clean publishToMavenLocal
*/
if (!project.hasProperty('ossrhUsername') || !project.hasProperty('ossrhPassword')) {
println 'OSS repository hosting username or password not set'
ext.ossrhUsername = ''
ext.ossrhPassword = ''
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'org.beanfabrics'
version = '1.6.0-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(6)
}
}
ext {
isReleaseVersion = !version.endsWith('SNAPSHOT')
buildDate = new Date().format("yyyy-MM-dd HH:mm:ss")
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.1'
testImplementation group: 'junit', name: 'junit', version: '4.10'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.7'
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
tasks.withType(Jar) {
into('META-INF') {
from 'license.txt'
from '3rdparty-license.txt'
from 'lgpl.txt'
}
manifest {
attributes(
'Implementation-Title': 'Beanfabrics',
'Implementation-Version': version,
"Created-Date": buildDate
)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact tasks.sourcesJar
artifact tasks.javadocJar
pom {
name = 'Beanfabrics'
description = 'Beanfabrics is a component framework for building Java desktop applications according to the Presentation Model Pattern with Swing.'
url = 'http://github.com/mkarneim/beanfabrics'
packaging = 'jar'
scm {
url = '[email protected]:mkarneim/beanfabrics.git'
connection = 'scm:git:[email protected]:mkarneim/beanfabrics.git'
developerConnection = 'scm:git:[email protected]:mkarneim/beanfabrics.git'
tag = 'HEAD'
}
licenses {
license {
name = 'GNU Lesser General Public License, Version 3'
url = 'http://github.com/mkarneim/beanfabrics/blob/master/licence.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'mkarneim'
name = 'Michael Karneim'
url = 'http://www.karneim.net'
timezone = 'GMT+1'
}
developer {
id = 'max.gensthaler'
name = 'Max Gensthaler'
url = 'http://www.gensthaler.de'
timezone = 'GMT+1'
}
}
}
}
}
repositories {
// If this is a release build, push to the release URL; else snapshots
maven {
name = "sonatype"
url = isReleaseVersion
? uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
: uri("https://oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = project.ossrhUsername
password = project.ossrhPassword
}
}
}
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
signing {
sign publishing.publications.mavenJava
}
}
project('beanfabrics-core') {
description = 'Beanfabrics Core'
}
project('beanfabrics-swing') {
description = 'Beanfabrics Swing'
sourceSets.main.java.srcDir 'src/main/design'
dependencies {
implementation project(':beanfabrics-core')
}
jar {
manifest {
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/table/BnTable.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnPasswordField.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnButton.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnMenuItem.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnIconLabel.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnTextField.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/list/BnList.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnLabel.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnRadioButton.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnAction.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnCheckBox.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnComboBox.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnTextArea.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnMouseClickAction.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnProgressBar.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/BnToggleButton.class')
}
}
}
project('beanfabrics-swing-goodies') {
description = 'Beanfabrics Swing Goodies'
dependencies {
implementation project(':beanfabrics-core')
implementation project(':beanfabrics-swing')
}
jar {
manifest {
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/goodies/calendar/BnCalendarChooser.class')
attributes(['Java-Bean': 'true'], 'org/beanfabrics/swing/goodies/calendar/BnCalendarChooserButton.class')
}
}
}
project('beanfabrics-swing-samples') {
description = 'Beanfabrics Swing Samples'
dependencies {
implementation project(':beanfabrics-core')
implementation project(':beanfabrics-swing')
}
tasks.withType(Sign) { enabled = false }
tasks.withType(PublishToMavenLocal) { enabled = false }
tasks.withType(PublishToMavenRepository) { enabled = false }
}
ext {
def os = System.getProperty("os.name").toLowerCase()
def arch = System.getProperty("os.arch").toLowerCase()
// This makes the dependency on the SWT library platform-dependent
def swtVersion = '3.3.0-v3346'
if (os.contains('linux') && arch.contains('amd64')) {
ext.swtGroup = 'org.eclipse.swt.gtk.linux'
ext.swtName = 'x86_64'
} else if (os.contains('linux') && (arch.contains('x86') || arch.contains('i386'))) {
ext.swtGroup = 'org.eclipse.swt.gtk.linux'
ext.swtName = 'x86'
} else if (os.contains('mac os x')) {
ext.swtGroup = 'org.eclipse.swt.carbon'
ext.swtName = 'macosx'
} else if (os.contains('windows') && arch.contains('amd64')) {
//throw new GradleException("Unsupported values for os=${os}, arch=${arch} since no SWT artifact for version ${swtVersion} is available on Maven Central.")
ext.swtGroup = 'org.eclipse.swt.win32.win32'
ext.swtName = 'x86'
} else if (os.contains('windows') && (arch.contains('x86') || arch.contains('i386'))) {
ext.swtGroup = 'org.eclipse.swt.win32.win32'
ext.swtName = 'x86'
} else {
throw new GradleException("Unexpected values for os=${os}, arch=${arch}")
}
ext.swtVersion = swtVersion
}
project('beanfabrics-swt') {
description = 'Beanfabrics SWT'
dependencies {
implementation project(':beanfabrics-core')
compileOnly group: swtGroup, name: swtName, version: swtVersion
}
}
project('beanfabrics-swt-samples') {
description = 'Beanfabrics SWT Samples'
dependencies {
implementation project(':beanfabrics-core')
implementation project(':beanfabrics-swt')
compileOnly group: swtGroup, name: swtName, version: swtVersion
}
tasks.withType(Sign) { enabled = false }
tasks.withType(PublishToMavenLocal) { enabled = false }
tasks.withType(PublishToMavenRepository) { enabled = false }
}
task javadocDir(type: Javadoc) {
source subprojects.collect { project -> project.sourceSets.main.allJava }
classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath })
destinationDir = file("${project.buildDir}/docs")
}