blob: e9f1f818daedeba0d299e3911a425de910535ab5 [file] [log] [blame]
mistachkin48680192012-07-27 02:36:06 +00001#!/usr/bin/tclsh
2#
3# This script is used to generate a VSIX (Visual Studio Extension) file for
4# SQLite usable by Visual Studio.
mistachkin7c5dbdf2012-10-19 00:23:31 +00005#
6# PREREQUISITES
7#
8# 1. Tcl 8.4 and later are supported, earlier versions have not been tested.
9#
10# 2. The "sqlite3.h" file is assumed to exist in the parent directory of the
11# directory containing this script. The [optional] second command line
12# argument to this script may be used to specify an alternate location.
13# This script also assumes that the "sqlite3.h" file corresponds with the
14# version of the binaries to be packaged. This assumption is not verified
15# by this script.
16#
17# 3. The temporary directory specified in the TEMP or TMP environment variables
18# must refer to an existing directory writable by the current user.
19#
20# 4. The "zip" and "unzip" command line tools must be located either in a
21# directory contained in the PATH environment variable or specified as the
22# exact file names to execute in the "ZipTool" and "UnZipTool" environment
23# variables, respectively.
24#
25# 5. The template VSIX file (which is basically a zip file) must be located in
26# a "win" directory inside the directory containing this script. It should
27# not contain any executable binaries. It should only contain dynamic
28# textual content files to be processed using [subst] and/or static content
29# files to be copied verbatim.
30#
31# 6. The executable and other compiled binary files to be packaged into the
32# final VSIX file (e.g. DLLs, LIBs, and PDBs) must be located in a single
33# directory tree. The top-level directory of the tree must be specified as
34# the first command line argument to this script. The second level
35# sub-directory names must match those of the build configuration (e.g.
36# "Debug" or "Retail"). The third level sub-directory names must match
37# those of the platform (e.g. "x86", "x64", and "ARM"). For example, the
38# binary files to be packaged would need to be organized as follows when
39# packaging the "Debug" and "Retail" build configurations for the "x86" and
40# "x64" platforms (in this example, "C:\temp" is the top-level directory as
41# specified in the first command line argument):
42#
43# C:\Temp\Debug\x86\sqlite3.lib
44# C:\Temp\Debug\x86\sqlite3.dll
45# C:\Temp\Debug\x86\sqlite3.pdb
46# C:\Temp\Debug\x64\sqlite3.lib
47# C:\Temp\Debug\x64\sqlite3.dll
48# C:\Temp\Debug\x64\sqlite3.pdb
49# C:\Temp\Retail\x86\sqlite3.lib
50# C:\Temp\Retail\x86\sqlite3.dll
51# C:\Temp\Retail\x86\sqlite3.pdb
52# C:\Temp\Retail\x64\sqlite3.lib
53# C:\Temp\Retail\x64\sqlite3.dll
54# C:\Temp\Retail\x64\sqlite3.pdb
55#
56# The above directory tree organization is performed automatically if the
57# "tool\build-all-msvc.bat" batch script is used to build the binary files
58# to be packaged.
59#
60# USAGE
61#
mistachkin0f801702012-10-20 08:40:05 +000062# The first argument to this script is required and must be the name of the
63# top-level directory containing the directories and files organized into a
64# tree as described in item 6 of the PREREQUISITES section, above. The second
65# argument is optional and if present must contain the name of the directory
66# containing the root of the source tree for SQLite. The third argument is
67# optional and if present must contain the flavor the VSIX package to build.
68# Currently, the only supported package flavors are "WinRT" and "WP80". The
69# fourth argument is optional and if present must be a string containing a list
70# of platforms to include in the VSIX package. The format of the platform list
71# string is "platform1,platform2,platform3". Typically, when on Windows, this
72# script is executed using commands similar to the following from a normal
73# Windows command prompt:
mistachkin7c5dbdf2012-10-19 00:23:31 +000074#
75# CD /D C:\dev\sqlite\core
76# tclsh85 tool\mkvsix.tcl C:\Temp
77#
78# In the example above, "C:\dev\sqlite\core" represents the root of the source
79# tree for SQLite and "C:\Temp" represents the top-level directory containing
80# the executable and other compiled binary files, organized into a directory
81# tree as described in item 6 of the PREREQUISITES section, above.
82#
83# This script should work on non-Windows platforms as well, provided that all
84# the requirements listed in the PREREQUISITES section are met.
85#
86# NOTES
87#
88# The temporary directory is used as a staging area for the final VSIX file.
89# The template VSIX file is extracted, its contents processed, and then the
90# resulting files are packaged into the final VSIX file.
91#
92package require Tcl 8.4
93
mistachkin48680192012-07-27 02:36:06 +000094proc fail { {error ""} {usage false} } {
95 if {[string length $error] > 0} then {
96 puts stdout $error
97 if {!$usage} then {exit 1}
98 }
99
100 puts stdout "usage:\
101[file tail [info nameofexecutable]]\
mistachkin0f801702012-10-20 08:40:05 +0000102[file tail [info script]] <binaryDirectory> \[sourceDirectory\]\
103\[packageFlavor\] \[platformNames\]"
mistachkin48680192012-07-27 02:36:06 +0000104
105 exit 1
106}
107
108proc getEnvironmentVariable { name } {
109 #
110 # NOTE: Returns the value of the specified environment variable or an empty
111 # string for environment variables that do not exist in the current
112 # process environment.
113 #
114 return [expr {[info exists ::env($name)] ? $::env($name) : ""}]
115}
116
117proc getTemporaryPath {} {
118 #
119 # NOTE: Returns the normalized path to the first temporary directory found
120 # in the typical set of environment variables used for that purpose
121 # or an empty string to signal a failure to locate such a directory.
122 #
123 set names [list]
124
125 foreach name [list TEMP TMP] {
126 lappend names [string toupper $name] [string tolower $name] \
127 [string totitle $name]
128 }
129
130 foreach name $names {
131 set value [getEnvironmentVariable $name]
132
133 if {[string length $value] > 0} then {
134 return [file normalize $value]
135 }
136 }
137
138 return ""
139}
140
141proc appendArgs { args } {
142 #
143 # NOTE: Returns all passed arguments joined together as a single string with
144 # no intervening spaces between arguments.
145 #
146 eval append result $args
147}
148
149proc readFile { fileName } {
150 #
151 # NOTE: Reads and returns the entire contents of the specified file, which
152 # may contain binary data.
153 #
154 set file_id [open $fileName RDONLY]
155 fconfigure $file_id -encoding binary -translation binary
156 set result [read $file_id]
157 close $file_id
158 return $result
159}
160
161proc writeFile { fileName data } {
162 #
163 # NOTE: Writes the entire contents of the specified file, which may contain
164 # binary data.
165 #
166 set file_id [open $fileName {WRONLY CREAT TRUNC}]
167 fconfigure $file_id -encoding binary -translation binary
168 puts -nonewline $file_id $data
169 close $file_id
170 return ""
171}
172
173proc substFile { fileName } {
174 #
175 # NOTE: Performs all Tcl command, variable, and backslash substitutions in
mistachkin0f801702012-10-20 08:40:05 +0000176 # the specified file and then rewrites the contents of that same file
mistachkin48680192012-07-27 02:36:06 +0000177 # with the substituted data.
178 #
179 return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]
180}
181
mistachkin0f801702012-10-20 08:40:05 +0000182proc replaceFileNameTokens { fileName name buildName platformName } {
mistachkin48680192012-07-27 02:36:06 +0000183 #
184 # NOTE: Returns the specified file name containing the platform name instead
185 # of platform placeholder tokens.
186 #
mistachkin0f801702012-10-20 08:40:05 +0000187 return [string map [list <build> $buildName <platform> $platformName \
188 <name> $name] $fileName]
mistachkin48680192012-07-27 02:36:06 +0000189}
190
mistachkin0f801702012-10-20 08:40:05 +0000191#
192# NOTE: This is the entry point for this script.
193#
mistachkin48680192012-07-27 02:36:06 +0000194set script [file normalize [info script]]
195
196if {[string length $script] == 0} then {
197 fail "script file currently being evaluated is unknown" true
198}
199
200set path [file dirname $script]
201set rootName [file rootname [file tail $script]]
202
203###############################################################################
204
205#
206# NOTE: Process and verify all the command line arguments.
207#
208set argc [llength $argv]
mistachkin0f801702012-10-20 08:40:05 +0000209if {$argc < 1 || $argc > 4} then {fail}
mistachkin48680192012-07-27 02:36:06 +0000210
211set binaryDirectory [lindex $argv 0]
212
213if {[string length $binaryDirectory] == 0} then {
214 fail "invalid binary directory"
215}
216
217if {![file exists $binaryDirectory] || \
218 ![file isdirectory $binaryDirectory]} then {
219 fail "binary directory does not exist"
220}
221
mistachkin0f801702012-10-20 08:40:05 +0000222if {$argc >= 2} then {
mistachkin48680192012-07-27 02:36:06 +0000223 set sourceDirectory [lindex $argv 1]
224} else {
225 #
226 # NOTE: Assume that the source directory is the parent directory of the one
227 # that contains this script file.
228 #
229 set sourceDirectory [file dirname $path]
230}
231
232if {[string length $sourceDirectory] == 0} then {
233 fail "invalid source directory"
234}
235
236if {![file exists $sourceDirectory] || \
237 ![file isdirectory $sourceDirectory]} then {
238 fail "source directory does not exist"
239}
240
mistachkin0f801702012-10-20 08:40:05 +0000241if {$argc >= 3} then {
242 set packageFlavor [lindex $argv 2]
243} else {
244 #
245 # NOTE: Assume the package flavor is WinRT.
246 #
247 set packageFlavor WinRT
248}
249
250if {[string length $packageFlavor] == 0} then {
251 fail "invalid package flavor"
252}
253
254if {[string equal -nocase $packageFlavor WinRT]} then {
255 set shortName SQLite.WinRT
256 set displayName "SQLite for Windows Runtime"
257 set targetPlatformIdentifier Windows
258 set extraSdkPath ""
259 set extraFileListAttributes [appendArgs \
260 "\r\n " {AppliesTo="WindowsAppContainer"} \
261 "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}]
262} elseif {[string equal -nocase $packageFlavor WP80]} then {
263 set shortName SQLite.WP80
264 set displayName "SQLite for Windows Phone"
265 set targetPlatformIdentifier "Windows Phone"
266 set extraSdkPath "\\..\\$targetPlatformIdentifier"
267 set extraFileListAttributes ""
268} else {
269 fail "unsupported package flavor, must be \"WinRT\" or \"WP80\""
270}
271
272if {$argc >= 4} then {
273 set platformNames [list]
274
275 foreach platformName [split [lindex $argv 3] ", "] {
276 if {[string length $platformName] > 0} then {
277 lappend platformNames $platformName
278 }
279 }
280}
281
mistachkin48680192012-07-27 02:36:06 +0000282###############################################################################
283
mistachkin391b3642012-07-31 00:43:31 +0000284#
285# NOTE: Evaluate the user-specific customizations file, if it exists.
286#
287set userFile [file join $path [appendArgs \
288 $rootName . $tcl_platform(user) .tcl]]
289
290if {[file exists $userFile] && \
291 [file isfile $userFile]} then {
292 source $userFile
293}
294
295###############################################################################
296
mistachkin48680192012-07-27 02:36:06 +0000297set templateFile [file join $path win sqlite.vsix]
298
299if {![file exists $templateFile] || \
300 ![file isfile $templateFile]} then {
301 fail [appendArgs "template file \"" $templateFile "\" does not exist"]
302}
303
304set currentDirectory [pwd]
mistachkinecf42d52012-10-28 19:35:55 +0000305set outputFile [file join $currentDirectory [appendArgs sqlite- \
306 $packageFlavor -output.vsix]]
mistachkin48680192012-07-27 02:36:06 +0000307
308if {[file exists $outputFile]} then {
309 fail [appendArgs "output file \"" $outputFile "\" already exists"]
310}
311
312###############################################################################
313
314#
315# NOTE: Make sure that a valid temporary directory exists.
316#
317set temporaryDirectory [getTemporaryPath]
318
319if {[string length $temporaryDirectory] == 0 || \
320 ![file exists $temporaryDirectory] || \
321 ![file isdirectory $temporaryDirectory]} then {
322 fail "cannot locate a usable temporary directory"
323}
324
325#
326# NOTE: Setup the staging directory to have a unique name inside of the
327# configured temporary directory.
328#
329set stagingDirectory [file normalize [file join $temporaryDirectory \
330 [appendArgs $rootName . [pid]]]]
331
332###############################################################################
333
334#
335# NOTE: Configure the external zipping tool. First, see if it has already
336# been pre-configured. If not, try to query it from the environment.
337# Finally, fallback on the default of simply "zip", which will then
338# be assumed to exist somewhere along the PATH.
339#
340if {![info exists zip]} then {
341 if {[info exists env(ZipTool)]} then {
342 set zip $env(ZipTool)
343 }
344 if {![info exists zip] || ![file exists $zip]} then {
345 set zip zip
346 }
347}
348
349#
350# NOTE: Configure the external unzipping tool. First, see if it has already
351# been pre-configured. If not, try to query it from the environment.
352# Finally, fallback on the default of simply "unzip", which will then
353# be assumed to exist somewhere along the PATH.
354#
355if {![info exists unzip]} then {
356 if {[info exists env(UnZipTool)]} then {
357 set unzip $env(UnZipTool)
358 }
359 if {![info exists unzip] || ![file exists $unzip]} then {
360 set unzip unzip
361 }
362}
363
364###############################################################################
365
366#
367# NOTE: Attempt to extract the SQLite version from the "sqlite3.h" header file
368# in the source directory. This script assumes that the header file has
369# already been generated by the build process.
370#
mistachkin391b3642012-07-31 00:43:31 +0000371set pattern {^#define\s+SQLITE_VERSION\s+"(.*)"$}
mistachkin48680192012-07-27 02:36:06 +0000372set data [readFile [file join $sourceDirectory sqlite3.h]]
373
374if {![regexp -line -- $pattern $data dummy version]} then {
375 fail [appendArgs "cannot locate SQLITE_VERSION value in \"" \
376 [file join $sourceDirectory sqlite3.h] \"]
377}
378
379###############################################################################
380
381#
mistachkin0f801702012-10-20 08:40:05 +0000382# NOTE: Setup all the master file list data. This includes the source file
383# names, the destination file names, and the file processing flags. The
384# possible file processing flags are:
385#
386# "buildNeutral" -- This flag indicates the file location and content do
387# not depend on the build configuration.
388#
389# "platformNeutral" -- This flag indicates the file location and content
390# do not depend on the build platform.
391#
392# "subst" -- This flag indicates that the file contains dynamic textual
393# content that needs to be processed using [subst] prior to
394# packaging the file into the final VSIX package. The primary
395# use of this flag is to insert the name of the VSIX package,
396# some package flavor-specific value, or the SQLite version
397# into a file.
398#
399# "noDebug" -- This flag indicates that the file should be skipped when
400# processing the debug build.
401#
402# "noRetail" -- This flag indicates that the file should be skipped when
403# processing the retail build.
404#
405# "move" -- This flag indicates that the file should be moved from the
406# source to the destination instead of being copied.
407#
408# This file metadata may be overridden, either in whole or in part, via
409# the user-specific customizations file.
mistachkin48680192012-07-27 02:36:06 +0000410#
mistachkin391b3642012-07-31 00:43:31 +0000411if {![info exists fileNames(source)]} then {
mistachkin0f801702012-10-20 08:40:05 +0000412 set fileNames(source) [list "" "" \
413 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.props] \
414 [file join $sourceDirectory sqlite3.h] \
415 [file join $binaryDirectory <build> <platform> sqlite3.lib] \
416 [file join $binaryDirectory <build> <platform> sqlite3.dll]]
mistachkin48680192012-07-27 02:36:06 +0000417
mistachkin391b3642012-07-31 00:43:31 +0000418 if {![info exists no(symbols)]} then {
419 lappend fileNames(source) \
mistachkin0ec07442012-10-12 18:06:07 +0000420 [file join $binaryDirectory <build> <platform> sqlite3.pdb]
mistachkin391b3642012-07-31 00:43:31 +0000421 }
422}
mistachkin48680192012-07-27 02:36:06 +0000423
mistachkin391b3642012-07-31 00:43:31 +0000424if {![info exists fileNames(destination)]} then {
425 set fileNames(destination) [list \
mistachkin0f801702012-10-20 08:40:05 +0000426 [file join $stagingDirectory extension.vsixmanifest] \
427 [file join $stagingDirectory SDKManifest.xml] \
428 [file join $stagingDirectory DesignTime <build> <platform> <name>.props] \
429 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.h] \
430 [file join $stagingDirectory DesignTime <build> <platform> sqlite3.lib] \
431 [file join $stagingDirectory Redist <build> <platform> sqlite3.dll]]
mistachkin391b3642012-07-31 00:43:31 +0000432
433 if {![info exists no(symbols)]} then {
434 lappend fileNames(destination) \
mistachkin0ec07442012-10-12 18:06:07 +0000435 [file join $stagingDirectory Redist <build> <platform> sqlite3.pdb]
mistachkin391b3642012-07-31 00:43:31 +0000436 }
437}
438
mistachkin0f801702012-10-20 08:40:05 +0000439if {![info exists fileNames(flags)]} then {
440 set fileNames(flags) [list \
441 [list buildNeutral platformNeutral subst] \
442 [list buildNeutral platformNeutral subst] \
443 [list buildNeutral platformNeutral subst move] \
444 [list buildNeutral platformNeutral] \
445 [list] [list] [list noRetail]]
mistachkin391b3642012-07-31 00:43:31 +0000446
447 if {![info exists no(symbols)]} then {
mistachkin0f801702012-10-20 08:40:05 +0000448 lappend fileNames(flags) [list noRetail]
mistachkin0ec07442012-10-12 18:06:07 +0000449 }
450}
451
452###############################################################################
453
454#
mistachkin0f801702012-10-20 08:40:05 +0000455# NOTE: Setup the list of builds supported by this script. These may be
456# overridden via the user-specific customizations file.
mistachkin0ec07442012-10-12 18:06:07 +0000457#
458if {![info exists buildNames]} then {
459 set buildNames [list Debug Retail]
460}
461
mistachkin48680192012-07-27 02:36:06 +0000462###############################################################################
463
464#
mistachkin0f801702012-10-20 08:40:05 +0000465# NOTE: Setup the list of platforms supported by this script. These may be
466# overridden via the command line or the user-specific customizations
467# file.
mistachkin48680192012-07-27 02:36:06 +0000468#
mistachkin391b3642012-07-31 00:43:31 +0000469if {![info exists platformNames]} then {
mistachkin50afa2a2012-07-31 08:15:56 +0000470 set platformNames [list x86 x64 ARM]
mistachkin391b3642012-07-31 00:43:31 +0000471}
mistachkin48680192012-07-27 02:36:06 +0000472
473###############################################################################
474
475#
476# NOTE: Make sure the staging directory exists, creating it if necessary.
477#
478file mkdir $stagingDirectory
479
480#
mistachkin0f801702012-10-20 08:40:05 +0000481# NOTE: Build the Tcl command used to extract the template VSIX package to
482# the staging directory.
mistachkin48680192012-07-27 02:36:06 +0000483#
484set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory]
485
486#
mistachkin0f801702012-10-20 08:40:05 +0000487# NOTE: Extract the template VSIX package to the staging directory.
mistachkin48680192012-07-27 02:36:06 +0000488#
489eval $extractCommand
490
491###############################################################################
492
493#
mistachkin0f801702012-10-20 08:40:05 +0000494# NOTE: Process each file in the master file list. There are actually three
mistachkin21890122012-10-15 20:28:22 +0000495# parallel lists that contain the source file names, the destination file
mistachkin0f801702012-10-20 08:40:05 +0000496# names, and the file processing flags. If the "buildNeutral" flag is
497# present, the file location and content do not depend on the build
498# configuration and "CommonConfiguration" will be used in place of the
499# build configuration name. If the "platformNeutral" flag is present,
500# the file location and content do not depend on the build platform and
501# "neutral" will be used in place of the build platform name. If the
502# "subst" flag is present, the file is assumed to be a text file that may
503# contain Tcl variable, command, and backslash replacements, to be
504# dynamically replaced during processing using the Tcl [subst] command.
505# If the "noDebug" flag is present, the file will be skipped when
506# processing for the debug build. If the "noRetail" flag is present, the
507# file will be skipped when processing for the retail build. If the
508# "move" flag is present, the source file will be deleted after it is
509# copied to the destination file. If the source file name is an empty
510# string, the destination file name will be assumed to already exist in
511# the staging directory and will not be copied; however, Tcl variable,
512# command, and backslash replacements may still be performed on the
513# destination file prior to the final VSIX package being built if the
514# "subst" flag is present.
mistachkin48680192012-07-27 02:36:06 +0000515#
mistachkin21890122012-10-15 20:28:22 +0000516foreach sourceFileName $fileNames(source) \
517 destinationFileName $fileNames(destination) \
mistachkin0f801702012-10-20 08:40:05 +0000518 fileFlags $fileNames(flags) {
519 #
520 # NOTE: Process the file flags into separate boolean variables that may be
521 # used within the loop.
522 #
523 set isBuildNeutral [expr {[lsearch $fileFlags buildNeutral] != -1}]
524 set isPlatformNeutral [expr {[lsearch $fileFlags platformNeutral] != -1}]
525 set isMove [expr {[lsearch $fileFlags move] != -1}]
526 set useSubst [expr {[lsearch $fileFlags subst] != -1}]
527
mistachkin48680192012-07-27 02:36:06 +0000528 #
mistachkin0ec07442012-10-12 18:06:07 +0000529 # NOTE: If the current file is build-neutral, then only one build will
530 # be processed for it, namely "CommonConfiguration"; otherwise, each
531 # supported build will be processed for it individually.
mistachkin48680192012-07-27 02:36:06 +0000532 #
mistachkin0ec07442012-10-12 18:06:07 +0000533 foreach buildName \
mistachkin0f801702012-10-20 08:40:05 +0000534 [expr {$isBuildNeutral ? [list CommonConfiguration] : $buildNames}] {
mistachkin48680192012-07-27 02:36:06 +0000535 #
mistachkin0ec07442012-10-12 18:06:07 +0000536 # NOTE: Should the current file be skipped for this build?
mistachkin391b3642012-07-31 00:43:31 +0000537 #
mistachkin0f801702012-10-20 08:40:05 +0000538 if {[lsearch $fileFlags no${buildName}] != -1} then {
mistachkin0ec07442012-10-12 18:06:07 +0000539 continue
mistachkin48680192012-07-27 02:36:06 +0000540 }
541
542 #
mistachkin0ec07442012-10-12 18:06:07 +0000543 # NOTE: If the current file is platform-neutral, then only one platform
544 # will be processed for it, namely "neutral"; otherwise, each
545 # supported platform will be processed for it individually.
mistachkin48680192012-07-27 02:36:06 +0000546 #
mistachkin0ec07442012-10-12 18:06:07 +0000547 foreach platformName \
mistachkin0f801702012-10-20 08:40:05 +0000548 [expr {$isPlatformNeutral ? [list neutral] : $platformNames}] {
mistachkin48680192012-07-27 02:36:06 +0000549 #
mistachkin0ec07442012-10-12 18:06:07 +0000550 # NOTE: Use the actual platform name in the destination file name.
mistachkin48680192012-07-27 02:36:06 +0000551 #
mistachkin0f801702012-10-20 08:40:05 +0000552 set newDestinationFileName [replaceFileNameTokens $destinationFileName \
553 $shortName $buildName $platformName]
mistachkin0ec07442012-10-12 18:06:07 +0000554
555 #
556 # NOTE: Does the source file need to be copied to the destination file?
557 #
558 if {[string length $sourceFileName] > 0} then {
559 #
560 # NOTE: First, make sure the destination directory exists.
561 #
562 file mkdir [file dirname $newDestinationFileName]
563
564 #
565 # NOTE: Then, copy the source file to the destination file verbatim.
566 #
mistachkin0f801702012-10-20 08:40:05 +0000567 set newSourceFileName [replaceFileNameTokens $sourceFileName \
568 $shortName $buildName $platformName]
569
570 file copy $newSourceFileName $newDestinationFileName
571
572 #
573 # NOTE: If this is a move instead of a copy, delete the source file
574 # now.
575 #
576 if {$isMove} then {
577 file delete $newSourceFileName
578 }
mistachkin0ec07442012-10-12 18:06:07 +0000579 }
580
581 #
582 # NOTE: Does the destination file contain dynamic replacements that must
583 # be processed now?
584 #
585 if {$useSubst} then {
586 #
587 # NOTE: Perform any dynamic replacements contained in the destination
588 # file and then re-write it in-place.
589 #
590 substFile $newDestinationFileName
591 }
mistachkin48680192012-07-27 02:36:06 +0000592 }
593 }
594}
595
596###############################################################################
597
598#
599# NOTE: Change the current directory to the staging directory so that the
600# external archive building tool can pickup the necessary files using
601# relative paths.
602#
603cd $stagingDirectory
604
605#
mistachkin0f801702012-10-20 08:40:05 +0000606# NOTE: Build the Tcl command used to archive the final VSIX package in the
mistachkin48680192012-07-27 02:36:06 +0000607# output directory.
608#
609set archiveCommand [list exec -- $zip -r $outputFile *]
610
611#
mistachkin0f801702012-10-20 08:40:05 +0000612# NOTE: Build the final VSIX package archive in the output directory.
mistachkin48680192012-07-27 02:36:06 +0000613#
614eval $archiveCommand
615
616#
617# NOTE: Change back to the previously saved current directory.
618#
619cd $currentDirectory
620
621#
622# NOTE: Cleanup the temporary staging directory.
623#
624file delete -force $stagingDirectory
625
626###############################################################################
627
628#
629# NOTE: Success, emit the fully qualified path of the generated VSIX file.
630#
631puts stdout $outputFile