1. SCons
  2. Core
  3. SCons

Commits

Steven Knight  committed ac4b812

Add Visual Studio support for SCC Provider variables. (Dobes Vandermeer)

  • Participants
  • Parent commits b2ed2aa
  • Branches default

Comments (0)

Files changed (5)

File doc/man/scons.1

View file
 .IP
 Where '<VSDir>' 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

File src/engine/SCons/Tool/msvs.py

View file
 \tProjectType="Visual C++"
 \tVersion="%(versionstr)s"
 \tName="%(name)s"
-\tSccProjectName=""
-\tSccLocalPath=""
+%(scc_attrs)s
 \tKeyword="MakeFileProj">
 """
 
         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())
 
     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:
             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
                     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:

File src/engine/SCons/Tool/msvs.xml

View file
 </summary>
 </cvar>
 
+<cvar name="MSVS_PROJECT_BASE_PATH">
+<summary>
+The string
+placed in a generated Microsoft Visual Studio solution file
+as the value of the
+<literal>SccProjectFilePathRelativizedFromConnection0</literal>
+and 
+<literal>SccProjectFilePathRelativizedFromConnection1</literal>
+attributes of the
+<literal>GlobalSection(SourceCodeControl)</literal>
+section.
+There is no default value.
+</summary>
+</cvar>
+
+<cvar name="MSVS_PROJECT_GUID">
+<summary>
+The string
+placed in a generated Microsoft Visual Studio project file
+as the value of the
+<literal>ProjectGUID</literal>
+attribute.
+The string is also placed in the
+<literal>SolutionUniqueID</literal>
+attribute of the
+<literal>GlobalSection(SourceCodeControl)</literal>
+section of the Microsoft Visual Studio solution file.
+There is no default value.
+</summary>
+</cvar>
+
+<cvar name="MSVS_SCC_AUX_PATH">
+<summary>
+The path name
+placed in a generated Microsoft Visual Studio project file
+as the value of the
+<literal>SccAuxPath</literal>
+attribute
+if the
+<envar>MSVS_SCC_PROVIDER</envar>
+construction variable is also set.
+There is no default value.
+</summary>
+</cvar>
+
+<cvar name="MSVS_SCC_LOCAL_PATH">
+<summary>
+The path name
+placed in a generated Microsoft Visual Studio project file
+as the value of the
+<literal>SccLocalPath</literal>
+attribute
+if the
+<envar>MSVS_SCC_PROVIDER</envar>
+construction variable is also set.
+The path name is also placed in the
+<literal>SccLocalPath0</literal>
+and
+<literal>SccLocalPath1</literal>
+attributes of the
+<literal>GlobalSection(SourceCodeControl)</literal>
+section of the Microsoft Visual Studio solution file.
+There is no default value.
+</summary>
+</cvar>
+
+<cvar name="MSVS_SCC_PROJECT_NAME">
+<summary>
+The project name
+placed in a generated Microsoft Visual Studio project file
+as the value of the
+<literal>SccProjectName</literal>
+attribute.
+There is no default value.
+</summary>
+</cvar>
+
+<cvar name="MSVS_SCC_PROVIDER">
+<summary>
+The string
+placed in a generated Microsoft Visual Studio project file
+as the value of the
+<literal>SccProvider</literal>
+attribute.
+The string is also placed in the
+<literal>SccProvider1</literal>
+attribute of the
+<literal>GlobalSection(SourceCodeControl)</literal>
+section of the Microsoft Visual Studio solution file.
+There is no default value.
+</summary>
+</cvar>
+
 <cvar name="MSVS_USE_MFC_DIRS">
 <summary>
 Tells the MS Visual Studio tool(s) to use

File test/MSVS/vs-7.0-files.py

View file
 \tProjectType="Visual C++"
 \tVersion="7.00"
 \tName="Test"
+\tProjectGUID=""
 \tSccProjectName=""
 \tSccLocalPath=""
 \tKeyword="MakeFileProj">

File test/MSVS/vs-7.1-files.py

View file
 \tProjectType="Visual C++"
 \tVersion="7.10"
 \tName="Test"
+\tProjectGUID=""
 \tSccProjectName=""
 \tSccLocalPath=""
 \tKeyword="MakeFileProj">