|
1 | 1 | buildscript { |
2 | 2 | repositories { |
3 | | - maven { url = 'https://files.minecraftforge.net/maven' } |
| 3 | + maven { |
| 4 | + name = "MinecraftForge" |
| 5 | + url = 'https://files.minecraftforge.net/maven' |
| 6 | + } |
4 | 7 | jcenter() |
5 | 8 | mavenCentral() |
6 | 9 | } |
7 | 10 | dependencies { |
8 | | - classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' |
| 11 | + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' |
9 | 12 | } |
10 | 13 | } |
11 | | - |
12 | | -apply plugin: 'net.minecraftforge.gradle' |
13 | | -// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. |
| 14 | + |
| 15 | +apply plugin: 'net.minecraftforge.gradle.forge' |
14 | 16 | apply plugin: 'eclipse' |
15 | 17 | apply plugin: 'maven-publish' |
16 | 18 |
|
17 | | -version = '1.0' |
18 | | -group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html |
19 | | -archivesBaseName = 'modid' |
| 19 | +apply plugin: 'java' |
| 20 | +apply plugin: 'idea' |
20 | 21 |
|
21 | | -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. |
| 22 | +idea { |
| 23 | + module { |
| 24 | + // for those who provide sources and javadocs, this is great |
| 25 | + downloadJavadoc = downloadSources = true |
| 26 | + } |
| 27 | +} |
22 | 28 |
|
23 | | -minecraft { |
24 | | - // The mappings can be changed at any time, and must be in the following format. |
25 | | - // snapshot_YYYYMMDD Snapshot are built nightly. |
26 | | - // stable_# Stables are built at the discretion of the MCP team. |
27 | | - // Use non-default mappings at your own risk. they may not always work. |
28 | | - // Simply re-run your setup task after changing the mappings to update your workspace. |
29 | | - //mappings channel: 'snapshot', version: '20171003-1.12' |
30 | | - mappings channel: 'snapshot', version: '20171003-1.12' |
31 | | - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. |
32 | | - |
33 | | - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') |
34 | | - |
35 | | - // Default run configurations. |
36 | | - // These can be tweaked, removed, or duplicated as needed. |
37 | | - runs { |
38 | | - client { |
39 | | - workingDirectory project.file('run') |
40 | | - |
41 | | - // Recommended logging data for a userdev environment |
42 | | - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' |
43 | | - |
44 | | - // Recommended logging level for the console |
45 | | - property 'forge.logging.console.level', 'debug' |
46 | | - } |
| 29 | +repositories { |
| 30 | + maven { |
| 31 | + name = "CurseForge" |
| 32 | + url = "https://minecraft.curseforge.com/api/maven/" |
| 33 | + } |
| 34 | + maven { |
| 35 | + name 'DVS1 Maven FS' |
| 36 | + url 'http://dvs1.progwml6.com/files/maven' |
| 37 | + } |
| 38 | +} |
47 | 39 |
|
48 | | - server { |
| 40 | +def modid = 'natura_niceties' |
| 41 | +def creator = 'degeneratehuman' |
49 | 42 |
|
50 | | - // Recommended logging data for a userdev environment |
51 | | - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' |
| 43 | +project.setVersion '1.0' |
| 44 | +project.setGroup "com.${creator}.${modid}" |
| 45 | +project.setArchivesBaseName "${modid}" |
52 | 46 |
|
53 | | - // Recommended logging level for the console |
54 | | - property 'forge.logging.console.level', 'debug' |
55 | | - } |
56 | | - } |
| 47 | +def minecraft_ver = "${mc_ver}-${forge_ver}" |
| 48 | + |
| 49 | +def placeholderFileGlobs = [ |
| 50 | + '**/*.info', |
| 51 | + "assets/${modid}/**/*.json" |
| 52 | +] |
| 53 | + |
| 54 | +def placeholders = [ |
| 55 | + 'version' : project.getVersion(), |
| 56 | + 'mc_ver' : mc_ver, |
| 57 | + 'modid' : modid |
| 58 | +] |
| 59 | + |
| 60 | +def jvm_ver = '1.8' |
| 61 | +sourceCompatibility = targetCompatibility = jvm_ver |
| 62 | + |
| 63 | +compileJava { |
| 64 | + sourceCompatibility = targetCompatibility = jvm_ver |
57 | 65 | } |
58 | 66 |
|
59 | 67 | dependencies { |
60 | | - // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed |
61 | | - // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. |
62 | | - // The userdev artifact is a special name and will get all sorts of transformations applied to it. |
63 | | - minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2854' |
| 68 | + compile "com.progwml6.natura:natura:${mc_ver}-${natura_ver}" |
| 69 | + compile "slimeknights.mantle:Mantle:${mc_ver_short}-${mantle_ver}" |
64 | 70 |
|
65 | | - // You may put jars on which you depend on in ./libs or you may define them like so.. |
66 | | - // compile "some.group:artifact:version:classifier" |
67 | | - // compile "some.group:artifact:version" |
| 71 | + // utility for when manually testing stuff |
| 72 | + // runtime "mezz.jei:jei_${mc_ver}:${jei_ver}" |
| 73 | +} |
68 | 74 |
|
69 | | - // Real examples |
70 | | - // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env |
71 | | - // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env |
| 75 | +task generateJava(type:Copy) { |
| 76 | + from 'src/template/java' |
| 77 | + into "$buildDir/generated/java" |
| 78 | + expand placeholders |
| 79 | +} |
72 | 80 |
|
73 | | - // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. |
74 | | - // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' |
| 81 | +// append the 'generated' folder to the list of source dirs |
| 82 | +sourceSets.main.java.srcDir "$buildDir/generated/java" |
| 83 | +compileJava.dependsOn generateJava |
75 | 84 |
|
76 | | - // These dependencies get remapped to your current MCP mappings |
77 | | - // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' |
| 85 | +minecraft { |
| 86 | + setVersion minecraft_ver |
| 87 | + setMappings mappings_ver |
| 88 | + runDir = "run" |
| 89 | + replace '${version}', project.version |
| 90 | + useDepAts = true |
| 91 | +} |
78 | 92 |
|
79 | | - // For more info... |
80 | | - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html |
81 | | - // http://www.gradle.org/docs/current/userguide/dependency_management.html |
| 93 | +processResources { |
| 94 | + from(sourceSets.main.resources.srcDirs) { |
| 95 | + for (glob in placeholderFileGlobs) { |
| 96 | + include glob |
| 97 | + } |
| 98 | + // replace version and MCVersion |
| 99 | + expand placeholders |
| 100 | + } |
82 | 101 |
|
| 102 | + from(sourceSets.main.resources.srcDirs) { |
| 103 | + for (glob in placeholderFileGlobs) { |
| 104 | + exclude glob |
| 105 | + } |
| 106 | + } |
83 | 107 | } |
84 | 108 |
|
85 | | -// Example for how to get properties into the manifest for reading by the runtime.. |
86 | 109 | jar { |
87 | 110 | manifest { |
88 | 111 | attributes([ |
89 | | - "Specification-Title": "examplemod", |
90 | | - "Specification-Vendor": "examplemodsareus", |
91 | | - "Specification-Version": "1", // We are version 1 of ourselves |
92 | | - "Implementation-Title": project.name, |
93 | | - "Implementation-Version": "${version}", |
94 | | - "Implementation-Vendor" :"examplemodsareus", |
95 | | - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") |
| 112 | + "Specification-Title" : modid, |
| 113 | + "Specification-Vendor" : creator, |
| 114 | + "Specification-Version" : "1", |
| 115 | + "Implementation-Title" : project.name, |
| 116 | + "Implementation-Version" : project.version, |
| 117 | + "Implementation-Vendor" : creator, |
| 118 | + "Implementation-Timestamp" : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") // ISO FORMAT!!! WOOP!!! |
96 | 119 | ]) |
97 | 120 | } |
| 121 | + |
| 122 | + finalizedBy('reobfJar') |
98 | 123 | } |
99 | 124 |
|
100 | | -// Example configuration to allow publishing using the maven-publish task |
101 | | -// This is the preferred method to reobfuscate your jar file |
102 | | -jar.finalizedBy('reobfJar') |
103 | | -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing |
104 | | -//publish.dependsOn('reobfJar') |
| 125 | +task sourcesJar(type: Jar) { |
| 126 | + from sourceSets.main.allJava |
| 127 | + classifier = 'sources' |
| 128 | +} |
105 | 129 |
|
106 | | -publishing { |
107 | | - publications { |
108 | | - mavenJava(MavenPublication) { |
109 | | - artifact jar |
110 | | - } |
111 | | - } |
112 | | - repositories { |
113 | | - maven { |
114 | | - url "file:///${project.projectDir}/mcmodsrepo" |
115 | | - } |
116 | | - } |
| 130 | +artifacts { |
| 131 | + archives sourcesJar |
117 | 132 | } |
0 commit comments