System.Data.SQLite
Check-in [6aad7b515d]
Not logged in

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

Overview
Comment:Pickup changes to Eagle script library in externals.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | netStandard20
Files: files | file ages | folders
SHA1: 6aad7b515dd240b165377c01eef38365377fcbd6
User & Date: mistachkin 2018-04-23 02:09:17
Context
2018-04-23
02:28
When building with .NET Core, always use the 'Build' target to avoid issues with the final output file being superfluously deleted. check-in: 23f04e9da0 user: mistachkin tags: netStandard20
02:09
Pickup changes to Eagle script library in externals. check-in: 6aad7b515d user: mistachkin tags: netStandard20
2018-04-18
15:59
Merge updates from trunk. check-in: 5c1ed740db user: mistachkin tags: netStandard20
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Externals/Eagle/lib/Eagle1.0/csharp.eagle.

    41     41     #
    42     42     # NOTE: This procedure is used to determine the fully qualified path to the
    43     43     #       directory containing the reference assemblies for the .NET Standard
    44     44     #       2.0.  An empty string will be returned to indicate an error.  This
    45     45     #       procedure should not raise script errors.
    46     46     #
    47     47     proc getDotNetStandardReferencePath {
    48         -          {packageVersion 2.0.1} {standardVersion netstandard2.0} } {
           48  +          {packageVersion ""} {standardVersion netstandard2.0} } {
    49     49       set path [getDotNetCoreSdkPath]
    50     50   
    51     51       if {[string length $path] > 0} then {
    52         -      return [file normalize [file join \
    53         -          [file dirname $path] NuGetFallbackFolder netstandard.library \
    54         -          $packageVersion build $standardVersion ref]]
           52  +      set libraryDirectory [file normalize [file join \
           53  +          [file dirname $path] NuGetFallbackFolder netstandard.library]]
           54  +
           55  +      set buildReferenceSubDirectory [file join build $standardVersion ref]
           56  +
           57  +      if {[string length $packageVersion] > 0} then {
           58  +        set assemblyDirectory [file normalize [file join \
           59  +            $libraryDirectory $packageVersion $buildReferenceSubDirectory]]
           60  +
           61  +        if {[file exists $assemblyDirectory]} then {
           62  +          return $assemblyDirectory
           63  +        }
           64  +      } else {
           65  +        set globPathPattern [file join $libraryDirectory *]
           66  +
           67  +        set maybeVersions [lsort -decreasing -command [list package vsort] \
           68  +            [lmap directory [glob -nocomplain -types {d} $globPathPattern] \
           69  +            { file tail $directory }]]
           70  +
           71  +        foreach maybeVersion $maybeVersions {
           72  +          set assemblyDirectory [file normalize [file join \
           73  +              $libraryDirectory $maybeVersion $buildReferenceSubDirectory]]
           74  +
           75  +          if {[file exists $assemblyDirectory]} then {
           76  +            return $assemblyDirectory
           77  +          }
           78  +        }
           79  +      }
    55     80       }
    56     81   
    57     82       return ""
    58     83     }
    59     84   
           85  +  #
           86  +  # NOTE: This procedure is used to obtain a test program for use with the
           87  +  #       C# compiler.  Upon success, the return value will be a list with
           88  +  #       two elements.  The first element will be the name of the C# class
           89  +  #       to be compiled.  The second element will be the C# program text.
           90  +  #       Upon failure, the return value will be an empty list.
           91  +  #
           92  +  proc getCSharpTestProgram { {name ""} } {
           93  +    set prefix Test
           94  +    set id [object invoke Interpreter.GetActive NextId]
           95  +
           96  +    set className [appendArgs \
           97  +        $prefix Namespace $id [object invoke Type Delimiter] \
           98  +        $prefix Class $id]
           99  +
          100  +    return [list $className [subst {
          101  +      using System;
          102  +
          103  +      namespace ${prefix}Namespace${id}
          104  +      {
          105  +        public static class ${prefix}Class${id}
          106  +        {
          107  +          public static Int32 Main(String\[\] args)
          108  +          {
          109  +            return 0;
          110  +          }
          111  +        }
          112  +      }
          113  +    }]]
          114  +  }
          115  +
          116  +  #
          117  +  # NOTE: This procedure is used to determine whether the C# compiler appears
          118  +  #       to work when invoked via the interfaces defined in this script file.
          119  +  #       Non-zero is returned to indicate success.  This procedure should not
          120  +  #       raise script errors.
          121  +  #
          122  +  proc doesCompileCSharpWork { {name ""} } {
          123  +    if {[catch {getCSharpTestProgram $name} program]} then {
          124  +      return false
          125  +    }
          126  +
          127  +    if {[llength $program] < 2} then {
          128  +      return false
          129  +    }
          130  +
          131  +    unset -nocomplain results errors
          132  +
          133  +    if {[catch {
          134  +      compileCSharp [lindex $program 1] true true true results errors
          135  +    } code]} then {
          136  +      return false
          137  +    }
          138  +
          139  +    if {$code ne "Ok"} then {
          140  +      return false
          141  +    }
          142  +
          143  +    if {[catch {
          144  +      object invoke [lindex $program 0] Main null
          145  +    } exitCode]} then {
          146  +      return false
          147  +    }
          148  +
          149  +    if {$exitCode ne "0"} then {
          150  +      return false
          151  +    }
          152  +
          153  +    return true
          154  +  }
          155  +
    60    156     #
    61    157     # NOTE: This procedure is used to determine the command line arguments that
    62         -  #       are required to invoke the .NET Core SDK compiler for CSharp.  An
    63         -  #       empty list will be returned if the arguments cannot be determined
    64         -  #       for some reason.  This procedure should not raise script errors.
          158  +  #       are required to invoke the .NET Core SDK compiler for C#.  An empty
          159  +  #       list will be returned if the arguments cannot be determined for some
          160  +  #       reason -OR- the C# compiler cannot be found.  This procedure should
          161  +  #       not raise script errors.
    65    162     #
    66    163     proc getDotNetCoreCSharpCommandArgs {} {
    67    164       set path [getDotNetCoreSdkPath]
    68    165   
    69    166       if {[string length $path] > 0} then {
    70         -      return [list dotnet exec [appendArgs \" \
    71         -          [file nativename [file normalize [file join $path Roslyn bincore \
    72         -          csc.dll]]] \"]]
          167  +      set compilerFileName [file normalize [file join \
          168  +          $path Roslyn bincore csc.dll]]
          169  +
          170  +      if {[file exists $compilerFileName]} then {
          171  +        return [list dotnet exec [appendArgs \
          172  +            \" [file nativename $compilerFileName] \"]]
          173  +      }
    73    174       }
    74    175   
    75    176       return [list]
    76    177     }
    77    178   
    78    179     #
    79    180     # NOTE: This procedure is used to format an option to the C# compiler.  It
................................................................................
   103    204     }
   104    205   
   105    206     #
   106    207     # NOTE: This procedure is used to translate a name/value pair into zero or
   107    208     #       more options to the C# compiler.  This procedure should not raise
   108    209     #       script errors.
   109    210     #
   110         -  proc compilerParameterToArguments { name {value ""} } {
          211  +  proc compilerParameterToArguments {
          212  +          name {value ""} {outputAssemblyVarName ""} } {
   111    213       switch -exact -nocase -- $name {
   112    214         WarningLevel {
   113    215           set name -warn
   114    216         }
   115    217         TreatWarningsAsErrors {
   116    218           set name -warnaserror
          219  +      }
          220  +      OutputAssembly {
          221  +        if {[string length $outputAssemblyVarName] > 0} then {
          222  +          #
          223  +          # HACK: This compiler parameter is handled by our caller; however,
          224  +          #       we want to honor the value specified via the OutputAssembly
          225  +          #       property.  Therefore, reset the specified variable from the
          226  +          #       caller to the new value.
          227  +          #
          228  +          upvar 1 $outputAssemblyVarName outputAssembly
          229  +
          230  +          #
          231  +          # NOTE: Use the file name value specified by the caller verbatim.
          232  +          #
          233  +          set outputAssembly $value
          234  +
          235  +          #
          236  +          # HACK: Also, make sure that we do not handle this parameter again,
          237  +          #       below.
          238  +          #
          239  +          set name ""; set value ""
          240  +        } else {
          241  +          #
          242  +          # BUGBUG: Translate the compiler parameter; however, this may not
          243  +          #         actually work, depending on how our caller handles its
          244  +          #         output assembly file name.  At the time this block was
          245  +          #         originally written (2018-04-09), the only caller (i.e.
          246  +          #         [compileViaDotNetCoreCSharp]) always passed the output
          247  +          #         assembly variable name, making this a non-issue.  This
          248  +          #         convention should also be followed by future callers of
          249  +          #         this procedure.
          250  +          #
          251  +          set name -out
          252  +        }
   117    253         }
   118    254         ReferencedAssemblies.Add {
   119    255           set name -reference
   120    256   
   121    257           if {[file pathtype $value] ne "absolute"} then {
   122    258             set value [file nativename [file normalize \
   123    259                 [file join [getDotNetStandardReferencePath] \
................................................................................
   246    382   
   247    383       foreach char [split $value ""] {
   248    384         append result \\u [format %04X [string ordinal $char 0]]
   249    385       }
   250    386   
   251    387       return $result
   252    388     }
          389  +
          390  +  #
          391  +  # NOTE: This procedure is used to execute the C# compiler and returns its
          392  +  #       platform normalized results.
          393  +  #
          394  +  proc runDotNetCSharpCommand { command } {
          395  +    #
          396  +    # NOTE: Evaluate the [exec] command constructed by our caller, in their
          397  +    #       context, and return the results, with line-endings normalized.
          398  +    #
          399  +    return [string map [list \r\n \n] [uplevel 1 $command]]
          400  +  }
   253    401   
   254    402     #
   255    403     # NOTE: This procedure is used to extract the C# compiler error messages
   256    404     #       from its results.  An empty list will be returned if the errors
   257    405     #       cannot be determined for some reason.  This procedure should not
   258    406     #       raise script errors.
   259    407     #
................................................................................
   497    645         if {[string length $errorsVarName] > 0} then {
   498    646           upvar 1 $errorsVarName local_errors
   499    647         }
   500    648   
   501    649         #
   502    650         # NOTE: Append to the list of errors.
   503    651         #
   504         -      lappend local_errors "cannot compile, CSharp compiler not found"
          652  +      lappend local_errors "cannot compile, C# compiler was not found"
   505    653   
   506    654         #
   507    655         # NOTE: Return the overall result to the caller.
   508    656         #
   509    657         return $code
   510    658       }
   511    659   
................................................................................
   518    666   
   519    667       #
   520    668       # NOTE: Start out the compiler options with the pre-existing defaults
   521    669       #       for the compiler followed by those necessary for the platform.
   522    670       #
   523    671       append command " " [getCSharpCompilerOptions "" true true -]
   524    672   
   525         -    #
   526         -    # NOTE: Process extra compiler settings the caller may have provided.
   527         -    #
   528         -    foreach {name value} $args {
   529         -      eval lappend command [compilerParameterToArguments $name $value]
   530         -    }
   531         -
   532    673       #
   533    674       # NOTE: Allocate a couple temporary file names, one to hold the source
   534    675       #       code to compile and one to hold the generated assembly.
   535    676       #
   536    677       set sourceFileName [appendArgs [file tempname] .cs]
   537    678       set outputFileName [appendArgs [file tempname] .dll]
          679  +
          680  +    #
          681  +    # NOTE: Process extra compiler settings the caller may have provided.
          682  +    #
          683  +    foreach {name value} $args {
          684  +      set nameValueArguments \
          685  +          [compilerParameterToArguments $name $value outputFileName]
          686  +
          687  +      if {[llength $nameValueArguments] > 0} then {
          688  +        eval lappend command $nameValueArguments
          689  +      }
          690  +    }
   538    691   
   539    692       try {
   540    693         #
   541    694         # NOTE: Make the compiler output a little quieter.  This is needed
   542    695         #       to maintain compatibility with the results generated by the
   543    696         #       [compileViaCSharpCodeProvider] procedure.
   544    697         #
................................................................................
   587    740   
   588    741         #
   589    742         # NOTE: Attempt to compile the temporary file as C# and capture the
   590    743         #       results into the variable provided by the caller.  Since the
   591    744         #       results are text, normalize line endings before extracting
   592    745         #       the compiler errors and/or warnings.
   593    746         #
   594         -      set local_results [string map [list \r\n \n] [eval $command]]
          747  +      set local_results [runDotNetCSharpCommand $command]
   595    748   
   596    749         #
   597    750         # NOTE: Extract the compiler errors (which may be empty).
   598    751         #
   599    752         set errors [extractCSharpErrors $sourceFileName $local_results]
   600    753   
   601    754         #

Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.

  3666   3666             "---- StringOps cleanup results: " $result \n]
  3667   3667   
  3668   3668         catch {uplevel 1 [list object invoke -flags +NonPublic \
  3669   3669             Eagle._Comparers.FileName ClearCache]} result
  3670   3670   
  3671   3671         tputs $channel [appendArgs \
  3672   3672             "---- Comparers.FileName cleanup results: " $result \n]
         3673  +
         3674  +      catch {uplevel 1 [list object invoke -flags +NonPublic \
         3675  +          Eagle._Components.Private.HashOps Cleanup]} result
         3676  +
         3677  +      tputs $channel [appendArgs \
         3678  +          "---- HashOps cleanup results: " $result \n]
         3679  +
         3680  +      catch {uplevel 1 [list object invoke -flags +NonPublic \
         3681  +          Eagle._Components.Private.FactoryOps Cleanup]} result
         3682  +
         3683  +      tputs $channel [appendArgs \
         3684  +          "---- FactoryOps cleanup results: " $result \n]
  3673   3685       }
  3674   3686   
  3675   3687       proc evalWithTimeout { script {milliseconds 2000} {resultVarName ""} } {
  3676   3688         #
  3677   3689         # NOTE: Verify that the number of milliseconds requested is greater than
  3678   3690         #       zero.
  3679   3691         #

Changes to Externals/Eagle/lib/Test1.0/constraints.eagle.

  2944   2944           tputs $channel no\n
  2945   2945         }
  2946   2946       }
  2947   2947   
  2948   2948       proc checkForCompileCSharp { channel } {
  2949   2949         tputs $channel "---- checking for test use of C# compiler... "
  2950   2950   
  2951         -      if {![info exists ::no(compileCSharp)]} then {
         2951  +      if {![info exists ::no(compileCSharp)] && \
         2952  +          [doesCompileCSharpWork]} then {
  2952   2953           addConstraint compileCSharp
  2953   2954   
  2954   2955           tputs $channel yes\n
  2955   2956         } else {
  2956   2957           tputs $channel no\n
  2957   2958         }
  2958   2959       }

Changes to Externals/Eagle/lib/Test1.0/prologue.eagle.

   184    184       #       the shell) and then into the "lib" directory just
   185    185       #       beneath that.
   186    186       #
   187    187       set lib_path [file normalize [file join [file dirname $bin_path] lib]]
   188    188     }
   189    189   
   190    190     #
   191         -  # NOTE: Set the location of the [non-script] library directory
   192         -  #       (i.e. the directory where the plugins are located), if
   193         -  #       necessary.  This variant is based on where the Eagle
   194         -  #       core library -OR- Tcl core library assembly is located.
          191  +  # NOTE: Set the location of the Eagle core library -OR- Tcl core
          192  +  #       library file is located.  This may be different than the
          193  +  #       location of the (shell?) executable file.
   195    194     #
   196         -  if {![info exists core_lib_path]} then {
          195  +  if {![info exists core_bin_path]} then {
   197    196       #
   198    197       # NOTE: Attempt to obtain the information for the Eagle core
   199    198       #       library assembly.  This will not work for native Tcl.
   200    199       #
   201         -    if {[catch {info assembly} lib_dir] == 0} then {
          200  +    if {[catch {info assembly} bin_dir] == 0} then {
   202    201         #
   203    202         # NOTE: Grab the directory for the core library assembly.
   204    203         #
   205         -      set core_lib_path [file dirname [lindex $lib_dir end]]
   206         -
   207         -      #
   208         -      # NOTE: Perform a check for the .NET Core output directories
   209         -      #       (e.g. "netcoreapp2.0", etc), which must be removed
   210         -      #       if present, prior to further checks.
   211         -      #
   212         -      if {![info exists no(dotNetCoreLibPath)] && \
   213         -          [string match net* [file tail $core_lib_path]]} then {
   214         -        #
   215         -        # NOTE: Remove the .NET Core output directory name.
   216         -        #
   217         -        set core_lib_path [file dirname $core_lib_path]
   218         -      }
   219         -
   220         -      #
   221         -      # NOTE: Go up one level, to remove the "bin" directory and
   222         -      #       then append the "lib" directory.  This gives us the
   223         -      #       final path we need.
   224         -      #
   225         -      set core_lib_path [file normalize \
   226         -          [file join [file dirname $core_lib_path] lib]]
          204  +      set core_bin_path [file dirname [lindex $bin_dir end]]
   227    205       } else {
   228    206         #
   229    207         # NOTE: This is native Tcl.  There is no way to query the
   230    208         #       path for the Tcl core library itself (e.g. "tcl*.dll",
   231    209         #       "libtcl*.so", etc); however, using [info library] is
   232    210         #       close enough.
   233    211         #
   234         -      set core_lib_path [file normalize [file dirname [info library]]]
          212  +      set core_bin_path [file dirname [info library]]
   235    213       }
   236    214   
   237         -    unset lib_dir
          215  +    unset bin_dir
          216  +  }
          217  +
          218  +  #
          219  +  # NOTE: Set the location of the [non-script] library directory
          220  +  #       (i.e. the directory where the plugins are located), if
          221  +  #       necessary.  This variant is based on where the Eagle
          222  +  #       core library -OR- Tcl core library file is located.
          223  +  #
          224  +  if {![info exists core_lib_path]} then {
          225  +    #
          226  +    # NOTE: Start with the directory for the core library assembly.
          227  +    #
          228  +    set core_lib_path $core_bin_path
          229  +
          230  +    #
          231  +    # NOTE: Perform a check for the .NET Core output directories
          232  +    #       (e.g. "netcoreapp2.0", etc), which must be removed
          233  +    #       if present, prior to further checks.
          234  +    #
          235  +    if {![info exists no(dotNetCoreLibPath)] && \
          236  +        [string match net* [file tail $core_lib_path]]} then {
          237  +      #
          238  +      # NOTE: Remove the .NET Core output directory name.
          239  +      #
          240  +      set core_lib_path [file dirname $core_lib_path]
          241  +    }
          242  +
          243  +    #
          244  +    # NOTE: Go up one level, to remove the "bin" directory and
          245  +    #       then append the "lib" directory.  This gives us the
          246  +    #       final path we need.
          247  +    #
          248  +    set core_lib_path [file normalize \
          249  +        [file join [file dirname $core_lib_path] lib]]
   238    250     }
   239    251   
   240    252     #
   241    253     # NOTE: Set the web host to test against, if necessary.
   242    254     #
   243    255     if {![info exists test_host]} then {
   244    256       set test_host eagle.to
................................................................................
   997   1009         $root_path \"\n]
   998   1010   
   999   1011     tputs $test_channel [appendArgs "---- binary path: \"" \
  1000   1012         $bin_path \"\n]
  1001   1013   
  1002   1014     tputs $test_channel [appendArgs "---- library path: \"" \
  1003   1015         $lib_path \"\n]
         1016  +
         1017  +  tputs $test_channel [appendArgs "---- core binary path: \"" \
         1018  +      $core_bin_path \"\n]
  1004   1019   
  1005   1020     tputs $test_channel [appendArgs "---- core library path: \"" \
  1006   1021         $core_lib_path \"\n]
  1007   1022   
  1008   1023     tputs $test_channel [appendArgs "---- test suite files located in: \"" \
  1009   1024         $test_all_path \"\n]
  1010   1025   
................................................................................
  3203   3218             Plugin1.0] Plugin.dll]
  3204   3219       }
  3205   3220   
  3206   3221       #
  3207   3222       # NOTE: For test "object-6.1".
  3208   3223       #
  3209   3224       if {![info exists no(Sample.exe)]} then {
  3210         -      checkForFile $test_channel [file join $bin_path Sample.exe]
         3225  +      checkForFile $test_channel [file join $core_bin_path Sample.exe]
  3211   3226       }
  3212   3227   
  3213   3228       #
  3214   3229       # NOTE: For test "object-4.8".
  3215   3230       #
  3216   3231       if {![info exists no(EagleCmdlets.dll)]} then {
  3217         -      checkForFile $test_channel [file join $bin_path EagleCmdlets.dll]
         3232  +      checkForFile $test_channel [file join $core_bin_path EagleCmdlets.dll]
  3218   3233       }
  3219   3234   
  3220   3235       #
  3221   3236       # NOTE: For test "object-4.10".
  3222   3237       #
  3223   3238       if {![info exists no(EagleExtensions.dll)]} then {
  3224         -      checkForFile $test_channel [file join $bin_path EagleExtensions.dll]
         3239  +      checkForFile $test_channel [file join $core_bin_path EagleExtensions.dll]
  3225   3240       }
  3226   3241   
  3227   3242       #
  3228   3243       # NOTE: For test "object-4.10".
  3229   3244       #
  3230   3245       if {![info exists no(test.wxs)]} then {
  3231   3246         checkForFile $test_channel [file join $base_path Installer Tests test.wxs]
................................................................................
  3232   3247       }
  3233   3248   
  3234   3249       #
  3235   3250       # NOTE: For tests "sql-1.2", "sql-1.4", "sql-1.5", "sql-1.6", "sql-1.7",
  3236   3251       #       "sql-1.8", and "sql-1.9".
  3237   3252       #
  3238   3253       if {![info exists no(sqlite3.dll)]} then {
  3239         -      checkForFile $test_channel [file join $bin_path sqlite3.dll]
         3254  +      checkForFile $test_channel [file join $core_bin_path sqlite3.dll]
  3240   3255   
  3241   3256         #
  3242   3257         # NOTE: Did we manage to find the native SQLite library?  If not, do we
  3243   3258         #       at least know the machine type?
  3244   3259         #
  3245   3260         if {![haveConstraint file_sqlite3.dll]} then {
  3246   3261           #
  3247   3262           # NOTE: Ok, now try to check for the machine specific native SQLite
  3248   3263           #       library.
  3249   3264           #
  3250         -        checkForFile $test_channel [file join $bin_path [machineToPlatform \
  3251         -            $test_machine true] sqlite3.dll]
         3265  +        checkForFile $test_channel [file join $core_bin_path \
         3266  +            [machineToPlatform $test_machine true] sqlite3.dll]
  3252   3267   
  3253   3268           #
  3254   3269           # NOTE: Did we manage to find the native SQLite library yet?
  3255   3270           #
  3256   3271           if {![haveConstraint file_sqlite3.dll]} then {
  3257   3272             #
  3258   3273             # NOTE: Ok, now try to check for the platform specific native SQLite
  3259   3274             #       library.
  3260   3275             #
  3261         -          checkForFile $test_channel [file join $bin_path [machineToPlatform \
  3262         -              $test_machine false] sqlite3.dll]
         3276  +          checkForFile $test_channel [file join $core_bin_path \
         3277  +              [machineToPlatform $test_machine false] sqlite3.dll]
  3263   3278           }
  3264   3279         }
  3265   3280       }
  3266   3281   
  3267   3282       if {![info exists no(System.Data.SQLite.dll)]} then {
  3268         -      checkForFile $test_channel [file join $bin_path System.Data.SQLite.dll]
         3283  +      checkForFile $test_channel [file join $core_bin_path \
         3284  +          System.Data.SQLite.dll]
  3269   3285       }
  3270   3286   
  3271   3287       if {![info exists no(test.sqlite3)]} then {
  3272   3288         checkForFile $test_channel [file join $test_data_path test.sqlite3]
  3273   3289       }
  3274   3290     }
  3275   3291