summaryrefslogtreecommitdiff
path: root/server/build.gradle
blob: 1dedae1123f1f823fc37a61ff61f139f3e06c37c (plain)
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
sourceCompatibility = 17
sourceSets.main.java.srcDirs = ["src/"]

project.ext.mainClassName = "kz.ilotterytea.maxon.ServerLauncher"

import org.gradle.internal.os.OperatingSystem

tasks.register('run', JavaExec) {
    dependsOn classes
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.rootDir
    ignoreExitValue = true

    if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
        // Required to run on macOS
        jvmArgs += "-XstartOnFirstThread"
    }
}

tasks.register('debug', JavaExec) {
    dependsOn classes
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.assetsDir
    ignoreExitValue = true
    debug = true
}

tasks.register('dist', Jar) {
    archiveFileName = "${appName}-server.jar"
    duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
    manifest {
        attributes 'Main-Class': project.mainClassName
    }
    dependsOn configurations.runtimeClasspath
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
    with jar
}


dist.dependsOn classes

eclipse.project.name = appName + "-server"