Skip to content

Commit

Permalink
WIP to build on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Aug 5, 2024
1 parent d4c2721 commit a3e453d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Enable building .NET Framework on non-Windows machines -->
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNetFrameworkReferenceAssembliesVersion)">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<ILRepackVersion>2.0.33</ILRepackVersion>
<MicrosoftNetCoreAppRefVersion>6.0.11</MicrosoftNetCoreAppRefVersion>
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.3</MicrosoftNetFrameworkReferenceAssembliesVersion>
<MicrosoftNetTestSdkVersion>17.10.0</MicrosoftNetTestSdkVersion>
<MicrosoftSourceLinkGitHubVersion>8.0.0</MicrosoftSourceLinkGitHubVersion>
<MicrosoftTestPlatformObjectModelVersion>$(MicrosoftNetTestSdkVersion)</MicrosoftTestPlatformObjectModelVersion>
Expand Down
46 changes: 46 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -euo pipefail

function write_error {
echo "error(1): $1" 2>&1
exit 1
}

function guard_bin {
builtin type -P "$1" &>/dev/null || write_error "Could not find '$1'; $2"
}

guard_bin git "please install the Git CLI from https://git-scm.com/"
guard_bin dotnet "please install the .NET SDK from https://dot.net/"

if [ `uname -o` = Msys ]; then
guard_bin msbuild.exe "please run this from a Visual Studio developer shell"
else
guard_bin mono "please install Mono from https://www.mono-project.com/"
fi

[ $(dotnet --version | cut -d. -f1) -ge 8 ] || write_error ".NET SDK version $(dotnet --version) is too low; please install version 8.0 or later from https://dot.net/"

git submodule status | while read line; do
if [ "$(echo $line | cut -b1)" == "-" ]; then
pieces=( $line )
git submodule update --init ${pieces[1]}
echo ""
fi
done

PUSHED=0

cleanup () {
if [[ $PUSHED == 1 ]]; then
popd >/dev/null
PUSHED=0
fi
}

trap cleanup EXIT ERR INT TERM

pushd $( cd "$(dirname "$0")" ; pwd -P ) >/dev/null
PUSHED=1

dotnet run --project tools/builder --no-launch-profile -- "$@"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Net.SDK">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
8 changes: 8 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
</Content>
</ItemGroup>

<!-- Enable building .NET Framework on non-Windows machines -->
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNetFrameworkReferenceAssembliesVersion)">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>

0 comments on commit a3e453d

Please sign in to comment.