Update python scripts to reflect that FML is now a submodule. Delete updateasmdata as it's in /fml/ now. Build should work once again.
This commit is contained in:
parent
f7d6c2384c
commit
00c596f5a3
4 changed files with 93 additions and 145 deletions
4
forge.py
4
forge.py
|
@ -64,7 +64,7 @@ def zip_folder(path, key, zip):
|
||||||
zip_folder(file_path, file_key, zip)
|
zip_folder(file_path, file_key, zip)
|
||||||
else:
|
else:
|
||||||
if not file_key.replace(os.sep, '/') in zip.NameToInfo:
|
if not file_key.replace(os.sep, '/') in zip.NameToInfo:
|
||||||
print file_key
|
print ' ' + file_key
|
||||||
zip.write(file_path, file_key)
|
zip.write(file_path, file_key)
|
||||||
|
|
||||||
def zip_create(path, key, zip_name):
|
def zip_create(path, key, zip_name):
|
||||||
|
@ -77,6 +77,7 @@ def zip_create(path, key, zip_name):
|
||||||
|
|
||||||
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
|
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
|
||||||
sys.path.append(fml_dir)
|
sys.path.append(fml_dir)
|
||||||
|
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||||
from fml import copytree, apply_patches
|
from fml import copytree, apply_patches
|
||||||
|
|
||||||
#patch files
|
#patch files
|
||||||
|
@ -100,6 +101,7 @@ def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0):
|
||||||
shutil.rmtree(src_dir)
|
shutil.rmtree(src_dir)
|
||||||
|
|
||||||
sys.path.append(fml_dir)
|
sys.path.append(fml_dir)
|
||||||
|
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||||
from fml import copytree
|
from fml import copytree
|
||||||
|
|
||||||
print 'src_work -> src'
|
print 'src_work -> src'
|
||||||
|
|
74
release.py
74
release.py
|
@ -34,8 +34,6 @@ def main():
|
||||||
mcp_dir = os.path.join(forge_dir, 'mcp')
|
mcp_dir = os.path.join(forge_dir, 'mcp')
|
||||||
if not options.mcp_dir is None:
|
if not options.mcp_dir is None:
|
||||||
mcp_dir = os.path.abspath(options.mcp_dir)
|
mcp_dir = os.path.abspath(options.mcp_dir)
|
||||||
elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
|
|
||||||
mcp_dir = os.path.abspath('..')
|
|
||||||
|
|
||||||
ret = 0
|
ret = 0
|
||||||
fml_dir = os.path.join(forge_dir, 'fml')
|
fml_dir = os.path.join(forge_dir, 'fml')
|
||||||
|
@ -43,8 +41,31 @@ def main():
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
|
|
||||||
|
temp_dir = os.path.join(forge_dir, 'temp')
|
||||||
|
src_dir = os.path.join(mcp_dir, 'src')
|
||||||
|
reobf_dir = os.path.join(mcp_dir, 'reobf')
|
||||||
|
client_dir = os.path.join(reobf_dir, 'minecraft')
|
||||||
|
fml_dir = os.path.join(temp_dir, 'fml')
|
||||||
|
|
||||||
print '=================================== Release Start ================================='
|
print '=================================== Release Start ================================='
|
||||||
|
|
||||||
|
fml = glob.glob(os.path.join(forge_dir, 'fml', 'target', 'fml-src-*.%d-*.zip' % build_num))
|
||||||
|
if not len(fml) == 1:
|
||||||
|
if len(fml) == 0:
|
||||||
|
print 'Missing FML source zip, should be named fml-src-*.zip inside ./fml/target/ created when running setup'
|
||||||
|
else:
|
||||||
|
print 'To many FML source zips found, we should only have one. Check the Forge Git for the latest FML version supported'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if os.path.isdir(fml_dir):
|
||||||
|
shutil.rmtree(fml_dir)
|
||||||
|
|
||||||
|
print 'Extracting: %s' % os.path.basename(fml[0])
|
||||||
|
zf = zipfile.ZipFile(fml[0])
|
||||||
|
zf.extractall(temp_dir)
|
||||||
|
zf.close()
|
||||||
|
|
||||||
error_level = 0
|
error_level = 0
|
||||||
try:
|
try:
|
||||||
sys.path.append(mcp_dir)
|
sys.path.append(mcp_dir)
|
||||||
|
@ -58,15 +79,11 @@ def main():
|
||||||
print 'Reobfusicate Exception: %d ' % e.code
|
print 'Reobfusicate Exception: %d ' % e.code
|
||||||
error_level = e.code
|
error_level = e.code
|
||||||
|
|
||||||
src_dir = os.path.join(mcp_dir, 'src')
|
extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir)
|
||||||
reobf_dir = os.path.join(mcp_dir, 'reobf')
|
|
||||||
client_dir = os.path.join(reobf_dir, 'minecraft')
|
|
||||||
|
|
||||||
extract_fml_obfed(mcp_dir, reobf_dir, client_dir)
|
|
||||||
extract_paulscode(mcp_dir, client_dir)
|
extract_paulscode(mcp_dir, client_dir)
|
||||||
version = load_version(build_num)
|
version = load_version(build_num)
|
||||||
version_forge = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build'])
|
version_forge = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build'])
|
||||||
version_mc = load_mc_version(forge_dir)
|
version_mc = load_mc_version(fml_dir)
|
||||||
branch = get_branch_name()
|
branch = get_branch_name()
|
||||||
|
|
||||||
version_str = '%s-%s' % (version_mc, version_forge)
|
version_str = '%s-%s' % (version_mc, version_forge)
|
||||||
|
@ -103,33 +120,35 @@ def main():
|
||||||
zip_add('client/forge_logo.png')
|
zip_add('client/forge_logo.png')
|
||||||
zip_add('install/MinecraftForge-Credits.txt')
|
zip_add('install/MinecraftForge-Credits.txt')
|
||||||
zip_add('install/MinecraftForge-License.txt')
|
zip_add('install/MinecraftForge-License.txt')
|
||||||
zip_add('fml/CREDITS-fml.txt')
|
|
||||||
zip_add('fml/LICENSE-fml.txt')
|
|
||||||
zip_add('fml/README-fml.txt')
|
|
||||||
zip_add('fml/common/fml_at.cfg')
|
|
||||||
zip_add('fml/common/fml_marker.cfg')
|
|
||||||
zip_add('fml/common/fmlversion.properties')
|
|
||||||
zip_add('fml/common/mcpmod.info')
|
|
||||||
zip_add('fml/client/mcp.png')
|
|
||||||
zip_add('install/Paulscode IBXM Library License.txt')
|
zip_add('install/Paulscode IBXM Library License.txt')
|
||||||
zip_add('install/Paulscode SoundSystem CodecIBXM License.txt')
|
zip_add('install/Paulscode SoundSystem CodecIBXM License.txt')
|
||||||
zip_add('common/forge_at.cfg')
|
zip_add('common/forge_at.cfg')
|
||||||
zip_add(version_file)
|
zip_add(version_file)
|
||||||
if not options.skip_changelog:
|
if not options.skip_changelog:
|
||||||
zip_add(changelog_file, 'MinecraftForge-Changelog.txt')
|
zip_add(changelog_file, 'MinecraftForge-Changelog.txt')
|
||||||
zip_end()
|
|
||||||
|
|
||||||
zips = glob.glob('fml/mcp*.zip')
|
#Add dependancy and licenses from FML
|
||||||
for i in zips:
|
FML_FILES = [
|
||||||
print 'Removing MCP Zip: %s' % os.path.basename(i)
|
'CREDITS-fml.txt',
|
||||||
os.remove(i)
|
'LICENSE-fml.txt',
|
||||||
|
'README-fml.txt',
|
||||||
|
'common/fml_at.cfg',
|
||||||
|
'common/fml_marker.cfg',
|
||||||
|
'common/fmlversion.properties',
|
||||||
|
'common/mcpmod.info',
|
||||||
|
'client/mcp.png'
|
||||||
|
]
|
||||||
|
for file in FML_FILES:
|
||||||
|
zip_add(os.path.join(fml_dir, file))
|
||||||
|
|
||||||
|
zip_end()
|
||||||
|
|
||||||
inject_version(os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num)
|
inject_version(os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num)
|
||||||
zip_start('minecraftforge-src-%s.zip' % version_str, 'forge')
|
zip_start('minecraftforge-src-%s.zip' % version_str, 'forge')
|
||||||
zip_add('client', 'client')
|
zip_add('client', 'client')
|
||||||
zip_add('common', 'common')
|
zip_add('common', 'common')
|
||||||
zip_add('patches', 'patches')
|
zip_add('patches', 'patches')
|
||||||
zip_add('fml', 'fml')
|
zip_add(fml_dir, 'fml')
|
||||||
zip_add('install', '')
|
zip_add('install', '')
|
||||||
zip_add('forge.py')
|
zip_add('forge.py')
|
||||||
zip_add(version_file)
|
zip_add(version_file)
|
||||||
|
@ -140,6 +159,7 @@ def main():
|
||||||
|
|
||||||
if os.path.exists(version_file):
|
if os.path.exists(version_file):
|
||||||
os.remove(version_file)
|
os.remove(version_file)
|
||||||
|
shutil.rmtree(temp_dir)
|
||||||
|
|
||||||
print '=================================== Release Finished %d =================================' % error_level
|
print '=================================== Release Finished %d =================================' % error_level
|
||||||
sys.exit(error_level)
|
sys.exit(error_level)
|
||||||
|
@ -156,7 +176,7 @@ def zip_add(file, key=None):
|
||||||
zip_folder(file, key, zip)
|
zip_folder(file, key, zip)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
print key
|
print ' ' + key
|
||||||
zip.write(file, key)
|
zip.write(file, key)
|
||||||
|
|
||||||
def zip_start(name, base=None):
|
def zip_start(name, base=None):
|
||||||
|
@ -175,8 +195,8 @@ def zip_end():
|
||||||
zip_name = None
|
zip_name = None
|
||||||
zip_base = None
|
zip_base = None
|
||||||
|
|
||||||
def load_mc_version(forge_dir):
|
def load_mc_version(fml_dir):
|
||||||
props = os.path.join(forge_dir, 'fml', 'common', 'fmlversion.properties')
|
props = os.path.join(fml_dir, 'common', 'fmlversion.properties')
|
||||||
|
|
||||||
if not os.path.isfile(props):
|
if not os.path.isfile(props):
|
||||||
print 'Could not load fmlversion.properties, build failed'
|
print 'Could not load fmlversion.properties, build failed'
|
||||||
|
@ -191,8 +211,8 @@ def load_mc_version(forge_dir):
|
||||||
print 'Could not load fmlversion.properties, build failed'
|
print 'Could not load fmlversion.properties, build failed'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def extract_fml_obfed(mcp_dir, reobf_dir, client_dir):
|
def extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir):
|
||||||
fml_file = os.path.join(forge_dir, 'fml', 'difflist.txt')
|
fml_file = os.path.join(fml_dir, 'difflist.txt')
|
||||||
if not os.path.isfile(fml_file):
|
if not os.path.isfile(fml_file):
|
||||||
print 'Could not find Forge ModLoader\'s DiffList, looking for it at: %s' % fml_file
|
print 'Could not find Forge ModLoader\'s DiffList, looking for it at: %s' % fml_file
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
53
setup.py
53
setup.py
|
@ -1,5 +1,6 @@
|
||||||
import os, os.path, sys, zipfile
|
import os, os.path, sys, zipfile
|
||||||
import shutil, glob, fnmatch
|
import shutil, glob, fnmatch, subprocess
|
||||||
|
from pprint import pformat
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -11,20 +12,25 @@ def main():
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None)
|
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None)
|
||||||
parser.add_option('-n', '--no-extract', action='store_true', dest='no_extract', help='Do not attempt to extract FML zip files', default=False)
|
parser.add_option('-b', '--build', action='store', dest='build', help='Build number', default=None)
|
||||||
options, _ = parser.parse_args()
|
options, _ = parser.parse_args()
|
||||||
|
|
||||||
|
build_num = 0
|
||||||
|
if not options.build is None:
|
||||||
|
try:
|
||||||
|
build_num = int(options.build)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
fml_dir = os.path.join(forge_dir, 'fml')
|
fml_dir = os.path.join(forge_dir, 'fml')
|
||||||
mcp_dir = os.path.join(forge_dir, 'mcp')
|
mcp_dir = os.path.join(forge_dir, 'mcp')
|
||||||
|
|
||||||
if not options.mcp_dir is None:
|
if not options.mcp_dir is None:
|
||||||
mcp_dir = os.path.abspath(options.mcp_dir)
|
mcp_dir = os.path.abspath(options.mcp_dir)
|
||||||
elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
|
|
||||||
mcp_dir = os.path.abspath('..')
|
|
||||||
|
|
||||||
src_dir = os.path.join(mcp_dir, 'src')
|
src_dir = os.path.join(mcp_dir, 'src')
|
||||||
|
|
||||||
setup_fml(mcp_dir, fml_dir, options.no_extract)
|
setup_fml(mcp_dir, fml_dir, build_num)
|
||||||
|
|
||||||
base_dir = os.path.join(mcp_dir, 'src_base')
|
base_dir = os.path.join(mcp_dir, 'src_base')
|
||||||
work_dir = os.path.join(mcp_dir, 'src_work')
|
work_dir = os.path.join(mcp_dir, 'src_work')
|
||||||
|
@ -39,17 +45,44 @@ def main():
|
||||||
shutil.copytree(src_dir, work_dir)
|
shutil.copytree(src_dir, work_dir)
|
||||||
|
|
||||||
print 'Applying forge patches'
|
print 'Applying forge patches'
|
||||||
apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, work_dir, False)
|
apply_forge_patches(fml_dir, mcp_dir, forge_dir, work_dir, False)
|
||||||
|
|
||||||
setup_eclipse(forge_dir)
|
setup_eclipse(forge_dir)
|
||||||
|
|
||||||
print '=================================== Setup Finished ================================='
|
print '=================================== Setup Finished ================================='
|
||||||
|
|
||||||
def setup_fml(mcp_dir, fml_dir, dont_extract=False):
|
def setup_fml(mcp_dir, fml_dir, build_num=0):
|
||||||
print 'Setting up Forge ModLoader'
|
print 'Setting up Forge ModLoader'
|
||||||
sys.path.append(os.path.join(fml_dir,'install')os.path.join(forge_dir, 'fml'))
|
os.environ['WORKSPACE'] = os.path.join(mcp_dir, '..')
|
||||||
from install import fml_main
|
os.environ['BUILD_NUMBER'] = str(build_num)
|
||||||
fml_main(fml_dir, mcp_dir, True)
|
|
||||||
|
BUILD = ['ant', 'jenkinsbuild']
|
||||||
|
if sys.platform.startswith('win'):
|
||||||
|
BUILD = ['cmd', '/C'] + BUILD
|
||||||
|
|
||||||
|
if not run_command(BUILD, cwd=fml_dir):
|
||||||
|
print('Could not setup FML')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
sys.path.append(fml_dir)
|
||||||
|
sys.path.append(os.path.join(fml_dir, 'install'))
|
||||||
|
from fml import finish_setup_fml
|
||||||
|
finish_setup_fml(fml_dir, mcp_dir)
|
||||||
|
|
||||||
|
def run_command(command, cwd='.', verbose=True):
|
||||||
|
print('Running command: ')
|
||||||
|
print(pformat(command))
|
||||||
|
|
||||||
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, cwd=cwd)
|
||||||
|
while process.poll() is None:
|
||||||
|
line = process.stdout.readline()
|
||||||
|
if line:
|
||||||
|
line = line.rstrip()
|
||||||
|
print(line)
|
||||||
|
if process.returncode:
|
||||||
|
self.logger.error("failed: %d", process.returncode)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def setup_eclipse(forge_dir):
|
def setup_eclipse(forge_dir):
|
||||||
eclipse_dir = os.path.join(forge_dir, 'eclipse')
|
eclipse_dir = os.path.join(forge_dir, 'eclipse')
|
||||||
|
|
107
updateasmdata.py
107
updateasmdata.py
|
@ -1,107 +0,0 @@
|
||||||
import os, os.path, sys
|
|
||||||
import shutil, glob, fnmatch
|
|
||||||
import csv, re
|
|
||||||
|
|
||||||
ctorsigre = re.compile('<init>\((.*)\)')
|
|
||||||
ctorparamre = re.compile('(([ZBCSIJFD]|L([\w\/]+);))')
|
|
||||||
|
|
||||||
def get_merged_info():
|
|
||||||
mcp_dir = os.path.join(os.getcwd(), 'mcp')
|
|
||||||
joined = os.path.join(mcp_dir, 'conf', 'joined.srg')
|
|
||||||
values = {'PK:': {}, 'CL:': {}, 'FD:': {}, 'MD:': {}}
|
|
||||||
|
|
||||||
if not os.path.isfile(joined):
|
|
||||||
sys.path.append('install')
|
|
||||||
from fml import gen_merged_srg
|
|
||||||
values = gen_merged_srg(mcp_dir, None)
|
|
||||||
else:
|
|
||||||
with open(joined, 'r') as fh:
|
|
||||||
for line in fh:
|
|
||||||
pts = line.rstrip('\r\n').split(' ')
|
|
||||||
if pts[0] == 'MD:':
|
|
||||||
values[pts[0]][pts[1] + ' ' + pts[2]] = pts[3] + ' ' + pts[4]
|
|
||||||
else:
|
|
||||||
values[pts[0]][pts[1]] = pts[2]
|
|
||||||
|
|
||||||
return {t:{v.split(' ')[0]:k for k, v in m.items()} for t,m in values.items()}
|
|
||||||
|
|
||||||
def process_file(file, srg):
|
|
||||||
name = os.path.basename(file)
|
|
||||||
print 'Processing: ' + name
|
|
||||||
|
|
||||||
if name == 'mcp_merge.cfg':
|
|
||||||
with open(file + '-new','w') as nf:
|
|
||||||
with open(file) as f:
|
|
||||||
for line in f:
|
|
||||||
parts = line.split('#')
|
|
||||||
target = parts[1].strip()
|
|
||||||
newpart = '%s%s #%s\n' % (parts[0][0], srg['CL:'][target], target)
|
|
||||||
nf.write(newpart)
|
|
||||||
else:
|
|
||||||
with open(file + '-new', 'wb') as nf:
|
|
||||||
with open(file) as f:
|
|
||||||
for line in f:
|
|
||||||
parts = line.split('#')
|
|
||||||
if len(parts) < 2:
|
|
||||||
nf.write(line)
|
|
||||||
continue
|
|
||||||
if len(parts[1]) < 4:
|
|
||||||
nf.write(line)
|
|
||||||
continue
|
|
||||||
|
|
||||||
typ = parts[1][0:3]
|
|
||||||
|
|
||||||
if not srg.has_key(typ):
|
|
||||||
nf.write(line)
|
|
||||||
continue
|
|
||||||
|
|
||||||
name = parts[1][3:].strip()
|
|
||||||
name = (name if name.startswith('net/minecraft/') else 'net/minecraft/src/' + name)
|
|
||||||
action = parts[0].split(' ')
|
|
||||||
|
|
||||||
if name.endswith('/*'):
|
|
||||||
targ = srg['CL:'][name[:-2]]
|
|
||||||
wildcard = ('.*()' if typ == 'MD:' else '.*')
|
|
||||||
|
|
||||||
newline = '%s %s%s #%s' % (action[0], targ, wildcard, '#'.join(parts[1:]))
|
|
||||||
nf.write(newline)
|
|
||||||
|
|
||||||
elif name.find('/<init>') >= 0:
|
|
||||||
targ = srg['CL:'][name[:name.find('/<init>')]]
|
|
||||||
args = '<init>('
|
|
||||||
armatch = ctorsigre.search(name).group(1)
|
|
||||||
for bit in ctorparamre.findall(armatch):
|
|
||||||
if len(bit[2]) > 0 and srg['CL:'].has_key(bit[2]):
|
|
||||||
cl = 'L' + srg['CL:'][bit[2]] + ';'
|
|
||||||
else:
|
|
||||||
cl = bit[1]
|
|
||||||
args += cl
|
|
||||||
args += ')V'
|
|
||||||
newline = ('%s %s.%s #%s' % (action[0], targ, args, '#'.join(parts[1:])))
|
|
||||||
nf.write(newline)
|
|
||||||
|
|
||||||
else:
|
|
||||||
if name not in srg[typ]:
|
|
||||||
nf.write("%s # -- MISSING MAPPING" %( line ))
|
|
||||||
print("%s is missing a mapping"% name)
|
|
||||||
else:
|
|
||||||
targ = srg[typ][name]
|
|
||||||
args = targ.replace('/', '.', 1).replace(' ', '', 1)
|
|
||||||
newline = ('%s %s #%s' % (action[0], args, '#'.join(parts[1:])))
|
|
||||||
nf.write(newline)
|
|
||||||
|
|
||||||
def main():
|
|
||||||
srg = get_merged_info()
|
|
||||||
for arg in sys.argv:
|
|
||||||
path = os.path.join(os.getcwd(), arg)
|
|
||||||
|
|
||||||
if arg.endswith('_at.cfg') or arg == 'mcp_merge.cfg':
|
|
||||||
process_file(path, srg)
|
|
||||||
elif os.path.isdir(path):
|
|
||||||
for file in os.listdir(path):
|
|
||||||
if file.endswith('_at.cfg'):
|
|
||||||
process_file(os.path.join(path, file), srg)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
|
|
Loading…
Reference in a new issue