From 25a705102da1fb1ef285d94153de052a94a358ac Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sat, 5 Nov 2005 16:48:27 +0000 Subject: Add Visual Studio support for SCC Provider variables. (Dobes Vandermeer) --- doc/man/scons.1 | 75 ++++++++++++++++++++++++++++++++++ src/engine/SCons/Tool/msvs.py | 53 +++++++++++++++++++++--- src/engine/SCons/Tool/msvs.xml | 93 ++++++++++++++++++++++++++++++++++++++++++ test/MSVS/vs-7.0-files.py | 1 + test/MSVS/vs-7.1-files.py | 1 + 5 files changed, 218 insertions(+), 5 deletions(-) diff --git a/doc/man/scons.1 b/doc/man/scons.1 index aed9e05..ef6e8b8 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -6523,6 +6523,81 @@ For VS7, it is: .IP Where '' is the installed location of Visual Studio. +.IP MSVS_PROJECT_BASE_PATH +The string +placed in a generated Microsoft Visual Studio solution file +as the value of the +.B SccProjectFilePathRelativizedFromConnection0 +and +.B SccProjectFilePathRelativizedFromConnection1 +attributes of the +.B GlobalSection(SourceCodeControl) +section. +There is no default value. + +.IP MSVS_PROJECT_GUID +The string +placed in a generated Microsoft Visual Studio project file +as the value of the +.B ProjectGUID +attribute. +The string is also placed in the +.B SolutionUniqueID +attribute of the +.B GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + +.IP MSVS_SCC_AUX_PATH +The path name +placed in a generated Microsoft Visual Studio project file +as the value of the +.B SccAuxPath +attribute +if the +.I MSVS_SCC_PROVIDER +construction variable is also set. +There is no default value. + +.IP MSVS_SCC_LOCAL_PATH +The path name +placed in a generated Microsoft Visual Studio project file +as the value of the +.B SccLocalPath +attribute +if the +.I MSVS_SCC_PROVIDER +construction variable is also set. +The path name is also placed in the +.B SccLocalPath0 +and +.B SccLocalPath1 +attributes of the +.B GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + +.IP MSVS_SCC_PROJECT_NAME +The project name +placed in a generated Microsoft Visual Studio project file +as the value of the +.B SccProjectName +attribute. +There is no default value. + +.IP MSVS_SCC_PROVIDER +The string +placed in a generated Microsoft Visual Studio project file +as the value of the +.B SccProvider +attribute. +The string is also placed in the +.B SccProvider1 +attribute of the +.B GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + .IP MSVS_USE_MFC_DIRS Tells the MS Visual Studio tool(s) to use the MFC directories in its default paths diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 38c6dcb..e3a28ec 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -470,8 +470,7 @@ V7DSPHeader = """\ \tProjectType="Visual C++" \tVersion="%(versionstr)s" \tName="%(name)s" -\tSccProjectName="" -\tSccLocalPath="" +%(scc_attrs)s \tKeyword="MakeFileProj"> """ @@ -501,11 +500,28 @@ class _GenerateV7DSP(_DSPGenerator): self.versionstr = '7.00' if self.version >= 7.1: self.versionstr = '7.10' + self.file = None def PrintHeader(self): + env = self.env versionstr = self.versionstr name = self.name encoding = self.env.subst('$MSVSENCODING') + scc_provider = env.get('MSVS_SCC_PROVIDER', '') + scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '') + scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '') + scc_local_path = env.get('MSVS_SCC_LOCAL_PATH', '') + project_guid = env.get('MSVS_PROJECT_GUID', '') + if scc_provider != '': + scc_attrs = ('\tProjectGUID="%s"\n' + '\tSccProjectName="%s"\n' + '\tSccAuxPath="%s"\n' + '\tSccLocalPath="%s"\n' + '\tSccProvider="%s"' % (project_guid, scc_project_name, scc_aux_path, scc_local_path, scc_provider)) + else: + scc_attrs = ('\tProjectGUID="%s"\n' + '\tSccProjectName="%s"\n' + '\tSccLocalPath="%s"' % (project_guid, scc_project_name, scc_local_path)) self.file.write(V7DSPHeader % locals()) @@ -725,6 +741,7 @@ class _GenerateV7DSW(_DSWGenerator): def __init__(self, dswfile, source, env): _DSWGenerator.__init__(self, dswfile, source, env) + self.file = None self.version = float(self.env['MSVS_VERSION']) self.versionstr = '7.00' if self.version >= 7.1: @@ -813,8 +830,34 @@ class _GenerateV7DSW(_DSWGenerator): self.file.write('\tProjectSection(ProjectDependencies) = postProject\n' '\tEndProjectSection\n') self.file.write('EndProject\n' - 'Global\n' - '\tGlobalSection(SolutionConfiguration) = preSolution\n') + 'Global\n') + env = self.env + if env.has_key('MSVS_SCC_PROVIDER'): + dspfile_base = os.path.basename(self.dspfile) + slnguid = self.slnguid + scc_provider = env.get('MSVS_SCC_PROVIDER', '') + scc_provider = string.replace(scc_provider, ' ', r'\u0020') + scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '') + # scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '') + scc_local_path = env.get('MSVS_SCC_LOCAL_PATH', '') + scc_project_base_path = env.get('MSVS_SCC_PROJECT_BASE_PATH', '') + # project_guid = env.get('MSVS_PROJECT_GUID', '') + + self.file.write('\tGlobalSection(SourceCodeControl) = preSolution\n' + '\t\tSccNumberOfProjects = 2\n' + '\t\tSccProjectUniqueName0 = %(dspfile_base)s\n' + '\t\tSccLocalPath0 = %(scc_local_path)s\n' + '\t\tCanCheckoutShared = true\n' + '\t\tSccProjectFilePathRelativizedFromConnection0 = %(scc_project_base_path)s\n' + '\t\tSccProjectName1 = %(scc_project_name)s\n' + '\t\tSccLocalPath1 = %(scc_local_path)s\n' + '\t\tSccProvider1 = %(scc_provider)s\n' + '\t\tCanCheckoutShared = true\n' + '\t\tSccProjectFilePathRelativizedFromConnection1 = %(scc_project_base_path)s\n' + '\t\tSolutionUniqueID = %(slnguid)s\n' + '\tEndGlobalSection\n' % locals()) + + self.file.write('\tGlobalSection(SolutionConfiguration) = preSolution\n') confkeys = self.configs.keys() confkeys.sort() cnt = 0 @@ -1012,7 +1055,7 @@ def get_visualstudio_versions(): vs = r'Microsoft Visual Studio\Common\MSDev98' else: vs = r'Microsoft Visual Studio .NET\Common7\IDE' - id = [ os.path.join(files_dir, vs) ] + id = [ os.path.join(files_dir, vs, 'devenv.exe') ] if os.path.exists(id[0]): L.append(p) except SCons.Util.RegError: diff --git a/src/engine/SCons/Tool/msvs.xml b/src/engine/SCons/Tool/msvs.xml index 647acd5..c972ac2 100644 --- a/src/engine/SCons/Tool/msvs.xml +++ b/src/engine/SCons/Tool/msvs.xml @@ -254,6 +254,99 @@ Where 'VSDir' is the installed location of Visual Studio. + + +The string +placed in a generated Microsoft Visual Studio solution file +as the value of the +SccProjectFilePathRelativizedFromConnection0 +and +SccProjectFilePathRelativizedFromConnection1 +attributes of the +GlobalSection(SourceCodeControl) +section. +There is no default value. + + + + + +The string +placed in a generated Microsoft Visual Studio project file +as the value of the +ProjectGUID +attribute. +The string is also placed in the +SolutionUniqueID +attribute of the +GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + + + + + +The path name +placed in a generated Microsoft Visual Studio project file +as the value of the +SccAuxPath +attribute +if the +MSVS_SCC_PROVIDER +construction variable is also set. +There is no default value. + + + + + +The path name +placed in a generated Microsoft Visual Studio project file +as the value of the +SccLocalPath +attribute +if the +MSVS_SCC_PROVIDER +construction variable is also set. +The path name is also placed in the +SccLocalPath0 +and +SccLocalPath1 +attributes of the +GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + + + + + +The project name +placed in a generated Microsoft Visual Studio project file +as the value of the +SccProjectName +attribute. +There is no default value. + + + + + +The string +placed in a generated Microsoft Visual Studio project file +as the value of the +SccProvider +attribute. +The string is also placed in the +SccProvider1 +attribute of the +GlobalSection(SourceCodeControl) +section of the Microsoft Visual Studio solution file. +There is no default value. + + + Tells the MS Visual Studio tool(s) to use diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py index 260ee76..e682607 100644 --- a/test/MSVS/vs-7.0-files.py +++ b/test/MSVS/vs-7.0-files.py @@ -69,6 +69,7 @@ expected_vcprojfile = """\ \tProjectType="Visual C++" \tVersion="7.00" \tName="Test" +\tProjectGUID="" \tSccProjectName="" \tSccLocalPath="" \tKeyword="MakeFileProj"> diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py index 30de516..131e4bd 100644 --- a/test/MSVS/vs-7.1-files.py +++ b/test/MSVS/vs-7.1-files.py @@ -69,6 +69,7 @@ expected_vcprojfile = """\ \tProjectType="Visual C++" \tVersion="7.10" \tName="Test" +\tProjectGUID="" \tSccProjectName="" \tSccLocalPath="" \tKeyword="MakeFileProj"> -- cgit v0.12