1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Improve readability and logging of the vsixtest script.

FossilOrigin-Name: 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83
This commit is contained in:
mistachkin
2016-02-25 08:02:16 +00:00
parent 6ae4d84fdf
commit 77b7e2afb1
3 changed files with 116 additions and 74 deletions

View File

@ -1,5 +1,5 @@
C Enable\sall\ssteps\sand\sadd/update\scomments. C Improve\sreadability\sand\slogging\sof\sthe\svsixtest\sscript.
D 2016-02-25T02:56:53.408 D 2016-02-25T08:02:16.943
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93
F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af
F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c
F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547 F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547
F vsixtest/vsixtest.tcl b80b4e1f007448d382e4a0d4f3751dba0fc47ba9 F vsixtest/vsixtest.tcl 41268d1a0937c517f3c2e3f6538c90da70d155f8
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 0ab74373bd37d48d6afa7aecb67885afcd3a85b1 P 788f99f47f40be42f30d3f324983f39e84d8cfbb
R ba41dee91dbb0324b1abb0791f91a36f R 27bc664c4897fa05fbab9ef38c37f4b7
U mistachkin U mistachkin
Z c3b39230971278db58f1c6301bccf9b2 Z e145e455c738e58b5464d9cf81ba3318

View File

@ -1 +1 @@
788f99f47f40be42f30d3f324983f39e84d8cfbb 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83

View File

@ -80,8 +80,8 @@ proc getTemporaryPath {} {
proc appendArgs { args } { proc appendArgs { args } {
# #
# NOTE: Returns all passed arguments joined together as a single string with # NOTE: Returns all passed arguments joined together as a single string
# no intervening spaces between arguments. # with no intervening spaces between arguments.
# #
eval append result $args eval append result $args
} }
@ -111,10 +111,43 @@ proc writeFile { fileName data } {
} }
proc putsAndEval { command } { proc putsAndEval { command } {
catch {puts stdout $command} #
# NOTE: Outputs a command to the standard output channel and then evaluates
# it in the callers context.
#
catch {
puts stdout [appendArgs "Running: " [lrange $command 1 end] ...\n]
}
return [uplevel 1 $command] return [uplevel 1 $command]
} }
proc isBadDirectory { directory } {
#
# NOTE: Returns non-zero if the directory is empty, does not exist, -OR- is
# not a directory.
#
catch {
puts stdout [appendArgs "Checking directory \"" $directory \"...\n]
}
return [expr {[string length $directory] == 0 || \
![file exists $directory] || ![file isdirectory $directory]}]
}
proc isBadFile { fileName } {
#
# NOTE: Returns non-zero if the file name is empty, does not exist, -OR- is
# not a regular file.
#
catch {
puts stdout [appendArgs "Checking file \"" $fileName \"...\n]
}
return [expr {[string length $fileName] == 0 || \
![file exists $fileName] || ![file isfile $fileName]}]
}
# #
# NOTE: This is the entry point for this script. # NOTE: This is the entry point for this script.
# #
@ -124,62 +157,52 @@ if {[string length $script] == 0} then {
fail "script file currently being evaluated is unknown" true fail "script file currently being evaluated is unknown" true
} }
set path [file dirname $script] set path [file normalize [file dirname $script]]
set argc [llength $argv]; if {$argc > 1} then {fail "" true}
###############################################################################
#
# NOTE: Process and verify all the command line arguments.
#
set argc [llength $argv]
if {$argc > 1} then {fail}
if {$argc == 1} then { if {$argc == 1} then {
set vsixFileName [lindex $argv 0] set vsixFileName [lindex $argv 0]
} else { } else {
set vsixFileName [file join [file dirname $path] sqlite-UWP-output.vsix] set vsixFileName [file join \
[file dirname $path] sqlite-UWP-output.vsix]
} }
if {[string length $vsixFileName] == 0} then { ###############################################################################
fail "invalid VSIX file name"
}
if {![file exists $vsixFileName] || ![file isfile $vsixFileName]} then { if {[isBadFile $vsixFileName]} then {
fail [appendArgs "VSIX file \"" $vsixFileName "\" does not exist"] fail [appendArgs \
"VSIX file \"" $vsixFileName "\" does not exist"]
} }
set versionFileName [file join [file dirname $path] VERSION] set versionFileName [file join [file dirname $path] VERSION]
if {![file exists $versionFileName] || ![file isfile $versionFileName]} then { if {[isBadFile $versionFileName]} then {
fail [appendArgs "Version file \"" $versionFileName "\" does not exist"] fail [appendArgs \
"Version file \"" $versionFileName "\" does not exist"]
} }
set projectTemplateFileName [file join $path vsixtest.vcxproj.data] set projectTemplateFileName [file join $path vsixtest.vcxproj.data]
set projectFileName [file join $path vsixtest.vcxproj]
if {![file exists $projectTemplateFileName] || \ if {[isBadFile $projectTemplateFileName]} then {
![file isfile $projectTemplateFileName]} then {
fail [appendArgs \ fail [appendArgs \
"Project template file \"" $projectTemplateFileName "\" does not exist"] "Project template file \"" $projectTemplateFileName \
"\" does not exist"]
} }
set envVarName VS140COMNTOOLS set envVarName VS140COMNTOOLS
set vsDirectory [getEnvironmentVariable $envVarName] set vsDirectory [getEnvironmentVariable $envVarName]
if {[string length $vsDirectory] == 0} then { if {[isBadDirectory $vsDirectory]} then {
fail [appendArgs \
"Visual Studio 2015 environment variable \"" $envVarName "\" missing"]
}
if {![file exists $vsDirectory] || ![file isdirectory $vsDirectory]} then {
fail [appendArgs \ fail [appendArgs \
"Visual Studio 2015 directory \"" $vsDirectory \ "Visual Studio 2015 directory \"" $vsDirectory \
"\" from environment variable \"" $envVarName \
"\" does not exist"] "\" does not exist"]
} }
set vsixInstaller [file join [file dirname $vsDirectory] IDE VSIXInstaller.exe] set vsixInstaller [file join \
[file dirname $vsDirectory] IDE VSIXInstaller.exe]
if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then { if {[isBadFile $vsixInstaller]} then {
fail [appendArgs \ fail [appendArgs \
"Visual Studio 2015 VSIX installer \"" $vsixInstaller \ "Visual Studio 2015 VSIX installer \"" $vsixInstaller \
"\" does not exist"] "\" does not exist"]
@ -188,46 +211,49 @@ if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then {
set envVarName ProgramFiles set envVarName ProgramFiles
set programFiles [getEnvironmentVariable $envVarName] set programFiles [getEnvironmentVariable $envVarName]
if {[string length $programFiles] == 0} then { if {[isBadDirectory $programFiles]} then {
fail [appendArgs \ fail [appendArgs \
"Windows environment variable \"" $envVarName "\" missing"] "Program Files directory \"" $programFiles \
} "\" from environment variable \"" $envVarName \
"\" does not exist"]
if {![file exists $programFiles] || ![file isdirectory $programFiles]} then {
fail [appendArgs \
"Program Files directory \"" $programFiles "\" does not exist"]
} }
set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe] set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe]
if {![file exists $msBuild] || ![file isfile $msBuild]} then { if {[isBadFile $msBuild]} then {
fail [appendArgs \ fail [appendArgs \
"MSBuild 14.0 executable file \"" $msBuild "\" does not exist"] "MSBuild v14.0 executable file \"" $msBuild \
"\" does not exist"]
} }
set temporaryDirectory [getTemporaryPath] set temporaryDirectory [getTemporaryPath]
if {[string length $temporaryDirectory] == 0 || \ if {[isBadDirectory $temporaryDirectory]} then {
![file exists $temporaryDirectory] || \ fail [appendArgs \
![file isdirectory $temporaryDirectory]} then { "Temporary directory \"" $temporaryDirectory \
fail "cannot locate a usable temporary directory" "\" does not exist"]
} }
###############################################################################
set installLogFileName [appendArgs \ set installLogFileName [appendArgs \
[file rootname [file tail $vsixFileName]] -install- [pid] .log] [file rootname [file tail $vsixFileName]] \
-install- [pid] .log]
set commands(1) [list exec [file nativename $vsixInstaller]]
lappend commands(1) /quiet /norepair
lappend commands(1) [appendArgs /logFile: $installLogFileName]
lappend commands(1) [file nativename $vsixFileName]
###############################################################################
set buildLogFileName [appendArgs \ set buildLogFileName [appendArgs \
[file rootname [file tail $vsixFileName]] \ [file rootname [file tail $vsixFileName]] \
-build-%configuration%-%platform%- [pid] .log] -build-%configuration%-%platform%- [pid] .log]
set uninstallLogFileName [appendArgs \
[file rootname [file tail $vsixFileName]] -uninstall- [pid] .log]
set commands(1) [list exec [file nativename $vsixInstaller] /quiet /norepair]
lappend commands(1) [appendArgs /logFile: $installLogFileName]
lappend commands(1) [file nativename $vsixFileName]
set commands(2) [list exec [file nativename $msBuild]] set commands(2) [list exec [file nativename $msBuild]]
lappend commands(2) [file nativename [file join $path vsixtest.sln]] lappend commands(2) [file nativename [file join $path vsixtest.sln]]
lappend commands(2) /target:Rebuild lappend commands(2) /target:Rebuild
lappend commands(2) /property:Configuration=%configuration% lappend commands(2) /property:Configuration=%configuration%
@ -235,27 +261,41 @@ lappend commands(2) /property:Platform=%platform%
lappend commands(2) [appendArgs \ lappend commands(2) [appendArgs \
/logger:FileLogger,Microsoft.Build.Engine\;Logfile= \ /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \
[file nativename [file join $temporaryDirectory $buildLogFileName]] \ [file nativename [file join $temporaryDirectory \
\;Verbosity=diagnostic] $buildLogFileName]] \;Verbosity=diagnostic]
set commands(3) [list exec [file nativename $vsixInstaller] /quiet /norepair] ###############################################################################
set uninstallLogFileName [appendArgs \
[file rootname [file tail $vsixFileName]] \
-uninstall- [pid] .log]
set commands(3) [list exec [file nativename $vsixInstaller]]
lappend commands(3) /quiet /norepair
lappend commands(3) [appendArgs /logFile: $uninstallLogFileName] lappend commands(3) [appendArgs /logFile: $uninstallLogFileName]
lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015] lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015]
############################################################################### ###############################################################################
if {1} then { if {1} then {
puts stdout [appendArgs \ catch {
"Install log will be \"" [file nativename [file join \ puts stdout [appendArgs \
$temporaryDirectory $installLogFileName]] "\"."] "Install log: \"" [file nativename [file join \
$temporaryDirectory $installLogFileName]] \"\n]
}
puts stdout [appendArgs \ catch {
"Build log will be \"" [file nativename [file join \ puts stdout [appendArgs \
$temporaryDirectory $buildLogFileName]] "\"."] "Build logs: \"" [file nativename [file join \
$temporaryDirectory $buildLogFileName]] \"\n]
}
puts stdout [appendArgs \ catch {
"Uninstall log will be \"" [file nativename [file join \ puts stdout [appendArgs \
$temporaryDirectory $uninstallLogFileName]] "\"."] "Uninstall log: \"" [file nativename [file join \
$temporaryDirectory $uninstallLogFileName]] \"\n]
}
} }
############################################################################### ###############################################################################
@ -266,6 +306,8 @@ if {1} then {
set versionNumber [string trim [readFile $versionFileName]] set versionNumber [string trim [readFile $versionFileName]]
set data [readFile $projectTemplateFileName] set data [readFile $projectTemplateFileName]
set data [string map [list %versionNumber% $versionNumber] $data] set data [string map [list %versionNumber% $versionNumber] $data]
set projectFileName [file join $path vsixtest.vcxproj]
writeFile $projectFileName $data writeFile $projectFileName $data
set platforms [list x86 x64 ARM] set platforms [list x86 x64 ARM]
@ -274,8 +316,8 @@ if {1} then {
foreach platform $platforms { foreach platform $platforms {
foreach configuration $configurations { foreach configuration $configurations {
putsAndEval [string map [list \ putsAndEval [string map [list \
%platform% $platform %configuration% \ %platform% $platform %configuration% $configuration] \
$configuration] $commands(2)] $commands(2)]
} }
} }