SQLite

Check-in [8be166af23]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Refactor VSIX package creation tool to better support Visual Studio 2013.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | vsixWinPhone81
Files: files | file ages | folders
SHA1: 8be166af239cbdaff3937c4003a6dc6e8a96e53a
User & Date: mistachkin 2014-05-06 00:09:46.488
Context
2014-05-06
21:30
Merge updates from trunk. (check-in: 7579c44ac1 user: mistachkin tags: vsixWinPhone81)
00:09
Refactor VSIX package creation tool to better support Visual Studio 2013. (check-in: 8be166af23 user: mistachkin tags: vsixWinPhone81)
2014-05-05
22:50
Merge updates from trunk. (check-in: 668ed76ac6 user: mistachkin tags: vsixWinPhone81)
Changes
Unified Diff Ignore Whitespace Patch
Changes to tool/mkvsix.tcl.
62
63
64
65
66
67
68
69
70
71




72
73
74
75
76
77
78
79
80
# The first argument to this script is required and must be the name of the
# top-level directory containing the directories and files organized into a
# tree as described in item 6 of the PREREQUISITES section, above.  The second
# argument is optional and if present must contain the name of the directory
# containing the root of the source tree for SQLite.  The third argument is
# optional and if present must contain the flavor the VSIX package to build.
# Currently, the only supported package flavors are "WinRT", "WinRT81", and
# "WP80".  The fourth argument is optional and if present must be a string
# containing a list of platforms to include in the VSIX package.  The format
# of the platform list string is "platform1,platform2,platform3".  Typically,




# when on Windows, this script is executed using commands similar to the
# following from a normal Windows command prompt:
#
#                         CD /D C:\dev\sqlite\core
#                         tclsh85 tool\mkvsix.tcl C:\Temp
#
# In the example above, "C:\dev\sqlite\core" represents the root of the source
# tree for SQLite and "C:\Temp" represents the top-level directory containing
# the executable and other compiled binary files, organized into a directory







|
|
|
>
>
>
>
|
|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# The first argument to this script is required and must be the name of the
# top-level directory containing the directories and files organized into a
# tree as described in item 6 of the PREREQUISITES section, above.  The second
# argument is optional and if present must contain the name of the directory
# containing the root of the source tree for SQLite.  The third argument is
# optional and if present must contain the flavor the VSIX package to build.
# Currently, the only supported package flavors are "WinRT", "WinRT81", and
# "WP80", "WP81", and "Win32".  The fourth argument is optional and if present
# must be a string containing a list of platforms to include in the VSIX
# package.  The platform list is "platform1,platform2,platform3".  The fifth
# argument is optional and if present must contain the version of Visual Studio
# required by the package.  Currently, the only supported versions are "2012"
# and "2013".  The package flavors "WinRT81" and "WP81" are only supported when
# the Visual Studio version is "2013".  Typically, when on Windows, this script
# is executed using commands similar to the following from a normal Windows
# command prompt:
#
#                         CD /D C:\dev\sqlite\core
#                         tclsh85 tool\mkvsix.tcl C:\Temp
#
# In the example above, "C:\dev\sqlite\core" represents the root of the source
# tree for SQLite and "C:\Temp" represents the top-level directory containing
# the executable and other compiled binary files, organized into a directory
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    puts stdout $error
    if {!$usage} then {exit 1}
  }

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <binaryDirectory> \[sourceDirectory\]\
\[packageFlavor\] \[platformNames\]"

  exit 1
}

proc getEnvironmentVariable { name } {
  #
  # NOTE: Returns the value of the specified environment variable or an empty







|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
    puts stdout $error
    if {!$usage} then {exit 1}
  }

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <binaryDirectory> \[sourceDirectory\]\
\[packageFlavor\] \[platformNames\] \[vsVersion\]"

  exit 1
}

proc getEnvironmentVariable { name } {
  #
  # NOTE: Returns the value of the specified environment variable or an empty
166
167
168
169
170
171
172















173

174
175
176





177


178












179


180
181
182
183
184
185
186
187
188
189









190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}
















proc substFile { fileName } {

  #
  # NOTE: Performs all Tcl command, variable, and backslash substitutions in
  #       the specified file and then rewrites the contents of that same file





  #       with the substituted data.


  #












  return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]


}

proc replaceFileNameTokens { fileName name buildName platformName } {
  #
  # NOTE: Returns the specified file name containing the platform name instead
  #       of platform placeholder tokens.
  #
  return [string map [list <build> $buildName <platform> $platformName \
      <name> $name] $fileName]
}










#
# NOTE: This is the entry point for this script.
#
set script [file normalize [info script]]

if {[string length $script] == 0} then {
  fail "script file currently being evaluated is unknown" true
}

set path [file dirname $script]
set rootName [file rootname [file tail $script]]

###############################################################################

#
# NOTE: Process and verify all the command line arguments.
#
set argc [llength $argv]
if {$argc < 1 || $argc > 4} then {fail}

set binaryDirectory [lindex $argv 0]

if {[string length $binaryDirectory] == 0} then {
  fail "invalid binary directory"
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>

|
|
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>










>
>
>
>
>
>
>
>
>



















|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc getMinVsVersionXmlChunk { vsVersion } {
  switch -exact $vsVersion {
    2012 {
      return [appendArgs \
          "\r\n    " {MinVSVersion="11.0"}]
    }
    2013 {
      return [appendArgs \
          "\r\n    " {MinVSVersion="12.0"}]
    }
    default {
      return ""
    }
  }
}

proc getExtraFileListXmlChunk { packageFlavor vsVersion } {
  #
  # NOTE: Neither Windows Phone 8.0 nor Windows Phone 8.1 require any extra
  #       attributes in their VSIX package SDK manifests.
  #
  if {[string equal $packageFlavor WP80] || \
      [string equal $packageFlavor WP81]} then {
    return ""
  }

  set appliesTo [expr {[string equal $packageFlavor Win32] ? \
      "VisualC" : "WindowsAppContainer"}]

  switch -exact $vsVersion {
    2012 {
      return [appendArgs \
          "\r\n    " AppliesTo=\" $appliesTo \" \
          "\r\n    " {DependsOn="Microsoft.VCLibs, version=11.0"}]
    }
    2013 {
      return [appendArgs \
          "\r\n    " AppliesTo=\" $appliesTo \" \
          "\r\n    " {DependsOn="Microsoft.VCLibs, version=12.0"}]
    }
    default {
      return ""
    }
  }
}

proc replaceFileNameTokens { fileName name buildName platformName } {
  #
  # NOTE: Returns the specified file name containing the platform name instead
  #       of platform placeholder tokens.
  #
  return [string map [list <build> $buildName <platform> $platformName \
      <name> $name] $fileName]
}

proc substFile { fileName } {
  #
  # NOTE: Performs all Tcl command, variable, and backslash substitutions in
  #       the specified file and then rewrites the contents of that same file
  #       with the substituted data.
  #
  return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]
}

#
# NOTE: This is the entry point for this script.
#
set script [file normalize [info script]]

if {[string length $script] == 0} then {
  fail "script file currently being evaluated is unknown" true
}

set path [file dirname $script]
set rootName [file rootname [file tail $script]]

###############################################################################

#
# NOTE: Process and verify all the command line arguments.
#
set argc [llength $argv]
if {$argc < 1 || $argc > 5} then {fail}

set binaryDirectory [lindex $argv 0]

if {[string length $binaryDirectory] == 0} then {
  fail "invalid binary directory"
}

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334


335
336
337
338
339































































































340
341
342
343
344
345
346
  set packageFlavor WinRT
}

if {[string length $packageFlavor] == 0} then {
  fail "invalid package flavor"
}

if {[string equal -nocase $packageFlavor WinRT]} then {
  set shortName SQLite.WinRT
  set displayName "SQLite for Windows Runtime"
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.0
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="11.0"}]
  set extraSdkPath ""
  set extraFileListAttributes [appendArgs \
      "\r\n    " {AppliesTo="WindowsAppContainer"} \
      "\r\n    " {DependsOn="Microsoft.VCLibs, version=11.0"}]
} elseif {[string equal -nocase $packageFlavor WinRT_2013]} then {
  set shortName SQLite.WinRT.2013
  set displayName "SQLite for Windows Runtime (2013)"
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.0
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="12.0"}]
  set extraSdkPath ""
  set extraFileListAttributes [appendArgs \
      "\r\n    " {AppliesTo="WindowsAppContainer"} \
      "\r\n    " {DependsOn="Microsoft.VCLibs, version=12.0"}]
} elseif {[string equal -nocase $packageFlavor WinRT81]} then {
  set shortName SQLite.WinRT81
  set displayName "SQLite for Windows Runtime (Windows 8.1)"
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.1
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="12.0"}]
  set extraSdkPath ""
  set extraFileListAttributes [appendArgs \
      "\r\n    " {AppliesTo="WindowsAppContainer"} \
      "\r\n    " {DependsOn="Microsoft.VCLibs, version=12.0"}]
} elseif {[string equal -nocase $packageFlavor WP80]} then {
  set shortName SQLite.WP80
  set displayName "SQLite for Windows Phone"
  set targetPlatformIdentifier "Windows Phone"
  set targetPlatformVersion v8.0
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="11.0"}]
  set extraSdkPath "\\..\\$targetPlatformIdentifier"
  set extraFileListAttributes ""
} elseif {[string equal -nocase $packageFlavor WP80_2013]} then {
  set shortName SQLite.WP80.2013
  set displayName "SQLite for Windows Phone (2013)"
  set targetPlatformIdentifier "Windows Phone"
  set targetPlatformVersion v8.0
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="12.0"}]
  set extraSdkPath "\\..\\$targetPlatformIdentifier"
  set extraFileListAttributes ""
} elseif {[string equal -nocase $packageFlavor WP81]} then {
  set shortName SQLite.WP81
  set displayName "SQLite for Windows Phone 8.1"
  set targetPlatformIdentifier "WindowsPhoneApp"
  set targetPlatformVersion v8.1
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="12.0"}]
  set extraSdkPath "\\..\\$targetPlatformIdentifier"
  set extraFileListAttributes ""
} elseif {[string equal -nocase $packageFlavor Win32]} then {
  set shortName SQLite.Win32
  set displayName "SQLite for Windows"
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.0
  set minVsVersion [appendArgs \
      "\r\n    " {MinVSVersion="11.0"}]
  set extraSdkPath ""
  set extraFileListAttributes [appendArgs \
      "\r\n    " {AppliesTo="VisualC"} \
      "\r\n    " {DependsOn="Microsoft.VCLibs, version=11.0"}]
} else {
  fail [appendArgs \
      "unsupported package flavor, must be one of: " \
      "WinRT WinRT_2013 WinRT81 WP80 WP80_2013 WP81 Win32"]
}

if {$argc >= 4} then {
  set platformNames [list]

  foreach platformName [split [lindex $argv 3] ", "] {


    if {[string length $platformName] > 0} then {
      lappend platformNames $platformName
    }
  }
}
































































































###############################################################################

#
# NOTE: Evaluate the user-specific customizations file, if it exists.
#
set userFile [file join $path [appendArgs \







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




>
>





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







297
298
299
300
301
302
303













































































304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
  set packageFlavor WinRT
}

if {[string length $packageFlavor] == 0} then {
  fail "invalid package flavor"
}














































































if {$argc >= 4} then {
  set platformNames [list]

  foreach platformName [split [lindex $argv 3] ", "] {
    set platformName [string trim $platformName]

    if {[string length $platformName] > 0} then {
      lappend platformNames $platformName
    }
  }
}

if {$argc >= 5} then {
  set vsVersion [lindex $argv 4]
} else {
  set vsVersion 2012
}

if {[string length $vsVersion] == 0} then {
  fail "invalid Visual Studio version"
}

if {$vsVersion ne "2012" && $vsVersion ne "2013"} then {
  fail [appendArgs \
      "unsupported Visual Studio version, must be one of: " \
      [list 2012 2013]]
}

set shortNames(WinRT,2012) SQLite.WinRT
set shortNames(WinRT,2013) SQLite.WinRT.2013
set shortNames(WinRT81,2013) SQLite.WinRT81
set shortNames(WP80,2012) SQLite.WP80
set shortNames(WP80,2013) SQLite.WP80.2013
set shortNames(WP81,2013) SQLite.WP81
set shortNames(Win32,2012) SQLite.Win32
set shortNames(Win32,2013) SQLite.Win32.2013

set displayNames(WinRT,2012) "SQLite for Windows Runtime"
set displayNames(WinRT,2013) "SQLite for Windows Runtime"
set displayNames(WinRT81,2013) "SQLite for Windows Runtime (Windows 8.1)"
set displayNames(WP80,2012) "SQLite for Windows Phone"
set displayNames(WP80,2013) "SQLite for Windows Phone"
set displayNames(WP81,2013) "SQLite for Windows Phone 8.1"
set displayNames(Win32,2012) "SQLite for Windows"
set displayNames(Win32,2013) "SQLite for Windows"

if {[string equal $packageFlavor WinRT]} then {
  set shortName $shortNames($packageFlavor,$vsVersion)
  set displayName $displayNames($packageFlavor,$vsVersion)
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.0
  set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
  set extraSdkPath ""
  set extraFileListAttributes \
      [getExtraFileListXmlChunk $packageFlavor $vsVersion]
} elseif {[string equal $packageFlavor WinRT81]} then {
  if {$vsVersion ne "2013"} then {
    fail [appendArgs \
        "unsupported combination, package flavor " $packageFlavor \
        " is only supported with Visual Studio 2013"]
  }
  set shortName $shortNames($packageFlavor,$vsVersion)
  set displayName $displayNames($packageFlavor,$vsVersion)
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.1
  set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
  set extraSdkPath ""
  set extraFileListAttributes \
      [getExtraFileListXmlChunk $packageFlavor $vsVersion]
} elseif {[string equal $packageFlavor WP80]} then {
  set shortName $shortNames($packageFlavor,$vsVersion)
  set displayName $displayNames($packageFlavor,$vsVersion)
  set targetPlatformIdentifier "Windows Phone"
  set targetPlatformVersion v8.0
  set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
  set extraSdkPath "\\..\\$targetPlatformIdentifier"
  set extraFileListAttributes \
      [getExtraFileListXmlChunk $packageFlavor $vsVersion]
} elseif {[string equal $packageFlavor WP81]} then {
  if {$vsVersion ne "2013"} then {
    fail [appendArgs \
        "unsupported combination, package flavor " $packageFlavor \
        " is only supported with Visual Studio 2013"]
  }
  set shortName $shortNames($packageFlavor,$vsVersion)
  set displayName $displayNames($packageFlavor,$vsVersion)
  set targetPlatformIdentifier WindowsPhoneApp
  set targetPlatformVersion v8.1
  set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
  set extraSdkPath "\\..\\$targetPlatformIdentifier"
  set extraFileListAttributes \
      [getExtraFileListXmlChunk $packageFlavor $vsVersion]
} elseif {[string equal $packageFlavor Win32]} then {
  set shortName $shortNames($packageFlavor,$vsVersion)
  set displayName $displayNames($packageFlavor,$vsVersion)
  set targetPlatformIdentifier Windows
  set targetPlatformVersion v8.0
  set minVsVersion [getMinVsVersionXmlChunk $vsVersion]
  set extraSdkPath ""
  set extraFileListAttributes \
      [getExtraFileListXmlChunk $packageFlavor $vsVersion]
} else {
  fail [appendArgs \
      "unsupported package flavor, must be one of: " \
      [list WinRT WinRT81 WP80 WP81 Win32]]
}

###############################################################################

#
# NOTE: Evaluate the user-specific customizations file, if it exists.
#
set userFile [file join $path [appendArgs \
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
###############################################################################

#
# NOTE: Setup the list of platforms supported by this script.  These may be
#       overridden via the command line or the user-specific customizations
#       file.
#
if {![info exists platformNames]} then {
  set platformNames [list x86 x64 ARM]
}

###############################################################################

#
# NOTE: Make sure the staging directory exists, creating it if necessary.







|







591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
###############################################################################

#
# NOTE: Setup the list of platforms supported by this script.  These may be
#       overridden via the command line or the user-specific customizations
#       file.
#
if {![info exists platformNames] || [llength $platformNames] == 0} then {
  set platformNames [list x86 x64 ARM]
}

###############################################################################

#
# NOTE: Make sure the staging directory exists, creating it if necessary.