Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update validator.exe and shim.exe #2024

Merged
merged 3 commits into from
Feb 20, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update Newtonsoft.Json and improve validator build process
r15ch13 committed Feb 16, 2018
commit 9a4dfc940fb3af85a29d7412e53fc940cb2f7d1b
Binary file removed supporting/validator/Newtonsoft.Json.Schema.dll
Binary file not shown.
10 changes: 10 additions & 0 deletions supporting/validator/Scoop.Validator.cs
Original file line number Diff line number Diff line change
@@ -83,6 +83,16 @@ public bool Validate(string file)

public bool Validate()
{
if (!this.SchemaFile.Exists)
{
Console.WriteLine("ERROR: Please provide schema.json!");
return false;
}
if (!this.ManifestFile.Exists)
{
Console.WriteLine("ERROR: Please provide manifest.json!");
return false;
}
this.Errors.Clear();
try
{
Binary file removed supporting/validator/Scoop.Validator.dll
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file added supporting/validator/bin/Scoop.Validator.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions supporting/validator/bin/checksum.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
52cc6ddf77990fbaaae4db593f655610652133ceeadb32262c122d8c9eea1bad *Newtonsoft.Json.dll
8643f860be0e5592e73219b6d5e993265f336d3bf2c93d6db5a2e918d3c3f177 *Newtonsoft.Json.Schema.dll
306de31359895c96e1b91df29a216b65a7aa3f353251ba3e5ad129906fcfc77b *Scoop.Validator.dll
cc82c9659716b564a69690a8b67e5472ea1e8e060b974306314acdd42767bf6d *validator.exe
4 changes: 4 additions & 0 deletions supporting/validator/bin/checksum.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
4639a7f77f7a9cafa38c632332dd5085355623f3d84475374241a64bd110569f504086b479b519e90ddbd471d4a5034239418ebc03277424212e0e6698e64418 *Newtonsoft.Json.dll
0c39a3c8e514fde4d629f11f94e6c7acdcd196cd1229c3ef5a6a0455c1cdf4dbf3fda24dd9392b05e917cb85ec745393595086078d1437343dded52f2c0011f3 *Newtonsoft.Json.Schema.dll
d133d47dbeda60571090fc4159e3575b40ddaddef858b56e0103ad531dc4612a9d4bdbee8a6b5dd4e0d5abeb549afadd059767058b568e4d5d31990a42631743 *Scoop.Validator.dll
384d22bfb21b2767de862f95945dca91aefb4b5eca687d20e410dc64059c5402a13c085517cb807635ff07397fee9bda31b0fdc0090c24cb424f62b285ea0477 *validator.exe
Binary file not shown.
27 changes: 21 additions & 6 deletions supporting/validator/build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
pushd $psscriptroot
iex "$psscriptroot\install.ps1"
gci $psscriptroot\packages\Newtonsoft.*\lib\net40\*.dll -file | % { copy-item $_ $psscriptroot }
& "$psscriptroot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:library /reference:Newtonsoft.Json.dll,Newtonsoft.Json.Schema.dll Scoop.Validator.cs
& "$psscriptroot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:exe /reference:Scoop.Validator.dll,Newtonsoft.Json.dll,Newtonsoft.Json.Schema.dll validator.cs
popd
Push-Location $psscriptroot
. "$psscriptroot\..\..\lib\install.ps1"

Write-Host "Install dependencies ..."
Invoke-Expression "$psscriptroot\install.ps1"

$output = "$psscriptroot\bin"
Get-ChildItem "$psscriptroot\packages\Newtonsoft.*\lib\net40\*.dll" -File | ForEach-Object { Copy-Item $_ $output }
Write-Output 'Compiling Scoop.Validator.cs ...'
& "$psscriptroot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:library /reference:"$output\Newtonsoft.Json.dll","$output\Newtonsoft.Json.Schema.dll" /out:"$output\Scoop.Validator.dll" Scoop.Validator.cs
Write-Output 'Compiling validator.cs ...'
& "$psscriptroot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:exe /reference:"$output\Scoop.Validator.dll","$output\Newtonsoft.Json.dll","$output\Newtonsoft.Json.Schema.dll" /out:"$output\validator.exe" validator.cs

Write-Output 'Computing checksums ...'
Remove-Item "$psscriptroot\bin\checksum.sha256" -ErrorAction Ignore
Remove-Item "$psscriptroot\bin\checksum.sha512" -ErrorAction Ignore
Get-ChildItem "$psscriptroot\bin\*" -Include *.exe,*.dll | ForEach-Object {
"$(compute_hash $_ 'sha256') *$($_.Name)" | Out-File "$psscriptroot\bin\checksum.sha256" -Append -Encoding oem
"$(compute_hash $_ 'sha512') *$($_.Name)" | Out-File "$psscriptroot\bin\checksum.sha512" -Append -Encoding oem
}
Pop-Location
6 changes: 3 additions & 3 deletions supporting/validator/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" />
<package id="Newtonsoft.Json.Schema" version="3.0.3" targetFramework="net40" />
<package id="Microsoft.Net.Compilers" version="2.3.2" targetFramework="net40" developmentDependency="true" />
</packages>
<package id="Newtonsoft.Json.Schema" version="3.0.5" targetFramework="net40" />
<package id="Microsoft.Net.Compilers" version="2.6.1" targetFramework="net40" developmentDependency="true" />
</packages>
4 changes: 3 additions & 1 deletion supporting/validator/validator.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" />
<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')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@@ -19,7 +20,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json.Schema, Version=3.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>packages\Newtonsoft.Json.Schema.3.0.3\lib\net40\Newtonsoft.Json.Schema.dll</HintPath>
<HintPath>packages\Newtonsoft.Json.Schema.3.0.5\lib\net40\Newtonsoft.Json.Schema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
@@ -44,5 +45,6 @@
<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>
</PropertyGroup>
<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'))" />
<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'))" />
</Target>
</Project>
6 changes: 3 additions & 3 deletions test/Scoop-Manifest.Tests.ps1
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ describe "manifest-validation" {
beforeall {
$working_dir = setup_working "manifest"
$schema = "$psscriptroot/../schema.json"
Add-Type -Path "$psscriptroot\..\supporting\validator\Newtonsoft.Json.dll"
Add-Type -Path "$psscriptroot\..\supporting\validator\Newtonsoft.Json.Schema.dll"
Add-Type -Path "$psscriptroot\..\supporting\validator\Scoop.Validator.dll"
Add-Type -Path "$psscriptroot\..\supporting\validator\bin\Newtonsoft.Json.dll"
Add-Type -Path "$psscriptroot\..\supporting\validator\bin\Newtonsoft.Json.Schema.dll"
Add-Type -Path "$psscriptroot\..\supporting\validator\bin\Scoop.Validator.dll"
}

it "Scoop.Validator is available" {