-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
225 lines (178 loc) · 9.66 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
plugins {
id 'java'
id 'maven-publish'
id 'com.github.eirnym.js2p' version '1.0'
id 'org.ajoberstar.grgit' version '4.1.0'
id "org.sonatype.gradle.plugins.scan" version "2.2.1"
}
group = 'org.alvearie.hri'
version = '3.2-2.0.3'
ext.ossPassword = findProperty("SONATYPE_OSS_PASSWORD") ?: System.getenv("SONATYPE_OSS_PASSWORD")
ext.branch = System.getenv('ACTIONS_BRANCH') != null
? System.getenv('ACTIONS_BRANCH')
: grgit.open(currentDir: project.rootDir).branch.current.name
if (System.getenv('ACTIONS_TAG') == null || System.getenv('ACTIONS_TAG') == "") {
version = "${branch}-SNAPSHOT"
} else if (System.getenv('ACTIONS_TAG') == "v${version}") {
version = "${version}"
} else {
throw new InvalidUserDataException(String.format("The tag '%s' does not match with the current release version '%s'",System.getenv('TRAVIS_TAG'),"${version}"));
}
println "api-spec version: ${version}"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// Required if generating Jackson 2 annotations
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
}
jsonSchema2Pojo {
// Whether to allow 'additional' properties to be supported in classes by adding a map to
// hold these. This is true by default, meaning that the schema rule 'additionalProperties'
// controls whether the map is added. Set this to false to globabally disable additional properties.
includeAdditionalProperties = false
// Whether to generate builder-style methods of the form withXxx(value) (that return this),
// alongside the standard, void-return setters.
generateBuilders = true
// Whether to use primitives (long, double, boolean) instead of wrapper types where possible
// when generating bean properties (has the side-effect of making those properties non-null).
usePrimitives = false
// Location of the JSON Schema file(s). This may refer to a single file or a directory of files.
source = files("${project.projectDir}/notifications/batchNotification.json", "${project.projectDir}/notifications/invalidRecord.json")
// Target directory for generated Java source files. The plugin will add this directory to the
// java source set so the compiler will find and compile the newly generated source files.
targetDirectory = file("${project.buildDir}/generated-sources/js2p")
// Package name used for generated Java classes (for types where a fully qualified name has not
// been supplied in the schema using the 'javaType' property).
targetPackage = 'org.alvearie.hri.api'
// The characters that should be considered as word delimiters when creating Java Bean property
// names from JSON property names. If blank or not set, JSON properties will be considered to
// contain a single word when creating Java Bean property names.
propertyWordDelimiters = [] as char[]
// Whether to use the java type long (or Long) instead of int (or Integer) when representing the
// JSON Schema type 'integer'.
useLongIntegers = false
// Whether to use the java type BigInteger when representing the JSON Schema type 'integer'. Note
// that this configuration overrides useLongIntegers
useBigIntegers = false
// Whether to use the java type double (or Double) instead of float (or Float) when representing
// the JSON Schema type 'number'.
useDoubleNumbers = true
// Whether to use the java type BigDecimal when representing the JSON Schema type 'number'. Note
// that this configuration overrides useDoubleNumbers
useBigDecimals = false
// Whether to include hashCode and equals methods in generated Java types.
includeHashcodeAndEquals = true
// Whether to include a toString method in generated Java types.
includeToString = true
// The style of annotations to use in the generated Java types. Supported values:
// - jackson (alias of jackson2)
// - jackson2 (apply annotations from the Jackson 2.x library)
// - jackson1 (apply annotations from the Jackson 1.x library)
// - gson (apply annotations from the Gson library)
// - moshi1 (apply annotations from the Moshi 1.x library)
// - none (apply no annotations at all)
annotationStyle = 'jackson'
// A fully qualified class name, referring to a custom annotator class that implements
// org.jsonschema2pojo.Annotator and will be used in addition to the one chosen
// by annotationStyle. If you want to use the custom annotator alone, set annotationStyle to none.
customAnnotator = 'org.jsonschema2pojo.NoopAnnotator'
// Whether to include JSR-303/349 annotations (for schema rules like minimum, maximum, etc) in
// generated Java types. Schema rules and the annotation they produce:
// - maximum = @DecimalMax
// - minimum = @DecimalMin
// - minItems,maxItems = @Size
// - minLength,maxLength = @Size
// - pattern = @Pattern
// - required = @NotNull
// Any Java fields which are an object or array of objects will be annotated with @Valid to
// support validation of an entire document tree.
includeJsr303Annotations = false
// The type of input documents that will be read. Supported values:
// - jsonschema (schema documents, containing formal rules that describe the structure of JSON data)
// - json (documents that represent an example of the kind of JSON data that the generated Java types
// will be mapped to)
// - yamlschema (JSON schema documents, represented as YAML)
// - yaml (documents that represent an example of the kind of YAML (or JSON) data that the generated Java types
// will be mapped to)
sourceType = 'jsonschema'
// Whether to empty the target directory before generation occurs, to clear out all source files
// that have been generated previously. <strong>Be warned</strong>, when activated this option
// will cause jsonschema2pojo to <strong>indiscriminately delete the entire contents of the target
// directory (all files and folders)</strong> before it begins generating sources.
removeOldOutput = true
// The character encoding that should be used when writing the generated Java source files
outputEncoding = 'UTF-8'
// Whether to use {@link org.joda.time.DateTime} instead of {@link java.util.Date} when adding
// date type fields to generated Java types.
useJodaDates = false
// Whether to add JsonFormat annotations when using Jackson 2 that cause format "date", "time", and "date-time"
// fields to be formatted as yyyy-MM-dd, HH:mm:ss.SSS and yyyy-MM-dd'T'HH:mm:ss.SSSZ respectively. To customize these
// patterns, use customDatePattern, customTimePattern, and customDateTimePattern config options or add these inside a
// schema to affect an individual field
formatDateTimes = true
formatDates = true
formatTimes = true
// Whether to initialize Set and List fields as empty collections, or leave them as null.
initializeCollections = true
// Whether to add a prefix to generated classes.
classNamePrefix = ""
// Whether to add a suffix to generated classes.
classNameSuffix = ""
// An array of strings that should be considered as file extensions and therefore not included in class names.
fileExtensions = [] as String[]
// Whether to generate constructors or not.
includeConstructors = false
// **EXPERIMENTAL** Whether to make the generated types Parcelable for Android
parcelable = false
// Whether to make the generated types Serializable
serializable = false
// Whether to include getters or to omit these accessor methods and create public fields instead.
includeGetters = true
// Whether to include setters or to omit these accessor methods and create public fields instead.
includeSetters = false
// Whether to include dynamic getters, setters, and builders or to omit these methods.
includeDynamicAccessors = false
// Whether to include dynamic getters or to omit these methods.
includeDynamicGetters = false
// Whether to include dynamic setters or to omit these methods.
includeDynamicSetters = false
// Whether to include dynamic builders or to omit these methods.
includeDynamicBuilders = false
// What type to use instead of string when adding string properties of format "date" to Java types
dateType = "java.time.LocalDate"
// What type to use instead of string when adding string properties of format "date-time" to Java types
dateTimeType = "java.time.OffsetDateTime"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = 'hri-api-batch-notification'
}
}
repositories {
maven {
name = "GitHubPackages"
url 'https://maven.pkg.github.com/Alvearie/hri-api-spec'
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
ossIndexAudit {
username = '[email protected]'
password = "${ossPassword}"
allConfigurations = true // if true includes the dependencies in all resolvable configurations. By default is false, meaning only 'compileClasspath', 'runtimeClasspath', 'releaseCompileClasspath' and 'releaseRuntimeClasspath' are considered
useCache = true // true by default
cacheExpiration = 'PT86400S' // note: time in seconds (24hrs); 12 hours if omitted. It must follow the Joda Time specification at https://www.javadoc.io/doc/joda-time/joda-time/2.10.4/org/joda/time/Duration.html#parse-java.lang.String-
colorEnabled = true // if true prints vulnerability description in color. By default is true.
printBanner = true // if true will print ASCII text banner. By default is true.
// Vulnerabilities that can safely be ignored
//excludeVulnerabilityIds = [ ]
// list containing coordinate of components which if vulnerable should be ignored
//excludeCoordinates = [ ]
}