[Freeswitch-svn] [commit] r2410 - in freeswitch/trunk: . libs/win32 w32/vsnet

Freeswitch SVN mikej at freeswitch.org
Sun Aug 27 16:37:01 EDT 2006


Author: mikej
Date: Sun Aug 27 16:37:01 2006
New Revision: 2410

Modified:
   freeswitch/trunk/Freeswitch.sln
   freeswitch/trunk/libs/win32/util.vbs
   freeswitch/trunk/w32/vsnet/FreeSwitchCore.vcproj

Log:
move creation of the version header file to use util.vbs

Modified: freeswitch/trunk/Freeswitch.sln
==============================================================================
--- freeswitch/trunk/Freeswitch.sln	(original)
+++ freeswitch/trunk/Freeswitch.sln	Sun Aug 27 16:37:01 2006
@@ -11,7 +11,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\vsnet\FreeSwitchCore.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{FE191916-DEDD-43B3-B28C-D09C9088C586} = {FE191916-DEDD-43B3-B28C-D09C9088C586}
 		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
 		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
@@ -154,8 +153,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "docs", "docs\docs.vcproj", "{1A1FF289-4FD6-4285-A422-D31DD67A4723}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchVersion", "w32\vsnet\FreeSwitchVersion.vcproj", "{FE191916-DEDD-43B3-B28C-D09C9088C586}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_xml", "src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.vcproj", "{07113B25-D3AF-4E04-BA77-4CD1171F022C}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -592,10 +589,6 @@
 		{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32
-		{FE191916-DEDD-43B3-B28C-D09C9088C586}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FE191916-DEDD-43B3-B28C-D09C9088C586}.Debug|Win32.Build.0 = Debug|Win32
-		{FE191916-DEDD-43B3-B28C-D09C9088C586}.Release|Win32.ActiveCfg = Release|Win32
-		{FE191916-DEDD-43B3-B28C-D09C9088C586}.Release|Win32.Build.0 = Release|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32

Modified: freeswitch/trunk/libs/win32/util.vbs
==============================================================================
--- freeswitch/trunk/libs/win32/util.vbs	(original)
+++ freeswitch/trunk/libs/win32/util.vbs	Sun Aug 27 16:37:01 2006
@@ -45,6 +45,9 @@
 			Wget objArgs(1), Showpath(objArgs(2))
 		Case "GetUnzip"		
 			WgetUnCompress objArgs(1), Showpath(objArgs(2))
+		Case "Version"					
+			'CreateVersion(tmpFolder, VersionDir, includebase, includedest)
+			CreateVersion Showpath(objArgs(1)), Showpath(objArgs(2)), objArgs(3), objArgs(4)
 	End Select
 End If
 
@@ -180,3 +183,62 @@
 	Set f = FSO.GetFolder(folderspec)
 	showpath = f.path & "\"
 End Function
+
+Sub FindReplaceInFile(FileName, sFind, sReplace)
+	Const OpenAsASCII = 0  ' Opens the file as ASCII (TristateFalse) 
+	Const OpenAsUnicode = -1  ' Opens the file as Unicode (TristateTrue) 
+	Const OpenAsDefault = -2  ' Opens the file using the system default 
+	
+	Const OverwriteIfExist = -1 
+	Const FailIfNotExist   =  0 
+	Const ForReading       =  1 
+	
+	Set fOrgFile = FSO.OpenTextFile(FileName, ForReading, FailIfNotExist, OpenAsASCII)
+	sText = fOrgFile.ReadAll
+	fOrgFile.Close
+	sText = Replace(sText, sFind, sReplace)
+	Set fNewFile = FSO.CreateTextFile(FileName, OverwriteIfExist, OpenAsASCII)
+	fNewFile.WriteLine sText
+	fNewFile.Close
+End Sub
+
+Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
+	Dim oExec
+	If Right(tmpFolder, 1) <> "\" Then tmpFolder = tmpFolder & "\" End If
+	If Not FSO.FileExists(tmpFolder & "svnversion.exe") Then 
+		Wget ToolsBase & "svnversion.exe", tmpFolder
+	End If	
+	Dim sLastFile
+	Const OverwriteIfExist = -1 
+	Const ForReading       =  1 
+	VersionCmd="svnversion " & quote & VersionDir & "." & quote &  " -n"
+	Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True)
+	MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote )
+	MyFile.WriteLine("@" & VersionCmd)
+	MyFile.Close
+	Set oExec = WshShell.Exec(tmpFolder & "tmpVersion.Bat")
+	Do
+		strFromProc = OExec.StdOut.ReadLine()
+		VERSION=strFromProc
+	Loop While Not OExec.StdOut.atEndOfStream
+	sLastVersion = ""
+	Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII)
+	If Not sLastFile.atEndOfStream Then
+		sLastVersion = sLastFile.ReadLine()
+	End If
+	sLastFile.Close
+	
+	If VERSION = "" Then
+		VERSION = "UNKNOWN"
+	End If
+
+	If VERSION <> sLastVersion Then
+		Set MyFile = fso.CreateTextFile(tmpFolder & "lastversion", True)
+		MyFile.WriteLine(VERSION)
+		MyFile.Close
+	
+		FSO.CopyFile includebase, includedest, true
+		FindReplaceInFile includedest, "@SVN_VERSION@", VERSION
+	End If
+	
+End Sub

Modified: freeswitch/trunk/w32/vsnet/FreeSwitchCore.vcproj
==============================================================================
--- freeswitch/trunk/w32/vsnet/FreeSwitchCore.vcproj	(original)
+++ freeswitch/trunk/w32/vsnet/FreeSwitchCore.vcproj	Sun Aug 27 16:37:01 2006
@@ -384,6 +384,36 @@
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
 			>
 		</Filter>
+		<Filter
+			Name="Generated Header Files"
+			>
+			<File
+				RelativePath="..\..\src\include\switch_version.h.in"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Generating switch_version.h"
+						CommandLine="cscript /nologo &quot;$(ProjectDir)..\..\libs\win32\util.vbs&quot; Version  &quot;$(ProjectDir)&quot; &quot;$(ProjectDir)..\..\&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h.in&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h&quot;&#x0D;&#x0A;"
+						AdditionalDependencies="..\..\src\include\switch.h;..\..\src\include\switch_apr.h;..\..\src\include\switch_buffer.h;..\..\src\include\switch_caller.h;..\..\src\include\switch_channel.h;..\..\src\include\switch_console.h;..\..\src\include\switch_core.h;..\..\src\include\switch_event.h;..\..\src\include\switch_frame.h;..\..\src\include\switch_ivr.h;..\..\src\include\switch_loadable_module.h;..\..\src\include\switch_log.h;..\..\src\include\switch_module_interfaces.h;..\..\src\include\switch_platform.h;..\..\src\include\switch_resample.h;..\..\src\include\switch_rtp.h;..\..\src\include\switch_sqlite.h;..\..\src\include\switch_stun.h;..\..\src\include\switch_types.h;..\..\src\include\switch_utils.h;..\..\src\include\switch_xml.h;..\..\src\switch_buffer.c;..\..\src\switch_caller.c;..\..\src\switch_channel.c;..\..\src\switch_config.c;..\..\src\switch_console.c;..\..\src\switch_core.c;..\..\src\switch_event.c;..\..\src\switch_ivr.c;..\..\src\switch_loadable_module.c;..\..\src\switch_log.c;..\..\src\switch_resample.c;..\..\src\switch_rtp.c;..\..\src\switch_stun.c;..\..\src\switch_utils.c;..\..\src\switch_xml.c"
+						Outputs="..\..\src\include\switch_version.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Generating switch_version.h"
+						CommandLine="cscript /nologo &quot;$(ProjectDir)..\..\libs\win32\util.vbs&quot; Version  &quot;$(ProjectDir)&quot; &quot;$(ProjectDir)..\..\&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h.in&quot; &quot;$(ProjectDir)..\..\src\include\switch_version.h&quot;&#x0D;&#x0A;"
+						AdditionalDependencies="..\..\src\include\switch.h;..\..\src\include\switch_apr.h;..\..\src\include\switch_buffer.h;..\..\src\include\switch_caller.h;..\..\src\include\switch_channel.h;..\..\src\include\switch_console.h;..\..\src\include\switch_core.h;..\..\src\include\switch_event.h;..\..\src\include\switch_frame.h;..\..\src\include\switch_ivr.h;..\..\src\include\switch_loadable_module.h;..\..\src\include\switch_log.h;..\..\src\include\switch_module_interfaces.h;..\..\src\include\switch_platform.h;..\..\src\include\switch_resample.h;..\..\src\include\switch_rtp.h;..\..\src\include\switch_sqlite.h;..\..\src\include\switch_stun.h;..\..\src\include\switch_types.h;..\..\src\include\switch_utils.h;..\..\src\include\switch_xml.h;..\..\src\switch_buffer.c;..\..\src\switch_caller.c;..\..\src\switch_channel.c;..\..\src\switch_config.c;..\..\src\switch_console.c;..\..\src\switch_core.c;..\..\src\switch_event.c;..\..\src\switch_ivr.c;..\..\src\switch_loadable_module.c;..\..\src\switch_log.c;..\..\src\switch_resample.c;..\..\src\switch_rtp.c;..\..\src\switch_stun.c;..\..\src\switch_utils.c;..\..\src\switch_xml.c"
+						Outputs="..\..\src\include\switch_version.h"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
 	</Globals>



More information about the Freeswitch-svn mailing list