-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
191 lines (163 loc) · 5.94 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
// dependencies {
// classpath "edu.kit.ifv.codegen.gradle.plugin:code-gen-gradle-plugin:latest.integration"
// }
}
plugins {
id 'java'
id 'eclipse'
id 'maven'
id 'signing'
id "maven-publish"
id 'jacoco'
}
group = 'edu.kit.ifv.mobitopp'
archivesBaseName = "logitopp"
version = project.hasProperty('next_version') ? project.property('next_version') : '0.0-SNAPSHOT'
wrapper.gradleVersion = '6.3'
sourceCompatibility = 1.12
targetCompatibility = 1.12
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url "https://jitpack.io" }
}
configurations.all {
exclude group: 'xerces', module: 'xerces'
}
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.8'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.8'
compileOnly 'org.projectlombok:lombok:1.18.8'
compile 'edu.kit.ifv.mobitopp:mobitopp:0.3+',
'org.jgrapht:jgrapht-core:1.5.1'
testCompile 'org.projectlombok:lombok:1.18.8'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0',
'org.junit.jupiter:junit-jupiter-migrationsupport:5.7.0',
'org.junit.vintage:junit-vintage-engine:5.7.0',
'org.mockito:mockito-core:3.0.0',
'org.assertj:assertj-core:3.13.2'
}
//def choiceModelsDirectory = "${rootDir}/choice-models"
//apply plugin: 'edu.kit.ifv.codegen.gradle.plugin'
//codeGenInp {
// outputDir = "${rootDir}/src/main/java"
// files = ["${choiceModelsDirectory}/number-of-parcels-choice-model.gen",
// "${choiceModelsDirectory}/parcel-destination-choice-model.gen"]
//}
//compileJava.dependsOn('generateCode')
test {
useJUnitPlatform()
enableAssertions = "true"
// maxHeapSize = "2G"
testLogging.showStandardStreams = true
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
release(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
}
snapshot(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
def buildNumber = project.hasProperty('build_number') ? project.property('build_number') : '123'
def snapshotVersion = project.version.replaceAll("\\.${buildNumber}", '') + '-SNAPSHOT'
version snapshotVersion
}
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
pom {
name = 'logitopp'
description = 'An extension of mobiTopp for simulating parcel deliveries'
url = 'https://github.com/kit-ifv/logitopp'
licenses {
license {
name = 'GNU GENERAL PUBLIC LICENSE, Version 3'
url = 'https://www.gnu.org/licenses/gpl-3.0-standalone.html'
}
}
developers {
developer {
id = 'jk'
name = 'Jelle Kuebler'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git:https://github.com/kit-ifv/logitopp.git'
developerConnection = 'scm:git:ssh:[email protected]:kit-ifv/logitopp.git'
url = 'https://github.com/kit-ifv/logitopp'
}
}
}
}
repositories {
maven {
name = 'Internal'
credentials {
username getPropertyOrDefault('repositoryUsername')
password getPropertyOrDefault('repositoryPassword')
}
def repositoryUrl = getPropertyOrDefault('repositoryUrl')
def releasesRepoUrl = "${repositoryUrl}/repository/maven-releases"
def snapshotsRepoUrl = "${repositoryUrl}/repository/maven-snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
maven {
name = 'External'
credentials {
username getPropertyOrDefault('user_oss')
password getPropertyOrDefault('pw_oss')
}
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
sign publishing.publications.mavenJava
}
task publishAndCheckRelease() {
dependsOn publishReleasePublicationToInternalRepository
if (project.hasProperty('isRelease') && project.property('isRelease').toBoolean()) {
print('New Release')
dependsOn publishMavenJavaPublicationToExternalRepository
} else {
print('No Release')
}
}
configure(publishAndCheckRelease) {
group = 'publishing'
description = 'Publish to internal repo. Also publish staging release to external repo if "isRelease" is set.'
}
def getPropertyOrDefault(key) {
return project.hasProperty(key) ? project.property(key) : key
}