def prepare_nmm(context): sln = VisualStudio2015Solution() sln.LoadFromFile(os.path.join(build_path, "Nexus-Mod-Manager", 'NexusClient.sln')) ncc_csproj = os.path.join(build_path, 'NexusClientCLI', 'NexusClientCLI', 'NexusClientCLI.csproj') if not os.path.isfile(ncc_csproj): log.critical('NOT FOUND: %s', ncc_csproj) else: log.info('FOUND: %s', ncc_csproj) changed = False projfile = VS2015Project() projfile.LoadFromFile(ncc_csproj) projguid = projfile.PropertyGroups[0].element.find('ProjectGuid').text log.info('ProjectGuid = %s', projguid) 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
import os script_dir = os.path.dirname(__file__) from buildtools import log from buildtools.buildsystem.visualstudio import VisualStudio2015Solution, ProjectType target = os.path.join(script_dir, '..', 'NMM', 'NexusClient.sln') csprojfile = os.path.join('..', 'NexusClientCli', 'NexusClientCLI', 'NexusClientCLI.csproj') sln = VisualStudio2015Solution() sln.LoadFromFile(target) changed = False if 'NexusClientCli' not in sln.projectsByName: proj = sln.AddProject('NexusClientCli', ProjectType.CSHARP_PROJECT, csprojfile) log.info('Added %s (%s) to %s', proj.name, proj.guid, target) changed = True else: proj = sln.projectsByName['NexusClientCli'] log.info('Project %s (%s) already exists in %s', proj.name, proj.guid, target) if proj.projectfile != csprojfile: oprojfile = proj.projectfile proj.projectfile = csprojfile log.info('Fixed CSPROJ location: %s -> %s', oprojfile, csprojfile) changed = True if changed: sln.SaveToFile(target + '.patched')