|
1 | 1 | plugins { |
2 | | - // osgi |
3 | | - id "org.jruyi.osgibnd" version "0.4.0" |
4 | 2 | // code formatting |
5 | 3 | id "com.diffplug.gradle.spotless" version "3.1.0" |
6 | 4 | // bintray uploading |
@@ -54,39 +52,6 @@ task testMatlabInteractive(type: Test) { |
54 | 52 | } |
55 | 53 | task testMatlabAll(dependsOn: [test, testMatlabHeadless, testMatlabInteractive]) |
56 | 54 |
|
57 | | -////////// |
58 | | -// OSGI // |
59 | | -////////// |
60 | | - |
61 | | -// delete the old manifest to ensure there's no caching or merging going on |
62 | | -jar.doFirst { |
63 | | - project.file('META-INF/MANIFEST.MF').delete() |
64 | | -} |
65 | | - |
66 | | -jar.manifest { |
67 | | - attributes ( |
68 | | - 'Export-Package': 'matlabcontrol.*,!matlabcontrol.internal.*,!matlabcontrol.demo.*', |
69 | | - 'Bundle-SymbolicName': "${project.group}.${project.name}", |
70 | | - 'Bundle-Vendor': 'DiffPlug', |
71 | | - 'Bundle-DocURL': "https://github.com/${project.org}/${project.name}", |
72 | | - 'Bundle-License': "https://github.com/${project.org}/${project.name}/blob/v${project.version}/LICENSE", |
73 | | - 'Import-Package': '!com.mathworks.jmi', |
74 | | - 'Main-Class': 'matlabcontrol.demo.DemoMain', |
75 | | - '-includeresource': "matlabcontrol=${sourceSets.main.output.classesDir}/matlabcontrol,${sourceSets.main.output.resourcesDir}", |
76 | | - '-removeheaders': 'Bnd-LastModified,Bundle-Name,Created-By,Tool,Private-Package', |
77 | | - '-savemanifest': project.file('META-INF/MANIFEST.MF'), |
78 | | - ) |
79 | | -} |
80 | | - |
81 | | -// manifests are only generated when the java files change - not if manifest properties change |
82 | | -// this task forces the manifests to regenerate |
83 | | -task refreshManifest(dependsOn: jar) |
84 | | -gradle.taskGraph.whenReady { taskGraph -> |
85 | | - if (taskGraph.hasTask(refreshManifest)) { |
86 | | - jar.outputs.upToDateWhen { false } |
87 | | - } |
88 | | -} |
89 | | - |
90 | 55 | //////////// |
91 | 56 | // JAVA 6 // |
92 | 57 | //////////// |
@@ -239,107 +204,3 @@ task javadocJar(type: Jar, dependsOn: javadoc) { |
239 | 204 | classifier = 'javadoc' |
240 | 205 | from javadoc.destinationDir |
241 | 206 | } |
242 | | - |
243 | | -//////////////// |
244 | | -// PUBLISHING // |
245 | | -//////////////// |
246 | | -def isSnapshot = project.version.endsWith('-SNAPSHOT') |
247 | | -// pulls the credentials from either the environment variable or gradle.properties |
248 | | -def cred = { |
249 | | - if (System.env[it] != null) { |
250 | | - return System.env[it] |
251 | | - } else if (project.hasProperty(it)) { |
252 | | - return project[it] |
253 | | - } else { |
254 | | - return 'unknown_' + it |
255 | | - } |
256 | | -} |
257 | | - |
258 | | -publishing { |
259 | | - publications { |
260 | | - mavenJava(MavenPublication) { |
261 | | - from components.java |
262 | | - artifact sourcesJar |
263 | | - artifact javadocJar |
264 | | - pom.withXml { |
265 | | - // findbugs annotations should have scope "provided" |
266 | | - asNode().dependencies.'*'.findAll() { it.groupId.text() == 'com.google.code.findbugs' }.each() { it.scope*.value = 'provided' } |
267 | | - // add MavenCentral requirements to the POM |
268 | | - asNode().children().last() + { |
269 | | - resolveStrategy = Closure.DELEGATE_FIRST |
270 | | - name project.name |
271 | | - description project.description |
272 | | - url "https://github.com/${project.org}/${project.name}" |
273 | | - scm { |
274 | | - url "https://github.com/${project.org}/${project.name}" |
275 | | - connection "scm:git:git://github.com/${project.org}/${project.name}" |
276 | | - developerConnection "scm:git:ssh:git@github.com/${project.org}/${project.name}" |
277 | | - } |
278 | | - licenses { |
279 | | - license { |
280 | | - name 'New BSD License' |
281 | | - url 'https://github.com/diffplug/matconsolectl/blob/v4.4.0/LICENSE' |
282 | | - distribution 'repo' |
283 | | - } |
284 | | - } |
285 | | - developers { |
286 | | - developer { |
287 | | - id 'nedtwigg' |
288 | | - name 'Ned Twigg' |
289 | | - email 'ned.twigg@diffplug.com' |
290 | | - } |
291 | | - } |
292 | | - } |
293 | | - } |
294 | | - } |
295 | | - } |
296 | | - if (isSnapshot) { |
297 | | - // upload snapshots to oss.sonatype.org |
298 | | - repositories { maven { |
299 | | - url = 'https://oss.sonatype.org/content/repositories/snapshots' |
300 | | - credentials { |
301 | | - username = cred('nexus_user') |
302 | | - password = cred('nexus_pass') |
303 | | - } |
304 | | - } } |
305 | | - } |
306 | | -} |
307 | | - |
308 | | -if (!isSnapshot) { |
309 | | - // upload releases to bintray and then mavenCentral |
310 | | - bintray { |
311 | | - user = cred('bintray_user') |
312 | | - key = cred('bintray_pass') |
313 | | - publications = ['mavenJava'] |
314 | | - publish = true |
315 | | - pkg { |
316 | | - repo = 'opensource' |
317 | | - name = project.name |
318 | | - userOrg = project.org |
319 | | - version { |
320 | | - name = project.version |
321 | | - mavenCentralSync { |
322 | | - user = cred('nexus_user') |
323 | | - password = cred('nexus_pass') |
324 | | - } |
325 | | - } |
326 | | - } |
327 | | - } |
328 | | - |
329 | | - publish.dependsOn(bintrayUpload) |
330 | | - bintrayUpload.dependsOn(['generatePomFileForMavenJavaPublication', jar, sourcesJar, javadocJar]) |
331 | | -} |
332 | | - |
333 | | -// helps external scripts detect version |
334 | | -task printVersion { |
335 | | - doLast { |
336 | | - println version |
337 | | - } |
338 | | -} |
339 | | - |
340 | | -allprojects { |
341 | | - tasks.withType(JavaCompile).configureEach { |
342 | | - options.incremental = true |
343 | | - } |
344 | | - |
345 | | -} |
0 commit comments