Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
109 lines (91 loc) · 3.01 KB
/
Copy pathbuild.gradle
File metadata and controls
109 lines (91 loc) · 3.01 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
import java.text.SimpleDateFormat
plugins {
id 'application'
id 'maven-publish'
}
group = 'com.reportmill'
version = new SimpleDateFormat("yyyy.MM").format(new Date())
sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['src']
java {
toolchain { languageVersion = JavaLanguageVersion.of(21) }
}
repositories { mavenCentral() }
dependencies {
implementation project(':SnapKit')
implementation project(':SnapKitGL')
implementation project(':SnapBuilder')
// JGit
implementation 'org.eclipse.jgit:org.eclipse.jgit:7.3.0.202506031305-r'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-simple:1.7.36'
// Greenfoot
implementation project(':Greenfoot')
}
application {
mainClass = 'snapcode.app.App'
}
/**
* Custom task to build jar that includes all dependencies.
*/
tasks.register('buildFullJar', Jar) {
archiveBaseName = 'SnapCodeAll'
manifest {
attributes(
'Main-Class': 'snapcode.app.App',
'Application-Name': 'SnapCode',
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude('**/test/**', '/META-INF/*.SF', '/META-INF/*.RSA', '/com/teamdev/**') //, '**/org/**', '**/sun/**')
processResources { finalizedBy('buildInfo') }
with jar
dependsOn build
duplicatesStrategy = DuplicatesStrategy.WARN
}
tasks.register('copyCJ', Copy) {
from(
"../SnapKit/cjdom.js",
"../SnapKit/build/libs/SnapKit-" + new SimpleDateFormat("yyyy.MM").format(new Date()) + ".jar",
"../SnapBuilder/build/libs/SnapBuilder-" + new SimpleDateFormat("yyyy.MM").format(new Date()) + ".jar",
"../Greenfoot/build/libs/Greenfoot-" + new SimpleDateFormat("yyyy.MM").format(new Date()) + ".jar"
)
into "build/libs"
dependsOn buildFullJar
}
tasks.register('copyGT', Copy) {
from(
"../SnapCode/build/classes/java/main/GitTest.class"
)
into "build/libs"
dependsOn build
}
/**
* Writes the current build date into BuildInfo.txt, e.g.: Feb-02-23 09:31.
*/
tasks.register('buildInfo') {
doLast {
// Create BuildInfo text (date string) and write to file
String buildInfoText = new SimpleDateFormat("MMM-dd-yy HH:mm").format(new Date());
String buildInfoFilePathStr = buildDir.getAbsolutePath() + '/resources/main/snapcode/BuildInfo.txt';
java.nio.file.Path buildInfoFilePath = java.nio.file.Paths.get(buildInfoFilePathStr);
java.nio.file.Files.write(buildInfoFilePath, buildInfoText.getBytes());
}
}
publishing {
publications {
gpr(MavenPublication) {
artifactId = 'SnapCodeAll'
artifact buildFullJar // from(components.java)
pom.withXml {
asNode().dependencies.dependency.each { dep -> dep.parent().remove(dep) }
}
}
}
}
tasks.register('copyDependencies', Copy) {
from configurations.runtimeClasspath
into 'build/libs-all'
}