Skip to content

Commit

Permalink
fix: Skia packages are implicitly included in legacy Wasm head
Browse files Browse the repository at this point in the history
chore: fixing spaces

chore: adding missing UnoTarget
  • Loading branch information
dansiegel committed Mar 19, 2024
1 parent 34145c8 commit efe4b83
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Uno.Sdk/ImplicitPackagesResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void AddUnoCorePackages()
AddPackage("Uno.WinUI.DevServer", UnoVersion);
}

if (TargetFrameworkIdentifier != UnoTarget.Wasm)
if (TargetFrameworkIdentifier != UnoTarget.Wasm && !IsLegacyWasmHead())
{
AddPackage("SkiaSharp.Skottie", SkiaSharpVersion);
AddPackage("SkiaSharp.Views.Uno.WinUI", SkiaSharpVersion);
Expand Down
18 changes: 13 additions & 5 deletions src/Uno.Sdk/ImplicitPackagesResolverBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Uno.Sdk;

public abstract class ImplicitPackagesResolverBase : Task
{
private static readonly string[] _legacyWasmProjectSuffix = [".Wasm", ".WebAssembly"];
public bool SdkDebugging { get; set; }

public bool SingleProject { get; set; }
Expand Down Expand Up @@ -122,20 +123,27 @@ private UnoFeature ParseFeature(string feature)

protected bool IsLegacyWasmHead()
{
if (string.IsNullOrWhiteSpace(TargetFrameworkIdentifier) || string.IsNullOrEmpty(ProjectName))
// Neither of these should ever actually happen...
if (string.IsNullOrEmpty(TargetFrameworkIdentifier))
{
Debug("The TargetFrameworkIdentifier has no value.");
return false;
}
else if (string.IsNullOrEmpty(ProjectName))
{
Debug("The ProjectName has no value.");
return false;
}

var value = ProjectName.EndsWith(".Wasm", StringComparison.InvariantCultureIgnoreCase)
|| ProjectName.EndsWith(".WebAssembly", StringComparison.InvariantCultureIgnoreCase);
var isLegacyProject = !SingleProject && TargetFrameworkIdentifier == UnoTarget.Reference
&& _legacyWasmProjectSuffix.Any(x => ProjectName.EndsWith(x, StringComparison.InvariantCulture));

if (value)
if (isLegacyProject)
{
Debug("Building a Legacy WASM project.");
}

return value;
return isLegacyProject;
}

protected void AddPackageForFeature(UnoFeature feature, string packageId, string packageVersion)
Expand Down
1 change: 1 addition & 0 deletions src/Uno.Sdk/UnoTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Uno.Sdk;

internal static class UnoTarget
{
public const string Reference = "reference";
public const string Windows = "windows10";
public const string Wasm = "browserwasm";
public const string Android = "android";
Expand Down
1 change: 1 addition & 0 deletions src/Uno.Sdk/targets/Uno.Implicit.Packages.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<PropertyGroup>
<UnoTarget>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</UnoTarget>
<UnoTarget Condition="$(TargetFramework.Contains('windows10'))">windows10</UnoTarget>
<UnoTarget Condition="$(UnoTarget) == ''">reference</UnoTarget>
</PropertyGroup>

<Target Name="UnoImplicitPackages" BeforeTargets="ResolvePackageDependencies;CollectPackageReferences;ProcessFrameworkReferences">
Expand Down

0 comments on commit efe4b83

Please sign in to comment.