Skip to content

Commit

Permalink
Merge pull request #4111 from radical/msbuild-port
Browse files Browse the repository at this point in the history
[msbuild] Move from xbuild to msbuild
  • Loading branch information
rolfbjarne authored Oct 15, 2018
2 parents 904be25 + 5fbfacc commit 250fd97
Show file tree
Hide file tree
Showing 39 changed files with 328 additions and 257 deletions.
2 changes: 1 addition & 1 deletion Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ SYSTEM_CSC=$(MONO_PREFIX)/bin/csc
SYSTEM_SN=$(MONO_PREFIX)/bin/sn
SYSTEM_MONO=$(MONO_PREFIX)/bin/mono
SYSTEM_MONO32=$(MONO_PREFIX)/bin/mono32
SYSTEM_XBUILD=$(MONO_PREFIX)/bin/xbuild
SYSTEM_XBUILD=$(MONO_PREFIX)/bin/msbuild
SYSTEM_MSBUILD=unset MSBuildExtensionsPath && $(MONO_PREFIX)/bin/msbuild
SYSTEM_RESGEN=$(MONO_PREFIX)/bin/resgen

Expand Down
4 changes: 2 additions & 2 deletions fsharp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ build/%.dll: $(BIN_DIR)/%.dll | build/monotouch build/xamarinmacmobile build/xam
$(Q) cp $< $@
$(Q_SN) MONO_CFG_DIR="$(TOP)" sn -q -R "$@" "$(PRODUCT_KEY_PATH)"

build.stamp: export XBUILD_FRAMEWORK_FOLDERS_PATH=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks
build.stamp: export MSBuildExtensionsPath=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild
build.stamp: export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks
build.stamp: export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild
build.stamp: $(FSHARP_FILES) $(FSHARP_PATH)/Makefile
$(MAKE) -C $(FSHARP_PATH)/src/fsharp build-proto
$(MAKE) -C $(FSHARP_PATH)/src/fsharp $(FSHARP_BUILD_TARGETS)
Expand Down
11 changes: 5 additions & 6 deletions msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build" HintPath="$(MSBuildBinPath)\Microsoft.Build.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand All @@ -53,4 +52,4 @@
<Name>Xamarin.MacDev.Tasks.Core</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
9 changes: 4 additions & 5 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build" HintPath="$(MSBuildBinPath)\Microsoft.Build.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Tasks\ACTool.cs" />
Expand Down
1 change: 0 additions & 1 deletion msbuild/Xamarin.MacDev.Tasks.Core/MsBuildTasks/CopyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
public abstract class CopyBase : Copy
{
public string SessionId { get; set; }
public bool UseSymboliclinksIfPossible { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="Mono.Posix" />
Expand Down
7 changes: 3 additions & 4 deletions msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="Mono.Cecil, Version=0.9.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static bool TryRunMSBuildGetPropertyValueTarget (string path, string propertyNam
arguments = string.Format ("{0} /p:TargetFrameworkIdentifier={1}", arguments, targetFrameworkIdentifier);
}

var psi = new ProcessStartInfo ("/Library/Frameworks/Mono.framework/Commands/xbuild", arguments);
var psi = new ProcessStartInfo ("/Library/Frameworks/Mono.framework/Commands/msbuild", arguments);

psi.UseShellExecute = false;
psi.RedirectStandardError = true;
Expand Down
9 changes: 4 additions & 5 deletions msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build" HintPath="$(MSBuildBinPath)\Microsoft.Build.dll" />
<Reference Include="System" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Framework" HintPath="$(MSBuildBinPath)\Microsoft.Build.Framework.dll" />
<Reference Include="Microsoft.Build.Utilities.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Utilities.Core.dll" />
<Reference Include="Microsoft.Build.Tasks.Core" HintPath="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void BuildTest ()
AppBundlePath = mtouchPaths.AppBundlePath;
var dllPath = Path.Combine(mtouchPaths.ProjectBinPath, "bindings-test.dll");

Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);

RunTarget (proj, "Build", 0);
Assert.IsTrue (File.Exists (dllPath), "{1} binding dll does not exist: {0} ", dllPath, Platform);
Expand All @@ -43,7 +43,7 @@ public void FrameworkTest ()
AppBundlePath = mtouchPaths.AppBundlePath;
var dllPath = Path.Combine(mtouchPaths.ProjectBinPath, "bindings-test.dll");

Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);

RunTarget (proj, "Build", 0);
Assert.IsTrue (File.Exists (dllPath), "{1} binding dll does not exist: {0} ", dllPath, Platform);
Expand Down
11 changes: 6 additions & 5 deletions msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System.Linq;
using System.Collections;

using NUnit.Framework;
using Microsoft.Build.Evaluation;

using Microsoft.Build.BuildEngine;
using NUnit.Framework;

namespace Xamarin.iOS.Tasks
{
Expand All @@ -30,8 +30,8 @@ public void TestACToolTaskCatchesJsonException ()
var project = SetupProject (Engine, csproj);

AppBundlePath = mtouchPaths ["app_bundlepath"];
Engine.GlobalProperties.SetProperty("Platform", platform);
Engine.GlobalProperties.SetProperty("Configuration", config);
Engine.ProjectCollection.SetGlobalProperty("Platform", platform);
Engine.ProjectCollection.SetGlobalProperty("Configuration", config);

if (clean) {
RunTarget (project, "Clean");
Expand All @@ -56,8 +56,9 @@ public void TestACToolTaskCatchesJsonException ()
}

project = SetupProject (Engine, mtouchPaths.ProjectCSProjPath);
var projectInstance = project.CreateProjectInstance ();

Engine.BuildProject (project, new [] { target }, new Hashtable { {"Platform", "iPhone"} }, BuildSettings.None);
Engine.BuildProject (projectInstance, new [] { target }, new Hashtable { {"Platform", "iPhone"} });
if (Engine.Logger.ErrorEvents.Count != 1) {
string messages = string.Empty;
if (Engine.Logger.ErrorEvents.Count > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void BuildExtension (string hostAppName, string extensionName, string bun

AppBundlePath = mtouchPaths ["app_bundlepath"];
string extensionPath = Path.Combine(AppBundlePath, "PlugIns", extensionName + ".appex");
Engine.GlobalProperties.SetProperty ("Platform", platform);
Engine.GlobalProperties.SetProperty ("Configuration", config);
Engine.ProjectCollection.SetGlobalProperty ("Platform", platform);
Engine.ProjectCollection.SetGlobalProperty ("Configuration", config);

RunTarget (proj, "Clean");
Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, bundlePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void InvalidBundleIdTest ()
File.WriteAllText (appInfoPath, appInfoContents.Replace ("<string>com.xamarin.MyWatchApp</string>", "<string>com.xamarin.MyWatchAppX</string>"));

var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath);
Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);
AppBundlePath = mtouchPaths ["app_bundlepath"];
RunTarget (proj, "Build", 2);
Assert.AreEqual ("The App Extension 'WatchExtension' has an invalid CFBundleIdentifier (com.xamarin.MyWatchApp.WatchExtension), it does not begin with the main app bundle's CFBundleIdentifier (com.xamarin.MyWatchAppX).", Engine.Logger.ErrorEvents [0].Message, "#1");
Expand All @@ -73,12 +73,12 @@ public void CreateIpa ()

AppBundlePath = mtouchPaths.AppBundlePath;

Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.GlobalProperties.SetProperty ("BuildIpa", "true");
Engine.GlobalProperties.SetProperty ("IpaIncludeArtwork", "true");
Engine.GlobalProperties.SetProperty ("CodesignProvision", "Automatic"); // Provisioning profile
Engine.GlobalProperties.SetProperty ("CodesignKey", "iPhone Developer");
Engine.GlobalProperties.SetProperty ("Configuration", configuration);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("BuildIpa", "true");
Engine.ProjectCollection.SetGlobalProperty ("IpaIncludeArtwork", "true");
Engine.ProjectCollection.SetGlobalProperty ("CodesignProvision", "Automatic"); // Provisioning profile
Engine.ProjectCollection.SetGlobalProperty ("CodesignKey", "iPhone Developer");
Engine.ProjectCollection.SetGlobalProperty ("Configuration", configuration);

RunTarget (proj, "Clean");
Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, Platform);
Expand Down Expand Up @@ -115,7 +115,7 @@ public void CreateIpa ()
string wkPath = "WatchKitSupport/WK";
Assert.Contains (wkPath, lines, wkPath + " does not exist");

var ipaIncludeArtwork = proj.GetEvaluatedProperty ("IpaIncludeArtwork");
var ipaIncludeArtwork = proj.GetPropertyValue ("IpaIncludeArtwork");
Assert.IsTrue (output.Contains ("iTunesMetadata.plist"), string.Format ("The ipa should contain at least one iTunesMetadata.plist file if we are using an AppStore config and IpaIncludeArtwork is true. IpaIncludeArtwork: {0}", ipaIncludeArtwork));

RunTarget (proj, "Clean");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using NUnit.Framework;

namespace Xamarin.iOS.Tasks {
Expand All @@ -16,12 +17,12 @@ public void BasicTest ()
{
var mtouchPaths = SetupProjectPaths ("MyTabbedApplication", "../", true, Platform);

Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);

var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath);
var nr = proj.AddNewItem ("NativeReference", Path.Combine (".", "..", "..", "..", "tests", "test-libraries", ".libs", "ios", "XTest.framework"));
nr.SetMetadata ("IsCxx", "False");
nr.SetMetadata ("Kind", "Framework");
var nr = proj.AddItem ("NativeReference", Path.Combine (".", "..", "..", "..", "tests", "test-libraries", ".libs", "ios", "XTest.framework")).First ();
nr.SetMetadataValue ("IsCxx", "False");
nr.SetMetadataValue ("Kind", "Framework");

AppBundlePath = mtouchPaths.AppBundlePath;

Expand All @@ -40,14 +41,14 @@ public void WithIncrementalBuilds ()

var mtouchPaths = SetupProjectPaths ("MyiOSAppWithBinding", "../", true, Platform);

Engine.GlobalProperties.SetProperty ("Platform", Platform);
Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform);

var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath);

proj.GlobalProperties.SetProperty ("MtouchFastDev", "true");
proj.GlobalProperties.SetProperty ("MtouchExtraArgs", "-vvvv");
proj.GlobalProperties.SetProperty ("MtouchArch", "ARM64"); // only use ARM64 to speed up the build.
proj.GlobalProperties.SetProperty ("MtouchLink", "Full"); // also to speed up the build.
proj.SetGlobalProperty ("MtouchFastDev", "true");
proj.SetGlobalProperty ("MtouchExtraArgs", "-vvvv");
proj.SetGlobalProperty ("MtouchArch", "ARM64"); // only use ARM64 to speed up the build.
proj.SetGlobalProperty ("MtouchLink", "Full"); // also to speed up the build.

AppBundlePath = mtouchPaths.AppBundlePath;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public string BuildProject (string appName, string platform, string config, int
var proj = SetupProject (Engine, csproj);

AppBundlePath = mtouchPaths ["app_bundlepath"];
Engine.GlobalProperties.SetProperty("Platform", platform);
Engine.GlobalProperties.SetProperty("Configuration", config);
Engine.ProjectCollection.SetGlobalProperty("Platform", platform);
Engine.ProjectCollection.SetGlobalProperty("Configuration", config);

if (clean) {
RunTarget (proj, "Clean");
Expand Down
Loading

1 comment on commit 250fd97

@spouliot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.