Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workloads: Additional Checks #7679

Merged
merged 4 commits into from
Aug 6, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

namespace Microsoft.DotNet.Build.Tasks.Workloads.Tests
{
public class GenerateManifestMsiTests
{
[WindowsOnlyFact]
public void ItThrowsIfPayloadRelativePathIsTooLong()
{
var task = new GenerateManifestMsi();
task.MsiVersion = "1.2.3.11111";

Exception e = Assert.Throws<Exception>(() => task.GenerateSwixPackageAuthoring(@"C:\Foo\Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100.6.0.0-preview.7.21377.12-x64.msi",
"Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100", "x64"));
Assert.Equal(@"Payload relative path exceeds max length (182): Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100,version=1.2.3,chip=x64,productarch=neutral\Microsoft.NET.Workload.Mono.ToolChain.Manifest-6.0.100.6.0.0-preview.7.21377.12-x64.msi", e.Message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Linq;
using Microsoft.Arcade.Test.Common;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xunit;

namespace Microsoft.DotNet.Build.Tasks.Workloads.Tests
Expand All @@ -20,6 +20,42 @@ public class GenerateVisualStudioWorkloadTests

public string TestIntermediateBaseOutputPath => Path.Combine(IntermediateBaseOutputPath, Path.GetFileNameWithoutExtension(Path.GetTempFileName()));

[Fact]
public void ItIgnoresNotApplicableAliasedPacks()
{
string workloadManifest = Path.Combine(AppContext.BaseDirectory, "testassets", "AbstractWorkloadsNonWindowsPacks.json");

var buildTask = new GenerateVisualStudioWorkload()
{
WorkloadManifests = new TaskItem[]
{
new TaskItem(workloadManifest)
},
ComponentVersions = new TaskItem[]
{
new TaskItem("microsoft-net-runtime-ios", new Dictionary<string, string> { { "Version", "6.5.38766" } }),
new TaskItem("runtimes-ios", new Dictionary<string, string> { { "Version", "6.5.38766" } }),
new TaskItem("microsoft-net-runtime-mono-tooling", new Dictionary<string, string> { { "Version", "6.5.38766" } }),
},
GenerateMsis = false,
IntermediateBaseOutputPath = TestIntermediateBaseOutputPath,
WixToolsetPath = "",
BuildEngine = new MockBuildEngine()
};

Assert.True(buildTask.Execute());
string outputPath = Path.GetDirectoryName(buildTask.SwixProjects[0].GetMetadata("FullPath"));
string componentSwr = File.ReadAllText(Path.Combine(outputPath, "component.swr"));

Assert.Contains(@"package name=microsoft.net.runtime.ios", componentSwr);
Assert.DoesNotContain(@"vs.dependency id=Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm", componentSwr);
Assert.DoesNotContain(@"vs dependency id=Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64", componentSwr);
Assert.DoesNotContain(@"vs dependency id=Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64", componentSwr);
Assert.DoesNotContain(@"vs dependency id=Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64", componentSwr);
Assert.DoesNotContain(@"vs dependency id=Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86", componentSwr);
Assert.Contains(@"vs.dependency id=runtimes.ios", componentSwr);
}

[Fact]
public void ItGeneratesASwixProjectFromAWorkloadManifest()
{
Expand Down
19 changes: 19 additions & 0 deletions src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Xunit;

namespace Microsoft.DotNet.Build.Tasks.Workloads.Tests
{
public class WindowsOnlyFactAttribute : FactAttribute
{
public WindowsOnlyFactAttribute()
{
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
Skip = "Not running on Windows";
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"version": "6.0.0-preview.7.21358.4",
"depends-on": {
"Microsoft.NET.Workload.Emscripten": "6.0.0-preview.7.21330.1"
},
"workloads": {
"microsoft-net-runtime-ios": {
"abstract": true,
"description": "iOS Mono Runtime and AOT Workload",
"packs": [
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm",
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64",
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86"
],
"extends": [ "runtimes-ios" ],
"platforms": [ "win-x64", "osx-arm64", "osx-x64" ]
},
"runtimes-ios": {
"abstract": true,
"description": "iOS Mono Runtime Packs",
"packs": [
"Microsoft.NETCore.App.Runtime.Mono.ios-arm",
"Microsoft.NETCore.App.Runtime.Mono.ios-arm64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64",
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86"
],
"extends": [ "microsoft-net-runtime-mono-tooling" ],
"platforms": [ "win-x64", "osx-arm64", "osx-x64" ]
},
"microsoft-net-runtime-mono-tooling": {
"abstract": true,
"description": "Shared native build tooling for Mono runtime",
"packs": [
"Microsoft.NET.Runtime.MonoAOTCompiler.Task",
"Microsoft.NET.Runtime.MonoTargets.Sdk"
]
},
},
"packs": {
"Microsoft.NET.Runtime.MonoAOTCompiler.Task": {
"kind": "Sdk",
"version": "2.3.4.5"
},
"Microsoft.NET.Runtime.MonoTargets.Sdk": {
"kind": "Sdk",
"version": "2.3.4.5"
},
"Microsoft.NET.Runtime.WebAssembly.Sdk": {
"kind": "Sdk",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.android-arm": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.android-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.android-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.android-x86": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86",
"linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x86",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x86"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x64",
"linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x64",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm",
"linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-arm",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64",
"linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-arm64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm64",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm64"
}
},
"Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.osx-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.osx-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.osx-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.osx-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.ios-arm": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.ios-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.tvos-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64"
}
},
"Microsoft.NETCore.App.Runtime.Mono.tvos-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.tvossimulator-arm64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.Mono.tvossimulator-x64": {
"kind": "framework",
"version": "2.3.4.5"
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-arm64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-arm64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-x64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-arm64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-arm64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-x64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-x64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-arm64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-arm64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x64",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x64"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x86",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x86"
}
},
"Microsoft.NETCore.App.Runtime.AOT.Cross.browser-wasm": {
"kind": "Sdk",
"version": "2.3.4.5",
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm",
"linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm",
"osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm",
"osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm"
}
},
"Microsoft.NETCore.App.Runtime.Mono.browser-wasm": {
"kind": "framework",
"version": "2.3.4.5"
}
}
}
Loading