Author: rhuijben
Date: Fri Dec  4 15:49:56 2009
New Revision: 887234

URL: http://svn.apache.org/viewvc?rev=887234&view=rev
Log:
In preparation for adding Visual Studio 2010 support, move the project guid
generation to the creation of the targets and provide the guid to the project
templates.

Visual Studio moves the dependency references from the solution file to the
project files and requires guid references for the IDE.

* build/generator/gen_vcnet_vcproj.py
  (imports): Remove md5 import
  (Generator.write_project): Rename variable and pass project guid to ezt.
  (Generator.makeguid): Move to gen_win.py.

* build/generator/gen_win.py
  (imports): Import md5 support
  (GeneratorBase.makeguid): Moved here from gen_vcnet_vcproj.py.
  (GeneratorBase.write): Get guid from target instead of generating it and
    store the result on the target to allow retrieving it when writing the
    project file.

* build/generator/vcnet_vcproj.ezt
  Write ProjectGUID in vcproj file.

Modified:
    subversion/trunk/build/generator/gen_vcnet_vcproj.py
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/build/generator/vcnet_vcproj.ezt

Modified: subversion/trunk/build/generator/gen_vcnet_vcproj.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_vcnet_vcproj.py?rev=887234&r1=887233&r2=887234&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_vcnet_vcproj.py (original)
+++ subversion/trunk/build/generator/gen_vcnet_vcproj.py Fri Dec  4 15:49:56 
2009
@@ -23,13 +23,6 @@
 #
 
 import os
-try:
-  # Python >=2.5
-  from hashlib import md5 as hashlib_md5
-except ImportError:
-  # Python <2.5
-  from md5 import md5 as hashlib_md5
-
 import gen_base
 import gen_win
 import ezt
@@ -61,19 +54,19 @@
     "Write a Project (.vcproj)"
 
     if isinstance(target, gen_base.TargetProject):
-      config_type=10
+      target_type=10
     elif isinstance(target, gen_base.TargetExe):
       #EXE
-      config_type=1
+      target_type=1
     elif isinstance(target, gen_base.TargetJava):
-      config_type=10
+      target_type=10
     elif isinstance(target, gen_base.TargetLib):
       if target.msvc_static:
-        config_type=4
+        target_type=4
       else:
-        config_type=2
+        target_type=2
     elif isinstance(target, gen_base.TargetI18N):
-      config_type=4
+      target_type=4
     else:
       raise gen_base.GenError("Cannot create project for %s" % target.name)
 
@@ -88,8 +81,8 @@
 
     data = {
       'target' : target,
-      'target_type' : config_type,
-#      'target_number' : targval,
+      'target_type' : target_type,
+      'project_guid' : target.project_guid,
       'rootpath' : self.rootpath,
       'platforms' : self.platforms,
       'configs' : configs,
@@ -111,20 +104,6 @@
 
     self.write_with_template(fname, 'vcnet_vcproj.ezt', data)
 
-  def makeguid(self, data):
-    "Generate a windows style GUID"
-    ### blah. this function can generate invalid GUIDs. leave it for now,
-    ### but we need to fix it. we can wrap the apr UUID functions, or
-    ### implement this from scratch using the algorithms described in
-    ### http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
-
-    myhash = hashlib_md5(data).hexdigest()
-
-    guid = ("{%s-%s-%s-%s-%s}" % (myhash[0:8], myhash[8:12],
-                                  myhash[12:16], myhash[16:20],
-                                  myhash[20:32])).upper()
-    return guid
-
   def getguid(self, path):
     "Try to get a project's guid from its project file"
     try:
@@ -188,10 +167,8 @@
       guid = None
       proj_path = self.get_external_project(target, 'vcproj')
       if proj_path is not None:
-        guid = self.getguid(proj_path)
-      if guid is None:
-        guid = self.makeguid(target.name)
-      guids[target.name] = guid
+        target.project_guid = self.getguid(proj_path)
+      guids[target.name] = target.project_guid
 
     self.gen_proj_names(install_targets)
 

Modified: subversion/trunk/build/generator/gen_win.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=887234&r1=887233&r2=887234&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Fri Dec  4 15:49:56 2009
@@ -23,6 +23,12 @@
 #
 
 import os
+try:
+  # Python >=2.5
+  from hashlib import md5 as hashlib_md5
+except ImportError:
+  # Python <2.5
+  from md5 import md5 as hashlib_md5
 import sys
 import fnmatch
 import re
@@ -314,6 +320,20 @@
     else:
       print("%s not found; skipping SWIG file generation..." % self.swig_exe)
 
+  def makeguid(self, data):
+    "Generate a windows style GUID"
+    ### blah. this function can generate invalid GUIDs. leave it for now,
+    ### but we need to fix it. we can wrap the apr UUID functions, or
+    ### implement this from scratch using the algorithms described in
+    ### http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
+
+    myhash = hashlib_md5(data).hexdigest()
+
+    guid = ("{%s-%s-%s-%s-%s}" % (myhash[0:8], myhash[8:12],
+                                  myhash[12:16], myhash[16:20],
+                                  myhash[20:32])).upper()
+    return guid
+
   def path(self, *paths):
     """Convert build path to msvc path and prepend root"""
     return msvc_path_join(self.rootpath, *list(map(msvc_path, paths)))
@@ -370,6 +390,9 @@
           else:
             dll_targets.append(self.create_dll_target(target))
     install_targets.extend(dll_targets)
+    
+    for target in install_targets:
+      target.project_guid = self.makeguid(target.name)
 
     # sort these for output stability, to watch out for regressions.
     install_targets.sort(key = lambda t: t.name)

Modified: subversion/trunk/build/generator/vcnet_vcproj.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/vcnet_vcproj.ezt?rev=887234&r1=887233&r2=887234&view=diff
==============================================================================
--- subversion/trunk/build/generator/vcnet_vcproj.ezt (original)
+++ subversion/trunk/build/generator/vcnet_vcproj.ezt Fri Dec  4 15:49:56 2009
@@ -2,7 +2,8 @@
 <VisualStudioProject
        ProjectType="Visual C++"
        Version="[version]"
-       Name="[target.proj_name]">
+       Name="[target.proj_name]"
+       ProjectGUID="[project_guid]">
        <Platforms>
 [for platforms]                <Platform
                        Name="[platforms]"/>


Reply via email to