Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit ed8ac66

Browse files
committed
Lots of changes I've thrown in over the past couple months and the past day.
- Added a few more folders to .gitignore. - Added support for extending the Gradle build (I use this for a currently-private project). - Merged the checkout scripts and made them more useful (pass "b" for bleeding, "s" for the latest stable, or a number for that stable version). - Added support for passing arguments to the decompile script. - Added a script for setupDevWorkspace (setup-no-decompile).
1 parent 0fb8ec7 commit ed8ac66

8 files changed

+112
-40
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
/SpongeVanilla/
44
/gradlew
55
/gradlew.bat
6-
/gradle/wrapper
6+
/gradle/
77
.gradle/
88
.idea/
9+
build/
10+
.gitmodules
911
.classpath
1012
.project
13+
.settings/

build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
// SpongeForge: build.gradle references rootProject.tasks.shadowDevJar
44
task('shadowDevJar').dependsOn { project('SpongeForge').tasks.shadowDevJar }
5+
6+
if (file('gradle/local-build.gradle').exists()) {
7+
apply from: file('gradle/local-build.gradle')
8+
}

checkout

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/sh -e
2+
get_spongepowered_remote() {
3+
git remote -v | grep -E 'SpongePowered\/'`basename $(pwd)`'(\.git)? \(fetch\)' | awk -F"\t" '{print $1}'
4+
}
5+
6+
checkout() {
7+
if git rev-parse $1>/dev/null 2>/dev/null
8+
then git checkout $1
9+
else git checkout -b `get-spongepowered-remote`/$1 $1
10+
fi
11+
}
12+
13+
# $1 should be a pattern containing OUT
14+
# $2, if present, should be the smallest number
15+
get_largest_numbered_branch() {
16+
x=
17+
if [ ! -z $2 ]
18+
then x=$(($2 + 1))
19+
else x=1
20+
fi
21+
22+
remote=`get_spongepowered_remote`
23+
# Must pipe git branch through grep -e '.*'; git branch does not error when no branches match, but grep does.
24+
while git branch --list -a $remote/`echo $1 | sed 's/OUT/'$x'/'` | grep -e '.*' > /dev/null
25+
do x=$((x + 1))
26+
done
27+
echo $((x - 1))
28+
}
29+
30+
help() {
31+
echo "Usage:" > /dev/stderr
32+
echo " $0 b - Check out the latest bleeding version" > /dev/stderr
33+
echo " $0 s - Check out the latest stable version" > /dev/stderr
34+
echo " $0 <major API version> - Check out a specific stable version" > /dev/stderr
35+
echo " Example: $0 6" > /dev/stderr
36+
echo " Minimum supported version is 5" > /dev/stderr
37+
exit 1
38+
}
39+
40+
if [ $# -ne 1 ]
41+
then help
42+
elif [ $1 = b ]
43+
then
44+
echo Fetching all repositories...
45+
git submodule foreach --recursive git fetch --all --prune
46+
echo
47+
echo Checking out bleeding...
48+
git submodule foreach --recursive git checkout bleeding
49+
elif [ $1 = s ] || [ $(($1)) -gt 4 ] # If it isn't a number, it will resolve to 0, and thus not be checked.
50+
then
51+
echo Fetching all repositories...
52+
git submodule foreach --recursive git fetch --all --prune
53+
echo
54+
55+
cd SpongeCommon
56+
major=$1
57+
if [ $major = s ]
58+
then
59+
major=`get_largest_numbered_branch "stable-OUT" 5`
60+
echo Will check out API version $major in all repositories.
61+
elif [ $major -lt 5 ]
62+
then
63+
help
64+
elif ! (git branch --list -a `get_spongepowered_remote`/stable-$major | grep -e '.*') > /dev/null
65+
then
66+
echo No such API version $major. If you want bleeding, use '"b"' instead. > /dev/stderr
67+
exit 1
68+
fi
69+
echo Checking out SpongeCommon...
70+
checkout stable-$major
71+
cd ..
72+
echo
73+
echo Checking out SpongeForge...
74+
cd SpongeForge
75+
checkout stable-$major
76+
cd ..
77+
echo
78+
echo Checking out SpongeVanilla...
79+
cd SpongeVanilla
80+
checkout stable-$major
81+
cd ..
82+
echo
83+
84+
cd SpongeCommon/SpongeAPI
85+
minor=`get_largest_numbered_branch "stable-$major.OUT.0"`
86+
patch=`get_largest_numbered_branch "stable-$major.$minor.OUT"`
87+
echo Checking out SpongeAPI...
88+
checkout stable-$major.$minor.$patch
89+
cd ../..
90+
else help
91+
fi
92+
echo
93+
echo Pulling all repositories...
94+
git submodule foreach --recursive git pull

checkout-bleeding

-3
This file was deleted.

checkout-stable

-35
This file was deleted.

decompile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
GRADLE_OPTS=-Xmx2G ./gradlew --no-daemon setupDecompWorkspace
2+
GRADLE_OPTS=-Xmx2G ./gradlew --no-daemon "$@" setupDecompWorkspace

settings.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ include 'SpongeForge'
33
include 'SpongeVanilla'
44
include 'SpongeCommon'
55
include 'SpongeCommon:SpongeAPI'
6+
if (file('SpongeVanilla/client.gradle').exists() && file('SpongeVanilla/client.gradle').text.contains("include 'client'") && !file
7+
('SpongeVanilla/client.gradle').text.contains("// include 'client'")) {
8+
include 'SpongeVanilla:client'
9+
}
10+
if (file('gradle/local-settings.gradle').exists()) {
11+
apply from: file('gradle/local-settings.gradle')
12+
}

setup-no-decompile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
GRADLE_OPTS=-Xmx2G ./gradlew --no-daemon "$@" setupDevWorkspace

0 commit comments

Comments
 (0)