Skip to content

Commit 2cef9a1

Browse files
committed
[WIP] More dotnet build support for unix
1 parent ab276dc commit 2cef9a1

File tree

8 files changed

+40
-15
lines changed

8 files changed

+40
-15
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _PREPARE_CI_MODE_ARGS = $(_PREPARE_CI_MODE_PR_ARGS) -a
2222
_PREPARE_ARGS =
2323

2424
all:
25-
$(call MSBUILD_BINLOG,all,$(_SLN_BUILD)) /restore $(MSBUILD_FLAGS) $(SOLUTION)
25+
$(call DOTNET_BINLOG,all) $(MSBUILD_FLAGS) $(SOLUTION) -m:1
2626
$(call MSBUILD_BINLOG,all,$(_SLN_BUILD)) /restore $(MSBUILD_FLAGS) tools/xabuild/xabuild.csproj
2727

2828
-include bin/Build$(CONFIGURATION)/rules.mk
@@ -97,7 +97,7 @@ all-tests::
9797
MSBUILD="$(MSBUILD)" $(call MSBUILD_BINLOG,all-tests,tools/scripts/xabuild) /restore $(MSBUILD_FLAGS) Xamarin.Android-Tests.sln
9898

9999
pack-dotnet::
100-
$(call MSBUILD_BINLOG,pack-dotnet,$(_SLN_BUILD)) $(MSBUILD_FLAGS) Xamarin.Android.sln /t:PackDotNet
100+
$(call DOTNET_BINLOG,pack-dotnet) $(MSBUILD_FLAGS) $(SOLUTION) -m:1 -t:PackDotNet
101101

102102
install::
103103
@if [ ! -d "bin/$(CONFIGURATION)" ]; then \
@@ -141,7 +141,7 @@ run-all-tests:
141141
exit $$_r
142142

143143
clean:
144-
$(call MSBUILD_BINLOG,clean) /t:Clean Xamarin.Android.sln
144+
$(call DOTNET_BINLOG,clean) -t:Clean $(SOLUTION) -m:1
145145
tools/scripts/xabuild $(MSBUILD_FLAGS) /t:Clean Xamarin.Android-Tests.sln
146146

147147
distclean:

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,28 @@
1919
<ProjectReference Include="..\..\external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj" />
2020
</ItemGroup>
2121

22+
<!-- See https://github.com/xamarin/xamarin-android/commit/ceca993068c0401f664676db85edec1d772bf5ff -->
23+
<ItemGroup>
24+
<None Include="$(PkgMono_Unix)\runtimes\linux-x64\native\libMono.Unix.so" CopyToOutputDirectory="PreserveNewest" />
25+
<_MonoUnixDylib Include="$(PkgMono_Unix)\runtimes\osx-arm64\native\libMono.Unix.dylib" Condition=" '$(HostOS)' == 'Darwin' " />
26+
<_MonoUnixDylib Include="$(PkgMono_Unix)\runtimes\osx-x64\native\libMono.Unix.dylib" />
27+
</ItemGroup>
28+
<PropertyGroup>
29+
<_MonoUnixOutputDylib>$(OutputPath)$(TargetFrameworkNETStandard)\libMono.Unix.dylib</_MonoUnixOutputDylib>
30+
</PropertyGroup>
31+
<Target Name="_MakeMonoUnixFatBinariesOSX"
32+
AfterTargets="CopyFilesToOutputDirectory"
33+
Inputs="@(_MonoUnixDylib)"
34+
Outputs="$(_MonoUnixOutputDylib)">
35+
<Exec
36+
Command="lipo @(_MonoUnixDylib->'&quot;%(FullPath)&quot;', ' ') -create -output &quot;$(_MonoUnixOutputDylib)&quot;"
37+
Condition=" '$(HostOS)' == 'Darwin' "
38+
/>
39+
<Copy
40+
SourceFiles="@(_MonoUnixDylib)"
41+
DestinationFolder="$(OutputPath)"
42+
Condition=" '$(HostOS)' != 'Darwin' "
43+
/>
44+
</Target>
45+
2246
</Project>

build-tools/scripts/BuildEverything.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ ifneq ("$(wildcard $(topdir)/external/monodroid/Makefile)","")
2222
cd $(topdir)/external/monodroid && ./configure --with-xamarin-android='$(topdir)'
2323
cd $(topdir)/external/monodroid && $(MAKE) build-monodroid CONFIGURATION=$(CONFIGURATION) XAMARIN_ANDROID_PATH=$(topdir)
2424
endif
25-
$(MAKE) leeroy $(ZIP_OUTPUT)
25+
$(MAKE) leeroy
2626

2727
leeroy: leeroy-all framework-assemblies
2828

2929
leeroy-all:
30-
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore $(SOLUTION) /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)
30+
$(call DOTNET_BINLOG,leeroy-all) $(SOLUTION) -m:1 $(_MSBUILD_ARGS)
3131
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore tools/xabuild/xabuild.csproj /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)

build-tools/scripts/Packaging.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ create-nupkgs:
1111
$(call DOTNET_BINLOG,create-all-packs) -t:CreateAllPacks $(topdir)/build-tools/create-packs/Microsoft.Android.Sdk.proj
1212

1313
create-pkg:
14-
MONO_IOMAP=all MONO_OPTIONS="$(MONO_OPTIONS)" $(call MSBUILD_BINLOG,create-pkg) /p:Configuration=$(CONFIGURATION) /t:CreatePkg \
14+
$(call DOTNET_BINLOG,create-pkg) /t:CreatePkg \
1515
build-tools/create-pkg/create-pkg.csproj \
1616
$(if $(PACKAGE_VERSION),/p:ProductVersion="$(PACKAGE_VERSION)") \
1717
$(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \
@@ -21,10 +21,12 @@ create-pkg:
2121
$(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)")
2222

2323
create-workload-installers:
24-
MONO_IOMAP=all MONO_OPTIONS="$(MONO_OPTIONS)" $(call MSBUILD_BINLOG,create-workload-installers) /p:Configuration=$(CONFIGURATION) /t:CreateWorkloadInstallers \
24+
$(call DOTNET_BINLOG,create-workload-installers) /t:CreateWorkloadInstallers \
2525
Xamarin.Android.sln \
2626
$(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)")
2727

28+
# create-vsix.csproj dependencies do not yet support `dotnet build`:
29+
# .nuget/packages/microsoft.vssdk.buildtools/17.0.4207-preview4/build/Microsoft.VSSDK.BuildTools.targets(16,5): error MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild.
2830
create-vsix:
2931
MONO_IOMAP=all MONO_OPTIONS="$(MONO_OPTIONS)" $(call MSBUILD_BINLOG,create-vsix) /p:Configuration=$(CONFIGURATION) /p:CreateVsixContainer=True \
3032
build-tools/create-vsix/create-vsix.csproj \

build-tools/xaprepare/xaprepare/Application/GeneratedMakeRulesFile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ void Generate (Context context, StreamWriter sw)
129129
WriteRuleLine ( "if [ $$? -ne 0 ] ; then \\");
130130
WriteRuleLine ($"\trm -f {redistFile}; \\");
131131
WriteRuleLine ( "fi; \\");
132-
WriteRuleLine ( "$(call MSBUILD_BINLOG,Mono.Android,$(_SLN_BUILD)) src/Mono.Android/Mono.Android.csproj \\");
133-
WriteRuleLine ( "\t/p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS) \\");
132+
WriteRuleLine ( "$(call DOTNET_BINLOG,Mono.Android) src/Mono.Android/Mono.Android.csproj \\");
133+
WriteRuleLine ( "\t$(_MSBUILD_ARGS) \\");
134134
WriteRuleLine ($"\t/p:AndroidApiLevel={apiLevel} /p:AndroidPlatformId={platformId} /p:AndroidFrameworkVersion={curVersion} \\");
135135
WriteRuleLine ($"\t/p:AndroidPreviousFrameworkVersion={prevVersion} || exit 1;");
136136

@@ -170,8 +170,8 @@ void Generate (Context context, StreamWriter sw)
170170
void WriteMSBuildCall (string fileToRemovePath, string projectPath)
171171
{
172172
WriteRuleLine ($"rm -f {fileToRemovePath}");
173-
WriteRuleLine ($"$(call MSBUILD_BINLOG,NUnitLite,$(_SLN_BUILD)) $(MSBUILD_FLAGS) {projectPath} \\");
174-
WriteRuleLine ( "\t/p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS) \\");
173+
WriteRuleLine ($"$(call DOTNET_BINLOG,NUnitLite) $(MSBUILD_FLAGS) {projectPath} \\");
174+
WriteRuleLine ( "\t$(_MSBUILD_ARGS) \\");
175175
WriteRuleLine ($"\t/p:AndroidApiLevel={firstApiLevel} /p:AndroidPlatformId={firstPlatformId} \\");
176176
WriteRuleLine ($"\t/p:AndroidFrameworkVersion={firstFramework} || exit 1;");
177177
}

external/debugger-libs

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@
316316
<Target Name="ILRepacker"
317317
BeforeTargets="CopyFilesToOutputDirectory"
318318
Inputs="$(MSBuildAllProjects);@(IntermediateAssembly);@(InputAssemblies)"
319-
Outputs="$(IntermediateOutputPath)ILRepacker.stamp"
320-
Condition=" '$(HostOS)' != 'Linux' ">
319+
Outputs="$(IntermediateOutputPath)ILRepacker.stamp" >
321320
<ItemGroup>
322321
<_InputAssembliesThatExist Include="@(InputAssemblies)" Condition="Exists('%(Identity)')" />
323322
<_NetstandardPath Include="@(ReferencePath->'%(RootDir)%(Directory)')" Condition="'%(FileName)%(Extension)' == 'netstandard.dll'" />

tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Target Name="_RemapAssemblies"
44
AfterTargets="Build"
5-
Condition=" '$(TargetFramework)' != '' ">
5+
Condition=" '$(TargetFramework)' == 'net472' ">
66
<ItemGroup>
77
<_Source Include="$(OutputPath)Mono.Debugging.Soft.dll">
88
<From>Mono.Cecil</From>

0 commit comments

Comments
 (0)