Skip to content

Commit

Permalink
Merge pull request #1023 from microsoft/users/marekaldorf/Move_from_s…
Browse files Browse the repository at this point in the history
…ubmodule_to_nuget

Replace sarif-sdk submodule with Nuget package
  • Loading branch information
AllDwarf authored Jan 7, 2025
2 parents 66597e4 + 5976bdb commit 8ec0a12
Show file tree
Hide file tree
Showing 22 changed files with 130 additions and 229 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ permissions:
on:
push:
branches-ignore:
- 'dependabot/**'
- "dependabot/**"
pull_request:
branches: [ main ]
branches: [main]
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
Expand All @@ -24,8 +24,6 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down Expand Up @@ -60,5 +58,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
run: dotnet tool install -g dotnet-format

- name: dotnet format
run: dotnet-format --folder --check --exclude .\src\sarif-sdk\
run: dotnet-format --folder --check
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

3 changes: 0 additions & 3 deletions BuildAndTest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ echo public const string Version = AssemblyVersion + Prerelease;
echo } >> %VERSION_CONSTANTS%
echo } >> %VERSION_CONSTANTS%

::Download Submodules
if not exist %~dp0src\sarif-sdk\src\Sarif.Sdk.sln (git submodule update --init --recursive)

::Restore packages
echo Restoring packages...
Expand Down Expand Up @@ -78,7 +76,6 @@ call BuildPackages.cmd || goto :ExitFailed

echo dotnet-format
dotnet tool update --global dotnet-format --version 4.1.131201
dotnet-format --folder --exclude .\src\sarif-sdk\

::Update BinSkimRules.md to cover any xml changes
echo Exporting any BinSkim rules
Expand Down
4 changes: 0 additions & 4 deletions BuildAndTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ if [[ "$(uname)" == "Linux" || "$(uname)" == "Darwin" ]]; then
sed 's#\\#/#g' src/BinSkim.sln > src/BinSkimUnix.sln
fi

if [ ! -f src/sarif-sdk/src/Sarif.Sdk.sln ]; then
echo "Get submodule..."
git submodule update --init --recursive
fi

dotnet build src/BinSkimUnix.sln --configuration Release /p:Platform="x64"

Expand Down
1 change: 1 addition & 0 deletions ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- NEW => new feature

## UNRELEASED
* NEW: Remove sarif-sdk submodule and use nuget package instead

## **v4.3.1** [NuGet Package](https://www.nuget.org/packages/Microsoft.CodeAnalysis.BinSkim/4.3.1)
* DEP: Update `msdia140.dll` from 14.40.33810.0 to 14.40.33812. [1000](https://github.com/microsoft/binskim/pull/1002)
Expand Down
23 changes: 18 additions & 5 deletions ado-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ jobs:
packageType: sdk

- checkout: self
submodules: true

- task: UseDotNet@2
displayName: .NET Core 8 sdk
inputs:
version: "8.0.x"
packageType: sdk

- task: Bash@3
displayName: "Build and Test"
Expand All @@ -43,17 +48,20 @@ jobs:
version: "6.0.x"
packageType: sdk

- task: UseDotNet@2
displayName: .NET Core 8 sdk
inputs:
version: "8.0.x"
packageType: sdk

- checkout: self
submodules: true

- task: CmdLine@2
displayName: "Build and Test"
inputs:
script: "BuildAndTest.cmd"

- task: ComponentGovernanceComponentDetection@0
inputs:
ignoreDirectories: 'src\sarif-sdk'

- job: mac
pool:
Expand All @@ -71,8 +79,13 @@ jobs:
version: "6.0.x"
packageType: sdk

- task: UseDotNet@2
displayName: .NET Core 8 sdk
inputs:
version: "8.0.x"
packageType: sdk

- checkout: self
submodules: true

- task: Bash@3
displayName: "Build and Test"
Expand Down
9 changes: 9 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "8.0.404",
"rollForward": "latestPatch"
},
"msbuild-sdks": {
"Microsoft.Build.Traversal": "2.0.48"
}
}
29 changes: 9 additions & 20 deletions src/BinSkim.Driver/BinSkim.Driver.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.netcore.props))\build.netcore.props" />

<PropertyGroup>
<AssemblyName>BinSkim</AssemblyName>
<!-- Condition="'$(OS)'=='Windows_NT'" -->
Expand All @@ -10,7 +9,6 @@
<OutputType>Exe</OutputType>
<Platforms>x64</Platforms>
</PropertyGroup>

<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand All @@ -19,61 +17,52 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Microsoft/binskim</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<Content Include="README.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Reflection.Metadata" Version="7.0.2" />
<PackageReference Include="CommandLineParser" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Private.Uri" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="Sarif.Driver" />
</ItemGroup>

<ItemGroup>
<Reference Include="Dia2Lib">
<HintPath>..\..\refs\Dia2Lib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\sarif-sdk\src\Sarif.Driver\Sarif.Driver.csproj" />
<ProjectReference Include="..\BinaryParsers\BinaryParsers.csproj" />
<ProjectReference Include="..\BinSkim.Rules\BinSkim.Rules.csproj" />
<ProjectReference Include="..\BinSkim.Sdk\BinSkim.Sdk.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="DriverResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>DriverResources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="DriverResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DriverResources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Microsoft.CodeAnalysis.IL</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ItemGroup>
<MsDiaLibs Include="..\..\refs\x64\*" Condition="'$(RuntimeIdentifier)'==''" />
<!-- Note: Official Release builds on Windows should specify a RID. Build using the BuildAndTest.cmd script. -->
<!-- Note: Official Release builds on Windows should specify a RID. Build using the BuildAndTest.cmd script. -->
<MsDiaLibs Include="..\..\refs\x64\*" Condition="'$(RuntimeIdentifier)'=='win-x64'" />
<MsDiaLibs Include="..\..\refs\msdia140.dll.manifest" />

<!-- Required DLLs for Microsoft Visual C++ runtime. -->
<MsRuntime Include="..\..\refs\runtime\*" />
</ItemGroup>

<Target Name="CopyMsDiaLibs" AfterTargets="build">
<Copy SourceFiles="@(MsDiaLibs)" DestinationFolder="$(OutputPath)\" />
<Copy SourceFiles="@(MsRuntime)" DestinationFolder="$(OutputPath)\" />
Expand All @@ -82,4 +71,4 @@
<Copy SourceFiles="@(MsDiaLibs)" DestinationFolder="$(PublishDir)\" />
<Copy SourceFiles="@(MsRuntime)" DestinationFolder="$(PublishDir)\" />
</Target>
</Project>
</Project>
17 changes: 5 additions & 12 deletions src/BinSkim.Rules/BinSkim.Rules.csproj
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.netcore.props))\build.netcore.props" />
<PropertyGroup>
<RootNamespace>Microsoft.CodeAnalysis.IL.Rules</RootNamespace>
<TargetFramework>$(NetStandardVersion)</TargetFramework>
<Platforms>x64</Platforms>
</PropertyGroup>

<ItemGroup>
<Reference Include="Dia2Lib">
<HintPath>..\..\refs\Dia2Lib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
<PackageReference Include="System.Composition" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Composition" />
<PackageReference Include="Sarif.Driver" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\sarif-sdk\src\Sarif.Driver\Sarif.Driver.csproj" />
<ProjectReference Include="..\BinaryParsers\BinaryParsers.csproj" />
<ProjectReference Include="..\BinSkim.Sdk\BinSkim.Sdk.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="RuleResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>RuleResources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="RuleResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>RuleResources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Microsoft.CodeAnalysis.IL.Rules</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>

</Project>
</Project>
18 changes: 6 additions & 12 deletions src/BinSkim.Sdk/BinSkim.Sdk.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.netcore.props))\build.netcore.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.netcore.props))\build.netcore.props" />
<PropertyGroup>
<RootNamespace>Microsoft.CodeAnalysis.IL.Sdk</RootNamespace>
<TargetFramework>$(NetStandardVersion)</TargetFramework>
<Platforms>x64</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="Sarif.Driver" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BinaryParsers\BinaryParsers.csproj" />
<ProjectReference Include="..\sarif-sdk\src\Sarif.Driver\Sarif.Driver.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="EnvironmentResources.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -31,7 +27,6 @@
<DependentUpon>SdkResources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="EnvironmentResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand All @@ -43,5 +38,4 @@
<CustomToolNamespace>Microsoft.CodeAnalysis.IL.Sdk</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>

</Project>
</Project>
3 changes: 2 additions & 1 deletion src/BinSkim.Sdk/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public void Dispose()
private static void ConfigureTelemetryContext(TelemetryContext context)
{
context.Session.Id = CreateRandomSessionId();
context.Component.Version = Assembly.GetCallingAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
AssemblyFileVersionAttribute? versionAttribute = Assembly.GetCallingAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>();
context.Component.Version = versionAttribute?.Version ?? "Unknown";
context.Device.OperatingSystem = RuntimeInformation.OSDescription;
}

Expand Down
Loading

0 comments on commit 8ec0a12

Please sign in to comment.