Skip to content

Commit

Permalink
Merge pull request #4410 from unoplatform/dev/jela/wasm-missing-constant
Browse files Browse the repository at this point in the history
fix(shapes): [Wasm] Fix invalid generation of Shapes caused by missing Wasm detection
  • Loading branch information
jeromelaban authored Oct 28, 2020
2 parents 02e2f23 + e97142d commit 3873dad
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ private string GenerateGlobalResources(IEnumerable<XamlFileDefinition> files, Xa
writer.AppendLineInvariant("using {0};", _defaultNamespace);
writer.AppendLineInvariant("");

// If a failure happens here, this means that the _isWasm was not properly set as the DefineConstants msbuild property
// was not populated. This can happen when the property is set through a target with the "CreateProperty" task, and the
// Uno.SourceGeneration tasks do not execute this task properly.
writer.AppendLineInvariant("#if __WASM__");
writer.AppendLineInvariant(_isWasm ? "" : "#error invalid internal source generator state. The __WASM__ DefineConstant was not propagated properly.");
writer.AppendLineInvariant("#endif");

using (writer.BlockInvariant("namespace {0}", _defaultNamespace))
{
writer.AppendLineInvariant("/// <summary>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<Target Name="_UnoSkiaGtkFeatureDefines"
BeforeTargets="BeforeCompile">
BeforeTargets="PrepareForBuild">

<PropertyGroup>
<UnoDefineConstants>$(UnoDefineConstants);UNO_REFERENCE_API;HAS_UNO_SKIA;HAS_UNO_SKIA_GTK</UnoDefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<Target Name="_UnoSkiaTizenFeatureDefines"
BeforeTargets="BeforeCompile">
BeforeTargets="PrepareForBuild">

<PropertyGroup>
<UnoDefineConstants>$(UnoDefineConstants);UNO_REFERENCE_API;HAS_UNO_SKIA;HAS_UNO_SKIA_TIZEN</UnoDefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="_UnoSkiaWpfFeatureDefines"
BeforeTargets="BeforeCompile">
BeforeTargets="PrepareForBuild">

<PropertyGroup>
<UnoDefineConstants>$(UnoDefineConstants);UNO_REFERENCE_API;HAS_UNO_SKIA;HAS_UNO_SKIA_WPF</UnoDefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<Target Name="_UnoSkiaWasmFeatureDefines"
BeforeTargets="BeforeCompile">
BeforeTargets="PrepareForBuild">

<PropertyGroup>
<UnoDefineConstants>$(UnoDefineConstants);UNO_REFERENCE_API;HAS_UNO_WASM;__WASM__</UnoDefineConstants>
Expand Down

0 comments on commit 3873dad

Please sign in to comment.