-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Microsoft.NET.HostModel.TestData (#505)
Adds a project with binary Mach-O files to test the ad-hoc signing in Microsoft.NET.HostModel.
- Loading branch information
1 parent
a301793
commit 24f902e
Showing
9 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
int add(int a, int b) | ||
{ | ||
return a + b; | ||
} | ||
|
||
int main() | ||
{ | ||
return add(2, 3) - add(1, 4); | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
src/Microsoft.NET.HostModel.TestData/Microsoft.NET.HostModel.TestData.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.Build.NoTargets"> | ||
<ItemGroup> | ||
<None Remove="MachO\src\*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<MachOArch Include="arm64" /> | ||
<MachOArch Include="x86_64" /> | ||
<MachOCodesignOption Include="signed" /> | ||
<MachOCodesignOption Include="unsigned" /> | ||
<MachOCodesignOption Include="buildonly" /> | ||
</ItemGroup> | ||
|
||
<Target Name="GenerateMachOBinaries"> | ||
<ItemGroup> | ||
<_MachObjectFile Include="@(MachOArch)"> | ||
<Codesign>%(MachOCodesignOption.Identity)</Codesign> | ||
</_MachObjectFile> | ||
<MachObjectFile Include="@(_MachObjectFile->'$(MSBuildThisFileDirectory)MachO/%(Identity)/a.%(Codesign).out')" > | ||
<Arch>%(_MachObjectFile.Identity)</Arch> | ||
</MachObjectFile> | ||
</ItemGroup> | ||
|
||
<MakeDir Directories="%(MachObjectFile.RelativeDir)" /> | ||
<Exec Command="clang $(MSBuildThisFileDirectory)MachO/src/main.c -o %(MachObjectFile.Identity) -arch %(Arch)" /> | ||
<Exec Command="codesign --sign - %(MachObjectFile.Identity)" | ||
Condition="'%(Codesign)' == 'signed'" /> | ||
<Exec Command="codesign --remove-signature %(MachObjectFile.Identity)" | ||
Condition="'%(Codesign)' == 'unsigned'" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Microsoft.NET.HostModel.TestData | ||
|
||
This project contains binary Mach-O files that are used to test the `Microsoft.NET.HostModel` implementation of ad-hoc signing. | ||
|
||
To produce the binary files, run `dotnet build -t:GenerateMachOBinaries` on a macOS machine with `clang` installed. The version of `clang` used for the files in the current commit is `Apple clang version 16.0.0 (clang-1600.0.26.3)`. |