-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
187 lines (155 loc) · 4.89 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
/*
* Copyright 2024-2025 ISC Konstanz
*
* This file is part of OpenESG.
* For more information visit http://www.openmuc.org
*
* OpenESG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenESG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenESG. If not, see <http://www.gnu.org/licenses/>.
*
*/
import java.nio.file.Paths
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java-library'
id 'biz.aQute.bnd.builder' version '5.1.2'
}
apply from: 'projects.gradle'
def javaProjects() {
return allprojects.findAll { new File(it.projectDir, 'src').exists() }
}
configure(javaProjects()) {
apply plugin: 'java-library'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'eclipse'
group = projectGroup
version = projectVersion
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.11'
}
if (!project.properties.containsKey('javaVersion')) {
project.ext {
javaVersion = '1.8'
}
}
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
javadoc {
options.encoding = 'utf-8'
exclude '**/internal/**'
exclude '**/java-gen/**'
exclude '**/app/**'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task jarAll(type: Copy) {
// Include the jar file created, as well as all artifacts:
from jar
from javadocJar
from sourcesJar
if (copyDependencies) {
// Includes all the dependencies:
from configurations.default
}
into rootDir.getPath() + '/build/libs'
}
build.dependsOn { jarAll }
eclipse.pathVariables([GRADLE_USER_HOME:file(gradle.gradleUserHomeDir)])
tasks.eclipse.dependsOn(cleanEclipse)
afterEvaluate {
eclipse {
project {
name = projectName
}
}
jar {
bnd('Bundle-Vendor': projectVendor,
'Bundle-DocURL': projectRepository,
'Bundle-Description': projectDescription,
'Bundle-Name': projectFullName,
'Bundle-SymbolicName': project.group + '.' +
project.name)
archivesBaseName = projectKey
}
}
artifacts {
archives javadocJar
archives sourcesJar
}
}
configure(rootProject) {
jar {
// FIXME: Find better solution to avoid the root project beeing built
destinationDirectory = new File("$rootDir/build/tmp/libs")
}
}
task javadocClean(type: Delete) {
delete rootDir.getPath() + '/docs/javadoc'
}
task javadocAll(type: Javadoc) {
dependsOn(javadocClean)
source javadocProjects.collect {
project -> project.sourceSets.main.allJava
}
exclude '**/internal/**'
exclude '**/java-gen/**'
exclude '**/app/**'
destinationDir = new File(rootDir, 'docs/javadoc')
classpath = files(javadocProjects.collect { project ->
project.sourceSets.main.compileClasspath })
classpath += files(javadocProjects.collect { project ->
project.sourceSets.main.output })
}
task distribute(type: Tar) {
dependsOn(distributionProjects.build)
dependsOn(javadocAll)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
compression = Compression.GZIP
archiveFileName = project.name + '-' + projectVersion + '.tar.gz'
into(project.name) {
from('build') {
include 'libs/*' + projectVersion + '*.jar'
}
from('./') {
include 'LICENSE**'
include 'NOTICE**'
include 'conf/**'
include 'libs/**'
include 'licenses/**'
}
into('licenses') {
for (Project distributionProject: distributionProjects) {
from (distributionProject.getProjectDir().toString() + '/libs') {
exclude '**/*.jar'
exclude '**.jar'
}
}
}
}
destinationDirectory = file('build/dist/')
}