Jump to content

Several artifacts from one project


Onyn

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.