def main(): global fn2depsfn, fn2deps, forceRescan forceRescan = False if len(sys.argv) > 1: if sys.argv[1] == "--force-rescan": forceRescan = True # TODO: proper argument parsing else: print "Usage: %s [--force-rescan]" % (sys.argv[0], ) raise SystemExit # gather dependencies modid2fn = {} fn2deps = {} for fn in getMods(): info = readMcmodInfo(fn) deps = getDeps(fn, info) for modid in getModIDs(fn, info): modid2fn[modid] = fn fn2deps[fn] = mcmodfixes.fixDeps(fn, deps) if len(deps) != 0: print fn, deps # build mod filename -> dependency filenames fn2depsfn = {None: []} for fn, deps in fn2deps.iteritems(): for dep in deps: if not modid2fn.has_key(dep): print "Mod %s is missing dependency: %s. Cannot continue" % ( fn, dep) sys.exit(-1) fn2depsfn[fn] = modid2fn[dep] fn2depsfn[fn] = [modid2fn[dep] for dep in deps if modid2fn[dep] != fn] # setup analyzer if not os.path.exists(os.path.join("target", ANALYZER_FILENAME)): os.system("mvn initialize -P -built") os.system("mvn package") # setup server server = os.path.join(TEST_SERVER_ROOT, TEST_SERVER_FILE) if not os.path.exists(server): if not os.path.exists(TEST_SERVER_ROOT): os.mkdir(TEST_SERVER_ROOT) setupServer(server) print "Using server at:", server # analyze vanilla for reference if not os.path.exists(DATA_DIR): os.mkdir(DATA_DIR) if not os.path.exists(CONFIGS_DIR): os.mkdir(CONFIGS_DIR) vanilla = getModAnalysis(None) analyzedMods = {None: vanilla} for mod in getMods(): getModAnalysis(mod)
def main(): global fn2depsfn, fn2deps, forceRescan forceRescan = False if len(sys.argv) > 1: if sys.argv[1] == "--force-rescan": forceRescan = True # TODO: proper argument parsing else: print "Usage: %s [--force-rescan]" % (sys.argv[0],) raise SystemExit # gather dependencies modid2fn = {} fn2deps = {} for fn in getMods(): info = readMcmodInfo(fn) deps = getDeps(fn, info) for modid in getModIDs(fn, info): modid2fn[modid] = fn fn2deps[fn] = mcmodfixes.fixDeps(fn, deps) if len(deps) != 0: print fn,deps # build mod filename -> dependency filenames fn2depsfn = {None: []} for fn, deps in fn2deps.iteritems(): for dep in deps: if not modid2fn.has_key(dep): print "Mod %s is missing dependency: %s. Cannot continue" % (fn, dep) sys.exit(-1) fn2depsfn[fn] = modid2fn[dep] fn2depsfn[fn] = [modid2fn[dep] for dep in deps if modid2fn[dep] != fn] # setup analyzer if not os.path.exists(os.path.join("target", ANALYZER_FILENAME)): os.system("mvn initialize -P -built") os.system("mvn package") # setup server server = os.path.join(TEST_SERVER_ROOT, TEST_SERVER_FILE) if not os.path.exists(server): if not os.path.exists(TEST_SERVER_ROOT): os.mkdir(TEST_SERVER_ROOT) setupServer(server) print "Using server at:",server # analyze vanilla for reference if not os.path.exists(DATA_DIR): os.mkdir(DATA_DIR) if not os.path.exists(CONFIGS_DIR): os.mkdir(CONFIGS_DIR) vanilla = getModAnalysis(None) analyzedMods = {None: vanilla} for mod in getMods(): getModAnalysis(mod)
def getDeps(fn, info): deps = set() for sub in getSubInfo(info): # https://github.com/MinecraftForge/FML/wiki/FML-mod-information-file # soft deps - lets require them anyways deps.update(set(sub.get("dependencies", []))) # before deps.update(set(sub.get("dependancies", []))) # typo deps.update(set(sub.get("dependants", []))) # after # hard deps deps.update(set(sub.get("requiredMods", []))) deps = mcmodfixes.fixDeps(getModName(fn), deps) return deps