-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild.gradle
710 lines (587 loc) · 24.8 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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
/* ******************************************************************************
* Copyright (c) 2019, 2020 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Caks <[email protected]> - initial API and implementation
* ******************************************************************************/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.httpcomponents:httpclient:4.5.9'
classpath 'org.apache.httpcomponents:httpmime:4.5.9'
classpath 'org.standardout:bnd-platform:1.7.0'
classpath 'com.squareup.okhttp3:okhttp:4.8.0'
}
}
plugins {
id 'java'
id 'eclipse'
id 'maven-publish'
id 'visual-studio'
}
apply plugin: 'org.standardout.bnd-platform'
apply from: 'versioning.gradle'
version = "${Versioning.version}-SNAPSHOT"
task showInfo {
doLast {
println "$version"
//println "Versioning: ${Versioning}"
println "Release Tag: ${getReleaseTag()}"
println "Version: ${getVersion()}"
println "Qualifier: ${getQualifier()}"
println "last commit: ${getGitTimestamp()}"
println " -> ${toTimestamp(getGitTimestamp())}"
}
}
showInfo.group = "DriftFX"
showInfo.description = "Outputs the version information used for building"
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
}
def isUseSignedArtifacts() {
project.hasProperty("useSignedArtifacts")
}
def getMultireleaseJarPath() {
isUseSignedArtifacts() ? "$buildDir/signed/org.eclipse.fx.drift.jar" : "$buildDir/libs/org.eclipse.fx.drift.jar"
}
def getJava8() {
"${System.getenv('JAVA_HOME_8')}/bin/javac"
}
def getJava11() {
"${System.getenv('JAVA_HOME_11')}/bin/javac"
}
subprojects.each { subproject -> evaluationDependsOn( subproject.path ) }
task copyNativesMacos(type: Copy) {
from "native-repo/org/eclipse/fx/drift/driftfx_release_macos/$Versioning.fullVersion/driftfx_release_macos-${Versioning.fullVersion}.dylib"
into 'org.eclipse.fx.drift/src/main/resources/native'
rename { fileName -> fileName.replaceAll("driftfx_release_macos-.*[.]dylib", "libdriftfx.dylib") }
}
task copyNativesWindows(type: Copy) {
from "native-repo/org/eclipse/fx/drift/driftfx_release_windows/$Versioning.fullVersion/driftfx_release_windows-${Versioning.fullVersion}.dll"
into 'org.eclipse.fx.drift/src/main/resources/native'
rename { fileName -> fileName.replaceAll("driftfx_release_windows-.*[.]dll", "driftfx.dll") }
}
task copyNativesLinux(type: Copy) {
from "native-repo/org/eclipse/fx/drift/driftfx_release_linux/$Versioning.fullVersion/driftfx_release_linux-${Versioning.fullVersion}.so"
into 'org.eclipse.fx.drift/src/main/resources/native'
rename { fileName -> fileName.replaceAll("driftfx_release_linux-.*[.]so", "libdriftfx.so") }
}
task copyNatives {
group = "DriftFX"
description = "Copies the available natives from ./native-repo to ./org.eclipse.fx.drift/src/main/resources/native/"
dependsOn = [
copyNativesMacos,
copyNativesWindows,
copyNativesLinux
]
}
task buildMultireleaseJar(type: Jar, dependsOn: [
copyNatives,
project(':org.eclipse.fx.drift').tasks['classes'],
project(':org.eclipse.fx.drift.java8').tasks['classes'],
project(':org.eclipse.fx.drift.java11').tasks['classes']
]) {
archiveBaseName = 'org.eclipse.fx.drift'
archiveVersion = '' //"$fullVersion"
from( project(':org.eclipse.fx.drift').sourceSets.main.output ) {
exclude 'org/eclipse/fx/drift/DriftFXSurface.class'
exclude 'org/eclipse/fx/drift/internal/DriftUtil.class'
}
from project(':org.eclipse.fx.drift.java8').sourceSets.main.output
into('META-INF/versions/11') {
from project(':org.eclipse.fx.drift.java11').sourceSets.main.output
}
// manual header
manifest {
attributes(
"Manifest-Version": "1.0",
'Bundle-ManifestVersion': '2',
'Bundle-SymbolicName': 'org.eclipse.fx.drift',
'Bundle-Version': "${Versioning.bundleVersion}",
'Bundle-License': 'https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt',
"Multi-Release": true,
'Export-Package': "org.eclipse.fx.drift;version=\"${Versioning.version}\",org.eclipse.fx.drift.impl;version=\"${Versioning.version}\",org.eclipse.fx.drift.util;version=\"${Versioning.version}\"",
'Import-Package': "org.osgi.framework,org.osgi.framework.wiring",
'Private-Package': 'org.eclipse.fx.drift.internal',
'Bundle-ActivationPolicy': 'lazy',
'Bundle-Activator': 'org.eclipse.fx.drift.internal.OSGiActivator',
'Bundle-NativeCode': 'native/driftfx.dll;osname=Win32;processor=x86-64,native/libdriftfx.so;osname=Linux;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=aarch64',
'Drift-Version': "$Versioning.version",
'Drift-Qualifier': "$Versioning.qualifier",
'Drift-Timestamp': "$Versioning.timestamp",
'Drift-SHA': "$Versioning.gitSHA"
)
}
}
buildMultireleaseJar.group = "DriftFX"
buildMultireleaseJar.description = "builds the Multi-Release JAR of DriftFX. This is the main artifact."
task buildMultireleaseSourcesJar(type: Jar) {
archiveBaseName = 'org.eclipse.fx.drift'
archiveVersion = ''
archiveClassifier = 'sources'
from( project(':org.eclipse.fx.drift').sourceSets.main.allSource ) {
exclude 'native'
exclude 'org/eclipse/fx/drift/DriftFXSurface.java'
exclude 'org/eclipse/fx/drift/internal/DriftUtil.java'
}
from project(':org.eclipse.fx.drift.java8').sourceSets.main.allSource
into('META-INF/versions/11') {
from project(':org.eclipse.fx.drift.java11').sourceSets.main.allSource
}
manifest {
attributes(
"Manifest-Version": "1.0",
"Eclipse-SourceBundle": "org.eclipse.fx.drift;version=\"${Versioning.bundleVersion}\"",
'Bundle-ManifestVersion': '2',
'Bundle-SymbolicName': 'org.eclipse.fx.drift',
'Bundle-Version': "${Versioning.bundleVersion}",
'Bundle-License': 'https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt',
"Multi-Release": true,
'Export-Package': "org.eclipse.fx.drift;version=\"${Versioning.version}\",org.eclipse.fx.drift.impl;version=\"${Versioning.version}\",org.eclipse.fx.drift.util;version=\"${Versioning.version}\"",
'Import-Package': "org.osgi.framework,org.osgi.framework.wiring",
'Private-Package': 'org.eclipse.fx.drift.internal',
'Bundle-ActivationPolicy': 'lazy',
'Bundle-Activator': 'org.eclipse.fx.drift.internal.OSGiActivator',
'Bundle-NativeCode': 'native/driftfx.dll;osname=Win32;processor=x86-64,native/libdriftfx.so;osname=Linux;processor=x86-64,native/libdriftfx.dylib;osname=MacOSX;processor=x86-64',
'Drift-Version': "$Versioning.version",
'Drift-Qualifier': "$Versioning.qualifier",
'Drift-Timestamp': "$Versioning.timestamp",
'Drift-SHA': "$Versioning.gitSHA"
)
}
}
buildMultireleaseSourcesJar.group = "DriftFX"
buildMultireleaseSourcesJar.description = "builds the Sources JAR"
task downloadGithubArtifact {
outputs.files(
"$buildDir/downloaded/github-artifacts.zip",
"$buildDir/downloaded/native-repo.zip")
doLast {
def runId = System.getenv('GITHUB_RUN_ID')
def runArtifacts = github.getArtifacts(runId)
def artifactUnsigned = runArtifacts.artifacts.find { it.name == 'artifact-unsigned' }
github.downloadArtifact(artifactUnsigned.archive_download_url, "$buildDir/downloaded/github-artifacts.zip")
def artifactNativeRepo = runArtifacts.artifacts.find { it.name == 'native-repo'}
github.downloadArtifact(artifactNativeRepo.archive_download_url, "$buildDir/downloaded/native-repo.zip")
}
}
downloadGithubArtifact.group = "DriftFX"
downloadGithubArtifact.description = "downloads the github pipeline artificats for a specific GITHUB_RUN_ID (set in env)"
task askGithub {
doLast {
def runId = System.getenv('GITHUB_RUN_ID')
def runArtifacts = github.getArtifacts(runId)
println runArtifacts
println '---'
println groovy.json.JsonOutput.toJson(runArtifacts)
}
}
askGithub.group = "DriftFX"
askGithub.description = "outputs information to a specific github run using the GITHUB_RUN_ID (set in env)"
task unzipGithubArtifact(type: Copy) {
dependsOn downloadGithubArtifact
from {
zipTree("$buildDir/downloaded/github-artifacts.zip")
}
into "$buildDir/unsigned"
}
unzipGithubArtifact.group = "DriftFX"
unzipGithubArtifact.description = "unzips the downloaded github artifacts"
task unzipNativeRepo(type: Copy) {
dependsOn downloadGithubArtifact
inputs.files("$buildDir/downloaded/native-repo.zip")
from {
zipTree("$buildDir/downloaded/native-repo.zip")
}
into "$buildDir/native-repo"
}
unzipNativeRepo.group = "DriftFX"
unzipNativeRepo.description = "unzips native-repo"
task signJarFiles() {
group "DriftFX"
description "signs the Jar using the eclipse jar signing service"
dependsOn unzipGithubArtifact
outputs.dir("$buildDir/signed").withPropertyName("outputDir")
doLast {
def sourceFile = "$buildDir/unsigned/org.eclipse.fx.drift.jar"
def targetFile = "$buildDir/signed/org.eclipse.fx.drift.jar"
mkdir "$buildDir/signed"
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'curl', '-sS', '-o', targetFile, '-F', "file=@$sourceFile", 'https://cbi.eclipse.org/jarsigner/sign'
standardOutput = stdout
}
copy {
from "$buildDir/libs/org.eclipse.fx.drift-sources.jar"
into "$buildDir/signed/"
}
}
}
platform {
eclipseMirror = 'http://philippkatz.de/eclipse-p2-minimal.tar.gz'
featureId = 'org.eclipse.fx.drift.feature'
featureName = 'DriftFX'
featureVersion = Versioning.bundleVersion
featureProvider = "BestSolution"
categoryId = 'org.eclipse.fx.drift'
categoryName = 'e(fx)clipse Drift'
fetchSources = true
useBndHashQualifiers = false
useFeatureHashQualifiers = false
//generatePlatformFeature = false
bundle file(getMultireleaseJarPath())
//bundle buildMultireleaseSourcesJar.outputs.files
/* bundle file("$buildDir/downloaded/org.eclipse.fx.drift.jar"), {
bnd {
version = '2.5.0'
symbolicName = 'the.super.drift'
}
}*/
/*
feature (id: 'org.eclipse.fx.drift.feature', name: 'DriftFX Runtime', version: '') {
plugin file("$buildDir/downloaded/org.eclipse.fx.drift.jar")
}
*/
}
ext.github = new GithubAPI(githubOrga, githubRepo, System.getenv('GITHUB_ACCESS_TOKEN'))
import okhttp3.*
ext.client = new OkHttpClient()
abstract class ExecuteRemoteJenkins extends DefaultTask {
@Internal
def client = new OkHttpClient()
@Input
abstract Property<String> getJobUrl()
@Input
abstract MapProperty<String, String> getBuildParameters()
@TaskAction
def execute() {
def queueUri = triggerBuild()
println "Job queued."
def jobUri
while (true) {
Thread.sleep(5000L)
try {
def queueData = queryQueue(queueUri)
if (queueData.why) {
println "Jenkings Queue: $queueData.why"
}
if (queueData.executable) {
jobUri = queueData.executable.url
break
}
} catch (java.net.SocketTimeoutException e) {
println "Jenkins Queue: $e.message"
}
}
println "Job started."
def info
while (true) {
Thread.sleep(5000L)
try {
info = queryBuildInfo(jobUri);
println "Jenkins Build: $info.duration / $info.estimatedDuration ( duration / est. duration )"
if (info.building == false) {
break;
}
} catch (java.net.SocketTimeoutException e) {
println "Jenkins Build: $e.message"
}
}
println "Jenkins Job $info.id finished; result=$info.result"
assert info.result == "SUCCESS"
}
def computeTriggerUrl() {
def toParams = {
it.collect { "$it.key=$it.value" } join "&"
}
return jobUrl.get() + "/buildWithParameters?" + toParams(buildParameters.get())
}
def queryQueue(uri) {
def req = new Request.Builder().url(uri + "api/json?now=${System.currentTimeMillis()}").build()
def res = client.newCall(req).execute()
assert res.code == 200
return new groovy.json.JsonSlurper().parseText(res.body.string())
}
def queryBuildInfo(jobUri) {
def req = new Request.Builder().url(jobUri + "api/json?now=${System.currentTimeMillis()}").build()
def res = client.newCall(req).execute()
assert res.code == 200
return new groovy.json.JsonSlurper().parseText(res.body.string());
}
def triggerBuild() {
def req = new Request.Builder().url(computeTriggerUrl()).build()
def res = client.newCall(req).execute()
assert res.code == 201
def result = res.header("location")
res.close()
return result
}
}
task testIt(type: ExecuteRemoteJenkins) {
def jenkinsToken = System.getenv("JENKINS_ACCESS_TOKEN")
def runId = System.getenv('GITHUB_RUN_ID')
def githubToken = System.getenv('GH_ACCESS_TOKEN')
def githubRef = System.getenv('GITHUB_REF')
if (jenkinsToken == null) jenkinsToken = 'asdf'
if (runId == null) runId = 'b'
if (githubToken == null) githubToken = 'c'
if (githubRef == null) githubRef = 'd'
jobUrl = "https://ci.eclipse.org/efxclipse/job/test_gradle"
buildParameters = [
token: jenkinsToken,
GITHUB_RUN_ID: runId,
GITHUB_ACCESS_TOKEN: githubToken,
GIT_SHA: Versioning.gitSHA,
GITHUB_REF: githubRef
]
}
task notifyJenkins(type: ExecuteRemoteJenkins) {
def jenkinsToken = System.getenv("JENKINS_ACCESS_TOKEN")
def runId = System.getenv('BUILD_RUN_ID')
def githubToken = System.getenv('GITHUB_TOKEN')
def githubRef = System.getenv('GITHUB_REF')
def headBranch = System.getenv('HEAD_BRANCH')
jobUrl = "https://ci.eclipse.org/efxclipse/job/efxclipse_drift_build"
buildParameters = [
token: jenkinsToken,
GITHUB_RUN_ID: runId,
GITHUB_ACCESS_TOKEN: githubToken,
GIT_SHA: Versioning.gitSHA,
GITHUB_REF: githubRef,
GITHUB_REF_NAME: headBranch
]
}
task notifyJenkins2() {
doLast {
def jenkinsToken = System.getenv("JENKINS_ACCESS_TOKEN")
def runId = System.getenv('GITHUB_RUN_ID')
def githubToken = System.getenv('GH_ACCESS_TOKEN')
def githubRef = System.getenv('GITHUB_REF')
def req = new Request.Builder()
.url("https://ci.eclipse.org/efxclipse/job/efxclipse_drift_build/buildWithParameters?token=$jenkinsToken&GITHUB_ACCESS_TOKEN=$githubToken&GITHUB_RUN_ID=$runId&GIT_SHA=${Versioning.gitSHA}&GITHUB_REF=$githubRef")
.build()
def res = client.newCall(req).execute()
assert res.code == 201
println "triggered jenkins build"
}
}
notifyJenkins.group = "DriftFX"
notifyJenkins.description = "Notifies the eclipse build system of a successful github run"
ext {
UpdateSiteReleaseBase = "efxclipse/driftfx/releases"
UpdateSiteNightlyBase = "efxclipse/driftfx/nightly"
UpdateSitePath = Versioning.releaseMode ? "$UpdateSiteReleaseBase/$Versioning.version" : "$UpdateSiteNightlyBase/$Versioning.qualifier"
}
task deployUpdateSite() {
dependsOn updateSite
doLast {
def remoteHost = "[email protected]"
def remoteDirectory = "/home/data/httpd/download.eclipse.org"
def target = "$remoteDirectory/$UpdateSitePath"
println "Deploying update site to '$target'"
// create update site directory
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'ssh', remoteHost, 'mkdir', '-p', target
standardOutput = stdout
}
println stdout.toString().trim()
// copy update site
stdout = new ByteArrayOutputStream()
exec {
commandLine 'scp', '-r', 'build/updatesite/features', 'build/updatesite/plugins', 'build/updatesite/content.jar', 'build/updatesite/artifacts.jar', "$remoteHost:$target"
standardOutput = stdout
}
println stdout.toString().trim()
}
}
deployUpdateSite.group = "DriftFX"
deployUpdateSite.description = "Deploys the update site to download.eclipse.org."
/*
task updateCompositeUpdateSite() {
doLast {
def remoteHost = "[email protected]"
def compositeDirectory = "/home/data/httpd/download.eclipse.org"
def target = "${compositeDirectory}/${UpdateSiteBaseNightly}"
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'ssh', "$remoteHost", "ls", "$target"
standardOutput = stdout
}
}
}
*/
task createDistribution(type: Zip) {
dependsOn updateSiteZip
//dependsOn unzipNativeRepo
from file('LICENSE')
from file("$buildDir/updatesite.zip")
into('driftcpp') {
from "native-driftcpp/src/main/public"
from "native-driftcpp/src/main/cpp"
}
// into('libs/debug') {
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_debug_windows") {
// include "**/*${Versioning.fullVersion}.dll"
// include "*/*${Versioning.fullVersion}.lib"
// eachFile { path = "libs/debug/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_debug_linux") {
// include "**/*${Versioning.fullVersion}.so"
// eachFile { path = "libs/debug/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_debug_macos") {
// include "**/*${Versioning.fullVersion}.dylib"
// eachFile { path = "libs/debug/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// }
// into('libs/release') {
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_release_windows") {
// include "**/*${Versioning.fullVersion}.dll"
// include "*/*${Versioning.fullVersion}.lib"
// eachFile { path = "libs/release/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_release_linux") {
// include "**/*${Versioning.fullVersion}.so"
// eachFile { path = "libs/release/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// from fileTree("$buildDir/native-repo/org/eclipse/fx/drift/driftcpp_release_macos") {
// include "**/*${Versioning.fullVersion}.dylib"
// eachFile { path = "libs/release/$name" } // flatten into libs
// includeEmptyDirs = false
// }
// }
archiveBaseName = "dist"
archiveVersion = Versioning.fullVersion
}
createDistribution.group = "DriftFX"
createDistribution.description = "Creates the dist.zip to be attached to a github release."
task publishGithubRelease() {
doLast {
if (Versioning.releaseMode) {
def release = github.createRelease(Versioning.releaseTag, Versioning.gitSHA, "DriftFX $Versioning.version", """
### p2 Update Site
https://download.eclipse.org/$UpdateSitePath
### Maven
Repo: https://repo.eclipse.org/content/groups/efxclipse
Group Id: `org.eclipse.fx`
Artifact Id: `org.eclipse.fx.drift`
Version: `$Versioning.version`
""".stripIndent().trim(), Versioning.isPreRelease)
def releaseId = release.id
println "Created Release $releaseId"
def uploadUrl = release.upload_url
def distZip = file("build/distributions/dist-${Versioning.version}.zip")
def r = github.uploadAsset(release.upload_url,
"application/zip", distZip,
"driftfx-dist-${Versioning.version}.zip",
null)
def modify = github.modifyRelease(releaseId, Versioning.releaseTag, false)
println new groovy.json.JsonBuilder(modify).toPrettyString()
} else {
// no github release for nightly builds
/*
def release = github.createRelease(Versioning.timestamp, Versioning.gitSHA, "DriftFX Nightly $Versioning.qualifier", """
This is a nightly build. (The Version number 999.0.0 indicates nightly builds)
### p2 Update Site
https://download.eclipse.org/$UpdateSitePath
### Maven
Repo: https://repo.eclipse.org/content/groups/efxclipse
Group Id: `org.eclipse.fx`
Artifact Id: `org.eclipse.fx.drift`
Version: `$Versioning.version-SNAPSHOT`
""".stripIndent().trim(), true)
println new groovy.json.JsonBuilder(release).toPrettyString()
def releaseId = release.id
println "Created Nightly Release $releaseId"
def uploadUrl = release.upload_url
def distZip = file("build/distributions/dist-${Versioning.fullVersion}.zip")
def r = github.uploadAsset(release.upload_url,
"application/zip", distZip,
"driftfx-dist-${Versioning.fullVersion}.zip",
null)
println "going to modify release..."
def modify = github.modifyRelease(releaseId, Versioning.timestamp, false)
println new groovy.json.JsonBuilder(modify).toPrettyString()
*/
}
}
}
publishGithubRelease.group = "DriftFX"
publishGithubRelease.description = "Publishes a release to github. Only works in releaseMode (The checked out state is on a release tag)"
task undoRelease() {
doLast {
def modify = github.modifyRelease("${System.getenv("RELID")}", true)
println new groovy.json.JsonBuilder(modify).toPrettyString()
}
}
undoRelease.group = "DriftFX"
undoRelease.description = "Revokes a github release by settings its draft flag to true. The release is specified by setting RELID in env."
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.eclipse.fx'
artifactId = 'org.eclipse.fx.drift'
version = "${Versioning.version}${Versioning.releaseMode ? '' : '-SNAPSHOT'}"
pom {
name = 'DriftFX'
url = 'https://github.com/eclipse-fx/efxclipse-drift'
licenses {
license {
name = 'Eclipse Public License - v 2.0'
url = 'https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt'
}
}
}
artifact(getMultireleaseJarPath()) {
extension 'jar'
}
artifact buildMultireleaseSourcesJar
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/$githubOrga/$githubRepo"
credentials {
username = "redrezo"
password = "${System.getenv('GITHUB_ACCESS_TOKEN')}"
}
}
maven {
name = "MavenInProject"
url = "./maven-repo"
}
if (project.hasProperty('eclipseRepoUsername')) {
maven {
name = 'EclipseNexus'
def releasesUrl = 'https://repo.eclipse.org/content/repositories/efxclipse-releases'
def snapshotsUrl = 'https://repo.eclipse.org/content/repositories/efxclipse-snapshots'
url = Versioning.releaseMode ? releasesUrl : snapshotsUrl
credentials {
username eclipseRepoUsername
password eclipseRepoPassword
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}