Skip to content

Commit

Permalink
Addressing comments, small fixes to build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Everett Maus committed Jan 12, 2018
1 parent dce56b2 commit a9ee6d5
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 50 deletions.
22 changes: 10 additions & 12 deletions BuildAndTest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ set Configuration=Release
if exist bld (rd /s /q bld)

SET NuGetConfigFile=%~dp0src\NuGet.config
set NuGetPackageDir=.\src\packages
set NuGetOutputDirectory=..\..\bld\bin\nuget\
set NuGetPackageDir=%~dp0src\packages
set NuGetOutputDirectory=%~dp0bld\bin\nuget\

call SetCurrentVersion.cmd

set VERSION_CONSTANTS=src\BinaryParsers\VersionConstants.cs
set VERSION_CONSTANTS=%~dp0src\BinaryParsers\VersionConstants.cs

@REM Rewrite VersionConstants.cs
echo // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT > %VERSION_CONSTANTS%
Expand All @@ -37,11 +37,11 @@ echo public const string Version = AssemblyVersion + Prerelease;
echo } >> %VERSION_CONSTANTS%
echo } >> %VERSION_CONSTANTS%

%~dp0.nuget\NuGet.exe restore src\BinSkim.sln -ConfigFile "%NuGetConfigFile%" -OutputDirectory "%NuGetPackageDir%"
%~dp0.nuget\NuGet.exe restore %~dp0src\BinSkim.sln -ConfigFile "%NuGetConfigFile%" -OutputDirectory "%NuGetPackageDir%"

:: Build the solution
dotnet clean /verbosity:minimal src\BinSkim.sln /p:Configuration=%Configuration% || goto :ExitFailed
dotnet build /verbosity:minimal src\BinSkim.sln /p:Configuration=%Configuration% /filelogger /fileloggerparameters:Verbosity=detailed || goto :ExitFailed
dotnet clean /verbosity:minimal %~dp0src\BinSkim.sln /p:Configuration=%Configuration% || goto :ExitFailed
dotnet build /verbosity:minimal %~dp0src\BinSkim.sln /p:Configuration=%Configuration% /filelogger /fileloggerparameters:Verbosity=detailed || goto :ExitFailed

::Run unit tests
echo Run all multitargeting xunit tests
Expand All @@ -56,29 +56,27 @@ call :CreatePublishPackage netcoreapp2.0 win-x86 || goto :ExitFailed
call :CreatePublishPackage netcoreapp2.0 win-x64 || goto :ExitFailed
call :CreatePublishPackage netcoreapp2.0 linux-x64 || goto :ExitFailed

set Platform=AnyCPU

::Build NuGet package
echo BuildPackages.cmd
call BuildPackages.cmd || goto :ExitFailed

::Create layout directory of assemblies that need to be signed
echo CreateLayoutDirectory.cmd .\bld\bin %Configuration% %Platform%
call CreateLayoutDirectory.cmd .\bld\bin %Configuration% %Platform%
echo CreateLayoutDirectory.cmd %~dp0bld\bin %Configuration% %Platform%
call CreateLayoutDirectory.cmd %~dp0bld\bin %Configuration% %Platform%

goto :Exit

:RunMultitargetingTests
set TestProject=%1
set TestType=%2
pushd .\src\BinSkim.%TestProject%.%TestType%Tests && dotnet test --no-build -c %Configuration% && popd
pushd %~dp0src\BinSkim.%TestProject%.%TestType%Tests && dotnet test --no-build -c %Configuration% && popd
if "%ERRORLEVEL%" NEQ "0" (echo %TestProject% %TestType% tests execution FAILED.)
Exit /B %ERRORLEVEL%

:CreatePublishPackage
set Framework=%~1
set RuntimeArg=%~2
dotnet publish .\src\BinSkim.Driver\BinSkim.Driver.csproj --no-restore -c %Configuration% -f %Framework% --runtime %RuntimeArg%
dotnet publish %~dp0src\BinSkim.Driver\BinSkim.Driver.csproj --no-restore -c %Configuration% -f %Framework% --runtime %RuntimeArg%
Exit /B %ERRORLEVEL%

:ExitFailed
Expand Down
2 changes: 1 addition & 1 deletion BuildPackages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SETLOCAL

call SetCurrentVersion.cmd

.nuget\NuGet.exe pack .\src\Nuget\BinSkim.nuspec -Symbols -Properties configuration=%Configuration%;version=%MAJOR%.%MINOR%.%PATCH%%PRERELEASE% -Verbosity Quiet -BasePath .\ -OutputDirectory .\bld\bin\Nuget || goto :ExitFailed
%~dp0.nuget\NuGet.exe pack %~dp0src\Nuget\BinSkim.nuspec -Symbols -Properties configuration=%Configuration%;version=%MAJOR%.%MINOR%.%PATCH%%PRERELEASE% -Verbosity Quiet -BasePath %~dp0 -OutputDirectory %~dp0bld\bin\Nuget || goto :ExitFailed

goto Exit

Expand Down
6 changes: 3 additions & 3 deletions CreateLayoutDirectory.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set Configuration=%2
set Platform=%3

if "%BinaryOutputDirectory%" EQU "" (
set BinaryOutputDirectory=.\bld\bin
set BinaryOutputDirectory=%~dp0bld\bin
)

if "%Configuration%" EQU "" (
Expand Down Expand Up @@ -38,8 +38,8 @@ call :CopyFilesForMultitargeting BinSkim.Sdk.dll || goto :ExitFailed
goto :Exit

:CopyFilesForMultitargeting
xcopy /Y %BinaryOutputDirectory%\net461\%1 %LayoutForSigningDirectory%\net461\win-x86\
xcopy /Y %BinaryOutputDirectory%\net461\%1 %LayoutForSigningDirectory%\net461\win-x64\
xcopy /Y %BinaryOutputDirectory%\net461\win-x86\%1 %LayoutForSigningDirectory%\net461\win-x86\
xcopy /Y %BinaryOutputDirectory%\net461\win-x64\%1 %LayoutForSigningDirectory%\net461\win-x64\
:: For .NET core, .exes are renamed to .dlls due to packaging conventions
xcopy /Y %BinaryOutputDirectory%\netcoreapp2.0\win-x86\%~n1.dll %LayoutForSigningDirectory%\netcoreapp2.0\win-x86\
xcopy /Y %BinaryOutputDirectory%\netcoreapp2.0\win-x64\%~n1.dll %LayoutForSigningDirectory%\netcoreapp2.0\win-x64\
Expand Down
5 changes: 2 additions & 3 deletions src/BinSkim.Driver.FunctionalTests/UpdateBaselines.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ Param(

$tool = "BinSkim"
$repoRoot = ( Resolve-Path "$PSScriptRoot\..\..\" ).ToString()
$utility = "$repoRoot\bld\bin\AnyCPU_Release\net46\$tool.exe"
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
$utility = "$repoRoot\bld\bin\AnyCPU_Release\net461\$tool.exe"

function Build-Tool()
{
Write-Host "Building the tool..." -NoNewline
# Out-Null *and* /noconsolelogger here because our scripts call out to batch files and similar
# that don't respect msbuild's /noconsolelogger switch.
&$msbuild $PSScriptRoot\..\$tool.Driver\$tool.Driver.csproj /p:"Configuration=Release" /m /verbosity:minimal
&dotnet build $PSScriptRoot\..\$tool.Driver\$tool.Driver.csproj -c Release /m /verbosity:minimal
Write-Host " done."
}

Expand Down
4 changes: 2 additions & 2 deletions src/BinSkim.Driver/BinSkim.Driver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.0" />
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.6.1" />
<PackageReference Include="Microsoft.DiaSymReader" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
Expand Down Expand Up @@ -71,7 +71,7 @@
<Target Name="CopyMsDiaLibs" AfterTargets="build">
<Copy SourceFiles="@(MsDiaLibs)" DestinationFolder="$(OutputPath)\" />
</Target>
<Target Name="PubMsDiaLibs" AfterTargets="publish">
<Target Name="PublishMsDiaLibs" AfterTargets="publish">
<Copy SourceFiles="@(MsDiaLibs)" DestinationFolder="$(PublishDir)\" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion src/BinSkim.Rules/BinSkim.Rules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.0" />
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Sarif.Driver" Version="1.7.1-beta" />
<PackageReference Include="Sarif.Sdk" Version="1.7.1" />
Expand Down
1 change: 0 additions & 1 deletion src/BinSkim.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
ProjectSection(SolutionItems) = preProject
build.common.props = build.common.props
build.netcore.props = build.netcore.props
build.props = build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BinSkim.Sdk", "BinSkim.Sdk\BinSkim.Sdk.csproj", "{81687384-6DA2-4AD5-A889-0727F2EB8C8C}"
Expand Down
2 changes: 1 addition & 1 deletion src/BinaryParsers/BinaryParsers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.0" />
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="Microsoft.CodeAnalysis.BinSkim" Version="1.4.5" />
<PackageReference Include="Microsoft.DiaSymReader" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
Expand Down
2 changes: 1 addition & 1 deletion src/BinaryParsers/Packer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.CodeAnalysis.BinaryParsers
{
public enum Packer
{
UnknownOrNotPacked,
UnknownOrNotPacked,
Upx
}
}
2 changes: 0 additions & 2 deletions src/build.netcore.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
<NetRuntimeVersion>net461</NetRuntimeVersion>
<NetStandardVersion>netstandard2.0</NetStandardVersion>
</PropertyGroup>


</Project>
23 changes: 0 additions & 23 deletions src/build.props

This file was deleted.

0 comments on commit a9ee6d5

Please sign in to comment.