6
property pRootFolderName : "ncbi" -- name of the toolkit directory
7
property pRootFolderPath : "" -- full path of the parent of the toolkit directory. Optional
9
property pProjectFileExt : ".mcp"
11
property pSaveContinueOnErrors : false
12
-- true if we want to save compilation errors in a file and continue.
13
-- false if we want to stop on an error.
15
-- Whether to recreate existing project files.
16
property pAlwaysCreateProjects : false
18
-- Which targets to build.
19
-- All of the targets are populated all the time. These affect what is compiled & built.
20
property pCreateMachOTargets : true
21
property pCreateCarbonTargets : false
22
property pCreateWinTargets : false
24
property pCreateOptimizedTargets : true
25
property pCreateDebugTargets : false
26
property pCreateProfiledTargets : false
28
-- Whether to have the projects use CVS or not.
29
property pProjectsCVSEnabled : true
31
-- Whether to compile anything.
32
property pShouldBuild : true
34
property pStationeryName : "LibraryStationery"
36
-- the handler GetTargetSpecs should change if these do.
37
property pTargetKeyWords : "Mach-O Carbon Win32 Debug Final Profile"
51
on ProjectData(projName, features, aFileData)
53
if (count characters of projName) > 25 then
54
set projName to characters 1 through 25 of projName as string
57
if features does not contain "C" and features does not contain "C++" then
58
copy "C" to end of features
60
set myFeatures to features
62
return {name:projName, features:myFeatures, rsrcs:{}, settings:�
63
{prefixFile:"", ppcProject:{}}, projLibs:{}, sysPaths:{}, fileData:�
68
on AddProject(projData)
69
copy projData to end of gProjectData
72
on AddSimpleProject(projName, features, section)
73
AddProject(ProjectData(projName, features, {mkFileData(section)}))
76
on AddSimpleProjectListFiles(projName, features, section, fileList)
77
AddProject(ProjectData(projName, features, {mkFileDataListFiles(section, fileList)}))
78
end AddSimpleProjectListFiles
80
on AddSimpleProjectExceptFiles(projName, features, section, fileNotList)
81
AddProject(ProjectData(projName, features, {mkFileDataExceptFiles(section, fileNotList)}))
82
end AddSimpleProjectExceptFiles
84
on mkFileData(section)
85
if (section does not end with ":") then set section to section & ":"
86
return {projPath:section, fileList:GetFileNames(section), fileNotList:{}}
89
on mkFileDataListFiles(section, fileList)
90
if (section does not end with ":") then set section to section & ":"
92
repeat with i in fileList
93
if i does not contain "." then set i to i & ".c"
94
copy (contents of i) to end of newFileList
96
return {projPath:section, fileList:newFileList, fileNotList:{}}
97
end mkFileDataListFiles
99
on mkFileDataExceptFiles(section, fileNotList)
100
if (section does not end with ":") then set section to section & ":"
101
set theFileList to GetFileNames(section)
102
set theRealFileList to {}
103
repeat with f in theFileList
104
if fileNotList does not contain f then
105
copy f to the end of theRealFileList
108
return {projPath:section, fileList:theRealFileList, fileNotList:fileNotList}
109
end mkFileDataExceptFiles
111
on DataPlusPrefixFile(dataRec, prefix)
112
tell application "CodeWarrior IDE"
114
set the prefixFile of dataRec's settings to prefix
118
end DataPlusPrefixFile
120
on GetFileNames(relPath)
121
set theFiles to list folder (gSourceDir & relPath) without invisibles
122
set theFiles to EndsWith(theFiles, ".c") -- Assume C projects not C++
127
on EndsWith(aList, suffix)
129
repeat with f in aList
130
if (f ends with suffix) then
131
copy (f as string) to end of newList
139
-- Only needed for Carbon
140
AddSimpleProject("mitsock", {}, "connect:mitsock")
142
AddProject(ProjectData("ncbi", {"winprefix"}, {�
143
mkFileDataExceptFiles("corelib:", {"drwnflpt.c", "drwnfspc.c", "drwnmfls.c", "ncbiargs.c", "ncbimain.c"}), �
144
mkFileData("corelib:morefile:"), �
145
mkFileDataListFiles("connect:", {"ncbibuf", "ncbisock", "urlquery"}), �
146
mkFileData("ctools:"), �
147
mkFileDataListFiles("util:tables:", {"raw_scoremat"}), �
148
mkFileDataExceptFiles("asnlib:", {"asncode.c", "asntool.c"})}))
150
AddProject(ProjectData("ncbiobj", {}, {�
151
mkFileDataExceptFiles("object:", {"objmime.c"}), �
152
mkFileDataExceptFiles("access:", {"strucapi.c"}), �
153
mkFileData("api:"), �
154
mkFileData("util:creaders:"), �
155
mkFileDataExceptFiles("ddv:", {"ddvmain.c"})}))
157
AddSimpleProject("vibrant", {"winprefix"}, "vibrant")
159
AddSimpleProjectExceptFiles("ncbicdr", {}, "cdromlib", {"acccn3ds.c", "accentr.c", "accmmdbs.c", "accutils.c"})
161
AddSimpleProjectExceptFiles("ncbidesk", {}, "desktop", {"sdisplay.c"})
163
AddSimpleProject("ddvlib", {}, "ddv")
165
AddProject(DataPlusPrefixFile(ProjectData("ncbimmdb", {}, {�
166
mkFileDataListFiles("biostruc:", {�
167
"corematx", "dvncode", "objmmdb1", "objmmdb2", "objmmdb3", "mmdbapi", �
168
"mmdbapi1", "mmdbapi2", "mmdbapi3", "mmdbapi4", "mmdbentr", "vastsubs", �
170
mkFileDataListFiles("object:", {�
172
mkFileDataListFiles("access:", {�
174
mkFileDataListFiles("biostruc:cn3d:", {�
176
mkFileDataListFiles("biostruc:cdd:", {�
177
"objcdd", "cddutil", "cddposutil", �
178
"thrdalgs", "thrdatd", "thrdbwfi", "thrdcpal", �
179
"thrdcpll", "thrdcprl", "thrdcxei", "thrddgri", "thrdrsmp", �
180
"thrdsal0", "thrdsalr", "thrdsalu", "thrdsgoi", "thrdslo0", �
181
"thrdslor", "thrdslou", "thrdspci", "thrdspea", "thrdspel", �
182
"thrdspni", "thrdttb0", "thrdttbi", "thrdzsc"})}), "gif.pfx"))
184
AddSimpleProject("ncbiNacc", {}, "cdromlib")
186
AddSimpleProject("vibnet", {}, "network:vibnet")
188
AddSimpleProject("ncbitool", {}, "tools")
190
AddSimpleProject("netentr", {}, "network:entrez:client")
192
AddSimpleProjectExceptFiles("ncbibls3", {}, "network:blast3:client", {"blastcl3.c"})
194
AddSimpleProjectExceptFiles("ncbiid1", {}, "network:id1arch", {"idfetch.c"})
196
-- AddSimpleProject("ncbiid2", {}, "network:id2arch")
198
AddSimpleProjectExceptFiles("ncbimla", {}, "network:medarch:client", {"sybmed.c"})
200
AddProject(DataPlusPrefixFile(ProjectData("ncbitxc2", {}, {�
201
mkFileDataExceptFiles("network:taxon1:taxon2:", {"txcproc.c"}), �
202
mkFileDataExceptFiles("network:taxon1:common:", {"checkid.c"})}), "tax2.pfx"))
204
AddSimpleProjectListFiles("ncbiconn", {"winprefix"}, "connect", �
205
{"ncbi_buffer", "ncbi_socket", "ncbi_core", "ncbi_core_c", "ncbi_util", "ncbi_priv", �
206
"ncbi_ansi_ext", "ncbi_connection", "ncbi_connector", "ncbi_connutil", �
207
"ncbi_file_connector", "ncbi_host_info.c", "ncbi_http_connector", �
208
"ncbi_memory_connector", "ncbi_server_info", "ncbi_service", �
209
"ncbi_service_connector", "ncbi_dispd", "ncbi_lbsmd_stub", �
210
"ncbi_socket_connector", "ncbi_sendmail"})
212
AddSimpleProjectExceptFiles("netcli", {}, "network:nsclilib", {"ni_encr.c", "ni_list.c", "ni_lib.c"})
214
AddSimpleProject("ncbispell", {}, "network:spell:client")
216
AddSimpleProject("ncbiblast", {}, "algo:blast:core")
218
AddSimpleProject("ncbiblastapi", {}, "algo:blast:api")
223
-- Set Global variables
227
tell application "Finder"
228
set vers to the version as text
229
if second character of vers is equal to "." then
230
set vers to "0" & vers
232
return vers > 10 or vers = 10
236
on ResolveAlias(pathname)
237
tell application "Finder"
238
if exists folder pathname then
239
-- if pathname does not end with ":" then set pathname to pathname & ":"
240
return folder pathname as string
242
if exists alias file pathname then return the original item of alias file pathname as string
247
on stripVolName(macPath)
248
set saveTID to get text item delimiters of AppleScript
249
set text item delimiters of AppleScript to ":"
250
set strippedPath to (rest of text items of macPath) as string
251
set text item delimiters of AppleScript to saveTID
256
tell application "Finder"
258
return the home as string
268
set modRoot to ResolveAlias(pRootFolderPath & pRootFolderName)
270
if modRoot is "" then
271
set modRoot to ResolveAlias(gHomeDir & pRootFolderName)
277
set myPath to path to me as string
278
if myPath contains "Script Editor" or �
279
myPath contains "osascript" or �
280
myPath contains "Smile.app" then
281
-- Oops! running under script editor. 'me' is Script Editor not this script.
282
-- use the location this script is supposed to be in.
283
return gDistribRoot & "make:"
285
tell application "Finder"
286
return container of myPath as string
292
tell application "Finder"
294
set gProjectData to {}
296
set gStartupDisk to startup disk as string
297
set gHomeDir to my HomeDir()
298
set gDistribRoot to my ModuleRoot()
300
set gIncludeDir to gDistribRoot & "include:"
301
set gSourceDir to gDistribRoot
302
set gProjectsDir to gDistribRoot & "lib:"
303
set gRsrcsDir to gDistribRoot & "link:macmet:"
304
set gMakeDir to my GetMyPath()
309
on HeaderExists(header, headerDir)
310
tell application "Finder"
311
if headerDir is "" then set headerDir to folder gIncludeDir
312
return exists file header of headerDir
316
on IsOlderThan(fileA, fileB)
317
tell application "Finder"
318
return (the modification date of fileA < the modification date of fileB)
322
on UpdateRenameHeader(canonicalName, canonicalDir, dotHName, dotHDir)
323
tell application "Finder"
325
set needRename to (dotHName is not "")
326
if not needRename then set dotHName to canonicalName
327
if dotHDir is "" then set dotHDir to folder gIncludeDir
329
-- This file is only present if the script was interrupted.
330
if needRename and my HeaderExists(canonicalName, dotHDir) then
331
delete file canonicalName of dotHDir
334
-- The native config file.
335
-- If it's missing, assume this is a prepared distribution and the header is already up-to-date.
336
if not my HeaderExists(canonicalName, canonicalDir) then return
337
set canonicalFile to file canonicalName of canonicalDir
340
if my HeaderExists(dotHName, dotHDir) then
341
set dotHFile to file dotHName of dotHDir
342
if my IsOlderThan(dotHFile, canonicalFile) then
345
set needCopy to false
349
duplicate canonicalFile to dotHDir
350
if needRename then set name of file canonicalName of dotHDir to dotHName
353
end UpdateRenameHeader
356
CreateFolder(gIncludeDir)
357
tell application "Finder"
358
set corelibFolder to folder (gDistribRoot & "corelib")
359
my UpdateRenameHeader("ncbilcl.met", corelibFolder, "ncbilcl.h", "")
364
on AppendAccessPath(aPath, isRecursive, isUserPath)
365
tell application "CodeWarrior IDE"
366
if (aPath does not end with ":") then set aPath to aPath & ":"
368
set aPath to POSIX path of aPath
369
set pathsToAdd to {{name:aPath, recursive:isRecursive, origin:absolute, format:Unix Path}}
371
Set Preferences of panel "Access Paths" to {User Paths:pathsToAdd}
373
Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd}
379
on AppendPrefixFile(filename)
380
tell application "CodeWarrior IDE"
382
Set Preferences of panel "C/C++ Compiler" to {Prefix File:prefixFile}
385
set oldtext to Get Preferences of {Prefix Text} from panel "C/C++ Preprocessor"
386
set oldtext to (Prefix Text of oldtext)
387
set prefixFileInclude to (oldtext & return & "#include \"" & filename & "\"")
388
Set Preferences of panel "C/C++ Preprocessor" to {Prefix Text:prefixFileInclude}
394
on SetupTarget(proj, targetIndex)
395
tell application "CodeWarrior IDE"
397
set targetName to name of target targetIndex of project document 1
398
if targetName contains "Carbon" then
399
set targetAPI to "Carbon"
400
else if targetName contains "Mach-O" then
401
if not my IsOSX() then return -- do not try to populate Mach-O targets on pre-OS X systems.
402
set targetAPI to "Mach-O"
403
else if targetName contains "Win32" then
404
set targetAPI to "Win32"
407
if targetName contains "Debug" then
408
set targetDebug to true
409
set targetProfile to false
410
else if targetName contains "Profile" then
411
set targetDebug to false
412
set targetProfile to true
413
else -- if targeName contains "Final" then
414
set targetDebug to false
415
set targetProfile to false
418
-- NOTE: no Profile targets. if pCreateProfiledTargets, we make the debug targets also profile-able.
420
set the current target of project document 1 to target targetIndex of project document 1
422
-- initialize variables
424
set projFeatures to {}
427
-- Grab the fields of our project record and store them in local variables.
428
set projName to proj's name
429
set projSettings to proj's settings
431
set projFeatures to proj's features
434
set sysPaths to proj's sysPaths
437
set projRsrcs to proj's rsrcs
439
set projLibs to proj's projLibs
440
set projFileData to proj's fileData
442
-- mitsock library isn't needed (and won't compile) as Mach-O
443
if projName is "mitsock" and targetAPI is not "Carbon" then
447
-- Figure out what our output file and input libraries will be named.
448
set targetFilename to projName
450
if targetAPI is "Carbon" then
451
set targetFilename to targetFilename & "_C"
452
else if targetAPI is "Mach-O" then
453
set targetFilename to targetFilename & "_M"
454
else if targetAPI is "Win32" then
455
set targetFilename to targetFilename & "_W"
460
set targetFilename to targetFilename & "_D"
461
else if targetProfile then
462
set targetFilename to targetFilename & "_P"
464
set targetFilename to targetFilename & "_O" -- for Optimized.
467
set targetFilename to targetFilename & ".lib"
469
-- Get Preference Panel names.
470
if targetAPI is "Mach-O" then
471
set targetPanelName to "PPC Mac OS X Project"
472
set codeGenPanelName to "PPC CodeGen Mach-O"
473
else if targetAPI is "Win32" then
474
set targetPanelName to "x86 Project"
475
set codeGenPanelName to "x86 CodeGen"
477
set targetPanelName to "PPC Project"
478
set codeGenPanelName to "PPC CodeGen"
481
-- Set the name of the output file (the application)
482
Set Preferences of panel targetPanelName to {File Name:targetFilename}
484
-- If we have any per-project override settings, set them.
485
if (count ppcProject of projSettings) > 0 then
486
Set Preferences of panel targetPanelName to ppcProject of projSettings
490
if targetAPI is "Mach-O" then
491
my AppendAccessPath(gDistribRoot, true, false) -- end of system paths.
493
my AppendAccessPath(gDistribRoot, true, true) -- end of user paths.
496
-- Add per-project system paths.
498
repeat with i in sysPaths
499
copy {name:i, recursive:false, origin:absolute} to end of pathsToAdd
501
if (count pathsToAdd) > 0 then �
502
Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd}
504
-- Set the appropriate prefix file.
505
set prefixFile to prefixFile of projSettings
506
if targetAPI is "Win32" and projFeatures contains "winprefix" then
507
set prefixFile to "Win32Headers.pch"
509
if prefixFile is "" then
510
set prefixFile to "CarbonPrefix.h"
512
set prefixFile to "Carbon-" & prefixFile
515
if prefixFile is not "" then
516
my AppendPrefixFile(prefixFile)
522
repeat with group in projFileData
523
set projPath to projPath of group
524
set fileList to group's fileList
527
repeat with i in fileList
528
try -- ignore it if the file doesn't exist.
530
-- NOTE: if the following line is within a tell "Codewarrior" block then
531
-- the following Add Files command will fail.
532
copy alias (gSourceDir & projPath & i) to end of filesToAdd
536
tell application "CodeWarrior IDE"
539
-- Take out source files that do not belong.
540
--set fileNotList to group's fileNotList
541
--Remove Files fileNotList
545
tell application "CodeWarrior IDE"
547
-- take care of debugging and profiling settings
548
if targetDebug or targetProfile then
549
set the debug of every target file of target targetIndex �
550
of project document 1 to true
554
if targetAPI is "Carbon" then
555
if targetProfile then
556
(* ===== Panel PPC Processor ===== *)
557
Set Preferences of panel codeGenPanelName to �
560
(* ===== Panel PPC Processor ===== *)
561
Set Preferences of panel codeGenPanelName to �
569
if targetAPI is not "Win32" then
570
repeat with i in projRsrcs
571
copy gRsrcsDir & i to end of filesToAdd
582
tell application "CodeWarrior IDE"
584
if (i > (count of targets of project document 1)) then
587
-- get references to all the targets files
588
set atarget to get target i of project document 1
589
set trefs to (target files of atarget whose linked is true)
592
if ((count of trefs) � 0) then
593
repeat with tf in trefs
594
-- get locations of the targets files (as file objects)
595
tell application "CodeWarrior IDE"
596
set f to (location of tf)
598
tell application "Finder"
599
-- convert the file's to strings (colon style paths)
601
copy f as string to end of tfiles
602
on error errmsg number errnum
603
-- file in target but does not exist.
604
if errnum � -2753 then -- variable not defined.
605
error errmsg number errnum
614
on UpdateTarget(proj, targetIndex)
616
tell application "CodeWarrior IDE"
618
set targetName to name of target targetIndex of project document 1
619
if targetName contains "Carbon" then
620
set targetAPI to "Carbon"
621
else if targetName contains "Mach-O" then
622
if not my IsOSX() then return -- do not try to populate Mach-O targets on pre-OS X systems.
623
set targetAPI to "Mach-O"
624
else if targetName contains "Win32" then
625
set targetAPI to "Win32"
628
-- Grab the fields of our project record and store them in local variables.
629
set projName to proj's name
631
-- mitsock library isn't needed (and won't compile) except under Carbon.
632
if projName is "mitsock" and targetAPI is not "Carbon" then
636
set targetName to name of target targetIndex of project document 1
638
set the current target of project document 1 to target targetIndex of project document 1
640
-- initialize variables
641
set projFeatures to {}
643
-- Grab the fields of our project record and store them in local variables.
645
set projFeatures to proj's features
647
set projFileData to proj's fileData
651
-- Update source files
652
set targetFileList to my GetTargetFiles(targetIndex)
653
repeat with group in projFileData
654
set projPath to projPath of group -- projPath is relative.
656
set fileList to group's fileList
660
repeat with i in fileList
661
set fileFullPath to gSourceDir & projPath & i
662
set found to targetFileList contains fileFullPath
664
try -- ignore it if the file doesn't exist.
666
-- NOTE: if the following line is within a tell "Codewarrior" block then
667
-- the following Add Files command will fail.
669
copy alias (fileFullPath) to end of filesToAdd
674
tell application "CodeWarrior IDE"
675
if ((count of filesToAdd) is not 0) then
677
set targetFileList to my GetTargetFiles(targetIndex)
680
-- Take out source files that do not belong.
681
--set fileNotList to group's fileNotList
682
--Remove Files fileNotList
688
on CreateFolder(folderPath)
689
set text item delimiters of AppleScript to ":"
690
-- strip off disk name.
691
tell application "Finder"
693
if (exists disk (first text item of folderPath)) then
694
set pathSoFar to first text item of folderPath
695
set folderPath to (rest of text items of folderPath) as string
697
repeat with f in (text items of folderPath)
698
set longerPath to pathSoFar & ":" & f
699
if not (exists folder (longerPath)) then
700
make new folder at folder (pathSoFar) with properties {name:f}
702
set pathSoFar to longerPath
705
set text item delimiters of AppleScript to ""
708
on GetStationeryName(proj)
709
set stationeryDir to gProjectsDir & pStationeryName & ":"
710
set stationeryName to pStationeryName & pProjectFileExt
712
CreateFolder(stationeryDir)
713
tell application "Finder"
714
-- does the Library Stationery already exist?
715
if not (exists file (stationeryDir & stationeryName)) then
717
duplicate file (stationeryName) of folder gRsrcsDir to folder stationeryDir
720
return (stationeryDir & stationeryName)
721
end GetStationeryName
723
on CreateProject(proj)
724
tell application "CodeWarrior IDE"
731
set projFilename to proj's name & pProjectFileExt
732
set projPathname to gProjectsDir & projFilename
733
if pAlwaysCreateProjects or not (exists file projPathname of application "Finder") then
736
close (the first project document whose name is projFilename)
739
set stationeryName to my GetStationeryName(proj)
741
Create Project projPathname from stationery alias stationeryName
742
if the name of window 1 is "Project Messages" then
743
close first window -- "close window 1" becomes "Close Window 1" (different event)
746
repeat with i from 1 to (count targets of project document 1)
747
my SetupTarget(proj, i)
750
-- project already exists. Make sure it has all right files.
752
if the name of window 1 is "Project Messages" then
753
close first window -- "close window 1" becomes "Close Window 1" (different event)
755
repeat with i from 1 to (count targets of project document 1)
756
my UpdateTarget(proj, i)
759
if pProjectsCVSEnabled then
761
Set Preferences of panel "VCS Setup" to {VCS Active:true, Connection Method:"mwCVS"}
764
set the current target of project document 1 to target 1 of project document 1
770
on CreateAllProjects()
771
CreateFolder(gProjectsDir)
772
CleanupFiles(gProjectsDir)
774
repeat with proj in gProjectData
778
end CreateAllProjects
781
a target spec is a string of words "MSL Debug", all of which appear on our list of keywords.
782
Convert a Build file name to a target spec by filtering out non-keywords.
783
Each Build file creates another target spec.
784
A project target must match one of the target specs to compile.
785
To match, a target's name must contain each of the words in the target spec.
786
An empty target spec matches everything.
787
An empty list of target specs (no Build files) matches nothing,
788
But if there are no Build files we make target specs based on
789
the script parameters.
793
set theFiles to (list folder gMakeDir without invisibles)
794
set targetSpecs to {}
795
repeat with f in theFiles
796
if (f begins with "Build ") then
797
set targetSpecs to targetSpecs & MakeTargetSpec(f)
800
-- no Build files? match what the script parameters say to match.
801
-- NOTE: This is dependent on pTargetKeyWords and the target names in the stationery.
802
if (count items of targetSpecs) is 0 then
804
if pCreateDebugTargets then
805
if pCreateMachOTargets then copy ("Mach-O Debug") to end of targetSpecs
806
if pCreateCarbonTargets then copy ("Carbon Debug") to end of targetSpecs
807
if pCreateWinTargets then copy ("Win32 Debug") to end of targetSpecs
809
if pCreateProfiledTargets then
810
if pCreateMachOTargets then copy ("Mach-O Profile") to end of targetSpecs
811
if pCreateCarbonTargets then copy ("Carbon Profile") to end of targetSpecs
812
if pCreateWinTargets then copy ("Win32 Profile") to end of targetSpecs
814
if pCreateOptimizedTargets then
815
if pCreateMachOTargets then copy ("Mach-O Final") to end of targetSpecs
816
if pCreateCarbonTargets then copy ("Carbon Final") to end of targetSpecs
817
if pCreateWinTargets then copy ("Win32 Final") to end of targetSpecs
825
repeat with w in (words of f)
826
if pTargetKeyWords contains w then
827
set tspec to tspec & w & " "
833
on OkaytoBuild(targetName, targetSpecs)
834
--This target name must match at least one of the target specs.
835
repeat with ts in targetSpecs
836
if MatchSpec2Target(ts, targetName) then return true
841
on MatchSpec2Target(targSpec, targName)
842
-- the targetname must contain all of the words in the target spec.
843
repeat with w in (words of targSpec)
844
if w is not in targName then return false
849
on BuildProject(projName, targetSpecs)
850
tell application "CodeWarrior IDE"
851
open (gProjectsDir & projName & pProjectFileExt)
852
if the name of window 1 is "Project Messages" then
853
close first window -- "close window 1" becomes "Close Window 1" (different event)
855
repeat with i from 1 to (count targets of project document 1)
856
-- do we want to build this target?
857
set thisTarget to name of target i of project document 1
858
if my OkaytoBuild(thisTarget, targetSpecs) then
860
set the current target of project document 1 to target i of project document 1
861
if pSaveContinueOnErrors then
864
on error errmsg number errnum
866
set errFileName to (gProjectsDir & projName & "-" & i & ".errs")
867
Save Error Window As (file errFileName)
870
error errmsg number errnum
873
else -- stop on any error.
876
-- If there were compiler warnings, then a compiler window will be in front.
877
-- For whatever reason, this causes the next "set the current target..." to fail.
878
-- So check for the window and close it.
879
if the name of window 1 is "Errors & Warnings" then
880
close first window -- "close window 1" becomes "Close Window 1" (different event)
884
set the current target of project document 1 to target 1 of project document 1
889
on BuildAllProjects()
890
set targetSpecs to GetTargetSpecs()
891
repeat with proj in gProjectData
893
set projName to proj's name
897
if projName is not "" then
898
BuildProject(projName, targetSpecs)
904
on CleanupFiles(thePath)
905
-- get rid of all the files and folders starting with xxxx in thePath
906
repeat with f in list folder (thePath) without invisibles
907
if ((f as string) begins with "xxxx") then
909
tell application "Finder" to delete folder (thePath & f)
912
tell application "Finder" to delete file (thePath & f)
916
-- delete the stationery folder.
918
tell application "Finder" to delete folder (thePath & pStationeryName)
922
on SignalCompletion()
926
with timeout of 60000 seconds
932
tell application "CodeWarrior IDE" to activate
940
CleanupFiles(gProjectsDir)