-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
173 lines (149 loc) · 5.38 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import org.gosulang.gradle.build.VersionWriterTask
import java.nio.charset.StandardCharsets
plugins {
id 'com.gradle.plugin-publish' version "${gradlePublishPluginVersion}"
id 'net.researchgate.release' version "${researchgateReleaseGradlePluginVersion}"
id "org.gradlex.reproducible-builds" version "${reproducibleBuildsPluginVersion}"
id 'groovy'
}
wrapper {
distributionType = Wrapper.DistributionType.BIN // or .ALL
}
description = """Gosu language compiler for Gradle. Built with Gradle $gradleVersion.
This has also been tested with Gradle version(s): $project.testedVersions
Projects applying this plugin require a compile-time dependency on the gosu-core-api library.
This version requires $gosuVersion or greater.
Please include this in the dependencies closure:
dependencies {
implementation group: 'org.gosu-lang.gosu', name: 'gosu-core-api', version: '$project.gosuVersion'
}
"""
final boolean isSnapshot = project.version.endsWith('-SNAPSHOT')
boolean publishSnapshotToGwArtifactory = project.hasProperty('publishSnapshotToGwArtifactory')
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/' //for Gosu snapshot builds
}
}
dependencies {
testImplementation platform("org.junit:junit-bom:${junitPlatformVersion}")
testImplementation "org.junit.jupiter:junit-jupiter"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
testImplementation "junit:junit:${junitVersion}" //TODO refactor existing unit tests and get rid of junit 4
testImplementation "org.hamcrest:hamcrest-library:${hamcrestLibraryVersion}"
testImplementation "org.spockframework:spock-core:${spockCoreVersion}"
testImplementation "org.assertj:assertj-core:${assertjCoreVersion}"
testImplementation "org.opentest4j:opentest4j:${opentest4jVersion}"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of javaVersion
}
withSourcesJar()
withJavadocJar()
}
gradlePlugin {
plugins {
gosuPlugin {
id = 'org.gosu-lang.gosu'
implementationClass = 'org.gosulang.gradle.GosuPlugin'
displayName = 'Gosu Gradle Plugin'
description = project.description
tags.set(['gosu'])
}
}
}
//Test Helper Tasks
tasks.register('gradleVersionHelper', VersionWriterTask) {
propertyToRead = 'gradleVersion'
fallbackValue = project.gradle.gradleVersion
}
tasks.register('gosuVersionHelper', VersionWriterTask) {
propertyToRead = 'gosuVersion'
}
tasks.register('testedVersionsHelper', VersionWriterTask) {
propertyToRead = 'testedVersions'
}
dependencies {
testImplementation files(gradleVersionHelper) // Persist a file containing the gradleVersion
testImplementation files(gosuVersionHelper) // Persist a file containing the gosuVersion
testImplementation files(testedVersionsHelper) // Persist a file containing the testedVersions
}
test {
useJUnitPlatform()
testLogging {
events 'passed', 'failed', 'skipped'
}
environment('JAVA_TOOL_OPTIONS', '-Duser.language=en')
}
tasks.withType(AbstractCompile).configureEach {
options.with {
compilerArgs += ['-Xlint:unchecked']
deprecation = true
encoding = StandardCharsets.UTF_8
}
}
//constrain memory usage when running on CI server
if(System.getenv('CI') != null) {
tasks.withType(AbstractCompile).configureEach { //covers JavaCompile and GroovyCompile
options.fork = false
}
test {
maxHeapSize = '1g'
systemProperty 'org.gradle.testkit.debug', 'true' // prevents the testkit from spawning daemons and running out of memory
}
}
release {
git {
requireBranch.set('rel/.*')
}
tagTemplate = 'v${version}'
}
afterReleaseBuild.dependsOn publish, publishPlugins
publishing {
publications {
pluginMaven(MavenPublication) {
pom {
name = project.name
description = project.description
url = 'http://gosu-lang.github.io/'
scm {
connection = 'scm:git:[email protected]:gosu-lang/gosu-lang.git'
developerConnection = 'scm:git:[email protected]:gosu-lang/gosu-lang.git'
url = '[email protected]:gosu-lang/gosu-lang.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Kyle Moore'
email = '[email protected]'
organization = 'gosu-lang.org'
}
developer {
name = 'The Gosu Team'
email = '[email protected]'
organization = 'Guidewire Software, Inc.'
}
}
}
}
}
if (isSnapshot && publishSnapshotToGwArtifactory){
repositories {
maven {
url System.getenv('PUBLISH_TO_REPOSITORY_URL')
credentials {
username System.getenv('PUBLISH_WITH_USERNAME')
password System.getenv('PUBLISH_WITH_PASSWORD')
}
}
}
}
}