-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.gradle
90 lines (78 loc) · 2.99 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
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository
plugins {
id 'groovy'
id 'io.github.gradle-nexus.publish-plugin'
}
version = projectVersion
ext.set('grailsVersion', libs.versions.grails.get())
ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT'))
ext.set('isReleaseVersion', !isSnapshot)
String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION')
if (customGroovyVersion) {
logger.warn("Using custom Groovy version: $customGroovyVersion")
}
if (isReleaseVersion) {
nexusPublishing {
String nexusUser = System.getenv('SONATYPE_USERNAME')
String nexusPass = System.getenv('SONATYPE_PASSWORD')
String nexusStagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID')
repositories {
sonatype {
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
username = nexusUser
password = nexusPass
stagingProfileId = nexusStagingProfileId
}
}
}
}
subprojects {
apply plugin: 'groovy'
version = rootProject.version
if (customGroovyVersion) {
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.apache.groovy') {
details.useVersion(customGroovyVersion)
}
}
}
}
repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
if (customGroovyVersion?.endsWith('-SNAPSHOT')) {
// Used for testing locally against the latest snapshot of Groovy
// Usage: ./gradlew build -P"groovyVersion=X.X.X-SNAPSHOT"
maven {
name = 'ASF Snapshot repo'
url = 'https://repository.apache.org/content/repositories/snapshots'
}
}
if (System.getenv('GITHUB_MAVEN_PASSWORD') && !grailsVersion.endsWith('-SNAPSHOT')) {
// Used during the release process to access modules temporarily published to GitHub Packages
logger.warn("Adding Grails Core Repo to $name")
maven {
url = 'https://maven.pkg.github.com/grails/grails-core'
credentials {
username = 'DOES_NOT_MATTER'
password = System.getenv('GITHUB_MAVEN_PASSWORD')
}
}
}
}
dependencies {
implementation platform(libs.grails.bom)
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
//do not generate extra load on Nexus with new staging repository if signing fails
tasks.withType(InitializeNexusStagingRepository).configureEach {
shouldRunAfter tasks.withType(Sign)
}