@@ -18,20 +18,85 @@ plugins {
1818 id ' maven-publish'
1919}
2020
21- javadoc {
22- options. encoding = ' UTF-8'
23- // remove this to see all the missing tags/parameters.
24- options. addStringOption(' Xdoclint:none' , ' -quiet' )
25- }
21+ allprojects {
22+ // apply plugin: "java"
23+ apply plugin : " com.diffplug.spotless"
24+
25+ sourceCompatibility = ' 8'
26+ targetCompatibility = ' 8'
27+
28+ spotless {
29+ lineEndings ' UNIX'
30+ format ' misc' , {
31+ target ' **/*.gradle' , ' **/*.md' , ' **/.gitignore'
32+ targetExclude ' CONTRIBUTORS.md' , ' src/main/scripts/container/README.md' , ' build/**/*' , ' out/**/*'
33+ // all-contributor bot adds non-indented code
34+ trimTrailingWhitespace()
35+ indentWithTabs(4 ) // or spaces. Takes an integer argument if you don't like 4
36+ endWithNewline()
37+ }
38+ java {
39+ importOrder ' java' , ' javax' , ' org' , ' com' , ' dev.jbang' , ' '
40+ removeUnusedImports()
41+ eclipse(). configFile new File (rootProject. projectDir, " misc/eclipse_formatting_nowrap.xml" )
42+ targetExclude ' build/**/*'
43+ }
44+ format ' xml' , {
45+ targetExclude ' build/test-results' , fileTree(' .idea' )
46+ target ' **/*.xml' , ' **/*.nuspec'
47+ }
48+ }
2649
27- repositories {
28- mavenCentral()
29- // maven { url 'https://jitpack.io' }
30- }
50+ javadoc {
51+ options. encoding = ' UTF-8'
52+ // remove this to see all the missing tags/parameters.
53+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
54+ }
55+
56+ repositories {
57+ mavenCentral()
58+ // maven { url 'https://jitpack.io' }
59+ }
3160
32- java {
33- withJavadocJar()
34- withSourcesJar()
61+ java {
62+ withJavadocJar()
63+ withSourcesJar()
64+ }
65+
66+ test {
67+ useJUnitPlatform()
68+ jvmArgs = [
69+ " --add-opens" , " java.base/java.lang=ALL-UNNAMED" ,
70+ " --add-opens" , " java.base/java.util=ALL-UNNAMED"
71+ ]
72+ // testLogging.showStandardStreams = true
73+
74+ /* testLogging {
75+ events "passed", "skipped", "failed"
76+ exceptionFormat "full"
77+ }*/
78+ // timeout.set(Duration.ofSeconds(60))
79+
80+ jacoco {
81+ enabled = false
82+ }
83+ }
84+
85+ jacoco {
86+ toolVersion = ' 0.8.7'
87+ }
88+
89+ jacocoTestReport {
90+ afterEvaluate {
91+ executionData fileTree(project. rootDir. absolutePath). include(" **/build/jacoco/*.exec" )
92+ }
93+
94+ reports {
95+ html. required = true
96+ xml. required = true
97+ csv. required = false
98+ }
99+ }
35100}
36101
37102publishing {
@@ -77,6 +142,22 @@ publishing {
77142 url = layout. buildDirectory. dir(' staging-deploy' )
78143 }
79144 }
145+
146+ // to enable reproducible builds
147+ tasks. withType(AbstractArchiveTask ) {
148+ preserveFileTimestamps = false
149+ reproducibleFileOrder = true
150+ }
151+
152+ compileJava {
153+ options. encoding = ' UTF-8'
154+ options. compilerArgs << " -Xlint:unchecked"
155+ }
156+
157+ compileTestJava {
158+ options. encoding = ' UTF-8'
159+ options. compilerArgs << " -Xlint:unchecked"
160+ }
80161}
81162
82163sourceSets {
@@ -90,6 +171,8 @@ sourceSets {
90171sourceSets. main. compileClasspath + = sourceSets. java9. output. classesDirs;
91172
92173dependencies {
174+ implementation project(' :jdkmanager' )
175+
93176 implementation ' com.offbytwo:docopt:0.6.0.20150202'
94177
95178 implementation ' org.apache.commons:commons-text:1.11.0'
@@ -110,6 +193,7 @@ dependencies {
110193 runtimeOnly " eu.maveniverse.maven.mima.runtime:standalone-static:2.4.20"
111194
112195 testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:5.10.1"
196+ testImplementation project(' :jdkmanager' )
113197 testImplementation " org.junit.jupiter:junit-jupiter:5.10.1"
114198 testImplementation " com.github.stefanbirkner:system-rules:1.17.2"
115199 testImplementation " org.hamcrest:hamcrest-library:2.2"
@@ -126,12 +210,6 @@ buildConfig {
126210 buildConfigField(' String' , ' VERSION' , provider { " \" ${ project.version} \" " })
127211}
128212
129- // to enable reproducible builds
130- tasks. withType(AbstractArchiveTask ) {
131- preserveFileTimestamps = false
132- reproducibleFileOrder = true
133- }
134-
135213sonarqube {
136214 properties {
137215 property " sonar.projectKey" , " jbangdev_jbang"
@@ -140,28 +218,6 @@ sonarqube {
140218 }
141219}
142220
143- spotless {
144- lineEndings ' UNIX'
145- format ' misc' , {
146- target ' **/*.gradle' , ' **/*.md' , ' **/.gitignore'
147- targetExclude ' CONTRIBUTORS.md' , ' src/main/scripts/container/README.md' , ' build/**/*' , ' out/**/*'
148- // all-contributor bot adds non-indented code
149- trimTrailingWhitespace()
150- indentWithTabs(4 ) // or spaces. Takes an integer argument if you don't like 4
151- endWithNewline()
152- }
153- java {
154- importOrder ' java' , ' javax' , ' org' , ' com' , ' dev.jbang' , ' '
155- removeUnusedImports()
156- eclipse(). configFile " misc/eclipse_formatting_nowrap.xml"
157- targetExclude ' build/**/*'
158- }
159- format ' xml' , {
160- targetExclude ' build/test-results' , fileTree(' .idea' )
161- target ' **/*.xml' , ' **/*.nuspec'
162- }
163- }
164-
165221task versionTxt () {
166222 doLast {
167223 new File (project. buildDir, " tmp/version.txt" ). text = project. version
@@ -218,16 +274,6 @@ jar {
218274 duplicatesStrategy = DuplicatesStrategy . EXCLUDE
219275}
220276
221- compileJava {
222- options. encoding = ' UTF-8'
223- options. compilerArgs << " -Xlint:unchecked"
224- }
225-
226- compileTestJava {
227- options. encoding = ' UTF-8'
228- options. compilerArgs << " -Xlint:unchecked"
229- }
230-
231277compileJava9Java {
232278 sourceCompatibility = 9
233279 targetCompatibility = 9
@@ -251,42 +297,6 @@ shadowJar {
251297 archiveFileName = " ${ archiveBaseName.get()} .${ archiveExtension.get()} "
252298}
253299
254- test {
255- useJUnitPlatform()
256- jvmArgs = [
257- " --add-opens" , " java.base/java.lang=ALL-UNNAMED" ,
258- " --add-opens" , " java.base/java.util=ALL-UNNAMED"
259- ]
260- // testLogging.showStandardStreams = true
261-
262- /* testLogging {
263- events "passed", "skipped", "failed"
264- exceptionFormat "full"
265- }*/
266- // timeout.set(Duration.ofSeconds(60))
267-
268- jacoco {
269- enabled = false
270- }
271- }
272-
273- jacoco {
274- toolVersion = ' 0.8.7'
275- }
276-
277- jacocoTestReport {
278- afterEvaluate {
279- executionData fileTree(project. rootDir. absolutePath). include(" **/build/jacoco/*.exec" )
280- }
281-
282- reports {
283- html. required = true
284- xml. required = true
285- csv. required = false
286- }
287- }
288-
289-
290300task karateExecute (type : JavaExec ) {
291301 classpath = sourceSets. test. runtimeClasspath
292302 mainClass = System . properties. getProperty(' mainClass' )
@@ -435,5 +445,3 @@ tasks.named("spotlessXml").configure { dependsOn("chocolatey") }
435445tasks. named(" spotlessXml" ). configure { dependsOn(" copyITests" ) }
436446
437447group = " dev.jbang"
438- sourceCompatibility = ' 8'
439- targetCompatibility = ' 8'
0 commit comments