]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Improve readability and logging of the vsixtest script.
authormistachkin <mistachkin@noemail.net>
Thu, 25 Feb 2016 08:02:16 +0000 (08:02 +0000)
committermistachkin <mistachkin@noemail.net>
Thu, 25 Feb 2016 08:02:16 +0000 (08:02 +0000)
FossilOrigin-Name: 4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83

manifest
manifest.uuid
vsixtest/vsixtest.tcl

index dd58c45981d812948600cb7c3704d8251bbff85a..d0f724c2b1ea82fc3f95c961df1519276c6e3674 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enable\sall\ssteps\sand\sadd/update\scomments.
-D 2016-02-25T02:56:53.408
+C Improve\sreadability\sand\slogging\sof\sthe\svsixtest\sscript.
+D 2016-02-25T08:02:16.943
 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 28fc4ee02333996d31b3602b39eeb8e609a89ce4
@@ -1446,11 +1446,11 @@ F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93
 F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af
 F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c
 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.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 0ab74373bd37d48d6afa7aecb67885afcd3a85b1
-R ba41dee91dbb0324b1abb0791f91a36f
+P 788f99f47f40be42f30d3f324983f39e84d8cfbb
+R 27bc664c4897fa05fbab9ef38c37f4b7
 U mistachkin
-Z c3b39230971278db58f1c6301bccf9b2
+Z e145e455c738e58b5464d9cf81ba3318
index c103aecccb220b6569c7555c280d616d391e0b17..0838b3b9bad499c3f22aa08fc458e4790afdf271 100644 (file)
@@ -1 +1 @@
-788f99f47f40be42f30d3f324983f39e84d8cfbb
\ No newline at end of file
+4fe7c4e90b7adbb1630b4aa15709968a1fcc7d83
\ No newline at end of file
index 7c30e579cf12aedaaf04d6239370a0760657af97..999c85977655c12773a971f744ad97edc5fd3f14 100644 (file)
@@ -80,8 +80,8 @@ proc getTemporaryPath {} {
 \f
 proc appendArgs { args } {
   #
-  # NOTE: Returns all passed arguments joined together as a single string with
-  #       no intervening spaces between arguments.
+  # NOTE: Returns all passed arguments joined together as a single string
+  #       with no intervening spaces between arguments.
   #
   eval append result $args
 }
@@ -111,10 +111,43 @@ proc writeFile { fileName data } {
 }
 \f
 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]
 }
 \f
+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]}]
+}
+\f
+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]}]
+}
+\f
 #
 # 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
 }
 
-set path [file dirname $script]
-
-###############################################################################
-
-#
-# NOTE: Process and verify all the command line arguments.
-#
-set argc [llength $argv]
-if {$argc > 1} then {fail}
+set path [file normalize [file dirname $script]]
+set argc [llength $argv]; if {$argc > 1} then {fail "" true}
 
 if {$argc == 1} then {
   set vsixFileName [lindex $argv 0]
 } 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 {
-  fail [appendArgs "VSIX file \"" $vsixFileName "\" does not exist"]
+if {[isBadFile $vsixFileName]} then {
+  fail [appendArgs \
+      "VSIX file \"" $vsixFileName "\" does not exist"]
 }
 
 set versionFileName [file join [file dirname $path] VERSION]
 
-if {![file exists $versionFileName] || ![file isfile $versionFileName]} then {
-  fail [appendArgs "Version file \"" $versionFileName "\" does not exist"]
+if {[isBadFile $versionFileName]} then {
+  fail [appendArgs \
+      "Version file \"" $versionFileName "\" does not exist"]
 }
 
 set projectTemplateFileName [file join $path vsixtest.vcxproj.data]
-set projectFileName [file join $path vsixtest.vcxproj]
 
-if {![file exists $projectTemplateFileName] || \
-    ![file isfile $projectTemplateFileName]} then {
+if {[isBadFile $projectTemplateFileName]} then {
   fail [appendArgs \
-      "Project template file \"" $projectTemplateFileName "\" does not exist"]
+      "Project template file \"" $projectTemplateFileName \
+      "\" does not exist"]
 }
 
 set envVarName VS140COMNTOOLS
 set vsDirectory [getEnvironmentVariable $envVarName]
 
-if {[string length $vsDirectory] == 0} then {
-  fail [appendArgs \
-      "Visual Studio 2015 environment variable \"" $envVarName "\" missing"]
-}
-
-if {![file exists $vsDirectory] || ![file isdirectory $vsDirectory]} then {
+if {[isBadDirectory $vsDirectory]} then {
   fail [appendArgs \
       "Visual Studio 2015 directory \"" $vsDirectory \
+      "\" from environment variable \"" $envVarName \
       "\" 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 \
       "Visual Studio 2015 VSIX installer \"" $vsixInstaller \
       "\" does not exist"]
@@ -188,46 +211,49 @@ if {![file exists $vsixInstaller] || ![file isfile $vsixInstaller]} then {
 set envVarName ProgramFiles
 set programFiles [getEnvironmentVariable $envVarName]
 
-if {[string length $programFiles] == 0} then {
+if {[isBadDirectory $programFiles]} then {
   fail [appendArgs \
-      "Windows environment variable \"" $envVarName "\" missing"]
-}
-
-if {![file exists $programFiles] || ![file isdirectory $programFiles]} then {
-  fail [appendArgs \
-      "Program Files directory \"" $programFiles "\" does not exist"]
+      "Program Files directory \"" $programFiles \
+      "\" from environment variable \"" $envVarName \
+      "\" does not exist"]
 }
 
 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 \
-      "MSBuild 14.0 executable file \"" $msBuild "\" does not exist"]
+      "MSBuild v14.0 executable file \"" $msBuild \
+      "\" does not exist"]
 }
 
 set temporaryDirectory [getTemporaryPath]
 
-if {[string length $temporaryDirectory] == 0 || \
-    ![file exists $temporaryDirectory] || \
-    ![file isdirectory $temporaryDirectory]} then {
-  fail "cannot locate a usable temporary directory"
+if {[isBadDirectory $temporaryDirectory]} then {
+  fail [appendArgs \
+      "Temporary directory \"" $temporaryDirectory \
+      "\" does not exist"]
 }
 
-set installLogFileName [appendArgs \
-    [file rootname [file tail $vsixFileName]] -install- [pid] .log]
+###############################################################################
 
-set buildLogFileName [appendArgs \
+set installLogFileName [appendArgs \
     [file rootname [file tail $vsixFileName]] \
-    -build-%configuration%-%platform%- [pid] .log]
+    -install- [pid] .log]
 
-set uninstallLogFileName [appendArgs \
-    [file rootname [file tail $vsixFileName]] -uninstall- [pid] .log]
+set commands(1) [list exec [file nativename $vsixInstaller]]
 
-set commands(1) [list exec [file nativename $vsixInstaller] /quiet /norepair]
+lappend commands(1) /quiet /norepair
 lappend commands(1) [appendArgs /logFile: $installLogFileName]
 lappend commands(1) [file nativename $vsixFileName]
 
+###############################################################################
+
+set buildLogFileName [appendArgs \
+    [file rootname [file tail $vsixFileName]] \
+    -build-%configuration%-%platform%- [pid] .log]
+
 set commands(2) [list exec [file nativename $msBuild]]
+
 lappend commands(2) [file nativename [file join $path vsixtest.sln]]
 lappend commands(2) /target:Rebuild
 lappend commands(2) /property:Configuration=%configuration%
@@ -235,27 +261,41 @@ lappend commands(2) /property:Platform=%platform%
 
 lappend commands(2) [appendArgs \
     /logger:FileLogger,Microsoft.Build.Engine\;Logfile= \
-    [file nativename [file join $temporaryDirectory $buildLogFileName]] \
-    \;Verbosity=diagnostic]
+    [file nativename [file join $temporaryDirectory \
+    $buildLogFileName]] \;Verbosity=diagnostic]
+
+###############################################################################
+
+set uninstallLogFileName [appendArgs \
+    [file rootname [file tail $vsixFileName]] \
+    -uninstall- [pid] .log]
 
-set commands(3) [list exec [file nativename $vsixInstaller] /quiet /norepair]
+set commands(3) [list exec [file nativename $vsixInstaller]]
+
+lappend commands(3) /quiet /norepair
 lappend commands(3) [appendArgs /logFile: $uninstallLogFileName]
 lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015]
 
 ###############################################################################
 
 if {1} then {
-  puts stdout [appendArgs \
-      "Install log will be \"" [file nativename [file join \
-      $temporaryDirectory $installLogFileName]] "\"."]
+  catch {
+    puts stdout [appendArgs \
+        "Install log: \"" [file nativename [file join \
+        $temporaryDirectory $installLogFileName]] \"\n]
+  }
 
-  puts stdout [appendArgs \
-      "Build log will be \"" [file nativename [file join \
-      $temporaryDirectory $buildLogFileName]] "\"."]
+  catch {
+    puts stdout [appendArgs \
+        "Build logs: \"" [file nativename [file join \
+        $temporaryDirectory $buildLogFileName]] \"\n]
+  }
 
-  puts stdout [appendArgs \
-      "Uninstall log will be \"" [file nativename [file join \
-      $temporaryDirectory $uninstallLogFileName]] "\"."]
+  catch {
+    puts stdout [appendArgs \
+        "Uninstall log: \"" [file nativename [file join \
+        $temporaryDirectory $uninstallLogFileName]] \"\n]
+  }
 }
 
 ###############################################################################
@@ -266,6 +306,8 @@ if {1} then {
   set versionNumber [string trim [readFile $versionFileName]]
   set data [readFile $projectTemplateFileName]
   set data [string map [list %versionNumber% $versionNumber] $data]
+
+  set projectFileName [file join $path vsixtest.vcxproj]
   writeFile $projectFileName $data
 
   set platforms [list x86 x64 ARM]
@@ -274,8 +316,8 @@ if {1} then {
   foreach platform $platforms {
     foreach configuration $configurations {
       putsAndEval [string map [list \
-          %platform% $platform %configuration% \
-          $configuration] $commands(2)]
+          %platform% $platform %configuration% $configuration] \
+          $commands(2)]
     }
   }