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

Release - 8/20/24 #435

Merged
merged 14 commits into from
Aug 20, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/GitHubExt-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
configuration: [Release, Debug]
platform: [x64, x86, arm64]
os: [windows-latest]
dotnet-version: ['6.0.x']
dotnet-version: ['8.0.x']
exclude:
- configuration: Debug
platform: x64
Expand Down
14 changes: 14 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,18 @@
</PackageReference>
</ItemGroup>

<!-- Needed for reverting back to pre-.NET 8 method of Host using the RID graph to determine assets
This is due to a change in how the RuntimeIdentifier graph was changed in .NET 8. Without this, any assets from
NuGet packages that are targeting win10-* won't get picked up and referenced prooperly. -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list -->
<PropertyGroup>
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" />
</ItemGroup>

<PropertyGroup>
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions GitHubExtension.sln
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{864DD9CD-9F45-47E8-847F-B72ED182626B}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
exclusion.dic = exclusion.dic
ToolingVersions.props = ToolingVersions.props
EndProjectSection
EndProject
Global
Expand Down
2 changes: 1 addition & 1 deletion ToolingVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.22000.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ parameters:
- release

variables:
MSIXVersion: '0.1600'
MSIXVersion: '0.1700'
solution: '**/GitHubExtension.sln'
appxPackageDir: 'AppxPackages'
testOutputArtifactDir: 'TestResults'
Expand Down
64 changes: 3 additions & 61 deletions build/scripts/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,63 +86,22 @@ $ErrorActionPreference = "Stop"
Try {
if (($BuildStep -ieq "all") -Or ($BuildStep -ieq "msix")) {
$buildRing = "Dev"
$newPackageName = $null
$newPackageDisplayName = $null
$newAppDisplayNameResource = $null
$newWidgetProviderDisplayName = $null
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\GitHubExtensionServer\Package-Dev.appxmanifest")

if ($AzureBuildingBranch -ieq "release") {
$buildRing = "Stable"
$newPackageName = "Microsoft.Windows.DevHomeGitHubExtension"
$newPackageDisplayName = "Dev Home GitHub Extension (Preview)"
$newAppDisplayNameResource = "ms-resource:AppDisplayNameStable"
$newWidgetProviderDisplayName = "ms-resource:WidgetProviderDisplayNameStable"
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\GitHubExtensionServer\Package.appxmanifest")
} elseif ($AzureBuildingBranch -ieq "staging") {
$buildRing = "Canary"
$newPackageName = "Microsoft.Windows.DevHomeGitHubExtension.Canary"
$newPackageDisplayName = "Dev Home GitHub Extension (Canary)"
$newAppDisplayNameResource = "ms-resource:AppDisplayNameCanary"
$newWidgetProviderDisplayName = "ms-resource:WidgetProviderDisplayNameCanary"
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\GitHubExtensionServer\Package-Can.appxmanifest")
}

[Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq")
$xIdentity = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity");
$xProperties = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Properties");
$xDisplayName = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}DisplayName");
$xApplications = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Applications");
$xApplication = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Application");
$uapVisualElements = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10}VisualElements");
$xExtensions = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Extensions");
$uapExtension = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10/3}Extension");
$uapAppExtension = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/uap/windows10/3}AppExtension");

# Update the appxmanifest
$appxmanifestPath = (Join-Path $env:Build_RootDirectory "src\GitHubExtensionServer\Package.appxmanifest")
$appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath)
$appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = $env:msix_version
if (-not ([string]::IsNullOrEmpty($newPackageName))) {
$appxmanifest.Root.Element($xIdentity).Attribute("Name").Value = $newPackageName
}
if (-not ([string]::IsNullOrEmpty($newPackageDisplayName))) {
$appxmanifest.Root.Element($xProperties).Element($xDisplayName).Value = $newPackageDisplayName
}
if (-not ([string]::IsNullOrEmpty($newAppDisplayNameResource))) {
$appxmanifest.Root.Element($xApplications).Element($xApplication).Element($uapVisualElements).Attribute("DisplayName").Value = $newAppDisplayNameResource
$extensions = $appxmanifest.Root.Element($xApplications).Element($xApplication).Element($xExtensions).Elements($uapExtension)
foreach ($extension in $extensions) {
if ($extension.Attribute("Category").Value -eq "windows.appExtension") {
$appExtension = $extension.Element($uapAppExtension)
switch ($appExtension.Attribute("Name").Value) {
"com.microsoft.devhome" {
$appExtension.Attribute("DisplayName").Value = $newAppDisplayNameResource
}
"com.microsoft.windows.widgets" {
$appExtension.Attribute("DisplayName").Value = $newWidgetProviderDisplayName
}
}
}
}
}
$appxmanifest.Save($appxmanifestPath)

foreach ($platform in $env:Build_Platform.Split(",")) {
Expand Down Expand Up @@ -171,23 +130,6 @@ Try {
# Reset the appxmanifest to prevent unnecessary code changes
$appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath)
$appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = "0.0.0.0"
$appxmanifest.Root.Element($xIdentity).Attribute("Name").Value = "Microsoft.Windows.DevHomeGitHubExtension.Dev"
$appxmanifest.Root.Element($xProperties).Element($xDisplayName).Value = "Dev Home GitHub Extension (Dev)"
$appxmanifest.Root.Element($xApplications).Element($xApplication).Element($uapVisualElements).Attribute("DisplayName").Value = "ms-resource:AppDisplayNameDev"
$extensions = $appxmanifest.Root.Element($xApplications).Element($xApplication).Element($xExtensions).Elements($uapExtension)
foreach ($extension in $extensions) {
if ($extension.Attribute("Category").Value -eq "windows.appExtension") {
$appExtension = $extension.Element($uapAppExtension)
switch ($appExtension.Attribute("Name").Value) {
"com.microsoft.devhome" {
$appExtension.Attribute("DisplayName").Value = "ms-resource:AppDisplayNameDev"
}
"com.microsoft.windows.widgets" {
$appExtension.Attribute("DisplayName").Value = "ms-resource:WidgetProviderDisplayNameDev"
}
}
}
}
$appxmanifest.Save($appxmanifestPath)
}

Expand Down
2 changes: 1 addition & 1 deletion build/scripts/CreateBuildInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Param(
)

$Major = "0"
$Minor = "16"
$Minor = "17"
$Patch = "99" # default to 99 for local builds

$versionSplit = $Version.Split(".");
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</config>
<packageSources>
<clear />
<add key="DevHomeDependencies" value="https://pkgs.dev.azure.com/ms/DevHome/_packaging/DevHomeDependencies/nuget/v3/index.json" />
<add key="DevHomeDependencies" value="https://pkgs.dev.azure.com/shine-oss/DevHome/_packaging/DevHomeDependencies/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubExtension/Client/Validation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private static string AddProtocolToString(string s)

private static string[]? GetNameAndRepoFromFullName(string s)
{
var n = s.Split(new[] { '/' });
var n = s.Split(['/']);

// This should be exactly two results with no empty strings.
if (n.Length != 2 || string.IsNullOrEmpty(n[0]) || string.IsNullOrEmpty(n[1]))
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubExtension/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace GitHubExtension;

internal class Constants
internal sealed class Constants
{
#pragma warning disable SA1310 // Field names should not contain underscore
public const string DEV_HOME_APPLICATION_NAME = "DevHome";
Expand Down
10 changes: 5 additions & 5 deletions src/GitHubExtension/DataManager/GitHubDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ await UpdateDataForRepositoryAsync(
await UpdatePullRequestsAsync(repository, devId.GitHubClient, parameters.RequestOptions);
});

SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), new string[] { "Issues", "PullRequests" });
SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), ["Issues", "PullRequests"]);
}

public async Task UpdateAllDataForRepositoryAsync(string fullName, RequestOptions? options = null)
Expand Down Expand Up @@ -133,7 +133,7 @@ await UpdateDataForRepositoryAsync(
await UpdatePullRequestsAsync(repository, devId.GitHubClient, parameters.RequestOptions);
});

SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), new string[] { "PullRequests" });
SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), ["PullRequests"]);
}

public async Task UpdatePullRequestsForRepositoryAsync(string fullName, RequestOptions? options = null)
Expand Down Expand Up @@ -162,7 +162,7 @@ await UpdateDataForRepositoryAsync(
await UpdateIssuesAsync(repository, devId.GitHubClient, parameters.RequestOptions);
});

SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), new string[] { "Issues" });
SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), ["Issues"]);
}

public async Task UpdateIssuesForRepositoryAsync(string fullName, RequestOptions? options = null)
Expand Down Expand Up @@ -202,7 +202,7 @@ await UpdateDataForRepositoryAsync(
await UpdateReleasesAsync(repository, devId.GitHubClient, parameters.RequestOptions);
});

SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), new string[] { "Releases" });
SendRepositoryUpdateEvent(this, GetFullNameFromOwnerAndRepository(owner, name), ["Releases"]);
}

public IEnumerable<Repository> GetRepositories()
Expand Down Expand Up @@ -788,7 +788,7 @@ private void SetLastUpdatedInMetaData()
// Converts fullName -> owner, name.
private string[] GetOwnerAndRepositoryNameFromFullName(string fullName)
{
var nameSplit = fullName.Split(new[] { '/' });
var nameSplit = fullName.Split(['/']);
if (nameSplit.Length != 2 || string.IsNullOrEmpty(nameSplit[0]) || string.IsNullOrEmpty(nameSplit[1]))
{
_log.Error($"Invalid repository full name: {fullName}");
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubExtension/DataModel/DataObjects/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public static IEnumerable<Repository> GetAll(DataStore dataStore)

public static Repository? Get(DataStore dataStore, string fullName)
{
var nameSplit = fullName.Split(new[] { '/' }, 2);
var nameSplit = fullName.Split(['/'], 2);
if (nameSplit.Length != 2)
{
_log.Warning($"Invalid fullName input into Repository.Get: {fullName}");
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubExtension/DeveloperId/LoginUI/EndPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace GitHubExtension.DeveloperId.LoginUI;

internal class EndPage : LoginUIPage
internal sealed class EndPage : LoginUIPage
{
public EndPage()
: base(LoginUIState.End)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace GitHubExtension.DeveloperId.LoginUI;

internal class EnterpriseServerPATPage : LoginUIPage
internal sealed class EnterpriseServerPATPage : LoginUIPage
{
public EnterpriseServerPATPage(Uri hostAddress, string errorText, SecureString inputPAT)
: base(LoginUIState.EnterpriseServerPATPage)
{
Data = new PageData()
Data = new EnterpriseServerPATPageData()
{
EnterpriseServerPATPageInputValue = new System.Net.NetworkCredential(string.Empty, inputPAT).Password ?? string.Empty,
EnterpriseServerPATPageErrorValue = errorText ?? string.Empty,
Expand All @@ -22,7 +22,7 @@ public EnterpriseServerPATPage(Uri hostAddress, string errorText, SecureString i
};
}

internal class PageData : ILoginUIPageData
internal sealed class EnterpriseServerPATPageData : ILoginUIPageData
{
public string EnterpriseServerPATPageInputValue { get; set; } = string.Empty;

Expand All @@ -36,19 +36,19 @@ internal class PageData : ILoginUIPageData

public string GetJson()
{
return Json.Stringify(this);
return Json.Stringify(this, _optionsWithContext);
}
}

internal class ActionPayload : SubmitActionPayload
internal sealed class ActionPayload : SubmitActionPayload
{
public string? URL
{
get; set;
}
}

internal class InputPayload
internal sealed class InputPayload
{
public string? PAT
{
Expand Down
14 changes: 7 additions & 7 deletions src/GitHubExtension/DeveloperId/LoginUI/EnterpriseServerPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

namespace GitHubExtension.DeveloperId.LoginUI;

internal class EnterpriseServerPage : LoginUIPage
internal sealed class EnterpriseServerPage : LoginUIPage
{
public EnterpriseServerPage(Uri? hostAddress, string errorText)
: base(LoginUIState.EnterpriseServerPage)
{
Data = new PageData()
Data = new EnterpriseServerPageData()
{
EnterpriseServerInputValue = hostAddress?.ToString() ?? string.Empty,
EnterpriseServerPageErrorValue = errorText ?? string.Empty,
Expand All @@ -21,15 +21,15 @@ public EnterpriseServerPage(Uri? hostAddress, string errorText)
public EnterpriseServerPage(string hostAddress, string errorText)
: base(LoginUIState.EnterpriseServerPage)
{
Data = new PageData()
Data = new EnterpriseServerPageData()
{
EnterpriseServerInputValue = hostAddress,
EnterpriseServerPageErrorValue = errorText ?? string.Empty,
EnterpriseServerPageErrorVisible = !string.IsNullOrEmpty(errorText),
};
}

internal class PageData : ILoginUIPageData
internal sealed class EnterpriseServerPageData : ILoginUIPageData
{
public string EnterpriseServerInputValue { get; set; } = string.Empty;

Expand All @@ -40,15 +40,15 @@ internal class PageData : ILoginUIPageData

public string GetJson()
{
return Json.Stringify(this);
return Json.Stringify(this, _optionsWithContext);
}
}

internal class ActionPayload : SubmitActionPayload
internal sealed class ActionPayload : SubmitActionPayload
{
}

internal class InputPayload
internal sealed class InputPayload
{
public string? EnterpriseServer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Text.Json.Serialization;
using static GitHubExtension.DeveloperId.LoginUI.EnterpriseServerPage;
using static GitHubExtension.DeveloperId.LoginUI.EnterpriseServerPATPage;
using static GitHubExtension.DeveloperId.LoginUI.LoginFailedPage;
using static GitHubExtension.DeveloperId.LoginUI.LoginPage;
using static GitHubExtension.DeveloperId.LoginUI.LoginSucceededPage;
using static GitHubExtension.DeveloperId.LoginUI.WaitingPage;

namespace GitHubExtension.DeveloperId;

[JsonSerializable(typeof(EnterpriseServerPageData))]
[JsonSerializable(typeof(EnterpriseServerPATPageData))]
[JsonSerializable(typeof(LoginFailedPageData))]
[JsonSerializable(typeof(LoginPageData))]
[JsonSerializable(typeof(LoginSucceededPageData))]
[JsonSerializable(typeof(WaitingPageData))]
internal sealed partial class JsonSourceGenerationContext : JsonSerializerContext
{
}
6 changes: 3 additions & 3 deletions src/GitHubExtension/DeveloperId/LoginUI/LoginFailedPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

namespace GitHubExtension.DeveloperId.LoginUI;

internal class LoginFailedPage : LoginUIPage
internal sealed class LoginFailedPage : LoginUIPage
{
public LoginFailedPage()
: base(LoginUIState.LoginFailedPage)
{
Data = new LoginFailedPageData();
}

internal class LoginFailedPageData : ILoginUIPageData
internal sealed class LoginFailedPageData : ILoginUIPageData
{
public string GetJson()
{
return Json.Stringify(this);
return Json.Stringify(this, _optionsWithContext);
}
}
}
Loading
Loading