-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
78 lines (62 loc) · 2.13 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
plugins {
id 'net.researchgate.release'
id 'checkstyle'
id 'com.adarshr.test-logger' version '4.0.0'
}
// Set Global Versions
// org.springframework.boot:spring-boot-gradle-plugin
// org.springframework.boot:spring-boot-dependencies
ext.springBootVersion = "3.4.2"
// io.spring.gradle:dependency-management-plugin
ext.springBootDependencyManagementPluginVersion = "1.1.7"
// com.github.ben-manes:gradle-versions-plugin
ext.gradleVersionsPluginVersion = "0.52.0"
// checkstyle
ext.checkstyleVersion = "10.18.1"
// com.adarshr:gradle-test-logger-plugin
ext.testLoggerPluginVersion = "4.0.0"
subprojects {
// See https://github.com/gradle/gradle/issues/22317
tasks.withType(Test).configureEach {
it.jvmArgs = ["--add-opens=java.base/java.lang=ALL-UNNAMED"]
}
repositories {
mavenCentral()
gradlePluginPortal()
}
apply plugin: 'maven-publish'
apply plugin: 'com.adarshr.test-logger'
publishing.repositories {
maven {
name = "GitHubPackages"
url "https://maven.pkg.github.com/ministryofjustice/${rootProject.name}"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
release {
tagTemplate = '$name-$version'
}
tasks.withType(AbstractPublishToMaven).tap {
configureEach {
doLast {
logger.lifecycle("Published Maven artifact: " +
"${publication.groupId}:${publication.artifactId}:${publication.version}")
}
}
}
}
task updateSnapshotVersion {
doLast {
def gitHash = "git rev-parse --short HEAD".execute().text.trim()
def propertiesFile = file('gradle.properties')
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))
def currentVersion = properties.getProperty('version')
def newVersion = currentVersion.replace('-SNAPSHOT', "-${gitHash}-SNAPSHOT")
properties.setProperty('version', newVersion)
properties.store(propertiesFile.newWriter(), null)
}
}