forked from HanSolo/AnimatedBackground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
158 lines (138 loc) · 4.8 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
import java.text.SimpleDateFormat
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
classpath 'org.javamodularity:moduleplugin:1.8.15'
}
}
plugins {
id 'java'
id 'application'
id 'signing'
id 'com.google.osdetector' version '1.7.3'
id 'org.javamodularity.moduleplugin' version '1.8.15'
id 'net.nemerosa.versioning' version '3.1.0'
}
apply plugin: 'signing'
normalization {
runtimeClasspath {
ignore('/META-INF/MANIFEST.MF')
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
platform = osdetector.os == 'osx' ? osdetector.arch == 'aarch_64' ? 'mac-aarch64' : 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os == 'linux' ? osdetector.arch == 'aarch_64' ? 'linux-aarch64' : 'linux' : osdetector.os
ciOssrhUsername = System.getenv('OSSRH_USERNAME')
ciOssrhPassword = System.getenv('OSSRH_PASSWORD')
ciGHUser = System.getenv('GH_USER')
ciGHToken = System.getenv('GH_TOKEN')
gpgkey = System.getenv("GPG_PRIVATE_KEY")
gpgpassphrase = System.getenv("PASSPHRASE")
}
dependencies {
//implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
implementation "org.openjfx:javafx-base:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-graphics:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-controls:${javafxVersion}:${platform}"
}
description = 'A JavaFX based animated background'
application {
mainModule.set('eu.hansolo.fx.animatedbackground')
mainClass.set('eu.hansolo.fx.animatedbackground.Launcher')
}
jar {
from {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Created-By' : System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Build-Date' : project.buildDate,
'Build-Time' : project.buildTime,
'Build-Revision' : versioning.info.commit,
'Specification-Title' : project.name,
'Specification-Version' : project.version,
'Implementation-Title' : project.name,
'Implementation-Version': project.version,
'Bundle-Name' : project.name,
'Bundle-License' : 'https://www.apache.org/licenses/LICENSE-2.0;description=Apache License Version 2.0;link=https://spdx.org/licenses/Apache-2.0.html',
'Bundle-Description' : description,
'Bundle-Version' : project.version,
'Bundle-SymbolicName' : 'eu.hansolo.fx.animatedbackground',
'Class-Path' : '${project.name}-${project.version}.jar',
'Main-Class' : 'eu.hansolo.fx.animatedbackground.Launcher'
)
}
}
// start app from gradle
tasks.register('Main', JavaExec) {
mainClass = "eu.hansolo.fx.animatedbackground.Launcher"
classpath = sourceSets.main.runtimeClasspath
}
// create properties file including the version
tasks.register('createProperties') {
dependsOn processResources
doLast {
new File("${projectDir}//build/classes/java/main/eu/hansolo/fx/animatedbackground/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
// Fix problems with loading resources
sourceSets {
main {
output.setResourcesDir(java.classesDirectory)
}
}
run {
inputs.property("moduleName", moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--module', mainClassName
]
classpath = files()
}
}
// PreView
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += "--enable-preview"
}
/*
signing {
useGpgCmd()
sign configurations.archives
}
*/