This repository has been archived by the owner on Jan 11, 2021. It is now read-only.
forked from jenetics/jenetics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
130 lines (110 loc) · 3.25 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
/*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author:
* Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
*/
import io.jenetics.gradle.Version
import io.jenetics.gradle.plugin.SetupPlugin
import java.time.Year
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
/**
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @since 1.2
* @version 4.3
*/
rootProject.version = Version.parse(property('jenetics.Version'))
apply plugin: 'signing'
apply plugin: 'packaging'
ext {
javaVersion = property('build.JavaVersion')
now = ZonedDateTime.now()
year = Year.now();
copyrightYear = "2007-${year}".toString()
identifier = "${rootProject.name}-${version}".toString()
manualDate = DateTimeFormatter.ofPattern("yyyy/MM/dd").format(now)
manualIdentifier = "${version}—${manualDate}".toString()
dateformat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
}
allprojects {
group = property('jenetics.Group')
version = property('jenetics.Version')
repositories {
flatDir(dir: "${rootDir}/buildSrc/lib")
mavenCentral()
}
}
subprojects { Project prj ->
prj.plugins.apply(SetupPlugin.class)
// The Javadoc doesn't work for
// openjdk version "11.0.2" 2018-10-16
// OpenJDK Runtime Environment 18.9 (build 11.0.2+7)
// OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+7, mixed mode
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
prj.tasks.withType(Javadoc).all {
enabled = false
}
}
}
allprojects { Project prj ->
repositories {
mavenCentral()
jcenter()
}
if (prj.plugins.hasPlugin('java')) {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
if (prj.plugins.hasPlugin('jacoco')) {
prj.jacoco {
toolVersion = '0.8.2'
}
}
}
task updateGradle(type: Wrapper) {
gradleVersion = project.property('build.GradleVersion')
}
task alljavadoc(type: Javadoc) {
options.encoding = 'UTF-8'
def jeneticsProjects = subprojects.findAll { project ->
project.name.startsWith('jenetics') &&
project.name != 'jenetics.doc'
}
configure(jeneticsProjects) {
apply plugin: 'java'
}
source jeneticsProjects.collect { p ->
p.sourceSets.main.allJava
}
destinationDir = file("${buildDir}/alljavadoc")
// Might need a classpath
classpath = files(jeneticsProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
// Create a zip file from the export directory.
task zip(type: Zip) {
from("build/package/${identifier}") {
into identifier
}
baseName = rootProject.name
version = project.property('jenetics.Version')
doLast {
def zip = file("${identifier}.zip")
zip.renameTo(new File('build/package', zip.getName()))
}
}