Move ps1 files into cake targets (#926)
* Move build scripts from powershell to cake * - fix yaml * change BUILD_CONFIGURATION to configuration * - IsDependentOn not needed for powershell scripts * - fix up build settings * - fix android target * Update dotnet.cake * - simplify android * - add dogfood target * - fix winui build and add winui stage * - remove depends on * - maybe? * - remove gallery for now
This commit is contained in:
Родитель
9faa2a04d5
Коммит
4f9fada370
|
@ -26,6 +26,7 @@
|
|||
<BuildNonNet6ForAndroid>false</BuildNonNet6ForAndroid>
|
||||
<NonNet6Platforms Condition="'$(BuildNonNet6ForAndroid)' == 'true'">MonoAndroid10.0</NonNet6Platforms>
|
||||
<NonNet6EssentialsPlatforms Condition="'$(BuildNonNet6ForAndroid)' == 'true'">netstandard2.0;netstandard2.1;MonoAndroid10.0</NonNet6EssentialsPlatforms>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ dotnet build src\DotNet\DotNet.csproj
|
|||
# Builds the rest of Maui
|
||||
.\bin\dotnet\dotnet build Microsoft.Maui-net6.sln
|
||||
# (Windows-only) to launch Visual Studio
|
||||
.\eng\dogfood.ps1
|
||||
dotnet cake --target=VS-DOGFOOD
|
||||
```
|
||||
|
||||
To build & run .NET 6 sample apps, you will also need to use `.\bin\dotnet\dotnet`:
|
||||
|
|
257
build.cake
257
build.cake
|
@ -22,6 +22,8 @@ PowerShell:
|
|||
#addin "nuget:?package=Cake.Boots&version=1.0.4.600-preview1"
|
||||
#addin "nuget:?package=Cake.AppleSimulator&version=0.2.0"
|
||||
#addin "nuget:?package=Cake.FileHelpers&version=3.2.1"
|
||||
#load "eng/cake/dotnet.cake"
|
||||
#load "eng/cake/helpers.cake"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TOOLS
|
||||
|
@ -37,7 +39,7 @@ string agentName = EnvironmentVariable("AGENT_NAME", "");
|
|||
bool isCIBuild = !String.IsNullOrWhiteSpace(agentName);
|
||||
string artifactStagingDirectory = EnvironmentVariable("BUILD_ARTIFACTSTAGINGDIRECTORY", ".");
|
||||
string workingDirectory = EnvironmentVariable("SYSTEM_DEFAULTWORKINGDIRECTORY", ".");
|
||||
var configuration = Argument("BUILD_CONFIGURATION", "Debug");
|
||||
var configuration = GetBuildVariable("BUILD_CONFIGURATION", GetBuildVariable("configuration", "DEBUG"));
|
||||
|
||||
var target = Argument("target", "Default");
|
||||
if(String.IsNullOrWhiteSpace(target))
|
||||
|
@ -237,26 +239,27 @@ Information ("iosSDK: {0}", iosSDK);
|
|||
// TASKS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Clean")
|
||||
.Description("Deletes all the obj/bin directories")
|
||||
Task("BuildUnitTests")
|
||||
.IsDependentOn("BuildTasks")
|
||||
.Description("Builds all necessary projects to run Unit Tests")
|
||||
.Does(() =>
|
||||
{
|
||||
List<string> foldersToClean = new List<string>();
|
||||
|
||||
foreach (var item in new [] {"obj", "bin"})
|
||||
try
|
||||
{
|
||||
foreach(string f in System.IO.Directory.GetDirectories(".", item, SearchOption.AllDirectories))
|
||||
{
|
||||
if(f.StartsWith(@".\bin") || f.StartsWith(@".\tools"))
|
||||
continue;
|
||||
var msbuildSettings = GetMSBuildSettings();
|
||||
var binaryLogger = new MSBuildBinaryLogSettings {
|
||||
Enabled = isCIBuild
|
||||
};
|
||||
|
||||
// this is here as a safety check
|
||||
if(!f.StartsWith(@".\src"))
|
||||
continue;
|
||||
|
||||
CleanDirectories(f);
|
||||
}
|
||||
}
|
||||
msbuildSettings.BinaryLogger = binaryLogger;
|
||||
binaryLogger.FileName = $"{artifactStagingDirectory}/Maui.Controls-{configuration}.binlog";
|
||||
MSBuild("./Microsoft.Maui.sln", msbuildSettings.WithRestore());
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
if(IsRunningOnWindows())
|
||||
throw;
|
||||
}
|
||||
});
|
||||
|
||||
Task("provision-macsdk")
|
||||
|
@ -678,19 +681,6 @@ Task("provision")
|
|||
.IsDependentOn("provision-windowssdk")
|
||||
.IsDependentOn("provision-monosdk"); // always provision monosdk last otherwise CI might fail
|
||||
|
||||
Task("NuGetPack")
|
||||
.Description("Build and Create Nugets").Does(()=> {
|
||||
|
||||
var settings = new DotNetCoreToolSettings
|
||||
{
|
||||
DiagnosticOutput = true,
|
||||
ArgumentCustomization = args => args.Append($"./eng/package.ps1 -configuration \"{configuration}\"")
|
||||
};
|
||||
|
||||
DotNetCoreTool("pwsh", settings);
|
||||
|
||||
});;
|
||||
|
||||
Task("provision-powershell").Does(()=> {
|
||||
var settings = new DotNetCoreToolSettings
|
||||
{
|
||||
|
@ -728,144 +718,6 @@ Task("WriteGoogleMapsAPIKey")
|
|||
}
|
||||
});
|
||||
|
||||
Task("BuildForNuget")
|
||||
.IsDependentOn("BuildTasks")
|
||||
.Description("Builds all necessary projects to create Nuget Packages")
|
||||
.Does(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var msbuildSettings = GetMSBuildSettings();
|
||||
var binaryLogger = new MSBuildBinaryLogSettings {
|
||||
Enabled = isCIBuild
|
||||
};
|
||||
|
||||
msbuildSettings.BinaryLogger = binaryLogger;
|
||||
binaryLogger.FileName = $"{artifactStagingDirectory}/Maui.Controls-{configuration}.binlog";
|
||||
MSBuild(MAUI_SLN, msbuildSettings.WithRestore());
|
||||
|
||||
// // This currently fails on CI will revisit later
|
||||
// if(isCIBuild)
|
||||
// {
|
||||
// MSBuild("./Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj", GetMSBuildSettings().WithTarget("Restore"));
|
||||
// MSBuild("./Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj", GetMSBuildSettings());
|
||||
// }
|
||||
|
||||
// MSBuild(MAUI_SLN, GetMSBuildSettings().WithTarget("Restore"));
|
||||
// MSBuild("./Xamarin.Forms.DualScreen.sln", GetMSBuildSettings().WithTarget("Restore"));
|
||||
|
||||
// if(isCIBuild)
|
||||
// {
|
||||
// foreach(var platformProject in GetFiles("./Xamarin.*.UnitTests/*.csproj").Select(x=> x.FullPath))
|
||||
// {
|
||||
// if(platformProject.Contains("Xamarin.Forms.Xaml.UnitTests"))
|
||||
// continue;
|
||||
|
||||
// Information("Building: {0}", platformProject);
|
||||
// MSBuild(platformProject,
|
||||
// GetMSBuildSettings().WithRestore());
|
||||
// }
|
||||
// }
|
||||
|
||||
// MSBuild(MAUI_SLN, GetMSBuildSettings().WithTarget("Restore"));
|
||||
// MSBuild("./Xamarin.Forms.DualScreen.sln", GetMSBuildSettings().WithTarget("Restore"));
|
||||
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
|
||||
// var platformProjects =
|
||||
// GetFiles("./Xamarin.Forms.Platform.*/*.csproj")
|
||||
// .Union(GetFiles("./Stubs/*/*.csproj"))
|
||||
// .Union(GetFiles("./Xamarin.Forms.Maps.*/*.csproj"))
|
||||
// .Union(GetFiles("./Xamarin.Forms.Pages.*/*.csproj"))
|
||||
// .Union(GetFiles("./Xamarin.Forms.Material.*/*.csproj"))
|
||||
// .Union(GetFiles("./Xamarin.Forms.Core.Design/*.csproj"))
|
||||
// .Union(GetFiles("./Xamarin.Forms.Xaml.Design/*.csproj"))
|
||||
// .Select(x=> x.FullPath).Distinct()
|
||||
// .ToList();
|
||||
|
||||
// foreach(var platformProject in platformProjects)
|
||||
// {
|
||||
// if(platformProject.Contains("UnitTests"))
|
||||
// continue;
|
||||
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// string projectName = platformProject
|
||||
// .Replace(' ', '_')
|
||||
// .Split('/')
|
||||
// .Last();
|
||||
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/{projectName}-{configuration}.binlog";
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
|
||||
// Information("Building: {0}", platformProject);
|
||||
// MSBuild(platformProject,
|
||||
// msbuildSettings);
|
||||
// }
|
||||
|
||||
// dual screen
|
||||
|
||||
|
||||
// XAML Tests are currently having issues compiling in Release Mode
|
||||
// if(configuration == "Debug")
|
||||
// {
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/ControlGallery-{configuration}.binlog";
|
||||
// MSBuild(CONTROLGALLERY_SLN, msbuildSettings.WithRestore());
|
||||
// }
|
||||
|
||||
if(IsRunningOnWindows())
|
||||
{
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/dualscreen-{configuration}-csproj.binlog";
|
||||
// MSBuild("./Xamarin.Forms.DualScreen/Xamarin.Forms.DualScreen.csproj",
|
||||
// msbuildSettings
|
||||
// .WithRestore()
|
||||
// .WithTarget("rebuild"));
|
||||
|
||||
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/win-maps-{configuration}-csproj.binlog";
|
||||
// MSBuild("./Xamarin.Forms.Maps.UWP/Xamarin.Forms.Maps.UWP.csproj",
|
||||
// msbuildSettings
|
||||
// .WithProperty("UwpMinTargetFrameworks", "uap10.0.14393")
|
||||
// .WithRestore());
|
||||
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/win-{configuration}-csproj.binlog";
|
||||
// MSBuild("./src/Compatibility/Core/src/UAP/Compatibility.UAP.csproj",
|
||||
// msbuildSettings
|
||||
// .WithRestore()
|
||||
// .WithTarget("rebuild")
|
||||
// .WithProperty("DisableEmbeddedXbf", "false")
|
||||
// .WithProperty("EnableTypeInfoReflection", "false"));
|
||||
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/ios-{configuration}-csproj.binlog";
|
||||
// MSBuild("./Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj",
|
||||
// msbuildSettings
|
||||
// .WithTarget("rebuild"));
|
||||
|
||||
// msbuildSettings = GetMSBuildSettings();
|
||||
// msbuildSettings.BinaryLogger = binaryLogger;
|
||||
// binaryLogger.FileName = $"{artifactStagingDirectory}/macos-{configuration}-csproj.binlog";
|
||||
// MSBuild("./Xamarin.Forms.Platform.MacOS/Xamarin.Forms.Platform.MacOS.csproj",
|
||||
// msbuildSettings
|
||||
// .WithTarget("rebuild"));
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
if(IsRunningOnWindows())
|
||||
throw;
|
||||
}
|
||||
});
|
||||
|
||||
Task("BuildTasks")
|
||||
.Description($"Build {BUILD_TASKS_PROJ}")
|
||||
.Does(() =>
|
||||
|
@ -898,45 +750,6 @@ Task("Android100")
|
|||
.WithProperty("AndroidTargetFrameworks", "MonoAndroid10.0"));
|
||||
});
|
||||
|
||||
|
||||
Task("VS-NET6")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetCoreBuild("./src/DotNet/Dotnet.csproj");
|
||||
var ext = IsRunningOnWindows() ? ".exe" : "";
|
||||
DotNetCoreBuild("./Microsoft.Maui.BuildTasks-net6.sln", new DotNetCoreBuildSettings { ToolPath = $"./bin/dotnet/dotnet{ext}" });
|
||||
StartVisualStudioForDotNet6();
|
||||
});
|
||||
|
||||
|
||||
Task("VS-ANDROID")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetCoreBuild("./src/DotNet/Dotnet.csproj");
|
||||
var ext = IsRunningOnWindows() ? ".exe" : "";
|
||||
DotNetCoreBuild("./Microsoft.Maui.BuildTasks-net6.sln", new DotNetCoreBuildSettings { ToolPath = $"./bin/dotnet/dotnet{ext}" });
|
||||
StartVisualStudioForDotNet6("./Microsoft.Maui.Droid.sln");
|
||||
});
|
||||
|
||||
|
||||
Task("VS-WINUI")
|
||||
.IsDependentOn("Clean")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetCoreBuild("./src/DotNet/Dotnet.csproj");
|
||||
var ext = IsRunningOnWindows() ? ".exe" : "";
|
||||
|
||||
StartProcess("powershell", $"./eng/dogfood.ps1 -JustCreateGlobalJSON");
|
||||
DotNetCoreBuild("./Microsoft.Maui.BuildTasks-net6.sln", new DotNetCoreBuildSettings { ToolPath = $"./bin/dotnet/dotnet{ext}" });
|
||||
|
||||
|
||||
MSBuild("Microsoft.Maui.WinUI.sln",
|
||||
GetMSBuildSettings(includePrerelease:true).
|
||||
WithRestore());
|
||||
|
||||
StartVisualStudioForDotNet6("./Microsoft.Maui.WinUI.sln");
|
||||
});
|
||||
|
||||
Task("VS")
|
||||
.Description("Builds projects necessary so solution compiles on VS")
|
||||
.IsDependentOn("Clean")
|
||||
|
@ -1196,9 +1009,7 @@ Task ("cg-ios-deploy")
|
|||
// TASK TARGETS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("NugetPack")
|
||||
;
|
||||
Task("Default").IsDependentOn("dotnet-pack");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EXECUTION
|
||||
|
@ -1238,14 +1049,6 @@ void RunTests(string unitTestLibrary, NUnit3Settings settings, ICakeContext ctx)
|
|||
}
|
||||
}
|
||||
|
||||
T GetBuildVariable<T>(string key, T defaultValue)
|
||||
{
|
||||
// on MAC all environment variables are upper case regardless of how you specify them in devops
|
||||
// And then Environment Variable check is case sensitive
|
||||
T upperCaseReturnValue = Argument(key.ToUpper(), EnvironmentVariable(key.ToUpper(), defaultValue));
|
||||
return Argument(key, EnvironmentVariable(key, upperCaseReturnValue));
|
||||
}
|
||||
|
||||
void StartVisualStudio(string sln = "./Microsoft.Maui.sln")
|
||||
{
|
||||
if(isCIBuild)
|
||||
|
@ -1265,22 +1068,6 @@ void StartVisualStudio(string sln = "./Microsoft.Maui.sln")
|
|||
StartProcess("open", new ProcessSettings{ Arguments = sln });
|
||||
}
|
||||
|
||||
void StartVisualStudioForDotNet6(string sln = "./Microsoft.Maui-net6.sln")
|
||||
{
|
||||
if (isCIBuild)
|
||||
return;
|
||||
if (!IsRunningOnWindows())
|
||||
{
|
||||
Information("This target is only supported on Windows.");
|
||||
return;
|
||||
}
|
||||
var vsLatest = VSWhereLatest(new VSWhereLatestSettings { IncludePrerelease = true, });
|
||||
if (vsLatest == null)
|
||||
throw new Exception("Unable to find Visual Studio!");
|
||||
var devenv = vsLatest.CombineWithFilePath("./Common7/IDE/devenv.exe");
|
||||
StartProcess("powershell", $"./eng/dogfood.ps1 -vs '{devenv}' -sln '{sln}'");
|
||||
}
|
||||
|
||||
MSBuildSettings GetMSBuildSettings(
|
||||
PlatformTarget? platformTarget = PlatformTarget.MSIL,
|
||||
string buildConfiguration = null,
|
||||
|
@ -1489,4 +1276,4 @@ public string ParseDevOpsInputs(string nunitWhere)
|
|||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
tools/
|
|
@ -0,0 +1,223 @@
|
|||
// Contains .NET 6-related Cake targets
|
||||
|
||||
var ext = IsRunningOnWindows() ? ".exe" : "";
|
||||
var dotnetPath = $"./bin/dotnet/dotnet{ext}";
|
||||
|
||||
Task("dotnet")
|
||||
.Description("Provisions .NET 6 into bin/dotnet based on eng/Versions.props")
|
||||
.Does(() =>
|
||||
{
|
||||
var binlog = $"artifacts/dotnet-{configuration}.binlog";
|
||||
var settings = new DotNetCoreBuildSettings
|
||||
{
|
||||
MSBuildSettings = new DotNetCoreMSBuildSettings()
|
||||
.EnableBinaryLogger(binlog)
|
||||
.SetConfiguration(configuration),
|
||||
};
|
||||
DotNetCoreBuild("./src/DotNet/DotNet.csproj", settings);
|
||||
});
|
||||
|
||||
Task("dotnet-pack")
|
||||
.Description("Build and create .NET 6 NuGet packages")
|
||||
//.IsDependentOn("dotnet")
|
||||
// .IsDependentOn("dotnet-buildtasks")
|
||||
.Does(()=>
|
||||
{
|
||||
|
||||
var settings = new DotNetCoreToolSettings
|
||||
{
|
||||
DiagnosticOutput = true,
|
||||
ArgumentCustomization = args => args.Append($"./eng/package.ps1 -configuration \"{configuration}\"")
|
||||
};
|
||||
|
||||
DotNetCoreTool("pwsh", settings);
|
||||
|
||||
// RunMSBuildWithLocalDotNet("Microsoft.Maui-net6.sln", (settings) =>
|
||||
// {
|
||||
// if (settings is MSBuildSettings msbuildSettings)
|
||||
// {
|
||||
// msbuildSettings
|
||||
// .WithProperty("Packing", "true")
|
||||
// .WithProperty("CI", "true")
|
||||
// .WithTarget("build");
|
||||
|
||||
// }
|
||||
// else if( settings is DotNetCoreMSBuildSettings dotnetSettings )
|
||||
// {
|
||||
// dotnetSettings
|
||||
// .WithProperty("Packing", "true")
|
||||
// .WithProperty("CI", "true")
|
||||
// .WithTarget("pack");
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// if (IsRunningOnWindows())
|
||||
// {
|
||||
// RunMSBuildWithLocalDotNet("Microsoft.Maui-net6.sln", (settings) =>
|
||||
// {
|
||||
// if (settings is MSBuildSettings msbuildSettings)
|
||||
// {
|
||||
// msbuildSettings
|
||||
// .WithProperty("Packing", "true")
|
||||
// .WithProperty("CI", "true")
|
||||
// .WithTarget("pack");
|
||||
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
});
|
||||
|
||||
Task("dotnet-buildtasks")
|
||||
.IsDependentOn("dotnet")
|
||||
.Does(() =>
|
||||
{
|
||||
RunMSBuildWithLocalDotNet("./Microsoft.Maui.BuildTasks-net6.sln");
|
||||
});
|
||||
|
||||
Task("VS-DOGFOOD")
|
||||
.Description("Provisions .NET 6 and launches an instance of Visual Studio using it.")
|
||||
.IsDependentOn("dotnet")
|
||||
.Does(() =>
|
||||
{
|
||||
StartVisualStudioForDotNet6(null);
|
||||
});
|
||||
|
||||
Task("VS-NET6")
|
||||
.Description("Provisions .NET 6 and launches an instance of Visual Studio using it.")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("dotnet")
|
||||
.IsDependentOn("dotnet-buildtasks")
|
||||
.Does(() =>
|
||||
{
|
||||
StartVisualStudioForDotNet6();
|
||||
});
|
||||
|
||||
Task("VS-WINUI")
|
||||
.Description("Provisions .NET 6 and launches an instance of Visual Studio with WinUI projects.")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("dotnet")
|
||||
.IsDependentOn("dotnet-buildtasks")
|
||||
.Does(() =>
|
||||
{
|
||||
RunMSBuildWithLocalDotNet("./Microsoft.Maui.WinUI.sln");
|
||||
StartVisualStudioForDotNet6("./Microsoft.Maui.WinUI.sln");
|
||||
});
|
||||
|
||||
Task("VS-ANDROID")
|
||||
.Description("Provisions .NET 6 and launches an instance of Visual Studio with Android projects.")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("dotnet")
|
||||
.IsDependentOn("dotnet-buildtasks")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetCoreRestore("./Microsoft.Maui-net6.sln", new DotNetCoreRestoreSettings
|
||||
{
|
||||
ToolPath = dotnetPath
|
||||
});
|
||||
|
||||
StartVisualStudioForDotNet6("./Microsoft.Maui.Droid.sln");
|
||||
});
|
||||
|
||||
string FindMSBuild()
|
||||
{
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
var vsInstallation = VSWhereLatest(new VSWhereLatestSettings { Requires = "Microsoft.Component.MSBuild", IncludePrerelease = true });
|
||||
if (vsInstallation != null)
|
||||
{
|
||||
var path = vsInstallation.CombineWithFilePath(@"MSBuild\Current\Bin\MSBuild.exe");
|
||||
if (FileExists(path))
|
||||
return path.FullPath;
|
||||
|
||||
path = vsInstallation.CombineWithFilePath(@"MSBuild\15.0\Bin\MSBuild.exe");
|
||||
if (FileExists(path))
|
||||
return path.FullPath;
|
||||
}
|
||||
}
|
||||
return "msbuild";
|
||||
}
|
||||
|
||||
void SetDotNetEnvironmentVariables()
|
||||
{
|
||||
var dotnet = MakeAbsolute(Directory("./bin/dotnet/")).ToString();
|
||||
var target = EnvironmentVariableTarget.Process;
|
||||
Environment.SetEnvironmentVariable("DOTNET_INSTALL_DIR", dotnet, target);
|
||||
Environment.SetEnvironmentVariable("DOTNET_ROOT", dotnet, target);
|
||||
Environment.SetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR", dotnet, target);
|
||||
Environment.SetEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0", target);
|
||||
Environment.SetEnvironmentVariable("MSBuildEnableWorkloadResolver", "true", target);
|
||||
Environment.SetEnvironmentVariable("PATH", dotnet + System.IO.Path.PathSeparator + EnvironmentVariable("PATH"), target);
|
||||
}
|
||||
|
||||
void StartVisualStudioForDotNet6(string sln = "./Microsoft.Maui-net6.sln")
|
||||
{
|
||||
if (isCIBuild)
|
||||
{
|
||||
Information("This target should not run on CI.");
|
||||
return;
|
||||
}
|
||||
if (!IsRunningOnWindows())
|
||||
{
|
||||
Information("This target is only supported on Windows.");
|
||||
return;
|
||||
}
|
||||
|
||||
var vsLatest = VSWhereLatest(new VSWhereLatestSettings { IncludePrerelease = true, });
|
||||
if (vsLatest == null)
|
||||
throw new Exception("Unable to find Visual Studio!");
|
||||
SetDotNetEnvironmentVariables();
|
||||
Environment.SetEnvironmentVariable("_ExcludeMauiProjectCapability", "true", EnvironmentVariableTarget.Process);
|
||||
StartProcess(vsLatest.CombineWithFilePath("./Common7/IDE/devenv.exe"), sln);
|
||||
}
|
||||
|
||||
// NOTE: this method works as long as the DotNet target has already run
|
||||
void RunMSBuildWithLocalDotNet(string sln, Action<object> settings = null)
|
||||
{
|
||||
var name = System.IO.Path.GetFileNameWithoutExtension(sln);
|
||||
var binlog = $"artifacts/{name}-{configuration}.binlog";
|
||||
|
||||
// If we're not on Windows, just use ./bin/dotnet/dotnet, that's it
|
||||
if (!IsRunningOnWindows())
|
||||
{
|
||||
var dotnetBuildSettings = new DotNetCoreMSBuildSettings
|
||||
{
|
||||
BinaryLogger = new MSBuildBinaryLoggerSettings
|
||||
{
|
||||
Enabled = true,
|
||||
FileName = binlog,
|
||||
},
|
||||
};
|
||||
|
||||
settings?.Invoke(dotnetBuildSettings);
|
||||
|
||||
DotNetCoreBuild(sln,
|
||||
new DotNetCoreBuildSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
ToolPath = dotnetPath,
|
||||
MSBuildSettings = dotnetBuildSettings,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise we need to set env variables and run MSBuild
|
||||
SetDotNetEnvironmentVariables();
|
||||
var msbuildSettings = new MSBuildSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
BinaryLogger = new MSBuildBinaryLogSettings
|
||||
{
|
||||
Enabled = true,
|
||||
FileName = binlog,
|
||||
},
|
||||
ToolPath = FindMSBuild(),
|
||||
};
|
||||
|
||||
settings?.Invoke(msbuildSettings);
|
||||
|
||||
MSBuild(sln,
|
||||
msbuildSettings
|
||||
.WithRestore());
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
Task("Clean")
|
||||
.Description("Deletes all the obj/bin directories")
|
||||
.Does(() =>
|
||||
{
|
||||
List<string> foldersToClean = new List<string>();
|
||||
|
||||
foreach (var item in new [] {"obj", "bin"})
|
||||
{
|
||||
foreach(string f in System.IO.Directory.GetDirectories(".", item, SearchOption.AllDirectories))
|
||||
{
|
||||
if(f.StartsWith(@".\bin") || f.StartsWith(@".\tools"))
|
||||
continue;
|
||||
|
||||
// this is here as a safety check
|
||||
if(!f.StartsWith(@".\src"))
|
||||
continue;
|
||||
|
||||
CleanDirectories(f);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
T GetBuildVariable<T>(string key, T defaultValue)
|
||||
{
|
||||
// on MAC all environment variables are upper case regardless of how you specify them in devops
|
||||
// And then Environment Variable check is case sensitive
|
||||
T upperCaseReturnValue = Argument(key.ToUpper(), EnvironmentVariable(key.ToUpper(), defaultValue));
|
||||
return Argument(key, EnvironmentVariable(key, upperCaseReturnValue));
|
||||
}
|
119
eng/dogfood.ps1
119
eng/dogfood.ps1
|
@ -1,119 +0,0 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
*Windows-only* Launches Visual Studio with environment variables to use the local ./bin/dotnet/dotnet.exe.
|
||||
|
||||
.DESCRIPTION
|
||||
*Windows-only* Launches Visual Studio with environment variables to use the local ./bin/dotnet/dotnet.exe.
|
||||
Script based on:
|
||||
https://github.com/dotnet/runtime/blob/1be117d8e7c0cd29ebc55cbcff2a7fa70604ed39/eng/build.ps1#L186-L208
|
||||
https://github.com/dotnet/runtime/blob/1be117d8e7c0cd29ebc55cbcff2a7fa70604ed39/eng/common/tools.ps1#L109
|
||||
|
||||
.PARAMETER vs
|
||||
The path to Visual Studio or the edition (Community, Enterprise, Preview), defaults to: "Enterprise".
|
||||
|
||||
.PARAMETER sln
|
||||
The path to a .sln or .project file, defaults to "Microsoft.Maui-net6.sln".
|
||||
|
||||
.PARAMETER modify
|
||||
Modify the environment variables in the current session. This would
|
||||
allow the "dotnet" command to work instead of ".\bin\dotnet\dotnet".
|
||||
However, it would be good to do this in a new terminal session,
|
||||
since you would have trouble running "dotnet build" if it needs to
|
||||
provision .NET 6 and the iOS/Android workloads again.
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\scripts\dogfood.ps1
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\scripts\dogfood.ps1 -vs "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\scripts\dogfood.ps1 -vs "Preview"
|
||||
|
||||
.EXAMPLE
|
||||
PS> .\scripts\dogfood.ps1 -sln .\path\to\MySolution.sln
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$vs = "Enterprise",
|
||||
[string]$sln,
|
||||
[switch]$modify,
|
||||
[switch]$JustCreateGlobalJSON
|
||||
)
|
||||
|
||||
if ($vs.Contains("\") -Or $vs.Contains("/")) {
|
||||
$realVS = $vs
|
||||
} else {
|
||||
$realVS = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\$vs\Common7\IDE\devenv.exe"
|
||||
}
|
||||
|
||||
$dotnet=Join-Path $PSScriptRoot ../bin/dotnet/
|
||||
$dotnet=(Get-Item $dotnet).FullName
|
||||
|
||||
if (-Not $sln) {
|
||||
$sln=Join-Path $PSScriptRoot ../Microsoft.Maui-net6.sln
|
||||
$sln=(Get-Item $sln).FullName
|
||||
}
|
||||
|
||||
# Modify global.json, so the IDE can load
|
||||
$globaljson = Join-Path $PSScriptRoot ../global.json
|
||||
[xml] $xml = Get-Content (Join-Path $PSScriptRoot Versions.props)
|
||||
$json = Get-Content $globaljson | ConvertFrom-Json
|
||||
$json | Add-Member sdk (New-Object -TypeName PSObject) -Force
|
||||
$json.sdk | Add-Member version $xml.Project.PropertyGroup.MicrosoftDotnetSdkInternalPackageVersion -Force
|
||||
$json | ConvertTo-Json | Set-Content $globaljson
|
||||
|
||||
# NOTE: I've not found a better way to do this
|
||||
# see: https://github.com/PowerShell/PowerShell/issues/3316
|
||||
$oldDOTNET_INSTALL_DIR=$env:DOTNET_INSTALL_DIR
|
||||
$oldDOTNET_ROOT=$env:DOTNET_ROOT
|
||||
$oldDOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
|
||||
$oldDOTNET_MULTILEVEL_LOOKUP=$env:DOTNET_MULTILEVEL_LOOKUP
|
||||
$oldMSBuildEnableWorkloadResolver=$env:MSBuildEnableWorkloadResolver
|
||||
$old_ExcludeMauiProjectCapability=$env:_ExcludeMauiProjectCapability
|
||||
# $old_MSBuildDisableNodeReuse=$env:MSBuildDisableNodeReuse
|
||||
$oldPATH=$env:PATH
|
||||
|
||||
try {
|
||||
$env:DOTNET_INSTALL_DIR=$dotnet
|
||||
|
||||
# This tells .NET to use the bootstrapped runtime
|
||||
$env:DOTNET_ROOT=$env:DOTNET_INSTALL_DIR
|
||||
|
||||
# This tells MSBuild to load the SDK from the directory of the bootstrapped SDK
|
||||
$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_ROOT
|
||||
|
||||
# This tells .NET not to go looking for .NET in other places
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
# This enables workload support inside the IDE
|
||||
$env:MSBuildEnableWorkloadResolver=$true
|
||||
|
||||
# This disables the Maui @(ProjectCapability), a temporary workaround for 16.9
|
||||
$env:_ExcludeMauiProjectCapability=$true
|
||||
|
||||
# # This tells MSBuild not to keep the process around
|
||||
# $env:MSBuildDisableNodeReuse=1
|
||||
|
||||
# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
|
||||
$env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH)
|
||||
|
||||
if(-Not $JustCreateGlobalJSON)
|
||||
{
|
||||
# Launch VS
|
||||
& "$realVS" "$sln"
|
||||
}
|
||||
} finally {
|
||||
if (-Not $modify) {
|
||||
$env:DOTNET_INSTALL_DIR = $oldDOTNET_INSTALL_DIR
|
||||
$env:DOTNET_ROOT=$oldDOTNET_ROOT
|
||||
$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$oldDOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP=$oldDOTNET_MULTILEVEL_LOOKUP
|
||||
$env:MSBuildEnableWorkloadResolver=$oldMSBuildEnableWorkloadResolver
|
||||
$env:_ExcludeMauiProjectCapability=$old_ExcludeMauiProjectCapability
|
||||
# $env:MSBuildDisableNodeReuse=$oldMSBuildDisableNodeReuse
|
||||
$env:PATH=$oldPATH
|
||||
}
|
||||
}
|
||||
|
||||
exit 0
|
|
@ -36,7 +36,7 @@ steps:
|
|||
inputs:
|
||||
script: 'nuget install NUnit3TestAdapter'
|
||||
|
||||
- script: build.cmd -Target BuildForNuget -ScriptArgs '--BUILD_CONFIGURATION="$(BuildConfiguration)"','--Build_ArtifactStagingDirectory="$(Build.ArtifactStagingDirectory)"'
|
||||
- script: build.cmd -Target BuildUnitTests -ScriptArgs '--configuration="$(BuildConfiguration)"','--Build_ArtifactStagingDirectory="$(Build.ArtifactStagingDirectory)"'
|
||||
name: winbuild
|
||||
displayName: 'Build Projects For Nuget'
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@ steps:
|
|||
inputs:
|
||||
targetType: 'filePath'
|
||||
filePath: 'build.sh'
|
||||
arguments: --target cg-android --ANDROID_RENDERERS="$(renderers)" --GoogleMapsAPIKey="$(GoogleMapsAPIKey)" --BUILD_CONFIGURATION=$(BuildConfiguration)
|
||||
arguments: --target cg-android --ANDROID_RENDERERS="$(renderers)" --GoogleMapsAPIKey="$(GoogleMapsAPIKey)" --configuration=$(BuildConfiguration)
|
||||
|
||||
- task: Bash@3
|
||||
displayName: 'Build Android UITests'
|
||||
inputs:
|
||||
targetType: 'filePath'
|
||||
filePath: 'build.sh'
|
||||
arguments: --target cg-android-build-tests --BUILD_CONFIGURATION=$(BuildConfiguration)
|
||||
arguments: --target cg-android-build-tests --configuration=$(BuildConfiguration)
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Android Files for UITest'
|
||||
|
|
|
@ -52,14 +52,14 @@ steps:
|
|||
inputs:
|
||||
targetType: 'filePath'
|
||||
filePath: 'build.sh'
|
||||
arguments: --target cg-ios --BUILD_CONFIGURATION=$(BuildConfiguration)
|
||||
arguments: --target cg-ios --configuration=$(BuildConfiguration)
|
||||
|
||||
- task: Bash@3
|
||||
displayName: 'Build iOS UITests Tests'
|
||||
inputs:
|
||||
targetType: 'filePath'
|
||||
filePath: 'build.sh'
|
||||
arguments: --target cg-ios-build-tests --BUILD_CONFIGURATION=$(BuildConfiguration)
|
||||
arguments: --target cg-ios-build-tests --configuration=$(BuildConfiguration)
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy iOS Files for UITest'
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
|
||||
- task: xamops.azdevex.provisionator-task.provisionator@1
|
||||
displayName: 'Provisionator'
|
||||
condition: eq(variables['provisioning'], 'true')
|
||||
inputs:
|
||||
provisioning_script: $(provisionator.path)
|
||||
provisioning_extra_args: $(provisionator.extraArguments)
|
||||
|
||||
- powershell: |
|
||||
$(System.DefaultWorkingDirectory)/build.ps1 --target provision --TeamProject="$(System.TeamProject)"
|
||||
displayName: 'Cake Provision'
|
||||
condition: eq(variables['provisioningCake'], 'true')
|
||||
|
||||
- powershell: |
|
||||
$(System.DefaultWorkingDirectory)/build.ps1 --target VS-WINUI --TeamProject="$(System.TeamProject)"
|
||||
displayName: 'Build WinUI Solution'
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: ${{ parameters.artifactsName }}'
|
||||
condition: always()
|
||||
inputs:
|
||||
ArtifactName: WINUI
|
|
@ -51,7 +51,7 @@ steps:
|
|||
packageType: 'sdk'
|
||||
|
||||
- pwsh: |
|
||||
./build.ps1 --target=BuildTasks --BUILD_CONFIGURATION=Debug --Build_ArtifactStagingDirectory="$(Build.ArtifactStagingDirectory)"
|
||||
./build.ps1 --target=BuildTasks --configuration=Debug --Build_ArtifactStagingDirectory="$(Build.ArtifactStagingDirectory)"
|
||||
name: winbuild
|
||||
displayName: 'Build the MSBuild Tasks'
|
||||
|
||||
|
|
|
@ -131,6 +131,27 @@ stages:
|
|||
steps:
|
||||
- template: common/build-windows.yml
|
||||
|
||||
# - stage: windows_controlgallery
|
||||
# displayName: Build Windows ControlGallery
|
||||
# dependsOn: []
|
||||
# jobs:
|
||||
# - ${{ each BuildCondition in parameters.BuildConfigurations }}:
|
||||
# - job: win_hosted_${{ BuildCondition }}
|
||||
# workspace:
|
||||
# clean: all
|
||||
# displayName: Build Windows Phase (${{ BuildCondition }})
|
||||
# condition: or(
|
||||
# ${{ parameters.BuildEverything }},
|
||||
# ne(variables['Build.Reason'], 'PullRequest'),
|
||||
# eq('${{ BuildCondition }}', 'Release'))
|
||||
# timeoutInMinutes: 60
|
||||
# pool:
|
||||
# name: $(vs2019VmPool)
|
||||
# vmImage: $(vs2019VmImage)
|
||||
# demands: [ msbuild ]
|
||||
# steps:
|
||||
# - template: common/controlgallery-windows.yml
|
||||
|
||||
- stage: build_osx
|
||||
displayName: iOS
|
||||
dependsOn: []
|
||||
|
@ -211,9 +232,10 @@ stages:
|
|||
- ${{ if eq(BuildPlatform.name, 'macos') }}:
|
||||
- script: echo '##vso[task.setvariable variable=JI_JAVA_HOME]$(JAVA_HOME_11_X64)'
|
||||
displayName: set JI_JAVA_HOME
|
||||
- pwsh: ./eng/package.ps1 -configuration Release
|
||||
- script: dotnet tool restore
|
||||
displayName: install dotnet tools
|
||||
- script: dotnet cake --configuration=Release
|
||||
displayName: pack nugets
|
||||
errorActionPreference: stop
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy SignList.xml Files'
|
||||
inputs:
|
||||
|
@ -223,6 +245,13 @@ stages:
|
|||
**/Microsoft.AspNetCore.Components.WebView.Maui.*.nupkg
|
||||
**/Microsoft.AspNetCore.Components.WebView.Maui.*.snupkg
|
||||
**/SignList.xml
|
||||
TargetFolder: $(build.artifactstagingdirectory)
|
||||
flattenFolders: true
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Bin Log Files'
|
||||
condition: always()
|
||||
inputs:
|
||||
Contents: |
|
||||
**/*.binlog
|
||||
TargetFolder: $(build.artifactstagingdirectory)
|
||||
flattenFolders: true
|
||||
|
|
|
@ -6,6 +6,7 @@ using WImageSource = Microsoft.UI.Xaml.Media.ImageSource;
|
|||
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.UWP;
|
||||
using Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
|
||||
[assembly: ExportRenderer(typeof(_51173Image), typeof(_51173CustomImageRenderer))]
|
||||
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI
|
||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.Maui.Controls.Compatibility.Platform.UWP;
|
|||
using Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues;
|
||||
using Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI;
|
||||
using Bitmap = Microsoft.UI.Xaml.Media.ImageSource;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
|
||||
[assembly: Dependency(typeof(_13109IssueHelper))]
|
||||
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;$(MauiPlatforms)</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;netstandard2.1;$(MauiPlatforms)</TargetFrameworks>
|
||||
<RootNamespace>Microsoft.Maui.Controls</RootNamespace>
|
||||
<AssemblyName>Microsoft.Maui.Controls</AssemblyName>
|
||||
<Nullable>disable</Nullable>
|
||||
|
|
Загрузка…
Ссылка в новой задаче