added AppleScripts to export/import xml files from/to projects
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
104
docs/mac/BuildSamplesM5.as → docs/mac/M5build.applescript
Executable file → Normal file
104
docs/mac/BuildSamplesM5.as → docs/mac/M5build.applescript
Executable file → Normal file
@@ -1,10 +1,13 @@
|
|||||||
--
|
-----------------------------------------------------------------------------
|
||||||
-- File: BuildSamplesM5.as
|
-- Name: docs/mac/M5build.applescript
|
||||||
-- Purpose: Automatic build of samples with CodeWarrior 5
|
-- Purpose: Automatic build of projects with CodeWarrior 5
|
||||||
-- Author: Gilles Depeyrot
|
-- Author: Gilles Depeyrot
|
||||||
-- Created: 06.10.2001
|
-- Modified by:
|
||||||
--
|
-- Created: 06.10.2001
|
||||||
|
-- RCS-ID: $Id$
|
||||||
|
-- Copyright: (c) 2001 Gilles Depeyrot
|
||||||
|
-- Licence: wxWindows licence
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
-- This AppleScript automatically recurses through the selected folder looking for
|
-- This AppleScript automatically recurses through the selected folder looking for
|
||||||
-- and building CodeWarrior projects.
|
-- and building CodeWarrior projects.
|
||||||
@@ -115,51 +118,54 @@ end tell
|
|||||||
on BuildProjects(inLogFileRef, inFolder, inTarget, inRebuild)
|
on BuildProjects(inLogFileRef, inFolder, inTarget, inRebuild)
|
||||||
global theProjectCount, theProjectSuccessCount
|
global theProjectCount, theProjectSuccessCount
|
||||||
|
|
||||||
|
try
|
||||||
|
tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
|
||||||
|
on error
|
||||||
|
set theProject to ""
|
||||||
|
end try
|
||||||
|
|
||||||
|
if theProject is not "" then
|
||||||
|
set theProjectCount to theProjectCount + 1
|
||||||
|
|
||||||
|
write "building project '" & (theProject as string) & "'" & gEol to inLogFileRef
|
||||||
|
|
||||||
|
tell application "CodeWarrior IDE 4.0.4"
|
||||||
|
--
|
||||||
|
-- Open the project in CodeWarrior
|
||||||
|
--
|
||||||
|
open theProject as string
|
||||||
|
--
|
||||||
|
-- Change to the requested target
|
||||||
|
--
|
||||||
|
Set Current Target inTarget
|
||||||
|
--
|
||||||
|
-- Remove object code if rebuild requested
|
||||||
|
--
|
||||||
|
if inRebuild then
|
||||||
|
Remove Binaries
|
||||||
|
end if
|
||||||
|
--
|
||||||
|
-- Build/Rebuild the selected target
|
||||||
|
--
|
||||||
|
set theBuildInfo to Make Project with ExternalEditor
|
||||||
|
--
|
||||||
|
-- Close the project
|
||||||
|
--
|
||||||
|
Close Project
|
||||||
|
end tell
|
||||||
|
--
|
||||||
|
-- Report errors to build log file
|
||||||
|
--
|
||||||
|
write gEol to inLogFileRef
|
||||||
|
ReportBuildInfo(inLogFileRef, theBuildInfo)
|
||||||
|
write gSeparator to inLogFileRef
|
||||||
|
end if
|
||||||
|
|
||||||
tell application "Finder" to set theSubFolders to every folder of inFolder
|
tell application "Finder" to set theSubFolders to every folder of inFolder
|
||||||
|
|
||||||
repeat with theFolder in theSubFolders
|
repeat with theFolder in theSubFolders
|
||||||
|
BuildProjects(inLogFileRef, theFolder, inTarget, inRebuild)
|
||||||
tell application "Finder" to set theProject to (the first file of theFolder whose name ends with gProjectSuffix)
|
|
||||||
|
|
||||||
if theProject as string is not "" then
|
|
||||||
set theProjectCount to theProjectCount + 1
|
|
||||||
write "building project '" & (theProject as string) & "'" & gEol to inLogFileRef
|
|
||||||
|
|
||||||
tell application "CodeWarrior IDE 4.0.4"
|
|
||||||
--
|
|
||||||
-- Open the project in CodeWarrior
|
|
||||||
--
|
|
||||||
open theProject as string
|
|
||||||
--
|
|
||||||
-- Change to the requested target
|
|
||||||
--
|
|
||||||
Set Current Target inTarget
|
|
||||||
--
|
|
||||||
-- Remove object code if rebuild requested
|
|
||||||
--
|
|
||||||
if inRebuild then
|
|
||||||
Remove Binaries
|
|
||||||
end if
|
|
||||||
--
|
|
||||||
-- Build/Rebuild the selected target
|
|
||||||
--
|
|
||||||
set theBuildInfo to Make Project with ExternalEditor
|
|
||||||
--
|
|
||||||
-- Close the project
|
|
||||||
--
|
|
||||||
Close Project
|
|
||||||
end tell
|
|
||||||
--
|
|
||||||
-- Report errors to build log file
|
|
||||||
--
|
|
||||||
write gEol to inLogFileRef
|
|
||||||
ReportBuildInfo(inLogFileRef, theBuildInfo)
|
|
||||||
write gSeparator to inLogFileRef
|
|
||||||
else
|
|
||||||
BuildProjects(inLogFileRef, theFolder, inTarget, inRebuild)
|
|
||||||
end if
|
|
||||||
|
|
||||||
end repeat
|
end repeat
|
||||||
|
|
||||||
end BuildProjects
|
end BuildProjects
|
||||||
|
|
||||||
--
|
--
|
90
docs/mac/M5mcp2xml.applescript
Normal file
90
docs/mac/M5mcp2xml.applescript
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Name: docs/mac/M5mcp2xml.applescript
|
||||||
|
-- Purpose: Automatic export of CodeWarrior 5 projects to XML files
|
||||||
|
-- Author: Gilles Depeyrot
|
||||||
|
-- Modified by:
|
||||||
|
-- Created: 28.11.2001
|
||||||
|
-- RCS-ID: $Id$
|
||||||
|
-- Copyright: (c) 2001 Gilles Depeyrot
|
||||||
|
-- Licence: wxWindows licence
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- This AppleScript automatically recurses through the selected folder looking for
|
||||||
|
-- and exporting CodeWarrior projects to xml files.
|
||||||
|
-- To use this script, simply open it with the 'Script Editor' and run it.
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Suffix used to recognize CodeWarrior project files
|
||||||
|
--
|
||||||
|
property gProjectSuffix : "M5.mcp"
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Project and build success count
|
||||||
|
--
|
||||||
|
set theProjectCount to 0
|
||||||
|
set theProjectSuccessCount to 0
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ask the user to select the wxWindows samples folder
|
||||||
|
--
|
||||||
|
set theFolder to choose folder with prompt "Select the wxWindows folder"
|
||||||
|
|
||||||
|
ExportProjects(theFolder)
|
||||||
|
|
||||||
|
tell me to display dialog "Exported " & theProjectSuccessCount & " projects out of " & theProjectCount
|
||||||
|
|
||||||
|
--
|
||||||
|
-- ExportProjects
|
||||||
|
--
|
||||||
|
on ExportProjects(inFolder)
|
||||||
|
global theProjectCount, theProjectSuccessCount
|
||||||
|
|
||||||
|
try
|
||||||
|
tell application "Finder" to set theProject to ((the first file of inFolder whose name ends with gProjectSuffix) as string)
|
||||||
|
on error
|
||||||
|
set theProject to ""
|
||||||
|
end try
|
||||||
|
|
||||||
|
if theProject is not "" then
|
||||||
|
set theProjectCount to theProjectCount + 1
|
||||||
|
|
||||||
|
-- save the current text delimiters
|
||||||
|
set theDelimiters to my text item delimiters
|
||||||
|
|
||||||
|
-- replace the ".mcp" extension with ".xml"
|
||||||
|
set my text item delimiters to "."
|
||||||
|
set theList to (every text item of theProject)
|
||||||
|
set theList to (items 1 thru -2 of theList)
|
||||||
|
set theExport to (theList as string) & ".xml"
|
||||||
|
|
||||||
|
-- restore the text delimiters
|
||||||
|
set my text item delimiters to theDelimiters
|
||||||
|
|
||||||
|
tell application "CodeWarrior IDE 4.0.4"
|
||||||
|
--
|
||||||
|
-- Open the project in CodeWarrior
|
||||||
|
--
|
||||||
|
open theProject
|
||||||
|
--
|
||||||
|
-- Export the selected project
|
||||||
|
--
|
||||||
|
try
|
||||||
|
export project document 1 in theExport
|
||||||
|
set theProjectSuccessCount to theProjectSuccessCount + 1
|
||||||
|
on error number errnum
|
||||||
|
tell me to display dialog "Error " & errnum & " exporting " & theExport
|
||||||
|
end try
|
||||||
|
--
|
||||||
|
-- Close the project
|
||||||
|
--
|
||||||
|
Close Project
|
||||||
|
end tell
|
||||||
|
end if
|
||||||
|
|
||||||
|
tell application "Finder" to set theSubFolders to every folder of inFolder
|
||||||
|
repeat with theFolder in theSubFolders
|
||||||
|
ExportProjects(theFolder)
|
||||||
|
end repeat
|
||||||
|
|
||||||
|
end ExportProjects
|
86
docs/mac/M5xml2mcp.applescript
Normal file
86
docs/mac/M5xml2mcp.applescript
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Name: docs/mac/M5xml2mcp.applescript
|
||||||
|
-- Purpose: Automatic import of CodeWarrior 5 xml files to projects
|
||||||
|
-- Author: Gilles Depeyrot
|
||||||
|
-- Modified by:
|
||||||
|
-- Created: 30.11.2001
|
||||||
|
-- RCS-ID: $Id$
|
||||||
|
-- Copyright: (c) 2001 Gilles Depeyrot
|
||||||
|
-- Licence: wxWindows licence
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
--
|
||||||
|
-- This AppleScript automatically recurses through the selected folder looking for
|
||||||
|
-- and importing CodeWarrior xml files to projects
|
||||||
|
-- To use this script, simply open it with the 'Script Editor' and run it.
|
||||||
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Suffix used to recognize CodeWarrior xml files
|
||||||
|
--
|
||||||
|
property gXmlSuffix : "M5.xml"
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Project and build success count
|
||||||
|
--
|
||||||
|
set theXmlCount to 0
|
||||||
|
set theXmlSuccessCount to 0
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ask the user to select the wxWindows samples folder
|
||||||
|
--
|
||||||
|
set theFolder to choose folder with prompt "Select the wxWindows folder"
|
||||||
|
|
||||||
|
ImportProjects(theFolder)
|
||||||
|
|
||||||
|
tell me to display dialog "Imported " & theXmlSuccessCount & " xml files out of " & theXmlCount buttons {"OK"}
|
||||||
|
|
||||||
|
--
|
||||||
|
-- ImportProjects
|
||||||
|
--
|
||||||
|
on ImportProjects(inFolder)
|
||||||
|
global theXmlCount, theXmlSuccessCount
|
||||||
|
|
||||||
|
try
|
||||||
|
tell application "Finder" to set theXml to ((the first file of inFolder whose name ends with gXmlSuffix) as string)
|
||||||
|
on error
|
||||||
|
set theXml to ""
|
||||||
|
end try
|
||||||
|
|
||||||
|
if theXml is not "" then
|
||||||
|
set theXmlCount to theXmlCount + 1
|
||||||
|
|
||||||
|
-- save the current text delimiters
|
||||||
|
set theDelimiters to my text item delimiters
|
||||||
|
|
||||||
|
-- replace the ".xml" extension with ".mcp"
|
||||||
|
set my text item delimiters to "."
|
||||||
|
set theList to (every text item of theXml)
|
||||||
|
set theList to (items 1 thru -2 of theList)
|
||||||
|
set theImport to (theList as string) & ".mcp"
|
||||||
|
|
||||||
|
-- restore the text delimiters
|
||||||
|
set my text item delimiters to theDelimiters
|
||||||
|
|
||||||
|
tell application "CodeWarrior IDE 4.0.4"
|
||||||
|
--
|
||||||
|
-- Import the selected xml file
|
||||||
|
--
|
||||||
|
try
|
||||||
|
make new project document as theImport with data theXml
|
||||||
|
set theXmlSuccessCount to theXmlSuccessCount + 1
|
||||||
|
--
|
||||||
|
-- Close the project
|
||||||
|
--
|
||||||
|
Close Project
|
||||||
|
on error number errnum
|
||||||
|
tell me to display dialog "Error " & errnum & " importing " & theXml & " to " & theImport
|
||||||
|
end try
|
||||||
|
end tell
|
||||||
|
end if
|
||||||
|
|
||||||
|
tell application "Finder" to set theSubFolders to every folder of inFolder
|
||||||
|
repeat with theFolder in theSubFolders
|
||||||
|
ImportProjects(theFolder)
|
||||||
|
end repeat
|
||||||
|
|
||||||
|
end ImportProjects
|
Reference in New Issue
Block a user