-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.gradle
More file actions
196 lines (167 loc) · 5.79 KB
/
build.gradle
File metadata and controls
196 lines (167 loc) · 5.79 KB
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
192
193
194
195
196
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// General Gradle Settings
////////////////////////////////////////////////////////////////////////////////////////////////////////////
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'groovy'
apply plugin: 'project-report'
apply plugin: 'com.spidasoftware.releaseNotes'
apply plugin: 'application'
group = 'com.spidasoftware'
version = '13.0.0-SNAPSHOT' // If you're changing the major version also change the currentVersion in ConverterUtils.
def schemaReleaseVersion = System.getenv("SCHEMA_RELEASE_VERSION")
if(schemaReleaseVersion){
println "Using ENV version $schemaReleaseVersion"
version = schemaReleaseVersion
}
description = "Schema"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceSets {
main {
groovy {
srcDir 'src/main/groovy'
}
resources {
srcDir 'resources'
}
}
test {
groovy {
srcDir 'src/test/groovy'
}
resources {
srcDir 'src/test/resources'
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Dependencies
////////////////////////////////////////////////////////////////////////////////////////////////////////////
buildscript {
repositories {
mavenCentral()
maven { url System.getenv("ARTIFACTORY_URL_EXPOSED") }
}
dependencies {
classpath (group: 'com.spidasoftware', name:'releaseNotes', version:'0.3-SNAPSHOT', changing:true)
}
}
application {
mainClass = 'com.spidasoftware.schema.validation.CommandLineValidator'
}
repositories {
mavenCentral()
maven { url System.getenv("ARTIFACTORY_URL_EXPOSED") }
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url System.getenv("ARTIFACTORY_URL_EXPOSED")
credentials {
username = System.getenv('ARTIFACTORY_USERNAME')
password = System.getenv('ARTIFACTORY_PASSWORD')
}
}
}
}
releaseNotes {
start = "git describe HEAD~1 --abbrev=0 --tags --match v*".execute().text.trim()
project = "147173"
}
dependencies {
implementation 'commons-codec:commons-codec:1.15'
implementation group: 'org.apache.ant', name: 'ant', version: '1.10.13'
implementation group: 'org.apache.ant', name: 'ant-launcher', version: '1.10.13'
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.5.14'
implementation (group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.22') {
exclude(module: 'slf4j-api')
}
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
implementation group: 'commons-io', name: 'commons-io', version:'2.21.0'
api 'com.github.java-json-tools:json-schema-core:1.2.14' // fge updated to java-json-tools - results schema does not parse
api 'org.mozilla:rhino:1.7.15.1' // replace the vulnerable version pulled in by json-schema-core
implementation 'com.networknt:json-schema-validator:1.0.30-SNAPSHOT'
api group: 'org.mongodb', name:'mongo-java-driver', version:'2.11.1'
implementation group: 'com.spidasoftware', name: 'schema-v4', version:'0.1'
testImplementation group: 'junit', name: 'junit', version:'4.13.2'
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.3-groovy-2.5'
testRuntimeOnly('net.bytebuddy:byte-buddy:1.14.2') // so spock can create mocks
testImplementation group: 'org.objenesis', name:'objenesis', version: '2.6'
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.2")
}
test {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
processTestResources {
duplicatesStrategy = DuplicatesStrategy.WARN
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Build Process
////////////////////////////////////////////////////////////////////////////////////////////////////////////
task buildInfo {
def cmd = "git rev-parse --short HEAD"
def proc = cmd.execute()
project.ext.revision = proc.text.trim()
cmd = "git show -s --format=%ct HEAD"
proc = cmd.execute()
project.ext.timestamp = proc.text.trim()
}
task assembleManifest(dependsOn:["buildInfo"]){
doLast {
jar {
manifest.attributes("VCSVersion": project.ext["revision"],
"VCSTimeStamp": project.ext["timestamp"],
"Version": version)
}
}
}
jar.dependsOn assembleManifest
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Command Line Tools
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Searches the project properties first (where the properties should be kept),
* then the system properties (where older integrations might expect them),
* and returns null if the property is not set.
*/
private String findPropertyAnywhere(Project project, String propertyName) {
return project.findProperty(propertyName) ?: System.getProperty(propertyName)
}
String csvFile = findPropertyAnywhere(project, 'file')
String schema = findPropertyAnywhere(project, 'schema')
String jsonFile = findPropertyAnywhere(project, 'jsonFile')
task csv(type: JavaExec) {
dependsOn classes
classpath = sourceSets.main.runtimeClasspath
mainClass = 'com.spidasoftware.schema.conversion.PoleCSVStationConverter'
standardInput = System.in
standardOutput = System.out
if(csvFile){
def file = new File("$csvFile")
args file.absolutePath
}
}
task validateJson(type: JavaExec) {
dependsOn classes
classpath = sourceSets.main.runtimeClasspath
mainClass = 'com.spidasoftware.schema.validation.CommandLineValidator'
standardInput = System.in
standardOutput = System.out
if (jsonFile && schema) {
def jFile = new File("$jsonFile")
args schema
args jFile.absolutePath
}
}
task printVersion() {
doLast {
println "SCHEMA_VERSION: ${version}"
}
}