11buildscript {
22 repositories {
33 maven { url = ' https://files.minecraftforge.net/maven' }
4- jcenter()
54 mavenCentral()
65 }
76
@@ -31,9 +30,25 @@ println("Version: ${version}");
3130sourceCompatibility = targetCompatibility = compileJava. sourceCompatibility = compileJava. targetCompatibility = ' 1.8' // Need this here so eclipse task generates correctly.
3231
3332sourceSets {
33+ api {
34+ java {
35+ srcDir " src/api/java"
36+ }
37+ compileClasspath + = configurations. getByName(" minecraft" )
38+ }
39+
3440 main {
35- resources. srcDir " src/generated/resources"
41+ java {
42+ srcDir " src/api/java"
43+ srcDir " src/main/java"
44+ }
45+
46+ resources {
47+ srcDir " src/main/resources"
48+ srcDir ' src/generated/resources'
49+ }
3650 }
51+
3752 test
3853}
3954
@@ -114,19 +129,22 @@ minecraft {
114129 unitTests {
115130 parent runs. server // This run config inherits settings from the server config
116131 workingDirectory project. file(' run/test' )
117- main ' com.alcatrazescapee.mcjunitlib.DedicatedTestServerLauncher' // The main class which launches a customized server which then runs JUnit tests
132+ main ' com.alcatrazescapee.mcjunitlib.DedicatedTestServerLauncher'
133+ // The main class which launches a customized server which then runs JUnit tests
118134 ideaModule " ${ project.name} .test" // Tell IDEA to use the classpath of the test module
119- property ' forge.logging.console.level' , ' unittest' // This logging level prevents any other server information messages and leaves only the unit test output
135+ property ' forge.logging.console.level' , ' unittest'
136+ // This logging level prevents any other server information messages and leaves only the unit test output
120137 environment ' MOD_CLASSES' , String . join(File . pathSeparator,
121138 " ${ mod_id} %%${ sourceSets.main.output.resourcesDir} " ,
122139 " ${ mod_id} %%${ sourceSets.main.output.classesDirs[0]} " ,
123140 " ${ mod_id} %%${ sourceSets.test.output.resourcesDir} " ,
124141 " ${ mod_id} %%${ sourceSets.test.output.classesDirs[0]} " ,
125142 ) // Forge will ignore all test sources unless we explicitly tell it to include them as mod sources
126- environment ' target' , ' fmltestserver' // This is a custom service used to launch with ModLauncher's transforming class loader
143+ environment ' target' , ' fmltestserver'
144+ // This is a custom service used to launch with ModLauncher's transforming class loader
127145 mods {
128146 compactmachines { // The mod that is being tested - Replace this with your mod ID!
129- sources sourceSets. main
147+ sources sourceSets. api, sourceSets . main
130148 }
131149 }
132150 }
@@ -191,6 +209,14 @@ repositories {
191209 name ' MCUnitTests'
192210 url ' https://jitpack.io'
193211 }
212+
213+ // Curseforge stuff
214+ maven {
215+ url " https://cursemaven.com"
216+ content {
217+ includeGroup " curse.maven"
218+ }
219+ }
194220}
195221
196222def dev_mods = fileTree(dev_mods_dir). filter { it -> it. isFile() }. files. name. collect({ getModVersion(it) })
@@ -203,10 +229,7 @@ dependencies {
203229
204230
205231 // Deobfuscate each dev mod for runtime
206- dev_mods. each {
207- compileOnly fg. deobf(it)
208- runtimeOnly fg. deobf(it)
209- }
232+ dev_mods. each { implementation(fg. deobf(it)) }
210233
211234
212235 // JEI
@@ -219,30 +242,37 @@ dependencies {
219242
220243 testImplementation(fg. deobf(" com.github.alcatrazEscapee:mcjunitlib:1.3.3-${ minecraft_version} " ))
221244
245+ // Nicephore - Screenshots and Stuff
246+ runtimeOnly(fg. deobf(" curse.maven:nicephore-401014:3318114" ))
247+
248+ // Mekanism + Mek Generators - Tunnel testing
249+ runtimeOnly(fg. deobf(" curse.maven:mekanism-268560:3206392" ))
250+ runtimeOnly(fg. deobf(" curse.maven:mekanismgenerators-268566:3206395" ))
222251}
223252
224253// Example for how to get properties into the manifest for reading by the runtime..
225254jar {
255+ from sourceSets. api. output
256+ from sourceSets. main. output
226257 destinationDirectory = file(" $rootDir /build-out" )
258+
227259 finalizedBy(' reobfJar' )
228260 manifest {
229261 attributes([
230262 " Specification-Title" : " compactmachines" ,
231263 " Specification-Vendor" : " " ,
232264 " Specification-Version" : " 1" , // We are version 1 of ourselves
233265 " Implementation-Title" : project. name,
234- " Implementation-Version" : isRelease ? archiveVersion : " nightly-${ gitCommitHash} " ,
266+ " Implementation-Version" : isRelease ? archiveVersion : " nightly-${ gitCommitHash} " ,
235267 " Implementation-Vendor" : " " ,
236268 " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
237269 ])
238270 }
239271}
240272
241273task apiJar (type : Jar ) {
274+ from sourceSets. api. output
242275 // Sources included because of MinecraftForge/ForgeGradle#369
243- from(sourceSets. main. allJava)
244- from(sourceSets. main. output)
245- include ' com/robotgryphon/compactmachines/api/**'
246276 archiveClassifier = ' api'
247277 destinationDirectory = file(" $rootDir /build-out" )
248278}
0 commit comments