Skip to content

Commit

Permalink
Build system update
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wimmer committed Jul 16, 2016
1 parent a17b1e7 commit 96827f6
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 29 deletions.
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# MoreFood

All releases are currently located here: [MoreFood Releases](https://github.com/teammion/morefood/releases)
For more information visit the [Curse Project](http://minecraft.curseforge.com/projects/tm-morefood)

## How to contribute?

1. Get [Git](https://git-scm.com)
2. [Fork repository](https://github.com/teammion/morefood/fork)
3. Clone repository using git: `git clone [your-fork-url]`
4. Setup Minecraft Forge MDK: `./gardlew setupDecompWorkspace`
5. Setup your IDE: `./gradlew [idea|eclipse|...]`
6. Start coding
7. Push to your forked repository: `git push origin master`
8. [Create Pull Request](https://github.com/teammion/morefood/compare)
9. Repeate steps 6 to 9
1. To update your code add upstream-remote `git remote add upstream https://github.com/teammion/morefood.git` (This is only needed once)
2. To update from upstram-remote: `git pull upstream master`
### Prerequisites

- Node, NPM
- Git (On windows: Git Bash)

### How to do it

Since I'm using a customized build system, I should tell you how to use it.

``` bash
# Setup gradle workspace and configure for IDE
npm run setup

# Run Minecraft Client
npm run client

# Run Minecraft Server
npm run server

# Build project
npm run build
```

The version must be changed in the "package.json" file.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ plugins {
}
*/
version = "1.0.0-rc.1"
group = "io.teammion.morefood" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = "io.teammion.morefood"
archivesBaseName = "morefood"

minecraft {
version = "1.10.2-12.18.0.2009"
version = "1.10.2-12.18.1.2014"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
Expand Down
17 changes: 4 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
#!/usr/bin/env bash

# Get version
version="$(node <<< "console.log(require(\"./package.json\").version);")"
# Update
npm run update

# Write version
while IFS="" read line
do
if [ "${line:0:10}" == "version = " ]
then
old_version="${line}"
fi
done < build.gradle
sed -i "/${old_version}/c\version = \"${version}\"" build.gradle
# Build
# Executing gradlew
echo "Executing gradlew..."
./gradlew clean build
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sat Jul 09 09:54:48 CEST 2016
#Sat Jul 16 16:09:28 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"version": "1.0.0-rc.1",
"description": "This Minecraft Mod will add additional food to Mincraft to provide a healthy variety.",
"scripts": {
"build": "./build.sh"
"setup": "./setup.sh",
"build": "./build.sh",
"update": "./update.sh",
"client": "./gradlew runClient",
"server": "./gradlew runServer"
},
"repository": {
"type": "git",
Expand Down
19 changes: 19 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Update
npm run update
sed -i "/group = */c\group = \"io.teammion.morefood\"" build.gradle
sed -i "/group= */c\group = \"io.teammion.morefood\"" build.gradle
sed -i "/archivesBaseName = */c\archivesBaseName = \"morefood\"" build.gradle

# IDE to configure for
read -p "IDE to configure for: [idea|eclipse] " ide
if [ ! "${ide,,}" == "idea" ] && [ ! "${ide,,}" == "eclipse" ]
then
ide=""
echo "No valid IDE! No IDE will be configured."
fi

# Executing gradlew
echo "Executing gradlew..."
JAVA_OPTS="-Xmx2g" ./gradlew setupDecompWorkspace $ide
16 changes: 16 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# Get version
version="$(node <<< "console.log(require(\"./package.json\").version);")"
echo "Version: $version"
# Update build.gradle
echo "Updating build.gradle..."
while IFS="" read line
do
if [ "${line:0:10}" == "version = " ]
then
old_version="$line"
fi
done < build.gradle
sed -i "/$old_version/c\version = \"$version\"" build.gradle

0 comments on commit 96827f6

Please sign in to comment.