Skip to content

Commit

Permalink
first working version for multiproject gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
Keridos committed Sep 26, 2023
1 parent eab7deb commit 4dcf852
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 450 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "runenv"]
path = runenv
url = https://github.com/amadornes/fg-multiproject-runenv.git
[submodule "OMLib"]
path = OMLib
url = [email protected]:OpenModularTurretsTeam/OMLib.git
[submodule "OpenModularTurrets"]
path = OpenModularTurrets
url = [email protected]:OpenModularTurretsTeam/OpenModularTurrets.git
1 change: 1 addition & 0 deletions OMLib
Submodule OMLib added at 74168f
1 change: 1 addition & 0 deletions OpenModularTurrets
Submodule OpenModularTurrets added at e94989
45 changes: 2 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
# ForgeGradle Multiproject Template
# OpenModularMods Multiproject Repo

This repository provides a template for multiproject development environments using ForgeGradle.

## Project structure
This template builds upon the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repo to provide the
binding logic that makes the multiproject environment work.

The built-in `examplelib` and `examplemod` projects are standard Forge MDK projects, heavily trimmed down for the sake
of simplicity, and are unaware that they exist within a multiproject environment.

## Setup
To set up a multiproject development environment, just clone this repository.
Optionally, you may delete the `.git` directory and initialize your own git repo in its place.
It is advised to keep the *runenv template* as a submodule, which allows you to easily pull new versions down the line.

## Customization
The most basic form of customization comes in the form of adding new projects to `settings.gradle`.
Just add new `include 'YourProjectName'` lines in the same place you find the predefined ones.

If you are authoring several mods that depend on each other, but you still want to be able to compile them on their own,
this template also allows it.
For example, if one of your projects depends on `fg.deobf("com.example:examplelib:1.2.3")`, you can define a
substitution in the root level buildscript: `substitute module("com.example:examplelib") using project(":examplelib")`.
This will make it so whatever depended on that artifact will now depend on the project in your dev environment instead.
Make sure to also define an exclusion for the same module in the `if` statement above it. That will ensure that
ForgeGradle doesn't try to unnecessarily resolve the artifact.

Further customization can be done by either modifying the *runenv template*, or the `project('runenv')` closure in the
root level buildscript.

## Generating runs
The run configurations for your multiproject environment should point to the *runenv template*.
You must run that project's `gen<IDE>Runs` task and use its classpath at runtime for all the projects to load.

For datagen, you may still use each project's individual runs.

## Known issues
Please check the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repository, as that will contain
the latest information regarding compatibility.

## Contributions
Pull requests adding extended feature support and bugfixes are welcome.
Please keep them simple if possible.
This repository provides a multiproject environment for our mods.
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ subprojects {
configurations.all {
if (it.name.startsWith("_")) {
// You must exclude the same modules you substitute here, because ForgeGradle
exclude group: "com.example", module: "examplelib"
exclude group: "com.ommods", module: "omlib"
return
}

resolutionStrategy.dependencySubstitution {
// Apply substitutions for modules your projects depend on, replacing them with another project
substitute module("com.example:examplelib") using project(":examplelib")
logger.info("substituted omlib")
substitute module("com.ommods:omlib") using project(":OMLib")
}

// Uncomment the following line if you are running into issues with dependency resolution.
Expand All @@ -26,10 +27,10 @@ subprojects {

project('runenv') {
ext {
mcversion = '1.19'
forgeversion = '41.1.0'
mcversion = '1.19.2'
forgeversion = '43.3.0'
// javaversion = 17 // Defaults to 17 already
// mappings = channel: 'official', version: '1.18.2' // Defaults to mojmap for the specified MC version
// mappings = "channel: 'parchment', version: '2022.11.27-1.19.2'" // Defaults to mojmap for the specified MC version
// runArgs = [ ] // Arguments applied to all runs
// runProps = [ name: value ] // Properties applied to all runs
}
Expand Down
5 changes: 0 additions & 5 deletions examplelib/.gitattributes

This file was deleted.

25 changes: 0 additions & 25 deletions examplelib/.gitignore

This file was deleted.

105 changes: 0 additions & 105 deletions examplelib/build.gradle

This file was deleted.

3 changes: 0 additions & 3 deletions examplelib/gradle.properties

This file was deleted.

25 changes: 0 additions & 25 deletions examplelib/src/main/java/com/example/examplelib/ExampleLib.java

This file was deleted.

25 changes: 0 additions & 25 deletions examplelib/src/main/resources/META-INF/mods.toml

This file was deleted.

7 changes: 0 additions & 7 deletions examplelib/src/main/resources/pack.mcmeta

This file was deleted.

5 changes: 0 additions & 5 deletions examplemod/.gitattributes

This file was deleted.

25 changes: 0 additions & 25 deletions examplemod/.gitignore

This file was deleted.

Loading

0 comments on commit 4dcf852

Please sign in to comment.