-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
319 lines (253 loc) · 13.6 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
plugins {
id "org.jetbrains.intellij" version "1.17.3"
id "java"
id "org.jsonschema2pojo" version "1.2.1"
}
group = findProperty("pluginGroup")
version = findProperty("pluginVersion")
allprojects {
group 'de.gebit.plugins.autoconfig'
ext {
lombokVersion = '1.18.30'
commonsIoVersion = '2.12.0'
intellijPluginVersion = '1.17.3'
jakartaJwsVersion = '2.1.0'
javaxPersistenceVersion = '2.2'
jUnitJupiterVersion = '5.10.1'
intellijType = 'IC' // IC: Community Edition, IU: Ultimate Edition.
intellijVersion = '2023.2' // https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellijSinceBuild = '232.10300.40'
}
}
patchPluginXml {
version = findProperty("pluginVersion")
sinceBuild = "232.1"
// untilBuild = "242.*"
def bodyMatcher = /(?s)(?<=<body>).*(?=<\/body>)/
pluginDescription = new File("metadata/description.html").text.findAll(bodyMatcher)?[0]
changeNotes = new File("metadata/changelog.html").text.findAll(bodyMatcher)?[0]
}
tasks.register('printVersion') {
doLast {
println(rootProject.version)
}
}
signPlugin {
certificateChain = System.getenv("CERTIFICATE_CHAIN")
privateKey = System.getenv("PRIVATE_KEY")
password = System.getenv("PRIVATE_KEY_PASSWORD")
}
publishPlugin {
token = System.getenv("PUBLISH_TOKEN")
setHidden(findProperty("hidden").toBoolean())
channels = findProperty("preRelease").toBoolean() ? ["autoconfig-beta"] : ["default", "autoconfig-beta"]
}
repositories {
mavenCentral()
}
// Must match Groovy version bundled with IntelliJ (see IJ/Contents/lib/groovy.jar/META-INF/org.codehaus.groovy.runtime.ExtensionModule)
ext.groovyVersion = "3.0.19"
intellij {
// Available IDE versions: https://www.jetbrains.com/intellij-repository/releases and https://www.jetbrains.com/intellij-repository/snapshots
version = System.getenv().getOrDefault("IJ_VERSION",
"2023.2"
)
pluginName = "AutoconfigPlugin"
downloadSources = true
updateSinceUntilBuild = false
instrumentCode = false
plugins = [
"java",
"Git4Idea",
"junit",
"org.jetbrains.plugins.yaml",
"org.jetbrains.idea.maven",
"org.sonarlint.idea:10.8.1.79205"
]
}
buildSearchableOptions.enabled = false // Disable because it takes a long time and the plugin doesn't need it
runIde.jbrVariant.set("jcef") // JVM with Java Chromium Embedded Framework because why not (see also https://github.com/JetBrains/gradle-intellij-plugin#running-dsl)
dependencies {
// Required if generating JSR-303 annotations
implementation 'javax.validation:validation-api:1.1.0.CR2'
implementation 'jakarta.validation:jakarta.validation-api:3.0.0'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1'
compileOnly("org.projectlombok:lombok:${lombokVersion}")
testCompileOnly("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
}
jsonSchema2Pojo {
// Location of the JSON Schema file(s). This may refer to a single file or a directory of files.
source = files("${sourceSets.main.output.resourcesDir}/schema")
// 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 = 'de.gebit.plugins.autoconfig.model'
// 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 globally disable additional properties.
includeAdditionalProperties = false
// Whether to include a javax.annotation.Generated (Java 8 and lower) or
// javax.annotation.processing.Generated (Java 9+) in on generated types (default true).
// See also: targetVersion.
includeGeneratedAnnotation = true
// Whether to generate builder-style methods of the form withXxx(value) (that return this),
// alongside the standard, void-return setters.
generateBuilders = false
// If set to true, then the gang of four builder pattern will be used to generate builders on
// generated classes. Note: This property works in collaboration with generateBuilders.
// If generateBuilders is false then this property will not do anything.
useInnerClassBuilders = false
// 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
// 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)
// - jsonb (apply annotations from the JSON-B 1 library)
// - jsonb2 (apply annotations from the JSON-B 2 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'
// 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
// Whether to include JSR-305 annotations, for schema rules like Nullable, NonNull, etc
includeJsr305Annotations = true
// The Level of inclusion to set in the generated Java types (for Jackson serializers)
// inclusionLevel = InclusionLevel.NON_NULL
// Whether to use the 'title' property of the schema to decide the class name (if not
// set to true, the filename and property names are used).
useTitleAsClassname = true
// 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 = false
// 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
// Whether to include java.beans.ConstructorProperties on generated constructors
includeConstructorPropertiesAnnotation = false
// Whether to include only 'required' fields in generated constructors
constructorsRequiredPropertiesOnly = false
// Whether to *add* a constructor that includes only 'required' fields, alongside other constructors.
// This property is irrelevant if constructorsRequiredPropertiesOnly = true
includeRequiredPropertiesConstructor = false
// Whether to *add* a constructor that includes all fields, alongside other constructors.
// This property is irrelevant if constructorsRequiredPropertiesOnly = true
includeAllPropertiesConstructor = false
// Include a constructor with the class itself as a parameter, with the expectation that all properties
// from the originating class will assigned to the new class.
// This property is irrelevant if constructorsRequiredPropertiesOnly = true
includeCopyConstructor = false
// 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 = true
// 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
// Which characters to use as 'path fragment delimiters' when trying to resolve a ref
refFragmentPathDelimiters = "#/."
// Whether to include json type information; often required to support polymorphic type handling.
// By default the type information is stored in the @class property, this can be overridden using
// deserializationClassProperty in the schema
includeJsonTypeInfoAnnotation = false
// Whether to use java.util.Optional for getters on properties that are not required
useOptionalForGetters = false
// properties to exclude from generated toString
toStringExcludes = []
// What Java version to target with generated source code (1.6, 1.8, 9, 11, etc).
// By default, the version will be taken from the Gradle Java plugin's 'sourceCompatibility',
// which (if unset) itself defaults to the current JVM version
targetVersion = "17"
// A sort order to use when reading input files, one of SourceSortOrder.OS (allow the OS to decide sort
// order), SourceSortOrder.FILES_FIRST or SourceSortOrder.SUBDIRS_FIRST
// sourceSortOrder = SourceSortOrder.OS
// Whether to use annotations from jakarta.validation package instead of javax.validation package
// when adding JSR-303 annotations to generated Java types
useJakartaValidation = false
}
sourceSets {
// Keep Groovy and Kotlin API source code in separate source sets, otherwise
// compilation fails because of inter-dependencies between Kotlin and Groovy files which confuse compiler,
// even though overall dependencies are unidirectional: pluginApiKotlin -> pluginApiGroovy -> main.
main {
java { srcDir "src/main" }
resources { srcDir "resources" }
}
}
compileJava {
sourceCompatibility = "17"
targetCompatibility = "17"
}