forked from nullEuro/5zigCubecraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
91 lines (75 loc) · 2.75 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
import org.gradle.internal.os.OperatingSystem;
apply plugin: 'java'
apply plugin: 'idea'
def major = 1, minor = 4, patch = 5
version = "$major.$minor.$patch"
task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}
jar {
from {
//noinspection GroovyAssignabilityCheck
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task generateSources {
// set this build.gradle as input, so the sources are regenerated when the version
// number is changed
inputs.file buildscript.sourceFile
def outputDir = file("$buildDir/generated-src")
outputs.dir outputDir
doFirst {
def srcFile = new File(outputDir, "net/frozenbit/plugin5zig/cubecraft/Build.java")
srcFile.parentFile.mkdirs()
srcFile.write("""
package net.frozenbit.plugin5zig.cubecraft;
public class Build {
public static final Version version = new Version($major, $minor, $patch);
public static final int major = $major, minor = $minor, patch = $patch;
public static final String versionStr = "$project.version";
}
""")
}
}
compileJava.dependsOn generateSources
compileJava.source generateSources.outputs.files, sourceSets.main.java
//sourceSets.main.srcDirs += 'build/generated-src/'
allprojects {
tasks.withType(JavaCompile) {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
idea {
module {
sourceDirs += generateSources.outputs.files
}
}
repositories {
jcenter()
}
def minecraftFolder
if (OperatingSystem.current().isMacOsX()) {
minecraftFolder = "${System.properties['user.home']}/Library/Application Support/minecraft"
} else if (OperatingSystem.current().isLinux()) {
minecraftFolder = "${System.properties['user.home']}/.minecraft"
} else if (OperatingSystem.current().isWindows()) {
minecraftFolder = "$System.env.APPDATA/.minecraft"
} else {
throw new FileNotFoundException("No minecraft folder detected")
}
def minecraftLibraries = fileTree(dir: "$minecraftFolder/libraries", include: '**/*.jar')
dependencies {
compile 'org.json:json:20171018'
compile 'org.iq80.leveldb:leveldb:0.9'
// the following dependencies are provided at runtime by minecraft
compileOnly 'org.apache.httpcomponents:httpclient:4.5.3'
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'org.apache.logging.log4j:log4j-api:2.9.1'
compileOnly 'com.google.guava:guava:23.4-jre'
compileOnly 'org.lwjgl.lwjgl:lwjgl:2.9.3'
compileOnly 'org.apache.commons:commons-lang3:3.7'
compileOnly minecraftLibraries.matching { include '**/authlib-1.5.25.jar' }
compileOnly fileTree(dir: 'libs', include: 'The-5zig-API-*.jar')
testCompile 'junit:junit:4.12'
}