Skip to content

Commit

Permalink
build: fix run configs and update dev setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Jul 3, 2023
1 parent 4abe9bf commit 507430b
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 124 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Thumbs.db
/build/
/*/build/
/run/
/*/run/
/projectFilesBackup/
#IDEA files from Gradle
.idea/
Expand Down
30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,25 @@ A Minecraft Forge mod all about Redstone circuity.

## Development Environment Setup

Project Red uses a standard Forge Gradle environment. Setup steps should be the same as most other mods:
Project Red uses a standard Forge Gradle environment. Setup steps should be the same as most other mods. Instructions below are for Intellij IDEA, but the process is very similar for both Eclipse and VSCode. See [Forge Gradle](https://docs.minecraftforge.net/en/fg-5.x/gettingstarted/#setting-up-forgegradle) docs for more info.

1. Create a new folder and check out the repository:
```
mkdir ~/projectred && cd ~/projectred
git checkout https://github.com/MrTJP/ProjectRed.git .
```
2. Setup a new workspace with a decompiled copy of Minecraft:

2. Build the project:
```
./gradlew build
```

3. Generate run configurations:
```
./gradlew setupDecompWorkspace
./gradlew genIntellijRuns
```
3. You can now either set up Eclipse or IntelliJ Idea as your IDE.

For Eclipse:
* Generate an Eclipse project with `./gradlew eclipse`
* Import the generated project with `File > Import > General > Existing Projects into Workspace`

For Intellij Idea:
* Open IntelliJ and from the splash screen, select `Import Project`
* Point IntelliJ to the `./build.gradle` file in the git repo
* Close IntelliJ and run `./gradlew genIntellijRuns` to complete setup

4. If you'd like to contribute changes, you'll need to create your own fork of ProjectRed, push your changes, and then open a Pull Request for review.
4. Open the project directory in Intellij IDEA and give it a few minutes to set up and index the Gradle project.

### Building Locally
You can build a locally checked out copy of the repository by simply running:
```
./gradlew build
```
The built jars will be found in `./build/libs`.
You can re-build jar files locally by running `./gradlew build`. The jars can be found in `./<module>/build/libs`.
19 changes: 6 additions & 13 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand Down
23 changes: 8 additions & 15 deletions expansion/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@ plugins {
id 'org.spongepowered.mixin'
}

String mod_id = 'projectred-expansion'
String mod_id = 'projectred_expansion'

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("../core/src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand All @@ -40,7 +33,7 @@ dependencies {
implementation fg.deobf("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal")
implementation fg.deobf("codechicken:CBMultipart:${mc_version}-${cbm_version}:universal")

compileOnly project(":core")
implementation project(":core")
}

mixin {
Expand Down
23 changes: 8 additions & 15 deletions exploration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@ plugins {
id 'com.matthewprenger.cursegradle'
}

String mod_id = 'projectred-exploration'
String mod_id = 'projectred_exploration'

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("../core/src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand All @@ -37,7 +30,7 @@ dependencies {
implementation fg.deobf("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal")
implementation fg.deobf("codechicken:CBMultipart:${mc_version}-${cbm_version}:universal")

compileOnly project(":core")
implementation project(":core")
}

curseforge {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jei_version=10.2.1.+
cct_version=1.101.2

fabrication_version=0.1.0-alpha-15

org.gradle.jvmargs=-Xmx4096M
23 changes: 8 additions & 15 deletions illumination/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@ plugins {
id 'com.matthewprenger.cursegradle'
}

String mod_id = 'projectred-illumination'
String mod_id = 'projectred_illumination'

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("../core/src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand All @@ -37,7 +30,7 @@ dependencies {
implementation fg.deobf("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal")
implementation fg.deobf("codechicken:CBMultipart:${mc_version}-${cbm_version}:universal")

compileOnly project(":core")
implementation project(":core")
}

curseforge {
Expand Down
23 changes: 8 additions & 15 deletions integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@ plugins {
id 'com.matthewprenger.cursegradle'
}

String mod_id = 'projectred-integration'
String mod_id = 'projectred_integration'

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand All @@ -37,7 +30,7 @@ dependencies {
implementation fg.deobf("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal")
implementation fg.deobf("codechicken:CBMultipart:${mc_version}-${cbm_version}:universal")

compileOnly project(":core")
implementation project(":core")
}

curseforge {
Expand Down
51 changes: 51 additions & 0 deletions runtime/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Used only for generating run configs that include all ProjectRed modules in the classpath.
*/
plugins {
id 'net.minecraftforge.gradle'
id 'org.spongepowered.mixin'
}

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("../core/src/main/resources/META-INF/accesstransformer.cfg")

runs {
configureEach {
ideaModule "${rootProject.name}.${project.name}.main"

mods {
'projectred_core' { source project(":core").sourceSets.main }
'projectred_expansion' { source project(":expansion").sourceSets.main }
'projectred_exploration' { source project(":exploration").sourceSets.main }
'projectred_illumination' { source project(":illumination").sourceSets.main }
'projectred_integration' { source project(":integration").sourceSets.main }
'projectred_transmission' { source project(":transmission").sourceSets.main }
}
}

client {
workingDirectory file('run')
}

server {
workingDirectory file('run_server')
}
}
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"

runtimeOnly project(":core")
runtimeOnly project(":expansion")
runtimeOnly project(":exploration")
runtimeOnly project(":illumination")
runtimeOnly project(":integration")
runtimeOnly project(":transmission")
}

mixin {
debug.verbose = true
debug.export = true
}
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ pluginManagement {

rootProject.name = 'ProjectRed'

include 'core', 'expansion', 'exploration', 'illumination', 'integration', 'transmission'
// Mod modules
include 'core', 'expansion', 'exploration', 'illumination', 'integration', 'transmission'

// Empty module for client/server run configurations
include 'runtime'
55 changes: 24 additions & 31 deletions transmission/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,18 @@ plugins {

apply plugin: 'net.minecraftforge.gradle'

String mod_id = 'projectred-transmission'
String mod_id = 'projectred_transmission'

minecraft {
mappings channel: mcp_mappings, version: mc_version
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
server {
workingDirectory file('run')
mods {
'${mod_id}' { source sourceSets.main }
}
}
datagen {
data {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

ideaModule "${rootProject.name}.${project.name}.main"

workingDirectory file('run')
args '--mod', mod_id, '--all', '--output', file("src/main/generated"), '--existing', file("src/main/resources")
mods {
Expand All @@ -39,24 +32,24 @@ dependencies {
implementation fg.deobf("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal")
implementation fg.deobf("codechicken:CBMultipart:${mc_version}-${cbm_version}:universal")

compileOnly project(":core")
implementation project(":core")
}

curseforge {
apiKey = System.getenv('CURSE_TOKEN') ?: 'XXX'

// Transmission
project {
id = '478939'
releaseType = System.getenv('CURSE_RELEASE_TYPE') ?: 'alpha'
changelogType = 'markdown'
changelog = rootProject.file('CHANGELOG.md')
relations {
requiredDependency 'project-red-core'
}

// Java/ForgeGradle integrations don't work after 1.18.2 port
addGameVersion "${mc_version}"
addGameVersion "Java ${java_lang_version}"
}
apiKey = System.getenv('CURSE_TOKEN') ?: 'XXX'

// Transmission
project {
id = '478939'
releaseType = System.getenv('CURSE_RELEASE_TYPE') ?: 'alpha'
changelogType = 'markdown'
changelog = rootProject.file('CHANGELOG.md')
relations {
requiredDependency 'project-red-core'
}

// Java/ForgeGradle integrations don't work after 1.18.2 port
addGameVersion "${mc_version}"
addGameVersion "Java ${java_lang_version}"
}
}

0 comments on commit 507430b

Please sign in to comment.