1
1
import net.e175.klaus.zip.ZipPrefixer
2
+ import org.owasp.dependencycheck.gradle.extension.AnalyzerExtension
2
3
3
4
buildscript {
4
5
repositories {
@@ -15,7 +16,7 @@ plugins {
15
16
id " java"
16
17
id ' java-library'
17
18
id " idea"
18
- id " com.github.johnrengelman. shadow" version " 8.1.1 "
19
+ id " com.gradleup. shadow" version " 8.3.3 "
19
20
id " application"
20
21
21
22
// test
@@ -51,9 +52,17 @@ idea {
51
52
/* *********************************************************************************************************************\
52
53
* Main
53
54
**********************************************************************************************************************/
54
- mainClassName = " io.kestra.cli.App"
55
- sourceCompatibility = 21
56
- targetCompatibility = 21
55
+ final mainClassName = " io.kestra.cli.App"
56
+ final targetJavaVersion = JavaVersion . VERSION_21
57
+
58
+ application {
59
+ mainClass = mainClassName
60
+ }
61
+
62
+ java {
63
+ sourceCompatibility = targetJavaVersion
64
+ targetCompatibility = targetJavaVersion
65
+ }
57
66
58
67
dependencies {
59
68
implementation project(" :cli" )
@@ -67,8 +76,10 @@ allprojects {
67
76
if (it. name != ' platform' ) {
68
77
group " io.kestra"
69
78
70
- sourceCompatibility = 21
71
- targetCompatibility = 21
79
+ java {
80
+ sourceCompatibility = targetJavaVersion
81
+ targetCompatibility = targetJavaVersion
82
+ }
72
83
73
84
repositories {
74
85
mavenCentral()
@@ -153,8 +164,10 @@ subprojects {
153
164
if (it. name != ' platform' ) {
154
165
apply plugin : " com.adarshr.test-logger"
155
166
156
- sourceCompatibility = 21
157
- targetCompatibility = 21
167
+ java {
168
+ sourceCompatibility = targetJavaVersion
169
+ targetCompatibility = targetJavaVersion
170
+ }
158
171
159
172
dependencies {
160
173
// Platform
@@ -325,9 +338,12 @@ dependencyCheck {
325
338
failBuildOnCVSS = 7
326
339
327
340
// disable the .NET assembly analyzer as otherwise it wants to analyze EXE file
328
- analyzers {
329
- assemblyEnabled = false
330
- }
341
+ analyzers(new Action<AnalyzerExtension > () {
342
+ @Override
343
+ void execute (AnalyzerExtension analyzerExtension ) {
344
+ analyzerExtension. assemblyEnabled = false
345
+ }
346
+ })
331
347
332
348
// configure a suppression file
333
349
suppressionFile = " $projectDir /owasp-dependency-suppressions.xml"
@@ -340,7 +356,7 @@ dependencyCheck {
340
356
**********************************************************************************************************************/
341
357
allprojects {
342
358
gradle. projectsEvaluated {
343
- tasks. withType(JavaCompile ) {
359
+ tasks. withType(JavaCompile ). configureEach {
344
360
options. encoding = " UTF-8"
345
361
options. compilerArgs. add(" -parameters" )
346
362
options. compilerArgs. add(" -Xlint:all" )
@@ -349,7 +365,7 @@ allprojects {
349
365
}
350
366
}
351
367
352
- tasks. withType(JavaCompile ) {
368
+ tasks. withType(JavaCompile ). configureEach {
353
369
options. encoding = " UTF-8"
354
370
options. compilerArgs. add(" -parameters" )
355
371
}
@@ -394,20 +410,25 @@ shadowJar.dependsOn 'ui:assembleFrontend'
394
410
/* *********************************************************************************************************************\
395
411
* Executable Jar
396
412
**********************************************************************************************************************/
397
- def executableDir = file( " ${ buildDir } / executable" )
398
- def executable = file(" ${ buildDir } / executable/${ project.name} -${ project.version} " )
413
+ def executableDir = layout . buildDirectory . dir( " executable" )
414
+ def executable = layout . buildDirectory . file(" executable/${ project.name} -${ project.version} " ). get() . asFile
399
415
400
- task writeExecutableJar ( ) {
416
+ tasks . register( ' writeExecutableJar ' ) {
401
417
group " build"
402
418
description " Write an executable jar from shadow jar"
403
419
dependsOn = [shadowJar]
404
420
421
+ final shadowJarFile = tasks. shadowJar. outputs. files. singleFile
422
+ inputs. file shadowJarFile
423
+ outputs. file executable
424
+ outputs. cacheIf { true }
425
+
405
426
doFirst {
406
- executableDir. mkdirs()
427
+ executableDir. get() . asFile . mkdirs()
407
428
}
408
429
409
430
doLast {
410
- executable. setBytes(file( " ${ buildDir } /libs/ ${ project.name } - ${ project.version } .jar " ) . readBytes())
431
+ executable. setBytes(shadowJarFile . readBytes())
411
432
ByteArrayOutputStream executableBytes = new ByteArrayOutputStream ()
412
433
executableBytes. write(" \n : <<END_OF_KESTRA_SELFRUN\r\n " . getBytes())
413
434
executableBytes. write(file(" gradle/jar/selfrun.bat" ). readBytes())
@@ -419,13 +440,13 @@ task writeExecutableJar() {
419
440
}
420
441
}
421
442
422
- task executableJar ( type : Zip ) {
443
+ tasks . register( ' executableJar ' , Zip ) {
423
444
group " build"
424
445
description " Zip the executable jar"
425
446
dependsOn = [writeExecutableJar]
426
447
427
448
archiveFileName = " ${ project.name} -${ project.version} .zip"
428
- destinationDirectory = file( " ${ buildDir } / archives" )
449
+ destinationDirectory = layout . buildDirectory . dir( ' archives' )
429
450
430
451
from executableDir
431
452
archiveClassifier. set(null )
@@ -434,8 +455,9 @@ task executableJar(type: Zip) {
434
455
/* *********************************************************************************************************************\
435
456
* Standalone
436
457
**********************************************************************************************************************/
437
- task runLocal ( type : JavaExec ) {
458
+ tasks . register( ' runLocal ' , JavaExec ) {
438
459
group = " application"
460
+ description = " Run Kestra as server local"
439
461
classpath = project(" :cli" ). sourceSets. main. runtimeClasspath
440
462
mainClass = mainClassName
441
463
environment ' MICRONAUT_ENVIRONMENTS' , ' override'
@@ -470,7 +492,7 @@ subprojects {
470
492
}
471
493
}
472
494
473
- task sourcesJar( type : Jar ) {
495
+ tasks . register( ' sourcesJar ' , Jar ) {
474
496
dependsOn = [' :core:copyGradleProperties' ]
475
497
dependsOn = [' :ui:assembleFrontend' ]
476
498
archiveClassifier. set(' sources' )
@@ -479,12 +501,12 @@ subprojects {
479
501
sourcesJar. dependsOn ' :core:copyGradleProperties'
480
502
sourcesJar. dependsOn ' :ui:assembleFrontend'
481
503
482
- task javadocJar( type : Jar ) {
504
+ tasks . register( ' javadocJar ' , Jar ) {
483
505
archiveClassifier. set(' javadoc' )
484
506
from javadoc
485
507
}
486
508
487
- task testsJar( type : Jar ) {
509
+ tasks . register( ' testsJar ' , Jar ) {
488
510
archiveClassifier. set(' tests' )
489
511
from sourceSets. test. output
490
512
}
0 commit comments