-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuild.gradle
More file actions
50 lines (40 loc) · 1.39 KB
/
build.gradle
File metadata and controls
50 lines (40 loc) · 1.39 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
import java.nio.file.Files
plugins {
id 'java'
}
group('io.github.lucasstarsz.fastj')
version('1.7.0-SNAPSHOT')
description('Example programs for the FastJ Game Engine.')
sourceCompatibility = 18
targetCompatibility = 18
repositories {
mavenCentral()
}
dependencies.implementation(project(':'))
dependencies.implementation('org.slf4j:slf4j-simple:2.0.6')
sourceSets {
main.java.srcDirs = ['java']
main.resources.srcDirs = ['resources']
}
task run(type: Exec) {
doFirst {
if (!project.hasProperty('toRun')) {
throw new IllegalArgumentException(
'You need to specify which example using the \"toRun\" property!\nE.G. \"./gradlew examples:run -PtoRun=hellofastj\"'
)
}
if (!Files.exists(java.nio.file.Path.of(projectDir.toString(), 'java', 'tech', 'fastj', 'examples', project.getProperty('toRun') as String))) {
throw new IllegalArgumentException(
"The example ${project.getProperty('toRun')} does not exist."
)
}
}
dependsOn(tasks.compileJava, tasks.processResources)
description = 'Runs a FastJ example program.'
group = 'Execution'
commandLine(
'java',
'-classpath', sourceSets.main.runtimeClasspath.getAsPath(),
"tech.fastj.examples.${project.hasProperty('toRun') ? project.getProperty('toRun') : ''}.Main"
)
}