Skip to content

Commit b3e335b

Browse files
committed
Move to reccomended format for gradle
1 parent f1c6d04 commit b3e335b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

build.gradle

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.springframework.boot.gradle.plugin.SpringBootPlugin
2+
13
import java.text.SimpleDateFormat
24

35
/*
@@ -57,7 +59,7 @@ allprojects {
5759
apply plugin: "io.spring.dependency-management"
5860
dependencyManagement {
5961
imports {
60-
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
62+
mavenBom SpringBootPlugin.BOM_COORDINATES
6163
}
6264
dependencies {
6365
dependency 'io.swagger.core.v3:swagger-annotations:2.2.20'
@@ -70,12 +72,12 @@ apply from: 'debug.gradle'
7072

7173
// skip subproject tasks by default when building jade-data-repo
7274
subprojects.each { s ->
73-
s.tasks.all {
75+
s.tasks.configureEach {
7476
task -> task.enabled = (System.getenv("ENABLE_SUBPROJECT_TASKS") != null)
7577
}
7678
}
7779

78-
def boolean isCiServer = System.getenv().containsKey("CI")
80+
boolean isCiServer = System.getenv().containsKey("CI")
7981

8082
java {
8183
sourceCompatibility = 17
@@ -88,7 +90,7 @@ if (hasProperty('buildScan')) {
8890
termsOfServiceAgree = 'yes'
8991
uploadInBackground = false
9092
publishAlways()
91-
def project = ""; def cluster = ""; def nschunk = "";
93+
def project = ""; def cluster = ""; def nschunk = ""
9294
if (System.getenv("NAMESPACEINUSE")) {
9395
project = "broad-jade-integration"
9496
cluster = "integration-master"
@@ -392,10 +394,10 @@ swaggerSources {
392394
}
393395
}
394396

395-
task generateVersionFile {
397+
tasks.register('generateVersionFile') {
396398
def properties = new Properties()
397399
def versionFile = file "src/main/resources/version.properties"
398-
properties.setProperty("semVer", project.version)
400+
properties.setProperty("semVer", project.getVersion().toString())
399401
properties.setProperty("gitHash", getGitHash())
400402
Writer writer = new FileWriter(versionFile, false)
401403
properties.store(writer, "DO NOT EDIT. Autogenerated by build.gradle.")
@@ -406,7 +408,7 @@ generateGrammarSource {
406408
arguments += ["-visitor", "-long-messages"]
407409
}
408410

409-
task unpack(type: Copy) {
411+
tasks.register('unpack', Copy) {
410412
dependsOn bootJar
411413
from(zipTree(tasks.bootJar.outputs.files.singleFile))
412414
into("build/dependency")
@@ -469,14 +471,14 @@ jib {
469471
container.creationTime = buildTime()
470472
}
471473

472-
def buildTime() {
474+
static def buildTime() {
473475
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'") // you can change it
474476
df.setTimeZone(TimeZone.getTimeZone("UTC"))
475477
return df.format(new Date())
476478
}
477479
// jib expects all classes to be under app/classes in the resulting image. this, combined with the extraDirectories
478480
// setting above will ensure that the generated classes end up in the right place when jib builds.
479-
task setupGeneratedDir(type: Copy) {
481+
tasks.register('setupGeneratedDir', Copy) {
480482
from file('build/classes/java/generated')
481483
into file('build/gen-expanded/app/classes')
482484
}
@@ -529,7 +531,7 @@ test {
529531
maxParallelForks = 2
530532
}
531533

532-
task testConnected(type: Test) {
534+
tasks.register('testConnected', Test) {
533535
useJUnitPlatform {
534536
includeTags 'bio.terra.common.category.Connected'
535537
}
@@ -547,7 +549,7 @@ task testConnected(type: Test) {
547549
maxHeapSize = "2g"
548550
}
549551

550-
task testIntegration(type: Test) {
552+
tasks.register('testIntegration', Test) {
551553
useJUnitPlatform {
552554
includeTags 'bio.terra.common.category.Integration'
553555
}
@@ -565,15 +567,15 @@ task testIntegration(type: Test) {
565567
outputs.upToDateWhen { false }
566568
}
567569

568-
task testUnit(type: Test) {
570+
tasks.register('testUnit', Test) {
569571
useJUnitPlatform {
570572
includeTags 'bio.terra.common.category.Unit'
571573
}
572574
maxParallelForks = 2
573575
outputs.upToDateWhen { false }
574576
}
575577

576-
task testOnDemand(type: Test) {
578+
tasks.register('testOnDemand', Test) {
577579
useJUnitPlatform {
578580
includeTags 'bio.terra.common.category.OnDemand'
579581
}
@@ -583,15 +585,15 @@ task testOnDemand(type: Test) {
583585
outputs.upToDateWhen { false }
584586
}
585587

586-
task testAll(type: Test) {
588+
tasks.register('testAll', Test) {
587589
useJUnitPlatform {
588590
// Note: explicitly not including OnDemand tests
589591
includeTags 'bio.terra.common.category.Connected', 'bio.terra.common.category.Unit'
590592
}
591593
outputs.upToDateWhen { false }
592594
}
593595

594-
task verifyPacts(type: Test) {
596+
tasks.register('verifyPacts', Test) {
595597
useJUnitPlatform {
596598
includeTags 'bio.terra.common.category.Pact'
597599
}

0 commit comments

Comments
 (0)