forked from eclipse-edc/IdentityHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
180 lines (157 loc) · 5.54 KB
/
build.gradle.kts
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
/*
* Copyright (c) 2022 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Microsoft Corporation - initial implementation
*
*/
plugins {
java
`java-library`
signing
`maven-publish`
id("org.gradle.crypto.checksum") version "1.4.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
repositories {
mavenCentral()
}
val projectGroup: String by project
val swagger: String by project
val rsApi : String by project
// these values are required for the project POM (for publishing)
val edcDeveloperId: String by project
val edcDeveloperName: String by project
val edcDeveloperEmail: String by project
val edcScmConnection: String by project
val edcWebsiteUrl: String by project
val edcScmUrl: String by project
val defaultVersion: String by project
// makes the project version overridable using the "-PidentityHubVersion..." flag. Useful for CI builds
val projectVersion: String = (project.findProperty("identityHubVersion") ?: defaultVersion) as String
var deployUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
if (projectVersion.contains("SNAPSHOT")) {
deployUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
}
subprojects{
afterEvaluate {
publishing {
publications.forEach { i ->
val mp = (i as MavenPublication)
mp.pom {
name.set(project.name)
description.set("edc :: ${project.name}")
url.set(edcWebsiteUrl)
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
developers {
developer {
id.set(edcDeveloperId)
name.set(edcDeveloperName)
email.set(edcDeveloperEmail)
}
}
scm {
connection.set(edcScmConnection)
url.set(edcScmUrl)
}
}
}
}
}
}
}
allprojects {
apply(plugin = "maven-publish")
version = projectVersion
group = projectGroup
repositories {
mavenCentral()
mavenLocal()
maven {
url = uri("https://maven.iais.fraunhofer.de/artifactory/eis-ids-public/")
}
maven{
url= uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
}
pluginManager.withPlugin("io.swagger.core.v3.swagger-gradle-plugin") {
dependencies {
// this is used to scan the classpath and generate an openapi yaml file
implementation("io.swagger.core.v3:swagger-jaxrs2-jakarta:${swagger}")
implementation("jakarta.ws.rs:jakarta.ws.rs-api:${rsApi}")
}
// this is used to scan the classpath and generate an openapi yaml file
tasks.withType<io.swagger.v3.plugins.gradle.tasks.ResolveTask> {
outputFileName = project.name
outputFormat = io.swagger.v3.plugins.gradle.tasks.ResolveTask.Format.YAML
prettyPrint = true
classpath = java.sourceSets["main"].runtimeClasspath
buildClasspath = classpath
resourcePackages = setOf("org.eclipse.dataspaceconnector")
outputDir = file("${rootProject.projectDir.path}/resources/openapi/yaml")
}
configurations {
all {
exclude(group = "com.fasterxml.jackson.jaxrs", module = "jackson-jaxrs-json-provider")
}
}
}
pluginManager.withPlugin("java-library"){
if (!project.hasProperty("skip.signing")) {
apply(plugin = "signing")
publishing {
repositories {
maven {
name = "OSSRH"
setUrl(deployUrl)
credentials {
username = System.getenv("OSSRH_USER") ?: return@credentials
password = System.getenv("OSSRH_PASSWORD") ?: return@credentials
}
}
}
signing {
useGpgCmd()
sign(publishing.publications)
}
}
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
}
// EdcRuntimeExtension uses this to determine the runtime classpath of the module to run.
tasks.register("printClasspath") {
doLast {
println(sourceSets["main"].runtimeClasspath.asPath)
}
}
}
buildscript {
dependencies {
classpath("io.swagger.core.v3:swagger-gradle-plugin:2.1.13")
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("OSSRH_USER") ?: return@sonatype)
password.set(System.getenv("OSSRH_PASSWORD") ?: return@sonatype)
}
}
}