-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
172 lines (148 loc) · 5.56 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
plugins {
id 'java-library'
id 'application'
// maven plugin is used to create .pom files and for publishing
id 'maven-publish'
id 'eclipse'
}
def las2peerRevision = "${project.property('las2peer.revision')}"
def las2peerBuildNumber = "${project.property('las2peer.build.number')}"
def las2peerRelease = System.env.LAS2PEER_RELEASE != null
def las2peerVersion = las2peerRelease ? "$las2peerRevision.$las2peerBuildNumber" : "$las2peerRevision-SNAPSHOT"
group = 'io.github.rwth-acis.org.las2peer'
archivesBaseName = 'las2peer-rest-mapper'
version = las2peerVersion
sourceCompatibility = "${project.property('java.version')}"
targetCompatibility = "${project.property('java.version')}"
repositories {
// Use maven central for resolving dependencies.
mavenCentral()
}
compileJava {
options.compilerArgs += ["-XDignore.symbol.file"]
options.fork = true
options.forkOptions.executable = "javac"
}
javadoc {
destinationDir = file("$projectDir/export/javadoc")
}
java {
withJavadocJar()
withSourcesJar()
}
task junitdoc(type: Javadoc) {
classpath = sourceSets.main.runtimeClasspath + sourceSets.test.runtimeClasspath
source = sourceSets.test.java
destinationDir = file("$projectDir/export/junitdoc")
}
build.dependsOn "javadoc"
build.dependsOn "junitdoc"
dependencies {
// Use JUnit test framework.
testImplementation "junit:junit:${project.property('junit.version')}"
api project(":core")
api "io.swagger:swagger-jersey2-jaxrs:1.6.3"
api "org.glassfish.jersey.core:jersey-server:${project.property('jersey.version')}"
api "org.glassfish.jersey.core:jersey-common:${project.property('jersey.version')}"
api "org.glassfish.jersey.media:jersey-media-json-jackson:${project.property('jersey.version')}"
api "javax.ws.rs:javax.ws.rs-api:2.0.1"
api "org.glassfish.jersey.media:jersey-media-multipart:${project.property('jersey.version')}"
api "javax.xml.bind:jaxb-api:2.3.1"
api "org.glassfish.jaxb:jaxb-runtime:2.3.1"
api "org.glassfish.jersey.inject:jersey-hk2:${project.property('jersey.version')}"
}
// put all .jar files into export/jars folder
tasks.withType(Jar) {
destinationDirectory = file("$projectDir/export/jars")
}
jar {
manifest {
attributes("Implementation-Version": las2peerVersion,
"Class-Path": configurations.runtimeClasspath.files.collect { it.getName() }.join(" "))
}
}
task copyToLib(type: Copy) {
from configurations.runtimeClasspath
into "$projectDir/lib"
}
build.dependsOn copyToLib
clean.doLast {
file("export").deleteDir()
file("lib").deleteDir()
}
// In .pom file, use "runtime" scope for dependencies declared with api configuration (instead of "compile" scope).
// Also las2peer (core) should be a runtime dependency.
publishing.publications.all {
pom.withXml {
asNode().dependencies."*".findAll() {
it.scope.text() == "compile" && project.configurations.api.allDependencies.find { dep -> dep.name == it.artifactId.text() }
}.each { it.scope*.value = "runtime"}
asNode().dependencies."*".findAll() {
it.artifactId.text() == "las2peer"
}.each { it.scope*.value = "runtime"}
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/rwth-acis/las2peer")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from components.java
pom {
name = 'las2peer-rest-mapper'
artifactId = 'las2peer-restmapper'
description = 'The restmapper component of the las2peer project'
url = 'https://las2peer.org/'
packaging = 'jar'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/rwth-acis/las2peer?tab=License-1-ov-file#readme'
distribution = 'repo'
}
}
developers {
developer {
name = 'rwth-acis'
email= '[email protected]'
organization = 'rwth-acis'
organizationUrl = 'https://las2peer.org/'
}
}
scm {
connection = 'scm:git:git://github.com/rwth-acis/las2peer.git'
developerConnection = 'scm:git:ssh://[email protected]:rwth-acis/las2peer.git'
url = 'https://github.com/rwth-acis/las2peer'
}
}
}
}
}
// disable module metadata publication
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// configuration for eclipse (this allows to import las2peer as a gradle project in eclipse without any problems)
eclipse {
classpath {
file {
whenMerged {
// change output directory for main, test and default
def main = entries.find { it.path == "src/main/java" }
main.output = "output/main"
def test = entries.find { it.path == "src/test/java" }
test.output = "output/test"
def defaultEntry = entries.find { it.kind == "output" && it.path == "bin/default" }
defaultEntry.path = "output/default"
}
}
}
}