forked from bardsoftware/ganttproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
164 lines (149 loc) · 5.42 KB
/
build.gradle
File metadata and controls
164 lines (149 loc) · 5.42 KB
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
import java.nio.file.Files
import java.nio.file.Paths
plugins {
id "org.jetbrains.kotlin.jvm" version "2.2.10" apply false
id 'com.github.spotbugs' version '5.0.13'
}
ext.distBinDir = file('ganttproject-builder/dist-bin')
ext.pluginsDir = file("ganttproject-builder/dist-bin/plugins/base")
def readVersion() {
def envVersion = System.getenv("VERSION")
return envVersion == null ? Files.readString(Paths.get(rootProject.projectDir.absolutePath, "ganttproject-builder", "VERSION")).trim() : envVersion
}
version = readVersion()
// Config for all projects: deps come from Maven repository,
// compile using Java 17, libs normally sit in lib
allprojects {
configurations {
direct
providedCompile
}
repositories {
mavenCentral()
google()
maven {
url "https://sandec.jfrog.io/artifactory/repo"
}
}
spotbugs {
toolVersion = "4.8.12" // SpotBugs engine version
effort = "max"
reportLevel = "medium"
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
reports {
xml.required = false
html.required = true
}
ignoreFailures = true // do not fail build on warnings
}
apply plugin: 'java'
ext {
libDir = 'lib'
mvnDir = 'lib/mvn'
kotlin_version = "2.2.20"
java_version = "21"
javaExportOptions = [
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.application=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.glass.ui=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.util=ALL-UNNAMED',
'--add-opens', 'java.desktop/sun.swing=ALL-UNNAMED',
'--add-opens', 'java.desktop/sun.awt.X11=ALL-UNNAMED'
]
}
sourceCompatibility = java_version
targetCompatibility = java_version
clean {
delete += "dist-bin"
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
// Add test dependencies here
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.5.0'
}
}
subprojects {
group 'biz.ganttproject'
version = new Date().format("yy.MM.dd") + "-SNAPSHOT"
apply plugin: 'java'
apply plugin: 'com.github.spotbugs'
afterEvaluate {
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
// Only set the compiled classes and source directories
classes = files(sourceSets.main.output)
sourceDirs = files(sourceSets.main.allSource.srcDirs)
reports {
xml.required = false
html.required = true
}
ignoreFailures = true
}
}
}
def addPublishing(project) {
project.publishing {
repositories {
maven {
name "ganttproject-maven-repository-internal"
url "gcs://ganttproject-maven-repository/internal"
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/bardsoftware/ganttproject")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
}
}
def installLibs(jar, project) {
def pluginDistDir = new File(rootProject.pluginsDir, project.name)
copy {
into(new File(pluginDistDir, "lib/"))
from(configurations.direct) {
include "*.jar"
}
from(jar.outputs.getFiles().getFiles().flatten())
from(project.configurations.compileClasspath.minus(project.configurations.providedCompile.resolve())) {
include "*.jar"
exclude "javafx*.jar"
}
rename { filename -> filename + ".lib" }
}
}
def install(task, jar, project) {
def pluginDistDir = new File(rootProject.pluginsDir, project.name)
task.doLast {
println ">>> ------------ Installing $project.name into $pluginDistDir ------------"
copy {
into(pluginDistDir)
from(fileTree(project.projectDir)) {
include "plugin.xml"
}
from(fileTree("$project.projectDir/src/main/")) {
include "resources/**"
}
}
installLibs(jar, project)
println "<<< $project.name"
}
}