-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (78 loc) · 2.81 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
import java.text.SimpleDateFormat
plugins {
id 'application'
}
group 'com.reportmill'
version new SimpleDateFormat("yyyy.MM").format(new Date())
sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['src']
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
// SnapKit project
implementation project(':SnapKit')
// SnapKitGL project
implementation project(':SnapKitGL')
// SnapBuilder project
implementation project(':SnapBuilder')
// Tools jar
implementation files('lib/tools.jar')
// JGit
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.13.3.202401111512-r'
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.slf4j:slf4j-simple:1.7.30'
// Greenfoot
implementation project(':Greenfoot')
// So we can get jars
testImplementation project(':CJDom')
testImplementation project(':SnapCJ')
}
mainClassName = 'snapcode.app.App'
/**
* Custom task to build jar that includes all dependencies.
*/
task buildFullJar(type: Jar) {
archiveBaseName = 'SnapCodeAll'
manifest {
attributes(
'Main-Class': 'snapcode.app.App',
'Application-Name': 'SnapCode',
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
exclude('**/org/**', '**/test/**', '/META-INF/*.SF', '/META-INF/*.RSA') //, '**/sun/**')
processResources { finalizedBy ('buildInfo') }
with jar
dependsOn build
}
task copyCJ(type: Copy) {
from (
"../CJDom/cjdom.js",
"../CJDom/build/libs/CJDom-" + new SimpleDateFormat("yyyy.MM").format(new Date()) + ".jar",
"../SnapCJ/build/libs/SnapCJ-" + new SimpleDateFormat("yyyy.MM").format(new Date()) + ".jar",
"../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
}
/**
* 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());
}
}