-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
233 lines (208 loc) · 8.73 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
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.3.3/userguide/building_java_projects.html
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
// Maven publish plugins helps us to publish our library to maven repos
id 'maven-publish'
// the signing plugin helps us to crypto-sign on our package (PGP key)
id 'signing'
// the git-version plugin helps us to publish an auto version (taken from git tags)
id 'com.palantir.git-version' version '0.13.0'
// auto release to maven central (skip sonatype manual nexus release process)
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
// translate json schemas to java classes
// id "org.jsonschema2pojo" version "1.1.3"
}
// It is important to set the group and the version to the root project
// so the nexus-publish plugin can detect if it is a snapshot version
// or not in order to select the correct repository where artifacts will
// be published
group = 'io.permit'
// sets the java package version automatically (looks at the git repo, latest tags, commit hashes, etc)
version gitVersion()
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
// sources are required by maven central in order to accept the package
withSourcesJar()
// javadoc jar is required by maven central in order to accept the package
withJavadocJar()
}
// package dependencies
dependencies {
// swagger
implementation 'io.swagger:swagger-annotations:1.6.5'
// http client
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
// json serialization and deserialization
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'io.gsonfire:gson-fire:1.8.5'
// openapi annotations
implementation 'javax.ws.rs:jsr311-api:1.1.1'
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
implementation 'org.openapitools:jackson-databind-nullable:0.2.3'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:1.3.5"
// logger
implementation 'ch.qos.logback:logback-classic:1.4.14'
implementation 'ch.qos.logback:logback-core:1.4.14'
implementation 'org.slf4j:slf4j-api:1.7.33'
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
// These dependencies are used internally, and not exposed to consumers on their own compile classpath.
// google standard java library
implementation 'com.google.guava:guava:32.0.0-jre'
}
//jsonSchema2Pojo {
// // Location of the JSON Schema file(s). This may refer to a single file or a directory of files.
// source = files("schemas/")
//
// // 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("src/main/java")
//
// // 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 = 'io.permit.sdk.openapi.models'
//
// // 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 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
//
// // 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
//
// // Whether to generate builder-style methods of the form withXxx(value) (that return this),
// // alongside the standard, void-return setters.
// generateBuilders = true
//
// // 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 include hashCode and equals methods in generated Java types.
// includeHashcodeAndEquals = false
//
// // Whether to include a toString method in generated Java types.
// includeToString = false
//
// // Whether to include getters or to omit these accessor methods and create public fields instead.
// includeGetters = false
//
// // Whether to include setters or to omit these accessor methods and create public fields instead.
// includeSetters = false
//
// // Whether to use java.util.Optional for getters on properties that are not required
// useOptionalForGetters = true
//
// // Whether to generate constructors or not.
// includeConstructors = true
//
// // Whether to include only 'required' fields in generated constructors
// constructorsRequiredPropertiesOnly = true
//
// annotationStyle = 'gson'
//
// // Whether to initialize Set and List fields as empty collections, or leave them as null.
// initializeCollections = false
//}
publishing {
repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/permitio/permit-java"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
maven(MavenPublication) {
groupId = 'io.permit'
artifactId = 'permit-sdk-java'
from components.java
pom {
name = "Permit.io Java SDK"
description = 'Java SDK for Permit.io: fullstack permissions for cloud native applications'
url = 'https://permit.io'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'asafc'
name = 'Asaf Cohen'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/permitio/permit-java'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = System.getenv("NEXUS_TOKEN_USERNAME")
password = System.getenv("NEXUS_TOKEN_PASSWORD")
}
}
}
signing {
def GPG_SIGNING_KEY = findProperty("signingKey") ?: System.getenv("GPG_SIGNING_KEY")
def GPG_SIGNING_PASSPHRASE = findProperty("signingPassword") ?: System.getenv("GPG_SIGNING_PASSPHRASE")
useInMemoryPgpKeys(GPG_SIGNING_KEY, GPG_SIGNING_PASSPHRASE)
sign publishing.publications.maven
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
tasks.named('jar') {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}