-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
191 lines (155 loc) · 4.67 KB
/
Copy pathbuild.gradle
File metadata and controls
191 lines (155 loc) · 4.67 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.13"
}
String genDir = "$projectDir/src-gen"
sourceSets {
main {
java {
srcDir 'src/main/java'
srcDir genDir
}
resources {
srcDir 'src/main/resources'
}
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(25))
}
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation platform('com.fasterxml.jackson:jackson-bom:2.21.2')
implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '7.6.0.202603022253-r'
// jackson-databind: .vscode/settings.json (JSON) editing; jackson-dataformat-yaml: the pruned wurst.build writer.
// Reading wurst.build now goes through the shared parser (WurstProjectConfigReader, snakeyaml), so the Kotlin
// binding module is no longer needed.
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
implementation 'com.github.wurstscript:wurst-project-config:348fcd4ef5'
implementation 'com.github.Frotty:SimpleRegistry:f96dda96bd'
implementation 'org.jline:jline:3.30.13'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.32'
testImplementation 'org.testng:testng:7.12.0'
}
test {
useTestNG()
jvmArgs '-Djava.awt.headless=true'
}
jacocoTestReport {
reports {
xml.required.set(true)
}
}
configurations.all {
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "log4j"
}
buildscript {
ext.kotlin_version = '2.3.21'
repositories {
flatDir dirs: 'src/main/resources/'
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
version '1.4.0.0'
task versionInfoFile {
description "Generates a file CompileTimeInfo.java with version number etc."
doLast {
def dir = new File("$projectDir/src-gen/file/")
dir.mkdirs()
def f = new File(dir, 'CompileTimeInfo.kt')
String gitRevision = "unknown-version"
String gitRevisionlong = "unknown-version"
gitRevision = providers.exec {
commandLine 'git', 'describe', '--tags', '--always'
}.standardOutput.asText.get().trim()
gitRevisionlong = providers.exec {
commandLine 'git', 'describe', '--tags', '--always', '--abbrev=0'
}.standardOutput.asText.get().trim()
String setupVersion = "${version}-${gitRevision}"
String currentTime = new Date().format("yyyy/MM/dd KK:mm:ss")
f.text = """
package file
object CompileTimeInfo {
\tval time="${currentTime}"
\tval revision="${gitRevision}"
\tval revisionLong="${gitRevisionlong}"
\tval version="${setupVersion}"
}"""
}
}
compileKotlin.dependsOn versionInfoFile
task dist(type: Jar) {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
manifest {
attributes 'Implementation-Title': 'Wurst Setup',
'Implementation-Version': version,
'Main-Class': 'file.SetupMain'
}
with jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
dist.dependsOn classes
dist.dependsOn versionInfoFile
dist.archiveFileName = "WurstSetup.jar"
def fatJar = dist.archiveFile.map { it.asFile }
def wurstUserDir = "${System.properties['user.home']}/.wurst"
def grillCliDir = "${wurstUserDir}/grill-cli"
tasks.register('delete_legacy_userdir_grill_jar', Delete) {
delete "${wurstUserDir}/WurstSetup.jar"
}
tasks.register('make_for_userdir', Copy) {
dependsOn 'dist', 'delete_legacy_userdir_grill_jar'
from fatJar
into grillCliDir
rename { 'grill.jar' }
}
tasks.register('make_for_userdir_grill_cli') {
dependsOn 'make_for_userdir'
}
task copy_jar(type: Copy) {
mkdir("downloads/")
from 'build/libs/'
into 'downloads/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
task proguardDist(type: Copy) {
}
proguardDist.dependsOn dist
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
copy_jar.dependsOn(dist)
application {
mainClass = "file.SetupMain"
}
compileKotlin {
kotlinOptions {
jvmTarget = "25"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "25"
}
}