-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
110 lines (94 loc) · 3.93 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
plugins {
id 'org.asciidoctor.jvm.convert' version '4.0.0'
id 'org.ajoberstar.git-publish' version '3.0.0'
id 'org.javamodularity.moduleplugin' version '1.8.10' apply false
id 'org.openjfx.javafxplugin' version '0.0.13' apply false
id 'org.beryx.jlink' version '2.25.0' apply false
id 'com.github.hierynomus.license' version '0.16.1' apply false
}
buildScan {
if (System.getenv('CI')) {
publishAlways()
tag 'CI'
}
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
rootProject.ext.signJPackageImages = signJPackageImages.toBoolean() // create boolean in ext from property string
logger.warn "rootProject.ext.signJPackageImages = ${rootProject.ext.signJPackageImages}"
allprojects {
apply plugin: 'java'
apply plugin: 'groovy'
version = supernautVersion // set in gradle.properties
group = 'app.supernaut'
repositories {
mavenCentral()
}
dependencies {
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation "org.apache.groovy:groovy:${groovyVersion}"
testRuntimeOnly "net.bytebuddy:byte-buddy:1.11.20" // allows Spock to mock classes (in addition to interfaces)
testRuntimeOnly "org.objenesis:objenesis:3.2" // Allow Spock to mock classes with constructor arguments
testRuntimeOnly "org.slf4j:slf4j-jdk14:${slf4jVersion}" // Runtime implementation of slf4j
}
java {
toolchain {
// `languageVersion` is used to configure the "Java Toolchain" used for the build. This includes `javac`,
// `jlink`, and the `jpackage` tool.
// See `gradle.properties` for the setting of `javaToolchainVersion` and other setting that are used
// to find and/or download JDK versions.
languageVersion = JavaLanguageVersion.of(javaToolchainVersion)
vendor = JvmVendorSpec.matching(javaToolchainVendor)
}
withJavadocJar()
withSourcesJar()
}
compileJava {
options.release = 11
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
}
test {
useJUnitPlatform() // We're using Spock 2.0 and JUnit 5
}
}
apply from: 'gradle/licenseCheck.gradle'
apply from: 'gradle/javadoc.gradle'
apply from: 'gradle/asciidoctor.gradle'
apply from: 'gradle/github-pages.gradle'
apply from: 'gradle/maven-publish.gradle'
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all subprojects
reportOn subprojects*.test
}
build.dependsOn subprojects.build
task buildCI {
dependsOn build, testReport,
mergedJavadoc,
subprojects.collect { it.tasks.matching { it.name == 'jlink'} }
}
task buildJPackages {
dependsOn buildCI, subprojects.collect { it.tasks.matching { it.name == 'jpackage'} }
}
/**
* Massage the version string based upon the current OS to be valid
* for the installer platforms for that OS. rpmbuild, MSI, and potentially
* others have restrictions on valid version strings.
*
* @param appVersion A typical Gradle version string
* @return a version string that should work for the currrent platform
*/
String normalizeAppVersion(final String appVersion) {
def os = org.gradle.internal.os.OperatingSystem.current()
if (os.linux) {
// Replace '-' with '.' for rpmbuild
return appVersion.replace('-', '.')
} else if (os.windows) {
// This is a hack attempt to assure the version conforms to MSI productVersion string rules
// See https://docs.microsoft.com/en-us/windows/win32/msi/productversion
// For now, we'll just remove '-SNAPSHOT' if present.
return appVersion.replaceAll('-SNAPSHOT$', '')
} else {
return appVersion.replaceAll('-SNAPSHOT$', '')
}
}