Jump to content

[Eclipse] Proper way of creating sub-mod addons etc.


SiriusWolf

Recommended Posts

Hey there, because I use 2 entirely different versions of forge this has never been an issue.

But now that I've released my 1.8 version there's things I want to add, but not as a part of the main mod.

 

Mods like TE, Mekanism, Growthcraft, etc. all have addons that require a base mod.

What is the proper way to have multiple mods and addons in a single forge copy

but only build them one at a time and be dependent?

 

I've tried fooling with the package structure and such, and even tried it the way I'd do this task in C# (VS)

but it all builds together.

a.k.a. Sirius

width=400 height=82http://i.imgur.com/QRtYi6e.png[/img]

Link to comment
Share on other sites

I am also interested in this.  I know Reika has a gradle.build file that does it for him (I've got a copy, but I can't decipher it in order to use it).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I am also interested in this.  I know Reika has a gradle.build file that does it for him (I've got a copy, but I can't decipher it in order to use it).

 

http://goo.gl/TSNMvo

It seems to be that bottom half that matters, directing gradle to build 3 separate libraries that all depend on 1 of them.

I've never played with the build file and didn't get it enough when I first looked at it when I began modding, but I'd really like

to be able to release the next couple of batches of stuff for my mod in parts rather than have another 5-10 config file options

the average user probably doesn't look at anyway. lol

a.k.a. Sirius

width=400 height=82http://i.imgur.com/QRtYi6e.png[/img]

Link to comment
Share on other sites

I'll have to mess around with it when I get a chance.  I haven't even looked at my code in three days.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

This is an excellent question, and it is one of those things that some people seem to just magically know how to do... for example, I had no idea that /src/api/java/ was a special folder (it didn't even exist). I suppose it's a feature of Gradle to link those files automatically?

 

Then there's all sorts of magic that is evidently possible with build.gradle, but there are probably whole books devoted to that subject - the online documentation certainly isn't a quick read.

 

For us non-Gradle experts, it would be really nice to have a 'Gradle for Modders' information page, somewhere we can quickly learn about the most common modding-related tasks so we don't all have to become experts in Gradle and can focus instead on adding content to our mods.

Link to comment
Share on other sites

Ha, Finally its my time to shine!

 

I did this a while ago to try out the submod system. I will post some step by step instructions in a few hours.

However, when I wrote them I never intended to share them and I never really tried if everything works (looks like it does, though)

Here could be your advertisement!

Link to comment
Share on other sites

Couple things.

 

To do a task, run "gradlew [name of task]" e.g. "gradlew fullBuild"

 

You can define variables in the build.gradle file like so:

 

def libVersion = "1.3.0"
def oresVersion = "0.3.0"
def hazardsVersion = "0.2.0"
def wildlifeVersion = "0.2.0"

 

There's supposedly a way to wrap those in the build's extended properties, eg.

ext {
   mySpecialProperty = "1234"
}

But I can't seem to reference it properly (that part is fine, the reference throws a build error) per section 13.5.2.

 

I'm also getting a build failure doing the

releaseJars

task, which is responsible for renaming the zip files as jar files ("file is in use by another process") but the file is renamed correctly (as well as every other step completing successfully).  Here's the debug output:

 

12:07:25.447 [iNFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :releaseJars (Thread[main,5,main]) started.
12:07:25.454 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :releaseJars
12:07:25.454 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter]
                                     Starting to execute task ':releaseJars'
12:07:25.471 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter]
                                     Determining if task ':releaseJars' is up-to-date
12:07:31.718 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter]
                                     Finished executing task ':releaseJars'
12:07:31.737 [iNFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :releaseJars (Thread[main,5,main]) completed. Took 6.283 secs.
12:07:31.753 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 36.296 secs, idle: 0.289 secs
12:07:31.784 [ERROR] [org.gradle.BuildExceptionReporter]
12:07:31.800 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.

 

Lastly don't forget to include/exclude your assets folder(s) as needed in the from zipTree(...) section:

 

exclude 'assets/**'
include 'assets/submod1/**'
include 'assets/submod2**'
etc

 

Anyway, here's my build.gradle

http://pastebin.com/hVGQqPcr

Note that I have a few include/exclude listing based on my setup which is not exactly ideal.  I was simply taking the path of least resistance (adding the extra include/exclude line rather than moving things to new folders and having the build file move them back to where they're needed).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

As a side note, I set up bat files to run the build commands for me, rather than using a command line (where I have to copy-paste the folder directory before I can do anything).

 

gradlew fullBuild
pause

 

The 'pause' should hold the window open (until you press any key) but I've had mixed results.  If it doesn't work, do this instead:

start /wait  fullBuild

 

It'll create a second command window, but it'll be forced to stay open after the process completes.  Either close it or type "exit"

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Or I can double-click a batch file.  I type the command once, and bam!

width=571 height=464http://imgs.xkcd.com/comics/is_it_worth_the_time.png[/img]

I save 5 seconds, I do it about once a week, and it took me less than 21 minutes to write.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.