Skip to content

Instantly share code, notes, and snippets.

@twizmwazin
Created February 17, 2015 06:37
Show Gist options
  • Save twizmwazin/d68dfeff1ab54cb13896 to your computer and use it in GitHub Desktop.
Save twizmwazin/d68dfeff1ab54cb13896 to your computer and use it in GitHub Desktop.
SportBukkit Build Script
#!/bin/python
#
# Copyright 2015 Kevin Phoenix. All rights reserved.
#
# Temporary script written to automatically compile SportBukkit 1.8 builds
# from the real1.8 branch. To run this script, git, maven, and bash need to
# be accessible from the command line.
import os
import shutil
import subprocess
import sys
def git(args):
return subprocess.check_call(["git"] + list(args))
def bash(args):
return subprocess.check_call(["bash"] + list(args))
def build(args):
odir = os.getcwd()
os.chdir(args)
result = subprocess.call(["mvn", "clean", "install"])
os.chdir(odir)
return result
def error():
print("An error has occurred, aborting...")
sys.exit(False)
print("Cleaning working directory...")
if shutil.rmtree("SportBukkit", ignore_errors=True):
error()
print("Cloning SportBukkit...")
git(["clone", "https://github.com/OvercastNetwork/SportBukkit.git", "SportBukkit"])
print("Switching to branch \'real1.8\'...")
os.chdir("SportBukkit")
git(["checkout", "real1.8"])
print("Cloning Bukkit...")
git(["clone", "https://[email protected]/stash/scm/spigot/bukkit.git", "base/Bukkit"])
print("Checking out Bukkit commit e3d656cd5dd...")
os.chdir("base/Bukkit")
git(["checkout", "e3d656cd5dd"])
os.chdir("../..")
print("Cloning CraftBukkit...")
git(["clone", "https://[email protected]/stash/scm/spigot/craftbukkit.git", "base/CraftBukkit"])
print("Checking out CraftBukkit commit 15e81cf551f...")
os.chdir("base/CraftBukkit")
git(["checkout", "15e81cf551f"])
os.chdir("../..")
print("Cloning Minecraft-Server...")
git(["clone", "https://[email protected]/twizmwazin/minecraft-server.git", "base/Minecraft-Server"])
print("Applying CraftBukkit patches...")
os.chdir('base/CraftBukkit')
bash(["applyPatches.sh", "../Minecraft-Server"])
git(["add", "src/main/java/net"])
git(["commit", "-m", "\'CraftBukkit\'"])
os.chdir("../..")
print("Applying SportBukkit patches...")
if subprocess.check_call(["bash"] + ["applyPatches.sh"]):
error()
print("Compiling SportBukkit-api...")
if build("build/Bukkit"):
error()
print("Compiling SportBukkit...")
if build("build/CraftBukkit"):
error()
print("Build Complete!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment