Posted October 19, 20177 yr Hello. For some reasons I need to make distinct jar files for server and client. And I choose to split code into two source sets (main and client). So there is my gradle.build file: Spoiler buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } apply plugin: 'forge' sourceSets { client } configurations { clientCompile.extendsFrom compile clientRuntime.extendsFrom runtime reobf.dependsOn.add("jarClient"); } version = "0.1.2" group = "mygroup" archivesBaseName = "mymod" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" } task jarClient(type: Jar, dependsOn: "compileClientJava") { classifier = "client" from sourceSets.client.output } Task dependency order seems to be correct: Spoiler gradle build --dry-run :compileApiJava SKIPPED :processApiResources SKIPPED :apiClasses SKIPPED :sourceMainJava SKIPPED :compileJava SKIPPED :processResources SKIPPED :classes SKIPPED :jar SKIPPED :compileTestJava SKIPPED :processTestResources SKIPPED :testClasses SKIPPED :test SKIPPED :extractMcpData SKIPPED :getVersionJson SKIPPED :extractUserDev SKIPPED :genSrgs SKIPPED :compileClientJava SKIPPED :processClientResources SKIPPED :clientClasses SKIPPED :jarClient SKIPPED :reobf SKIPPED :assemble SKIPPED :check SKIPPED :build SKIPPED BUILD SUCCESSFUL in 2s But client jar is not passed to reobf task and I can't find how to do this. Any suggestions?
October 20, 20177 yr Author If I say about reasons, then I'm afraid I will not get an answer to the question, since the discussion will shift in a completely different area. We may discuss the reasons for this architecture later, when I get an answer to my question.
October 24, 20177 yr Author ReobfTask have special method that add jar file to processing queue. So I simply use it in my task and work is done: Spoiler task jarClient(type: Jar, dependsOn: "compileClientJava") { classifier = "client" from sourceSets.client.output reobf.reobf(getArchivePath()) } Now about reasons. 1. This mod intended to use only by sole private minecraft server. There is no problems with distribution because there is no distribution at all. 2. Mod implements anti-cheat and other security measures. There is no reasons to expose security check details to the client side.
October 24, 20177 yr Author No. Client side collect information and send it to the server. Server side check that data and make decisions. Pure client side checks easy to bypass and because of that I need different code on client and server.
October 24, 20177 yr Author ...and third intermediary mod with shared code . Differentiation by sourceSets is enough for me.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.