-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
126 lines (112 loc) · 3.42 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
plugins {
id 'java'
id 'eclipse'
id 'maven'
id 'java-library'
id 'maven-publish'
id 'signing'
}
group = 'edu.kit.ifv.mobitopp'
version = project.hasProperty('next-version') ? project.property('next-version') : '0.0-SNAPSHOT'
wrapper.gradleVersion = '6.3'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
}
publishing {
publications {
release(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
}
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
pom {
name = 'actiTopp'
description = 'actiTopp is a model to generate week activity schedules'
url = 'https://github.com/kit-ifv/actitopp'
licenses {
license {
name = 'GNU GENERAL PUBLIC LICENSE, Version 3'
url = 'https://www.gnu.org/licenses/gpl-3.0-standalone.html'
}
}
developers {
developer {
id = 'lb'
name = 'Lars Briem'
email = 'lars.briem@kit.edu'
}
developer {
id = 'jk'
name = 'Jelle Kuebler'
email = 'jelle.kuebler@kit.edu'
}
}
scm {
connection = 'scm:git:git:https://github.com/kit-ifv/actitopp.git'
developerConnection = 'scm:git:ssh:git@github.com:kit-ifv/actitopp.git'
url = 'https://github.com/kit-ifv/actitopp'
}
}
}
}
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
}