Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 additions & 1 deletion tools/sharpie/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ SHARPIE_BIND_TOOL_NUGET_VERSION=$(if $(filter 0,$(XCODE_BUMP_COMMIT_DISTANCE)),$
SHARPIE_BIND_TOOL_NUPKG_NAME=Sharpie.Bind.Tool.$(SHARPIE_BIND_TOOL_NUGET_VERSION).nupkg
SHARPIE_BIND_TOOL_NUPKG=Sharpie.Bind.Tool/bin/Release/$(SHARPIE_BIND_TOOL_NUPKG_NAME)

SHARPIE_BIND_TOOL_X64_SHIM=Sharpie.Bind.Tool.Unsupported/bin/Release/osx-x64/publish/Sharpie.Bind.Tool

pack: $(SHARPIE_BIND_TOOL_NUPKG)
$(SHARPIE_BIND_TOOL_NUPKG): $(Sharpie.Bind_dependencies)
$(SHARPIE_BIND_TOOL_NUPKG): $(Sharpie.Bind_dependencies) $(SHARPIE_BIND_TOOL_X64_SHIM)
$(Q_BUILD) $(DOTNET) pack Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj "/p:Version=$(SHARPIE_VERSION)" "/p:CurrentBranch=$(CURRENT_BRANCH)" "/p:CurrentHash=$(CURRENT_HASH_LONG)" $(DOTNET_PACK_VERBOSITY) -bl:$@.binlog

$(SHARPIE_BIND_TOOL_X64_SHIM):
$(Q_BUILD) $(DOTNET) publish Sharpie.Bind.Tool.Unsupported/Sharpie.Bind.Tool.Unsupported.csproj -c Release $(DOTNET_BUILD_VERBOSITY) -bl:$@.binlog

Comment on lines +23 to +31
all-local:: $(DOTNET_NUPKG_DIR)/$(SHARPIE_BIND_TOOL_NUPKG_NAME)
$(DOTNET_NUPKG_DIR)/$(SHARPIE_BIND_TOOL_NUPKG_NAME): $(SHARPIE_BIND_TOOL_NUPKG)
$(Q) mkdir -p $(dir $@)
Expand Down
13 changes: 13 additions & 0 deletions tools/sharpie/Sharpie.Bind.Tool.Unsupported/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

class Program {
static int Main (string [] args)
{
Console.Error.WriteLine ("error: sharpie is not supported on x64. Please use an Apple Silicon (arm64) Mac.");
Console.Error.WriteLine ();
Console.Error.WriteLine ("sharpie requires Apple's libclang, which is only available for arm64.");
Console.Error.WriteLine ("If you're running on an Intel Mac, consider using a Mac with Apple Silicon (M1 or later).");
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<PublishAot>true</PublishAot>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AssemblyName>Sharpie.Bind.Tool</AssemblyName>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<DotNetCliTool Version="2">
<Commands>
<Command Name="sharpie" EntryPoint="Sharpie.Bind.Tool" Runner="executable" />
</Commands>
</DotNetCliTool>
19 changes: 18 additions & 1 deletion tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<!-- packing options -->
<!-- there's no x64 version of libClang, so we're only supporting arm64 -->
<!-- there's no x64 version of libClang, so only arm64 is fully functional -->
<!-- an x64 shim is included that prints a helpful error message -->
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
<PackAsTool>true</PackAsTool>
<ToolCommandName>sharpie</ToolCommandName>
Expand Down Expand Up @@ -50,4 +51,20 @@
<None Include="../../../LICENSE" Pack="true" PackagePath="/"/>
<None Include="../../../NOTICE.txt" Pack="true" PackagePath="/"/>
</ItemGroup>

<!-- Include the x64 shim in the nupkg so that x64 users get a helpful error message -->
<PropertyGroup>
<_X64ShimPublishDir>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..', 'Sharpie.Bind.Tool.Unsupported', 'bin', 'Release', 'osx-x64', 'publish'))</_X64ShimPublishDir>
</PropertyGroup>

<Target Name="_IncludeX64Shim" AfterTargets="PackTool" Condition="'$(PackAsTool)' == 'true'">
<ItemGroup>
<TfmSpecificPackageFile Include="$(_X64ShimPublishDir)/Sharpie.Bind.Tool">
<PackagePath>tools/any/osx-x64/</PackagePath>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)DotnetToolSettings.osx-x64.xml">
<PackagePath>tools/any/osx-x64/DotnetToolSettings.xml</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
Comment on lines +55 to +68
</Target>
</Project>
Loading