-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
191 lines (157 loc) · 5.32 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* Copyright © 2019,2020 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Build file for latte
* A Gradle plugin for ABL based on PCT written in Groovy
*
* Based on:
* - https://docs.gradle.org/current/userguide/plugins.html
* - https://docs.gradle.org/current/userguide/custom_plugins.html
* - https://github.com/gradle/gradle/tree/master/subprojects/docs/src/samples/customPlugin/plugin
* - https://github.com/gradle/gradle/tree/master/subprojects/docs/src/samples/javaGradlePlugin
*/
plugins {
id 'com.gradle.build-scan' version '2.3'
id 'me.champeau.buildscan-recipes' version '0.2.3'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.11.0'
id 'nebula.release' version '6.3.5'
id "com.bmuschko.clover" version "2.2.3"
id "groovy"
}
version = "0.3.1"
group = 'oe.espresso'
ext {
vcsBaseUrl = 'https://github.com/progress/latte'
}
repositories {
jcenter()
}
dependencies {
clover 'org.openclover:clover:4.3.1'
testCompile(
'junit:junit:4.12',
'org.codehaus.groovy:groovy-all:2.5.7',
'org.spockframework:spock-core:1.3-groovy-2.5',
'net.bytebuddy:byte-buddy:1.9.12'
)
}
// gradle doesn't like java 11 so always use java 8
java {
targetCompatibility = JavaVersion.VERSION_1_8
}
// Configure OpenClover coverage plugin
// https://github.com/bmuschko/gradle-clover-plugin/blob/master/README.md
clover {
targetPercentage = '90%'
report {
html = true
}
}
cloverGenerateReport.doLast {
// display results so GitLab can parse to provide a badge
// http://openclover.org/doc/manual/4.2.0/ant--clover-log.html
ant.lifecycleLogLevel = 'INFO'
ant."clover-log"(initString: "$project.buildDir/${getInitString()}")
}
check.dependsOn(cloverGenerateReport)
cloverGenerateReport.mustRunAfter(test)
// Configure development and publishing helper plugins
// Inspired by: https://github.com/gradle/kotlin-dsl/blob/master/plugins/build.gradle.kts
class GradlePluginMetaData {
String name
String displayName
String id
String implementationClass
GradlePluginMetaData(String name, String displayName, String id, String implementationClass) {
this.name = name
this.displayName = displayName
this.id = id
this.implementationClass = implementationClass
}
}
def pluginList = [
new GradlePluginMetaData(
"${project.name}-base",
'A Gradle base plugin for ABL language support based on PCT',
'oe.espresso.latte-base',
'oe.espresso.latte.LatteBasePlugin'
),
new GradlePluginMetaData(
"${project.name}",
'A Gradle plugin for ABL language support based on PCT',
'oe.espresso.latte',
"oe.espresso.latte.LattePlugin"
)
]
pluginBundle {
website = 'https://github.com/progress/latte'
vcsUrl = vcsBaseUrl
tags = ['abl', 'pct', 'openedge']
description = "oe.espresso"
version = "${version}"
}
pluginList.each { plugin ->
// Configuration for the `java-gradle-plugin` plugin
// https://docs.gradle.org/4.3.1/userguide/javaGradle_plugin.html
gradlePlugin {
plugins {
create(plugin.id) {
id = plugin.id
displayName = 'oe.espresso.latte'
implementationClass = plugin.implementationClass
}
}
}
}
postRelease.dependsOn(publishPlugins)
publishPlugins.mustRunAfter(tasks.release)
// Configure nebula.release plugin
// https://github.com/nebula-plugins/nebula-release-plugin
/* The default versions for dev snapshots generated by nebula.release
* contain commit counts, name of the source branch and a tag for
* uncommitted changes, e.g.:
*
* 0.1.0-dev.1.dev.8.uncommitted+bug.9.publishing.runs.before.release.dfc09a7
*
* However the Gradle Plugin Portal restricts versions to a string that
* 1) is more than 1 and less than 20 characters long;
* 2) includes a number;
* 3) that matches the regular expression: [a-zA-Z0-9\-\.\[\]\:\+]*
*
* Customise the strategy to only include information that is most
* useful in determining the source that was used to produce the build.
* That is: stage, GitLab issue ID, commit ID. This relies on
* convention to name the branches starting with the GitLab issue ID.
*/
import nebula.plugin.release.NetflixOssStrategies
import org.ajoberstar.gradle.git.release.opinion.Strategies.PreRelease
def DEV_STRATEGY = NetflixOssStrategies.DEVELOPMENT.copyWith(
preReleaseStrategy: PreRelease.STAGE_FLOAT
)
release {
versionStrategy DEV_STRATEGY
defaultVersionStrategy = DEV_STRATEGY
}
nebulaRelease {
shortenedBranchPattern = /(?:(?:bug|chore|feature|refactor|release)(?:-|\/))?((?:\d+|.*))/
}
// Configure build-scans
// https://docs.gradle.com/build-scan-plugin/
buildScan {
if (System.getenv('CI')) {
publishAlways()
tag 'CI'
} else {
tag 'dev'
}
}
buildScanRecipes {
recipe('remote',
url: 'https://github.com/gimoh/gradle-buildscan-recipes/raw/1be41ba9fd9c684aef0b8c1e9bae716ef85038af/src/recipes/gitlab-ci.groovy',
cache: true
)
recipe('remote',
url: 'https://github.com/gimoh/gradle-buildscan-recipes/raw/46bf70d41c6caf0a99b7583443723bc056fa46a8/src/recipes/grgit.groovy',
cache: true,
baseUrl: "$vcsBaseUrl/commit"
)
}