def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True): sys.path.append(fml_dir) from fml import copytree, apply_patches #patch files print 'Applying Minecraft Forge patches' sys.stdout.flush() if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')): apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir) if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')): copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft')) if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')): copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'))
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0): version = load_version(build_num) print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build']) src_dir = os.path.join(mcp_dir, 'src') if os.path.isdir(src_dir): shutil.rmtree(src_dir) sys.path.append(fml_dir) from fml import copytree print 'src_work -> src' copytree(os.path.join(mcp_dir, 'src_work'), src_dir) print '\nCopying Client Code' copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1) print '\nCopying Common Code' copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'), -1) print inject_version(os.path.join(src_dir, 'minecraft/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num) error_level = 0 try: sys.path.append(mcp_dir) from runtime.recompile import recompile os.chdir(mcp_dir) reset_logger() recompile(None, True, False) reset_logger() os.chdir(forge_dir) except SystemExit, e: if not e.code == 0: print 'Recompile Exception: %d ' % e.code error_level = e.code
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0): version = load_version(build_num) print '=================================== Build %d.%d.%d.%d Start =================================' % ( version['major'], version['minor'], version['revision'], version['build']) src_dir = os.path.join(mcp_dir, 'src') if os.path.isdir(src_dir): shutil.rmtree(src_dir) sys.path.append(fml_dir) sys.path.append(os.path.join(fml_dir, 'install')) from fml import copytree print 'src_work -> src' copytree(os.path.join(mcp_dir, 'src_work'), src_dir) print '\nCopying Client Code' copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1) print '\nCopying Common Code' copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'), -1) print inject_version( os.path.join( src_dir, 'minecraft/net/minecraftforge/common/ForgeVersion.java'.replace( '/', os.sep)), build_num) error_level = 0 try: sys.path.append(mcp_dir) from runtime.commands import Commands, CLIENT, SERVER, CalledProcessError from runtime.mcp import recompile_side os.chdir(mcp_dir) reset_logger() commands = Commands(None, verify=True) try: recompile_side(commands, CLIENT) except CalledProcessError as e: error_level = 1 pass reset_logger() os.chdir(forge_dir) except SystemExit, e: if not e.code == 0: print 'Recompile Exception: %d ' % e.code error_level = e.code
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0): version = load_version(build_num) print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build']) src_dir = os.path.join(mcp_dir, 'src') if os.path.isdir(src_dir): shutil.rmtree(src_dir) sys.path.append(fml_dir) sys.path.append(os.path.join(fml_dir, 'install')) from fml import copytree print 'src_work -> src' copytree(os.path.join(mcp_dir, 'src_work'), src_dir) print '\nCopying Client Code' copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1) print '\nCopying Common Code' copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'), -1) print inject_version(os.path.join(src_dir, 'minecraft/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num) error_level = 0 try: sys.path.append(mcp_dir) from runtime.commands import Commands, CLIENT, SERVER, CalledProcessError from runtime.mcp import recompile_side os.chdir(mcp_dir) reset_logger() commands = Commands(None, verify=True) try: recompile_side(commands, CLIENT) except CalledProcessError as e: error_level = 1 pass reset_logger() os.chdir(forge_dir) except SystemExit, e: if not e.code == 0: print 'Recompile Exception: %d ' % e.code error_level = e.code