if "NexusClientCli" not in sln.projectsByName: newproj = sln.AddProject('NexusClientCli', ProjectType.CSHARP_PROJECT, ncc_csproj, guid=projguid) log.info('Adding project %s (%s) to NexusClient.sln', newproj.name, newproj.guid) changed = True else: newproj = sln.projectsByName['NexusClientCli'] log.info('Project %s (%s) already exists in NexusClient.sln', newproj.name, newproj.guid) if newproj.projectfile != ncc_csproj: log.info('Changing projectfile: %s -> %s', newproj.projectfile, ncc_csproj) newproj.projectfile = ncc_csproj changed = True if changed: log.info('Writing NexusClientCli.sln') sln.SaveToFile(os.path.relpath(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'))) # So we dont get conflicts when pulling return True # https://github.com/Nexus-Mods/Nexus-Mod-Manager/commit/03448e0eb02e08f37d7b66507d0537ab67841321 broke fomod installation # until this is fixed we lock NMM to the latest nexus release. Project("ncc") \ .depend(build.Run(r"publish.bat".format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config["paths"]["install"], "bin")), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "NexusClientCli"))) .depend(msbuild.MSBuild(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager")), project_platform="Any CPU") .depend(build.Execute(prepare_nmm, name="append NexusClientCli project to NMM") .depend(github.Source("Nexus-Mods", "Nexus-Mod-Manager", "0.63.15", None, False)) .depend(github.Source(config['Main_Author'], "modorganizer-NCC", "master") .set_destination("NexusClientCli")))))
if config['architecture'] == "x86_64": path_segments.append("amd64") for f in glob(os.path.join(*path_segments,"*.lib")): shutil.copy(f, os.path.join(path_install, "libs")) for f in glob(os.path.join(*path_segments,"*.dll")): shutil.copy(f, os.path.join(path_install, "bin")) shutil.copy(os.path.join(path_install, "libs", "python{}.lib".format(python_version.replace(".", ""))), os.path.join(path_install, "libs", "python3.lib")) return True if config.get('Appveyor_Build', True): python = Project("Python") \ .depend(build.Execute(install) .depend(urldownload.URLDownload( config.get('prebuilt_url') + "python-prebuilt-{}.7z" .format(python_version + python_version_minor)). set_destination("python-{}".format(python_version + python_version_minor)))) else: python = Project("Python") \ .depend(build.Execute(install) .depend(build.Execute(python_prepare) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pyexpat", project_PlatformToolset=config['vc_platformtoolset']) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("python", "cpython", "v{}{}" .format(config['python_version'], config['python_version_minor']) , shallowclone=True) .set_destination("python-{}".format(python_version + python_version_minor)))))))
.depend(build.Execute(python_prepare) .depend(PydCompiler() .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pythonw,python3dll,select,pyexpat,unicodedata,_queue,_bz2,_ssl,_overlapped", project_PlatformToolset=config['vc_platformtoolset'], reltarget="Release", project_AdditionalParams=[ "/p:bz2Dir={}".format(os.path.join(build_path, "bzip2")), "/p:zlibDir={}".format(os.path.join(build_path, "zlib-{}".format(config['zlib_version']))), "/p:opensslIncludeDir={}".format(os.path.join(build_path, "openssl-{}".format(openssl_version), "include")), "/p:opensslOutDir={}".format(os.path.join(build_path, "openssl-{}".format(openssl_version))), "/p:libffiIncludeDir={}".format(os.path.join(build_path, "libffi", bitness(), "include")), "/p:libffiOutDir={}".format(os.path.join(build_path, "libffi", bitness())), ] ) .depend(build.Execute(patch_openssl_props) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("python", "cpython", "v{}{}" .format(config['python_version'], config['python_version_minor']) , shallowclone=True) .set_destination("python-{}".format(python_version + python_version_minor)) .depend(sourceforge.Release("bzip2","bzip2-{0}.tar.gz" .format(bzip2_version), tree_depth=1) .set_destination("bzip2") ) ) ) ) .depend("openssl") .depend("libffi") ) )
else: appveyor_cmake_step.depend(source_retrieval_step) project.depend(appveyor_cmake_step) else: vs_cmake_step = cmake.CMakeVS().arguments(cmake_param).install() if git_path != "cmake_common": vs_cmake_step.depend("cmake_common") for dep in dependencies: vs_cmake_step.depend(dep) #vs_target = "Clean;Build" if config['rebuild'] else "Build" vs_msbuild_step = msbuild.MSBuild(os.path.join("vsbuild", "INSTALL.vcxproj"), None, None, "{}".format("x64" if config['architecture'] == 'x86_64' else "x86"), config['build_type']) source_retrieval_step = github.Source(author, git_path, branch, feature_branch=config['Feature_Branch'], super_repository=tl_repo).set_destination(path) if git_path == "modorganizer" and config['override_build_version']: #add patching step that depends on source retrieval patch_version_step.depend(source_retrieval_step) vs_cmake_step.depend(patch_version_step) else: vs_cmake_step.depend(source_retrieval_step) project.depend(vs_msbuild_step.depend(vs_cmake_step)) else: project.depend(github.Source(author, git_path, branch, feature_branch=config['Feature_Branch'], super_repository=tl_repo) .set_destination(path))
Project(project32 + "_32").dummy().depend(project32) # TODO remove after repo merge def replace_paths(context): with open( os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'r') as file: lines = file.readlines() # keep whitespaces at the beginning for formatting lines[4] = " <BOOST_PATH>..\..\{}</BOOST_PATH>\n".format( boost_folder) lines[5] = " <GTEST_PATH>..\..\{}</GTEST_PATH>\n".format( gtest_folder) file.seek(0) # clean file first or we leave trailing characters behind with open( os.path.join(build_path, "usvfs", "vsbuild", "external_dependencies.props"), 'w') as file: file.writelines(lines) return True usvfs \ .depend(msbuild.MSBuild("usvfs.sln", vs_target, os.path.join(build_path, "usvfs", "vsbuild"), "{}".format("x64" if config['architecture'] == 'x86_64' else "x86")) .depend(build.Execute(replace_paths) .depend("boost" + suffix) .depend("GTest" + suffix) .depend(github.Source(config['Main_Author'], "usvfs", "0.3.1.0-Beta"))))
r'"{0}" unimake.py -d "{1}" --set architecture="x86" -b "build" -p "progress" -i "install" {2}'.format( sys.executable, config['__build_base_path'], project32), name="unimake_x86_{}".format(project32), environment=config['__Default_environment'], working_directory=os.path.join(os.getcwd())) for dep in dependencies: unimake32.depend(dep) Project(project32 + "_32").depend(unimake32) else: Project(project32 + "_32").dummy().depend(project32) # usvfs build: vs_target = "Clean;Build" if config['rebuild'] else "Build" usvfs_build = \ msbuild.MSBuild("usvfs.sln", vs_target, os.path.join(config["paths"]["build"], "usvfs", "vsbuild"), "x64" if config['architecture'] == 'x86_64' else "x86") usvfs_build.depend( github.Source(config['Main_Author'], "usvfs", "0.3.1.0-Beta").set_destination("usvfs")) usvfs_build.depend("boost" + suffix_32) usvfs_build.depend("GTest" + suffix_32) usvfs.depend(usvfs_build) for author, git_path, path, branch, dependencies, Build in [ (config['Main_Author'], "modorganizer-game_features", "game_features", "master", [], False), (config['Main_Author'], "modorganizer-archive", "archive", "API_9.20", ["7zip", "Qt5", "boost"], True), (config['Main_Author'], "modorganizer-uibase", "uibase", "QT5.7", ["Qt5", "boost"], True),
) ) ) ) else: def install(context): path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") for f in glob(os.path.join(*path_segments)): shutil.copy( f, os.path.join(config["__build_base_path"], "install", "libs")) return True python = Project("Python") \ .depend(build.Execute(install) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python") .depend(build.Run(upgrade_args, name="upgrade python project") .depend(build.Run(r"PCBuild\get_externals.bat", environment=python_environment()) .depend(urldownload.URLDownload("{0}/{1}/Python-{1}.tgz" .format(python_url, python_version), 1) ) ) ) ) )
) ) else: def install(context): make_sure_path_exists(os.path.join(config["paths"]["install"], "libs")) path_segments = [context['build_path'], "PCbuild"] if config['architecture'] == "x86_64": path_segments.append("amd64") path_segments.append("*.lib") shutil.copy( os.path.join(python['build_path'], "PC", "pyconfig.h"), os.path.join(python['build_path'], "Include", "pyconfig.h")) for f in glob(os.path.join(*path_segments)): shutil.copy(f, os.path.join(config["paths"]["install"], "libs")) return True python = Project("Python") \ .depend(build.Execute(install) .depend(msbuild.MSBuild("PCBuild/PCBuild.sln", "python,pyexpat", project_PlatformToolset=python_toolset) # .depend(build.Run(r'PCBuild\\build.bat -e -c Release -m -p {} "/p:PlatformToolset={}"'.format("x64" if config['architecture'] == 'x86_64' else "x86",config['vc_platform']), # environment=python_environment(), # working_directory=lambda: os.path.join(python['build_path'])) .depend(build.Run(upgrade_args, name="upgrade python project") .depend(github.Source("LePresidente", "cpython-1", config.get('python_version', "2.7")) \ .set_destination("python-{}".format(python_version)))) ) )
if newproj.projectfile != ncc_csproj: log.info('Changing projectfile: %s -> %s', newproj.projectfile, ncc_csproj) newproj.projectfile = ncc_csproj changed = True if changed: log.info('Writing NexusClientCli.sln') try: sln.SaveToFile(os.path.relpath(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'))) # So we dont get conflicts when pulling except ValueError: sln.SaveToFile(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln')) return True # https://github.com/Nexus-Mods/Nexus-Mod-Manager/commit/03448e0eb02e08f37d7b66507d0537ab67841321 broke fomod installation # until this is fixed we lock NMM to the latest nexus release. Project("ncc") \ .depend(build.Run(r"publish.bat {} {}".format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config["paths"]["install"], "bin")), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "NexusClientCli"))) .depend(msbuild.MSBuild(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln'), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager")), project_platform="Any CPU") .depend(build.Run(r"nuget.exe restore {}".format(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClientCli.sln')), environment=ncc_environment(), working_directory=lazy.Evaluate(lambda: os.path.join(build_path, "Nexus-Mod-Manager"))) .depend(build.Execute(prepare_nmm, name="append NexusClientCli project to NMM") .depend(github.Source("Nexus-Mods", "Nexus-Mod-Manager", config["nmm_version"], None, None, False)) .depend(github.Source(config['Main_Author'], "modorganizer-NCC", config['Build_Branch'], feature_branch=config['Feature_Branch']) .set_destination("NexusClientCli")))))) \ .depend("nuget")
depend( urldownload. URLDownload( "https://github.com/ModOrganizer2/modorganizer-umbrella/releases/download/1.1/lz4_prebuilt_{}.7z" .format(lz4_version_minor)).set_destination(lz_path)))) else: Project("lz4").depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.pdb"), os.path.join(config["paths"]["install"], "pdb")).depend( Patch.Copy( os.path.join(lz_path, "bin", "liblz4.dll"), os.path.join( config["paths"]["install"], "bin", "dlls")).depend( build.Execute(copy_binaries).depend( msbuild.MSBuild( os.path.join(lz_path, "visual", "VS2017", 'lz4.sln'), project="liblz4-dll", working_directory=lazy.Evaluate( lambda: os.path.join(lz_path)), reltarget="Release").depend( build.Run( upgrade_args, name="upgrade lz4 project").depend( github.Source( "lz4", "lz4", lz4_version_minor). set_destination(lz_path)))))))
usvfs = Project("usvfs") def usvfs_environment(): env = config['__environment'].copy() env['BOOST_PATH'] = boost_folder return env for (project32, dependencies) in [("boost", ["boost_prepare"]), ("GTest", []), ("usvfs", [])]: if config['architecture'] == 'x86_64': unimake32 = \ build.Run_With_Output(r'"{0}" unimake.py --set architecture="x86" -b "build" -p "progress" -i "install" -d "{1}" {2} "{3}"'.format(sys.executable, config['__build_base_path'],' -s ' + ' -s '.join(config['__Arguments'].set) if config['__Arguments'].set is not None else "", project32), name="unimake_x86_{}".format(project32), environment=config['__Default_environment'], working_directory=os.path.join(os.getcwd())) for dep in dependencies: unimake32.depend(dep) Project(project32 + "_32").depend(unimake32) else: Project(project32 + "_32").dummy().depend(project32) usvfs \ .depend(msbuild.MSBuild("usvfs.sln", vs_target, os.path.join(build_path, "usvfs", "vsbuild"), "{}".format("x64" if config['architecture'] == 'x86_64' else "x86"), None, None, None, usvfs_environment()) .depend("boost" + suffix) .depend("GTest" + suffix) .depend(github.Source('247321453', "usvfs", usvfs_version)))
log.info('Project %s (%s) already exists in NexusClient.sln', newproj.name, newproj.guid) if newproj.projectfile != ncc_csproj: log.info('Changing projectfile: %s -> %s', newproj.projectfile, ncc_csproj) newproj.projectfile = ncc_csproj changed = True if changed: log.info('Writing NexusClientCli.sln') sln.SaveToFile(os.path.relpath(os.path.join(ncc['build_path'], "..", "nmm", 'NexusClientCli.sln'))) # So we don't get conflicts when pulling. return True init_repos = github.Source("Nexus-Mods", "Nexus-Mod-Manager", "master") \ .set_destination(os.path.join("NCC", "nmm")) ncc = Project("NCC") \ .depend(build.Run(r"publish.bat" .format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config["paths"]["install"], "bin")), working_directory=lazy.Evaluate(lambda: os.path.join(ncc['build_path'], "..", "NexusClientCli"))) .depend(msbuild.MSBuild(os.path.join(config['paths']['build'], "NCC", "nmm", 'NexusClientCli.sln'), working_directory=lazy.Evaluate( lambda: os.path.join(ncc['build_path'], "..", "nmm")), project_platform="Any CPU") .depend(build.Execute(prepare_nmm, name="append NexusClientCli project to NMM") .depend(init_repos).depend( github.Source(config['Main_Author'], "modorganizer-NCC", "master") \ .set_destination(os.path.join("NCC", "NexusClientCli")) ))))
# install compiled mo components """ doesn't build through msbuild but builds fine in IDE?? .depend(msbuild.MSBuild("../nmm/NexusClient.sln", "NexusClientCli", working_directory=lazy.Evaluate(lambda: os.path.join(ncc['build_path'], "..", "nmm"))) """ ncc = Project("NCC") \ .depend(build.Run(r"publish.bat" .format("-debug" if config['build_type'] == "Debug" else "-release", os.path.join(config['__build_base_path'], "install", "bin")), working_directory=lazy.Evaluate(lambda: ncc['build_path'])) .depend(msbuild.MSBuild("../nmm/NexusClient.sln", working_directory=lazy.Evaluate(lambda: os.path.join(ncc['build_path'], "..", "nmm"))) .depend(patch.Copy("NexusClient.sln", "../nmm") .depend(github.Source(config['Main_Author'], "modorganizer-NCC", "master") .set_destination(os.path.join("NCC", "NexusClientCli")) .depend(github.Source("Nexus-Mods", "Nexus-Mod-Manager", "master") .set_destination(os.path.join("NCC", "nmm")) ) ) ) ) ) Project("modorganizer-game_features") \ .depend(github.Source(config['Main_Author'], "modorganizer-game_features", "master", super_repository=tl_repo) .set_destination("game_features")) def gen_userfile_content(project): with open("CMakeLists.txt.user.template", 'r') as f: res = Formatter().vformat(