-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
executable file
·152 lines (131 loc) · 5.07 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import grails.views.gradle.json.JsonViewCompilerTask
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository
import java.time.Duration
plugins {
id 'groovy'
id 'java-library'
id 'io.github.gradle-nexus.publish-plugin'
id 'maven-publish'
id 'signing'
}
group = 'io.github.matrei'
ext.set('grailsVersion', libs.versions.grails.asProvider().get())
apply plugin: 'org.grails.grails-gsp'
apply plugin: 'org.grails.grails-web'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'org.grails.plugins.views-json'
repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
implementation libs.grails.interceptors
implementation libs.grails.views.json
runtimeOnly libs.grails.gsp
compileOnly libs.micronaut.inject.groovy
compileOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during compileGsonViews task
testImplementation libs.micronaut.inject.groovy
testImplementation libs.grails.testing.support.web
testRuntimeOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during test task
}
java {
sourceCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging { events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' }
reports.html.required = false
reports.junitXml.required = false
}
tasks.named('compileTestGroovy') {
dependsOn 'compileGsonViews'
}
tasks.named('compileGsonViews', JsonViewCompilerTask) {
packageName = 'inertia' // This is needed for the gson view to be resolved from plugin
}
tasks.withType(Groovydoc).configureEach {
dependsOn 'compileGsonViews'
}
tasks.named('bootJar') {
enabled = false // Plugins should not create a bootJar
}
tasks.named('jar', Jar) {
enabled = true // Enable the jar task again, as the bootJar task has been disabled
archiveClassifier = '' // Remove '-plain' suffix from jar file name
}
def javaComponent = components.named('java')
publishing {
publications {
register('inertiaPlugin', MavenPublication) {
from javaComponent.get()
versionMapping {
usage('java-api') { fromResolutionOf('runtimeClasspath') }
usage('java-runtime') { fromResolutionResult() }
}
pom {
name = 'Grails Adapter for Inertia.js'
description = 'Grails plugin with server-side adapter for Inertia.js'
url = 'https://github.com/matrei/grails-inertia-plugin'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'matrei'
name = 'Mattias Reichel'
email = 'mattias.reichel@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/matrei/grails-inertia-plugin.git'
developerConnection = 'scm:git:ssh://github.com:matrei/grails-inertia-plugin.git'
url = 'https://github.com/matrei/grails-inertia-plugin'
}
}
// dependency management shouldn't be included
pom.withXml {
def root = it.asElement()
root.getElementsByTagName('dependencyManagement').each { root.removeChild(it) }
}
}
}
}
ext.set('signing.keyId', System.getenv('SIGNING_KEY'))
ext.set('signing.password', System.getenv('SIGNING_PASSPHRASE'))
ext.set('isReleaseVersion', !version.toString().endsWith('-SNAPSHOT'))
def mavenPublication = publishing.publications.named('inertiaPlugin')
afterEvaluate {
signing {
required = { isReleaseVersion }
sign mavenPublication.get()
}
}
//do not generate extra load on Nexus with new staging repository if signing fails
tasks.withType(InitializeNexusStagingRepository).configureEach {
shouldRunAfter = tasks.withType(Sign)
}
if (isReleaseVersion && project.hasProperty('release')) {
nexusPublishing {
String sonatypeUsername = project.findProperty('sonatypeOssUsername') ?: ''
String sonatypePassword = project.findProperty('sonatypeOssPassword') ?: ''
String sonatypeStagingProfileId = project.findProperty('sonatypeOssStagingProfileId') ?: ''
repositories {
sonatype {
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
username = sonatypeUsername
password = sonatypePassword
stagingProfileId = sonatypeStagingProfileId
}
}
transitionCheckOptions {
maxRetries = 100 // Default 60
delayBetween = Duration.ofSeconds(5) // Default 10
}
}
}