diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11fcb626..e64bb211 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: - release/** jobs: - build: + build_tool: name: Build runs-on: windows-latest steps: @@ -62,7 +62,7 @@ jobs: testwin: name: Validate Tool - Windows - ${{ matrix.manifest_name }} - needs: build + needs: build_tool runs-on: windows-latest strategy: @@ -72,6 +72,14 @@ jobs: manifest_name: Stable - manifest: 'manifests\uno.ui-preview.manifest.json' manifest_name: Preview + - manifest: 'manifests\uno.ui.manifest.json' + manifest_name: Stable Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '' + - manifest: 'manifests\uno.ui-preview.manifest.json' + manifest_name: Preview Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '--pre' steps: - name: Checkout @@ -101,6 +109,17 @@ jobs: useConfigFile: true configFilePath: gitversion.yml + - name: Install and Run Previous Tool + if: ${{ contains(matrix.previous_tool_version, '.') }} + shell: pwsh + run: | + Write-Output "PACKAGE VERSION: ${{ steps.gitversion.outputs.semVer }}" + $ProgressPreference = 'SilentlyContinue' + & dotnet --list-sdks + & dotnet tool install --global --version ${{ matrix.previous_tool_version }} uno.check + & uno-check --ci --fix --non-interactive --verbose --skip xcode --skip vswin --skip vsmac --skip wsl --skip edgewebview2 ${{ matrix.previous_tool_params }} + & dotnet tool uninstall --global uno.check + - name: Install and Run Tool shell: pwsh run: | @@ -112,7 +131,7 @@ jobs: testmac: name: Validate Tool - macOS - ${{ matrix.manifest_name }}/${{ matrix.os }} - needs: build + needs: build_tool strategy: matrix: @@ -136,7 +155,20 @@ jobs: - manifest: 'manifests/uno.ui-preview.manifest.json' manifest_name: Preview + previous_tool_version: '' + previous_tool_params: '' + - manifest: 'manifests/uno.ui.manifest.json' + manifest_name: Stable Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '' + + - manifest: 'manifests/uno.ui-preview.manifest.json' + manifest_name: Preview Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '--pre' + + runs-on: ${{ matrix.os }} steps: @@ -172,6 +204,17 @@ jobs: run: | brew install gtk+3 + - name: Install and Run Previous Tool + if: ${{ contains(matrix.previous_tool_version, '.') }} + shell: pwsh + run: | + Write-Output "PACKAGE VERSION: ${{ steps.gitversion.outputs.semVer }}" + $ProgressPreference = 'SilentlyContinue' + & dotnet --list-sdks + & dotnet tool install --global --version ${{ matrix.previous_tool_version }} uno.check + & uno-check --ci --fix --non-interactive --verbose --skip xcode --skip vswin --skip vsmac --skip wsl --skip edgewebview2 ${{ matrix.previous_tool_params }} + & dotnet tool uninstall --global uno.check + - name: Install and Run Tool shell: pwsh run: | @@ -183,7 +226,7 @@ jobs: testlinux: name: Validate Tool - Linux - ${{ matrix.manifest_name }} - needs: build + needs: build_tool runs-on: ubuntu-latest strategy: @@ -193,6 +236,15 @@ jobs: manifest_name: Stable - manifest: 'manifests/uno.ui-preview.manifest.json' manifest_name: Preview + + - manifest: 'manifests/uno.ui.manifest.json' + manifest_name: Stable Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '' + - manifest: 'manifests/uno.ui-preview.manifest.json' + manifest_name: Preview Upgrade + previous_tool_version: 1.4.2 + previous_tool_params: '--pre' steps: - name: Checkout @@ -228,6 +280,17 @@ jobs: sudo apt update sudo apt install libgtk-3-dev + - name: Install and Run Previous Tool + if: ${{ contains(matrix.previous_tool_version, '.') }} + shell: pwsh + run: | + Write-Output "PACKAGE VERSION: ${{ steps.gitversion.outputs.semVer }}" + $ProgressPreference = 'SilentlyContinue' + & dotnet --list-sdks + & dotnet tool install --global --version ${{ matrix.previous_tool_version }} uno.check + & uno-check --ci --fix --non-interactive --verbose --skip xcode --skip vswin --skip vsmac --skip wsl --skip edgewebview2 ${{ matrix.previous_tool_params }} + & dotnet tool uninstall --global uno.check + - name: Install and Run Tool shell: pwsh run: | @@ -235,13 +298,14 @@ jobs: $ProgressPreference = 'SilentlyContinue' & dotnet tool install --global --version ${{ steps.gitversion.outputs.semVer }} --add-source NuGet/ uno.check & uno-check --ci --fix --non-interactive --verbose --skip xcode --skip vswin --skip vsmac --skip wsl --skip edgewebview2 --manifest ${{ matrix.manifest }} + publish: name: Publish if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} runs-on: windows-latest needs: - - build + - build_tool steps: - name: Checkout uses: actions/checkout@v2 diff --git a/UnoCheck/AcquirePackagesCommand.cs b/UnoCheck/AcquirePackagesCommand.cs index 8a397e58..3ca3805d 100644 --- a/UnoCheck/AcquirePackagesCommand.cs +++ b/UnoCheck/AcquirePackagesCommand.cs @@ -105,9 +105,9 @@ public override async Task ExecuteAsync(CommandContext context, AcquirePack var manifests = nugetWorkloadManifestProvider.GetManifests(); foreach (var mfst in manifests) { - AnsiConsole.MarkupLine($"Acquiring packages for: {mfst.manifestId} ..."); + AnsiConsole.MarkupLine($"Acquiring packages for: {mfst.ManifestId} ..."); - var manifestReader = WorkloadManifestReader.ReadWorkloadManifest(mfst.manifestId, mfst.openManifestStream()); + var manifestReader = WorkloadManifestReader.ReadWorkloadManifest(mfst.ManifestId, mfst.OpenManifestStream(), mfst.ManifestPath); foreach (var wlPack in manifestReader.Packs) { @@ -310,8 +310,8 @@ public async Task ParseManifestPackages(string directory, List GetManifestDirectories() => manifestDirs.Select(m => m.dir); - public IEnumerable<(string manifestId, string informationalPath, Func openManifestStream, Func openLocalizationStream)> GetManifests() - => manifestDirs.Select(m => (m.id, m.dir, new Func(() => File.OpenRead(m.file)), new Func(() => null))); + public IEnumerable GetManifests() + => manifestDirs.Select(m => new ReadableWorkloadManifest(m.id, m.dir, new Func(() => File.OpenRead(m.file)), new Func(() => null))); public string GetSdkFeatureBand() => $"{SdkVersion.Major}.{SdkVersion.Minor}.{SdkVersion.Patch}"; diff --git a/UnoCheck/Checkups/DotNetWorkloadsCheckup.cs b/UnoCheck/Checkups/DotNetWorkloadsCheckup.cs index e6022e79..e54bb9b4 100644 --- a/UnoCheck/Checkups/DotNetWorkloadsCheckup.cs +++ b/UnoCheck/Checkups/DotNetWorkloadsCheckup.cs @@ -55,18 +55,42 @@ public override async Task Examine(SharedState history) if (force) wasForceRunAlready = true; - var workloadManager = new DotNetWorkloadManager(SdkRoot, sdkVersion, NuGetPackageSources); + var validWorkloads = RequiredWorkloads + .Where(w => w.SupportedPlatforms?.Contains(Util.Platform) ?? false) + .ToArray(); - var installedPackageWorkloads = workloadManager.GetInstalledWorkloads(); + var workloadManagers = validWorkloads + .Select(w => w.Version.Split("/", StringSplitOptions.None).LastOrDefault() is { Length: > 0 } workloadSdkVersion ? workloadSdkVersion : sdkVersion) + .Concat(new[] { sdkVersion }) + .Distinct() + .ToDictionary(v => v, v => new DotNetWorkloadManager(SdkRoot, v, NuGetPackageSources)); var missingWorkloads = new List(); foreach (var rp in RequiredWorkloads.Where(w => w.SupportedPlatforms?.Contains(Util.Platform) ?? false)) { - if (!NuGetVersion.TryParse(rp.Version, out var rpVersion)) + var versionParts = rp.Version.Split("/", StringSplitOptions.None); + var workloadVersion = versionParts.First(); + var workloadSdkVersion = versionParts.ElementAtOrDefault(1) is { Length: > 0 } v ? v : sdkVersion; + + if (!workloadManagers.TryGetValue(workloadSdkVersion, out var workloadManager)) + { + throw new Exception($"Unable to find workload manager for version [{rp.Id}: {rp.Version}]"); + } + + var installedPackageWorkloads = workloadManager.GetInstalledWorkloads(); + + if (!NuGetVersion.TryParse(workloadVersion, out var rpVersion)) rpVersion = new NuGetVersion(0, 0, 0); +#if DEBUG + foreach(var installedWorload in installedPackageWorkloads) + { + ReportStatus($"Reported installed: {installedWorload.id}: {installedWorload.version}", null); + } +#endif + // TODO: Eventually check actual workload resolver api for installed workloads and // compare the manifest version once it has a string in it if (!installedPackageWorkloads.Any(ip => ip.id.Equals(rp.Id, StringComparison.OrdinalIgnoreCase) && NuGetVersion.TryParse(ip.version, out var ipVersion) && ipVersion == rpVersion)) @@ -83,7 +107,9 @@ public override async Task Examine(SharedState history) if (!missingWorkloads.Any() && !force) return DiagnosticResult.Ok(this); - return new DiagnosticResult( + var genericWorkloadManager = new DotNetWorkloadManager(SdkRoot, sdkVersion, NuGetPackageSources); + + return new DiagnosticResult( Status.Error, this, new Suggestion("Install or Update SDK Workloads", @@ -93,7 +119,7 @@ public override async Task Examine(SharedState history) { try { - await workloadManager.Repair(); + await genericWorkloadManager.Repair(); } catch (Exception ex) { @@ -101,7 +127,7 @@ public override async Task Examine(SharedState history) } } - await workloadManager.Install(RequiredWorkloads); + await genericWorkloadManager.Install(RequiredWorkloads); }))); } } diff --git a/UnoCheck/DotNet/DotNetWorkloadManager.cs b/UnoCheck/DotNet/DotNetWorkloadManager.cs index a0182c97..a80f7376 100644 --- a/UnoCheck/DotNet/DotNetWorkloadManager.cs +++ b/UnoCheck/DotNet/DotNetWorkloadManager.cs @@ -96,10 +96,10 @@ Dictionary GetInstalledWorkloadManifestIdsAndVersions() foreach (var manifestInfo in manifestProvider.GetManifests()) { - using (var manifestStream = manifestInfo.openManifestStream()) + using (var manifestStream = manifestInfo.OpenManifestStream()) { - var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.manifestId, manifestStream); - items[manifestInfo.manifestId] = m.Version; + var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.ManifestId, manifestStream, manifestInfo.ManifestPath); + items[manifestInfo.ManifestId] = m.Version; } } @@ -112,9 +112,9 @@ Dictionary GetInstalledWorkloadManifestIdsAndVersions() foreach (var manifestInfo in manifestProvider.GetManifests()) { - using (var manifestStream = manifestInfo.openManifestStream()) + using (var manifestStream = manifestInfo.OpenManifestStream()) { - var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.manifestId, manifestStream); + var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.ManifestId, manifestStream, manifestInfo.ManifestPath); // Each workload manifest can have one or more workloads defined foreach (var wl in m.Workloads) diff --git a/UnoCheck/DotNet/DotNetWorkloadManagerLegacy.cs b/UnoCheck/DotNet/DotNetWorkloadManagerLegacy.cs index 2d729d52..de0db666 100644 --- a/UnoCheck/DotNet/DotNetWorkloadManagerLegacy.cs +++ b/UnoCheck/DotNet/DotNetWorkloadManagerLegacy.cs @@ -151,9 +151,9 @@ async Task DeleteExistingWorkloads(string sdkRoot, string sdkVersion, string wor foreach (var manifestInfo in manifestProvider.GetManifests()) { - using (var manifestStream = manifestInfo.openManifestStream()) + using (var manifestStream = manifestInfo.OpenManifestStream()) { - var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.manifestId, manifestStream); + var m = WorkloadManifestReader.ReadWorkloadManifest(manifestInfo.ManifestId, manifestStream, manifestInfo.ManifestPath); // Each workload manifest can have one or more workloads defined foreach (var wl in m.Workloads) diff --git a/UnoCheck/Properties/launchSettings.json b/UnoCheck/Properties/launchSettings.json index f7b15d9f..6f3e88c6 100644 --- a/UnoCheck/Properties/launchSettings.json +++ b/UnoCheck/Properties/launchSettings.json @@ -2,11 +2,10 @@ "profiles": { "UnoCheck": { "commandName": "Project", - "commandLineArgs": "--verbose --pre" + "commandLineArgs": "--verbose --manifest C:\\s\\unoplatform\\uno.check\\manifests\\uno.ui-preview.manifest.json" }, "WSL 2": { "commandName": "WSL2", - "environmentVariables": {}, "distributionName": "" } } diff --git a/UnoCheck/UnoCheck.csproj b/UnoCheck/UnoCheck.csproj index 22a1d2aa..f374d20d 100644 --- a/UnoCheck/UnoCheck.csproj +++ b/UnoCheck/UnoCheck.csproj @@ -38,7 +38,9 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/libs/Microsoft.DotNet.MSBuildSdkResolver.dll b/libs/Microsoft.DotNet.MSBuildSdkResolver.dll index b66310e4..8a8df3fd 100644 Binary files a/libs/Microsoft.DotNet.MSBuildSdkResolver.dll and b/libs/Microsoft.DotNet.MSBuildSdkResolver.dll differ diff --git a/manifests/uno.ui-preview.manifest.json b/manifests/uno.ui-preview.manifest.json index 39f6149b..e9f79dce 100644 --- a/manifests/uno.ui-preview.manifest.json +++ b/manifests/uno.ui-preview.manifest.json @@ -1,15 +1,15 @@ { "check": { - "toolVersion": "1.2.0", + "toolVersion": "1.5.0", "variables": { "OPENJDK_VERSION": "11.0.10.9", - "DOTNET_SDK_VERSION": "6.0.300", - "MACCATALYST_SDK_VERSION": "15.4.303", - "IOS_SDK_VERSION": "15.4.303", - "TVOS_SDK_VERSION": "15.4.303", - "MACOS_SDK_VERSION": "12.3.303", - "ANDROID_SDK_VERSION": "32.0.301", - "MONO_TOOLCHAIN_VERSION": "6.0.5" + "DOTNET_SDK_VERSION": "6.0.400-preview.22301.10", + "MACCATALYST_SDK_VERSION": "15.4.414/6.0.400", + "IOS_SDK_VERSION": "15.4.414/6.0.400", + "TVOS_SDK_VERSION": "15.4.414/6.0.400", + "MACOS_SDK_VERSION": "12.3.414/6.0.400", + "ANDROID_SDK_VERSION": "32.0.415/6.0.300", + "MONO_TOOLCHAIN_VERSION": "6.0.6/6.0.300" }, "variableMappers": [ ], @@ -25,7 +25,7 @@ "exactVersionName": "13.3" }, "vswin": { - "minimumVersion": "17.3.0-pre.1.0" + "minimumVersion": "17.3.0-pre.2.0" }, "vsmac": { "minimumVersion": "8.10.0", @@ -109,28 +109,28 @@ { "workloadId": "ios", "workloadManifestId": "microsoft.net.sdk.ios", - "packageId": "Microsoft.NET.Sdk.iOS.Manifest-6.0.300", + "packageId": "Microsoft.NET.Sdk.iOS.Manifest-6.0.400", "version": "$(IOS_SDK_VERSION)", "supportedPlatforms": [ "Windows", "OSX" ] }, { "workloadId": "maccatalyst", "workloadManifestId": "microsoft.net.sdk.maccatalyst", - "packageId": "Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.300", + "packageId": "Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.400", "version": "$(MACCATALYST_SDK_VERSION)", "supportedPlatforms": [ "Windows", "OSX" ] }, { "workloadId": "tvos", "workloadManifestId": "microsoft.net.sdk.tvos", - "packageId": "Microsoft.NET.Sdk.tvOS.Manifest-6.0.300", + "packageId": "Microsoft.NET.Sdk.tvOS.Manifest-6.0.400", "version": "$(TVOS_SDK_VERSION)", "supportedPlatforms": [ "Windows", "OSX" ] }, { "workloadId": "macos", "workloadManifestId": "microsoft.net.sdk.macos", - "packageId": "Microsoft.NET.Sdk.macOS.Manifest-6.0.300", + "packageId": "Microsoft.NET.Sdk.macOS.Manifest-6.0.400", "version": "$(MACOS_SDK_VERSION)", "supportedPlatforms": [ "Windows", "OSX" ] }, @@ -175,4 +175,4 @@ ] } } -} +} \ No newline at end of file