Skip to content

Commit f0a1588

Browse files
authored
Update validator.exe and shim.exe (#2024)
* Update Newtonsoft.Json and improve validator build process * Improve shimexe build process and create deterministic builds
1 parent 158a6de commit f0a1588

26 files changed

Lines changed: 132 additions & 20 deletions

lib/core.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function shim($path, $global, $name, $arg) {
230230

231231
if($path -match '\.exe$') {
232232
# for programs with no awareness of any shell
233-
cp "$(versiondir 'scoop' 'current')\supporting\shimexe\shim.exe" "$shim.exe" -force
233+
cp "$(versiondir 'scoop' 'current')\supporting\shimexe\bin\shim.exe" "$shim.exe" -force
234234
write-output "path = $resolved_path" | out-file "$shim.shim" -encoding utf8
235235
if($arg) {
236236
write-output "args = $arg" | out-file "$shim.shim" -encoding utf8 -append

supporting/shimexe/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0fb0a1d75fd6776841345fb99bae4d6db888732fed9ed9a5a1b9c1fad2020379 *shim.exe
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1239df21ed8ca1c6b5a0f8fba21c8bf16345605478a3c08899fb7d1d8ba9985ed40d41ce6354bdf05a475de3884557dd8359adc24ff99b32286a5aeda11291b7 *shim.exe

supporting/shimexe/bin/shim.exe

7 KB
Binary file not shown.

supporting/shimexe/build.ps1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
$fwdir = gci C:\Windows\Microsoft.NET\Framework\ -dir | sort -desc | select -first 1
1+
Push-Location $psscriptroot
2+
. "$psscriptroot\..\..\lib\install.ps1"
23

3-
pushd $psscriptroot
4-
& "$($fwdir.fullname)\csc.exe" /nologo shim.cs
5-
popd
4+
Write-Host "Install dependencies ..."
5+
Invoke-Expression "$psscriptroot\install.ps1"
6+
7+
$output = "$psscriptroot\bin"
8+
Write-Output 'Compiling shim.cs ...'
9+
& "$psscriptroot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:exe /out:"$output\shim.exe" shim.cs
10+
11+
Write-Output 'Computing checksums ...'
12+
Remove-Item "$psscriptroot\bin\checksum.sha256" -ErrorAction Ignore
13+
Remove-Item "$psscriptroot\bin\checksum.sha512" -ErrorAction Ignore
14+
Get-ChildItem "$psscriptroot\bin\*" -Include *.exe,*.dll | ForEach-Object {
15+
"$(compute_hash $_ 'sha256') *$($_.Name)" | Out-File "$psscriptroot\bin\checksum.sha256" -Append -Encoding oem
16+
"$(compute_hash $_ 'sha512') *$($_.Name)" | Out-File "$psscriptroot\bin\checksum.sha512" -Append -Encoding oem
17+
}
18+
Pop-Location

supporting/shimexe/install.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://github.com/edymtt/nugetstandalone
2+
$destinationFolder = "$psscriptroot\packages"
3+
if ((Test-Path -path $destinationFolder)) {
4+
Remove-Item -Path $destinationFolder -Recurse | Out-Null
5+
}
6+
7+
New-Item $destinationFolder -Type Directory | Out-Null
8+
nuget install packages.config -o $destinationFolder -ExcludeVersion

supporting/shimexe/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.Net.Compilers" version="2.6.1" targetFramework="net40" developmentDependency="true" />
4+
</packages>

supporting/shimexe/shim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Threading.Tasks;
99
using System.Runtime.InteropServices;
1010

11-
namespace shim {
11+
namespace Scoop {
1212

1313
class Program {
1414
[DllImport("kernel32.dll", SetLastError=true)]

supporting/shimexe/shim.csproj

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props" Condition="Exists('packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" />
4+
<Import Project="packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props')" />
5+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
6+
<PropertyGroup>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<ProjectGuid>{381F9D2E-2355-4F84-9206-06BB9175F97B}</ProjectGuid>
10+
<OutputType>Exe</OutputType>
11+
<RootNamespace>Scoop.Shim</RootNamespace>
12+
<AssemblyName>Scoop.Shim</AssemblyName>
13+
<TargetFrameworkVersion>v4.0.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
</PropertyGroup>
17+
<ItemGroup>
18+
<Reference Include="System" />
19+
<Reference Include="System.Core" />
20+
<Reference Include="System.Xml.Linq" />
21+
<Reference Include="System.Data.DataSetExtensions" />
22+
<Reference Include="Microsoft.CSharp" />
23+
<Reference Include="System.Data" />
24+
<Reference Include="System.Net.Http" />
25+
<Reference Include="System.Xml" />
26+
</ItemGroup>
27+
<ItemGroup>
28+
<Compile Include="shim.cs" />
29+
</ItemGroup>
30+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
31+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
32+
<PropertyGroup>
33+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
34+
</PropertyGroup>
35+
<Error Condition="!Exists('packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Net.Compilers.2.3.2\build\Microsoft.Net.Compilers.props'))" />
36+
<Error Condition="!Exists('packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props'))" />
37+
</Target>
38+
</Project>

0 commit comments

Comments
 (0)