mkvsix.tcl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. #!/usr/bin/tclsh
  2. #
  3. # This script is used to generate a VSIX (Visual Studio Extension) file for
  4. # SQLite usable by Visual Studio.
  5. #
  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. #
  62. # 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", "WinRT81", and
  69. # "WP80". The fourth argument is optional and if present must be a string
  70. # containing a list of platforms to include in the VSIX package. The format
  71. # of the platform list string is "platform1,platform2,platform3". Typically,
  72. # when on Windows, this script is executed using commands similar to the
  73. # following from a normal Windows command prompt:
  74. #
  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. #
  92. package require Tcl 8.4
  93. proc fail { {error ""} {usage false} } {
  94. if {[string length $error] > 0} then {
  95. puts stdout $error
  96. if {!$usage} then {exit 1}
  97. }
  98. puts stdout "usage:\
  99. [file tail [info nameofexecutable]]\
  100. [file tail [info script]] <binaryDirectory> \[sourceDirectory\]\
  101. \[packageFlavor\] \[platformNames\]"
  102. exit 1
  103. }
  104. proc getEnvironmentVariable { name } {
  105. #
  106. # NOTE: Returns the value of the specified environment variable or an empty
  107. # string for environment variables that do not exist in the current
  108. # process environment.
  109. #
  110. return [expr {[info exists ::env($name)] ? $::env($name) : ""}]
  111. }
  112. proc getTemporaryPath {} {
  113. #
  114. # NOTE: Returns the normalized path to the first temporary directory found
  115. # in the typical set of environment variables used for that purpose
  116. # or an empty string to signal a failure to locate such a directory.
  117. #
  118. set names [list]
  119. foreach name [list TEMP TMP] {
  120. lappend names [string toupper $name] [string tolower $name] \
  121. [string totitle $name]
  122. }
  123. foreach name $names {
  124. set value [getEnvironmentVariable $name]
  125. if {[string length $value] > 0} then {
  126. return [file normalize $value]
  127. }
  128. }
  129. return ""
  130. }
  131. proc appendArgs { args } {
  132. #
  133. # NOTE: Returns all passed arguments joined together as a single string with
  134. # no intervening spaces between arguments.
  135. #
  136. eval append result $args
  137. }
  138. proc readFile { fileName } {
  139. #
  140. # NOTE: Reads and returns the entire contents of the specified file, which
  141. # may contain binary data.
  142. #
  143. set file_id [open $fileName RDONLY]
  144. fconfigure $file_id -encoding binary -translation binary
  145. set result [read $file_id]
  146. close $file_id
  147. return $result
  148. }
  149. proc writeFile { fileName data } {
  150. #
  151. # NOTE: Writes the entire contents of the specified file, which may contain
  152. # binary data.
  153. #
  154. set file_id [open $fileName {WRONLY CREAT TRUNC}]
  155. fconfigure $file_id -encoding binary -translation binary
  156. puts -nonewline $file_id $data
  157. close $file_id
  158. return ""
  159. }
  160. proc substFile { fileName } {
  161. #
  162. # NOTE: Performs all Tcl command, variable, and backslash substitutions in
  163. # the specified file and then rewrites the contents of that same file
  164. # with the substituted data.
  165. #
  166. return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]
  167. }
  168. proc replaceFileNameTokens { fileName name buildName platformName } {
  169. #
  170. # NOTE: Returns the specified file name containing the platform name instead
  171. # of platform placeholder tokens.
  172. #
  173. return [string map [list <build> $buildName <platform> $platformName \
  174. <name> $name] $fileName]
  175. }
  176. #
  177. # NOTE: This is the entry point for this script.
  178. #
  179. set script [file normalize [info script]]
  180. if {[string length $script] == 0} then {
  181. fail "script file currently being evaluated is unknown" true
  182. }
  183. set path [file dirname $script]
  184. set rootName [file rootname [file tail $script]]
  185. ###############################################################################
  186. #
  187. # NOTE: Process and verify all the command line arguments.
  188. #
  189. set argc [llength $argv]
  190. if {$argc < 1 || $argc > 4} then {fail}
  191. set binaryDirectory [lindex $argv 0]
  192. if {[string length $binaryDirectory] == 0} then {
  193. fail "invalid binary directory"
  194. }
  195. if {![file exists $binaryDirectory] || \
  196. ![file isdirectory $binaryDirectory]} then {
  197. fail "binary directory does not exist"
  198. }
  199. if {$argc >= 2} then {
  200. set sourceDirectory [lindex $argv 1]
  201. } else {
  202. #
  203. # NOTE: Assume that the source directory is the parent directory of the one
  204. # that contains this script file.
  205. #
  206. set sourceDirectory [file dirname $path]
  207. }
  208. if {[string length $sourceDirectory] == 0} then {
  209. fail "invalid source directory"
  210. }
  211. if {![file exists $sourceDirectory] || \
  212. ![file isdirectory $sourceDirectory]} then {
  213. fail "source directory does not exist"
  214. }
  215. if {$argc >= 3} then {
  216. set packageFlavor [lindex $argv 2]
  217. } else {
  218. #
  219. # NOTE: Assume the package flavor is WinRT.
  220. #
  221. set packageFlavor WinRT
  222. }
  223. if {[string length $packageFlavor] == 0} then {
  224. fail "invalid package flavor"
  225. }
  226. if {[string equal -nocase $packageFlavor WinRT]} then {
  227. set shortName SQLite.WinRT
  228. set displayName "SQLite for Windows Runtime"
  229. set targetPlatformIdentifier Windows
  230. set targetPlatformVersion v8.0
  231. set minVsVersion 11.0
  232. set extraSdkPath ""
  233. set extraFileListAttributes [appendArgs \
  234. "\r\n " {AppliesTo="WindowsAppContainer"} \
  235. "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}]
  236. } elseif {[string equal -nocase $packageFlavor WinRT81]} then {
  237. set shortName SQLite.WinRT81
  238. set displayName "SQLite for Windows Runtime (Windows 8.1)"
  239. set targetPlatformIdentifier Windows
  240. set targetPlatformVersion v8.1
  241. set minVsVersion 12.0
  242. set extraSdkPath ""
  243. set extraFileListAttributes [appendArgs \
  244. "\r\n " {AppliesTo="WindowsAppContainer"} \
  245. "\r\n " {DependsOn="Microsoft.VCLibs, version=12.0"}]
  246. } elseif {[string equal -nocase $packageFlavor WP80]} then {
  247. set shortName SQLite.WP80
  248. set displayName "SQLite for Windows Phone"
  249. set targetPlatformIdentifier "Windows Phone"
  250. set targetPlatformVersion v8.0
  251. set minVsVersion 11.0
  252. set extraSdkPath "\\..\\$targetPlatformIdentifier"
  253. set extraFileListAttributes ""
  254. } elseif {[string equal -nocase $packageFlavor Win32]} then {
  255. set shortName SQLite.Win32
  256. set displayName "SQLite for Windows"
  257. set targetPlatformIdentifier Windows
  258. set targetPlatformVersion v8.0
  259. set minVsVersion 11.0
  260. set extraSdkPath ""
  261. set extraFileListAttributes [appendArgs \
  262. "\r\n " {AppliesTo="VisualC"} \
  263. "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}]
  264. } else {
  265. fail "unsupported package flavor, must be one of: WinRT WinRT81 WP80 Win32"
  266. }
  267. if {$argc >= 4} then {
  268. set platformNames [list]
  269. foreach platformName [split [lindex $argv 3] ", "] {
  270. if {[string length $platformName] > 0} then {
  271. lappend platformNames $platformName
  272. }
  273. }
  274. }
  275. ###############################################################################
  276. #
  277. # NOTE: Evaluate the user-specific customizations file, if it exists.
  278. #
  279. set userFile [file join $path [appendArgs \
  280. $rootName . $tcl_platform(user) .tcl]]
  281. if {[file exists $userFile] && \
  282. [file isfile $userFile]} then {
  283. source $userFile
  284. }
  285. ###############################################################################
  286. set templateFile [file join $path win sqlite.vsix]
  287. if {![file exists $templateFile] || \
  288. ![file isfile $templateFile]} then {
  289. fail [appendArgs "template file \"" $templateFile "\" does not exist"]
  290. }
  291. set currentDirectory [pwd]
  292. set outputFile [file join $currentDirectory [appendArgs sqlite- \
  293. $packageFlavor -output.vsix]]
  294. if {[file exists $outputFile]} then {
  295. fail [appendArgs "output file \"" $outputFile "\" already exists"]
  296. }
  297. ###############################################################################
  298. #
  299. # NOTE: Make sure that a valid temporary directory exists.
  300. #
  301. set temporaryDirectory [getTemporaryPath]
  302. if {[string length $temporaryDirectory] == 0 || \
  303. ![file exists $temporaryDirectory] || \
  304. ![file isdirectory $temporaryDirectory]} then {
  305. fail "cannot locate a usable temporary directory"
  306. }
  307. #
  308. # NOTE: Setup the staging directory to have a unique name inside of the
  309. # configured temporary directory.
  310. #
  311. set stagingDirectory [file normalize [file join $temporaryDirectory \
  312. [appendArgs $rootName . [pid]]]]
  313. ###############################################################################
  314. #
  315. # NOTE: Configure the external zipping tool. First, see if it has already
  316. # been pre-configured. If not, try to query it from the environment.
  317. # Finally, fallback on the default of simply "zip", which will then
  318. # be assumed to exist somewhere along the PATH.
  319. #
  320. if {![info exists zip]} then {
  321. if {[info exists env(ZipTool)]} then {
  322. set zip $env(ZipTool)
  323. }
  324. if {![info exists zip] || ![file exists $zip]} then {
  325. set zip zip
  326. }
  327. }
  328. #
  329. # NOTE: Configure the external unzipping tool. First, see if it has already
  330. # been pre-configured. If not, try to query it from the environment.
  331. # Finally, fallback on the default of simply "unzip", which will then
  332. # be assumed to exist somewhere along the PATH.
  333. #
  334. if {![info exists unzip]} then {
  335. if {[info exists env(UnZipTool)]} then {
  336. set unzip $env(UnZipTool)
  337. }
  338. if {![info exists unzip] || ![file exists $unzip]} then {
  339. set unzip unzip
  340. }
  341. }
  342. ###############################################################################
  343. #
  344. # NOTE: Attempt to extract the SQLite version from the "sqlite3.h" header file
  345. # in the source directory. This script assumes that the header file has
  346. # already been generated by the build process.
  347. #
  348. set pattern {^#define\s+SQLITE_VERSION\s+"(.*)"$}
  349. set data [readFile [file join $sourceDirectory sqlite3.h]]
  350. if {![regexp -line -- $pattern $data dummy version]} then {
  351. fail [appendArgs "cannot locate SQLITE_VERSION value in \"" \
  352. [file join $sourceDirectory sqlite3.h] \"]
  353. }
  354. ###############################################################################
  355. #
  356. # NOTE: Setup all the master file list data. This includes the source file
  357. # names, the destination file names, and the file processing flags. The
  358. # possible file processing flags are:
  359. #
  360. # "buildNeutral" -- This flag indicates the file location and content do
  361. # not depend on the build configuration.
  362. #
  363. # "platformNeutral" -- This flag indicates the file location and content
  364. # do not depend on the build platform.
  365. #
  366. # "subst" -- This flag indicates that the file contains dynamic textual
  367. # content that needs to be processed using [subst] prior to
  368. # packaging the file into the final VSIX package. The primary
  369. # use of this flag is to insert the name of the VSIX package,
  370. # some package flavor-specific value, or the SQLite version
  371. # into a file.
  372. #
  373. # "noDebug" -- This flag indicates that the file should be skipped when
  374. # processing the debug build.
  375. #
  376. # "noRetail" -- This flag indicates that the file should be skipped when
  377. # processing the retail build.
  378. #
  379. # "move" -- This flag indicates that the file should be moved from the
  380. # source to the destination instead of being copied.
  381. #
  382. # This file metadata may be overridden, either in whole or in part, via
  383. # the user-specific customizations file.
  384. #
  385. if {![info exists fileNames(source)]} then {
  386. set fileNames(source) [list "" "" \
  387. [file join $stagingDirectory DesignTime <build> <platform> sqlite3.props] \
  388. [file join $sourceDirectory sqlite3.h] \
  389. [file join $binaryDirectory <build> <platform> sqlite3.lib] \
  390. [file join $binaryDirectory <build> <platform> sqlite3.dll]]
  391. if {![info exists no(symbols)]} then {
  392. lappend fileNames(source) \
  393. [file join $binaryDirectory <build> <platform> sqlite3.pdb]
  394. }
  395. }
  396. if {![info exists fileNames(destination)]} then {
  397. set fileNames(destination) [list \
  398. [file join $stagingDirectory extension.vsixmanifest] \
  399. [file join $stagingDirectory SDKManifest.xml] \
  400. [file join $stagingDirectory DesignTime <build> <platform> <name>.props] \
  401. [file join $stagingDirectory DesignTime <build> <platform> sqlite3.h] \
  402. [file join $stagingDirectory DesignTime <build> <platform> sqlite3.lib] \
  403. [file join $stagingDirectory Redist <build> <platform> sqlite3.dll]]
  404. if {![info exists no(symbols)]} then {
  405. lappend fileNames(destination) \
  406. [file join $stagingDirectory Redist <build> <platform> sqlite3.pdb]
  407. }
  408. }
  409. if {![info exists fileNames(flags)]} then {
  410. set fileNames(flags) [list \
  411. [list buildNeutral platformNeutral subst] \
  412. [list buildNeutral platformNeutral subst] \
  413. [list buildNeutral platformNeutral subst move] \
  414. [list buildNeutral platformNeutral] \
  415. [list] [list] [list noRetail]]
  416. if {![info exists no(symbols)]} then {
  417. lappend fileNames(flags) [list noRetail]
  418. }
  419. }
  420. ###############################################################################
  421. #
  422. # NOTE: Setup the list of builds supported by this script. These may be
  423. # overridden via the user-specific customizations file.
  424. #
  425. if {![info exists buildNames]} then {
  426. set buildNames [list Debug Retail]
  427. }
  428. ###############################################################################
  429. #
  430. # NOTE: Setup the list of platforms supported by this script. These may be
  431. # overridden via the command line or the user-specific customizations
  432. # file.
  433. #
  434. if {![info exists platformNames]} then {
  435. set platformNames [list x86 x64 ARM]
  436. }
  437. ###############################################################################
  438. #
  439. # NOTE: Make sure the staging directory exists, creating it if necessary.
  440. #
  441. file mkdir $stagingDirectory
  442. #
  443. # NOTE: Build the Tcl command used to extract the template VSIX package to
  444. # the staging directory.
  445. #
  446. set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory]
  447. #
  448. # NOTE: Extract the template VSIX package to the staging directory.
  449. #
  450. eval $extractCommand
  451. ###############################################################################
  452. #
  453. # NOTE: Process each file in the master file list. There are actually three
  454. # parallel lists that contain the source file names, the destination file
  455. # names, and the file processing flags. If the "buildNeutral" flag is
  456. # present, the file location and content do not depend on the build
  457. # configuration and "CommonConfiguration" will be used in place of the
  458. # build configuration name. If the "platformNeutral" flag is present,
  459. # the file location and content do not depend on the build platform and
  460. # "neutral" will be used in place of the build platform name. If the
  461. # "subst" flag is present, the file is assumed to be a text file that may
  462. # contain Tcl variable, command, and backslash replacements, to be
  463. # dynamically replaced during processing using the Tcl [subst] command.
  464. # If the "noDebug" flag is present, the file will be skipped when
  465. # processing for the debug build. If the "noRetail" flag is present, the
  466. # file will be skipped when processing for the retail build. If the
  467. # "move" flag is present, the source file will be deleted after it is
  468. # copied to the destination file. If the source file name is an empty
  469. # string, the destination file name will be assumed to already exist in
  470. # the staging directory and will not be copied; however, Tcl variable,
  471. # command, and backslash replacements may still be performed on the
  472. # destination file prior to the final VSIX package being built if the
  473. # "subst" flag is present.
  474. #
  475. foreach sourceFileName $fileNames(source) \
  476. destinationFileName $fileNames(destination) \
  477. fileFlags $fileNames(flags) {
  478. #
  479. # NOTE: Process the file flags into separate boolean variables that may be
  480. # used within the loop.
  481. #
  482. set isBuildNeutral [expr {[lsearch $fileFlags buildNeutral] != -1}]
  483. set isPlatformNeutral [expr {[lsearch $fileFlags platformNeutral] != -1}]
  484. set isMove [expr {[lsearch $fileFlags move] != -1}]
  485. set useSubst [expr {[lsearch $fileFlags subst] != -1}]
  486. #
  487. # NOTE: If the current file is build-neutral, then only one build will
  488. # be processed for it, namely "CommonConfiguration"; otherwise, each
  489. # supported build will be processed for it individually.
  490. #
  491. foreach buildName \
  492. [expr {$isBuildNeutral ? [list CommonConfiguration] : $buildNames}] {
  493. #
  494. # NOTE: Should the current file be skipped for this build?
  495. #
  496. if {[lsearch $fileFlags no${buildName}] != -1} then {
  497. continue
  498. }
  499. #
  500. # NOTE: If the current file is platform-neutral, then only one platform
  501. # will be processed for it, namely "neutral"; otherwise, each
  502. # supported platform will be processed for it individually.
  503. #
  504. foreach platformName \
  505. [expr {$isPlatformNeutral ? [list neutral] : $platformNames}] {
  506. #
  507. # NOTE: Use the actual platform name in the destination file name.
  508. #
  509. set newDestinationFileName [replaceFileNameTokens $destinationFileName \
  510. $shortName $buildName $platformName]
  511. #
  512. # NOTE: Does the source file need to be copied to the destination file?
  513. #
  514. if {[string length $sourceFileName] > 0} then {
  515. #
  516. # NOTE: First, make sure the destination directory exists.
  517. #
  518. file mkdir [file dirname $newDestinationFileName]
  519. #
  520. # NOTE: Then, copy the source file to the destination file verbatim.
  521. #
  522. set newSourceFileName [replaceFileNameTokens $sourceFileName \
  523. $shortName $buildName $platformName]
  524. file copy $newSourceFileName $newDestinationFileName
  525. #
  526. # NOTE: If this is a move instead of a copy, delete the source file
  527. # now.
  528. #
  529. if {$isMove} then {
  530. file delete $newSourceFileName
  531. }
  532. }
  533. #
  534. # NOTE: Does the destination file contain dynamic replacements that must
  535. # be processed now?
  536. #
  537. if {$useSubst} then {
  538. #
  539. # NOTE: Perform any dynamic replacements contained in the destination
  540. # file and then re-write it in-place.
  541. #
  542. substFile $newDestinationFileName
  543. }
  544. }
  545. }
  546. }
  547. ###############################################################################
  548. #
  549. # NOTE: Change the current directory to the staging directory so that the
  550. # external archive building tool can pickup the necessary files using
  551. # relative paths.
  552. #
  553. cd $stagingDirectory
  554. #
  555. # NOTE: Build the Tcl command used to archive the final VSIX package in the
  556. # output directory.
  557. #
  558. set archiveCommand [list exec -- $zip -r $outputFile *]
  559. #
  560. # NOTE: Build the final VSIX package archive in the output directory.
  561. #
  562. eval $archiveCommand
  563. #
  564. # NOTE: Change back to the previously saved current directory.
  565. #
  566. cd $currentDirectory
  567. #
  568. # NOTE: Cleanup the temporary staging directory.
  569. #
  570. file delete -force $stagingDirectory
  571. ###############################################################################
  572. #
  573. # NOTE: Success, emit the fully qualified path of the generated VSIX file.
  574. #
  575. puts stdout $outputFile