From 18e2266169fd2de3ed8e4f8580a254cb40a69a6b Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 16:55:44 -0500 Subject: [PATCH 1/7] Added AddMultiTargetCompatibleSampleDocs target. Fixes #5. --- ProjectHeads/App.Head.props | 49 +++++++- ProjectHeads/Tasks/CheckMultiTarget.props | 131 ++++++++++++++++++++++ 2 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 ProjectHeads/Tasks/CheckMultiTarget.props diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index 5e36c67c..a3057b9d 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -1,5 +1,5 @@ - + @@ -64,7 +64,7 @@ - + @@ -76,6 +76,49 @@ + + + + + + + + + + uwp + wasm + wasdk + macos + ios + android + netstandard + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -92,8 +135,6 @@ SourceAssets/%(RecursiveDir)%(FileName)%(Extension).dat - - diff --git a/ProjectHeads/Tasks/CheckMultiTarget.props b/ProjectHeads/Tasks/CheckMultiTarget.props new file mode 100644 index 00000000..20c3c512 --- /dev/null +++ b/ProjectHeads/Tasks/CheckMultiTarget.props @@ -0,0 +1,131 @@ + + + + + + + + + + + + + GetMultiTargetPropsPath = (parent, subDir) => System.IO.Path.Combine(parent, subDir, "MultiTarget.props"); + Func ReadMultiTargetPropsOrDefault = path => System.IO.File.Exists(path) ? System.IO.File.ReadAllText(path) : string.Empty; + Func ExtractMultiTargetIdentifier = content => { + System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(content, @"([^<]*)", System.Text.RegularExpressions.RegexOptions.Singleline); + return match.Success ? match.Groups[1].Value : string.Empty; + }; + + multiTargetPropsPath = GetMultiTargetPropsPath(parentComponent, "sample"); + multiTargetPropsContent = ReadMultiTargetPropsOrDefault(multiTargetPropsPath); + multiTargetIdentifier = ExtractMultiTargetIdentifier(multiTargetPropsContent); + + if (string.IsNullOrEmpty(multiTargetIdentifier)) + { + multiTargetPropsPath = GetMultiTargetPropsPath(parentComponent, "src"); + multiTargetPropsContent = ReadMultiTargetPropsOrDefault(multiTargetPropsPath); + multiTargetIdentifier = ExtractMultiTargetIdentifier(multiTargetPropsContent); + } + + if (string.IsNullOrWhiteSpace(multiTargetIdentifier)) + { + multiTargetPropsPath = System.IO.Path.Combine(RepositoryDirectory, "tooling", "MultiTarget", "Defaults.props"); + multiTargetPropsContent = ReadMultiTargetPropsOrDefault(multiTargetPropsPath); + multiTargetIdentifier = ExtractMultiTargetIdentifier(multiTargetPropsContent); + } + + IsSupported = multiTargetIdentifier.Split(';').Contains(MultiTargetIdentifier); + FilePath.SetMetadata("IsSupported", IsSupported.ToString()); + ]]> + + + + + + From e24d45279968ea6a99e72b1ecb056299deac64f3 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 17:15:12 -0500 Subject: [PATCH 2/7] Fixed a lowercase T --- ProjectHeads/App.Head.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index a3057b9d..5ade8a83 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -79,7 +79,7 @@ - + From 8c767e698048a6f3d8d627bde04789a94040329b Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 17:44:00 -0500 Subject: [PATCH 3/7] Fixed target execution order --- ProjectHeads/App.Head.props | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index 5ade8a83..ad3af91c 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -1,5 +1,5 @@ - + @@ -81,24 +81,23 @@ - - - - - uwp - wasm - wasdk - macos - ios - android - netstandard - + + + uwp + wasm + wasdk + macos + ios + android + netstandard + - + + - + ` From 5406578f4bb92b2897c5ccada6f9870a0dbb84a2 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 17:44:05 -0500 Subject: [PATCH 4/7] Use RoslynCodeTaskFactory --- ProjectHeads/Tasks/CheckMultiTarget.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectHeads/Tasks/CheckMultiTarget.props b/ProjectHeads/Tasks/CheckMultiTarget.props index 20c3c512..812b68fe 100644 --- a/ProjectHeads/Tasks/CheckMultiTarget.props +++ b/ProjectHeads/Tasks/CheckMultiTarget.props @@ -40,7 +40,7 @@ 4. Always use fully qualified namespaces in inline tasks to ensure all types are recognized correctly. This can avoid issues where certain types or methods are not found. --> - + From f8c689447c99a0d35fc812fd8fd9a1e95c5bec1f Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 17:44:47 -0500 Subject: [PATCH 5/7] Fix typo --- ProjectHeads/App.Head.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index ad3af91c..d45a6f17 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -97,7 +97,7 @@ - ` + From 631d85630ab6244fa951cd686c76889f51e37987 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 19 Sep 2023 18:36:39 -0500 Subject: [PATCH 6/7] Fixed MultiTarget Identifiers --- ProjectHeads/App.Head.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index d45a6f17..cca61a2e 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -85,10 +85,10 @@ uwp wasm - wasdk - macos - ios - android + wasdk + macos + ios + android netstandard From 94b0829f49db3f8d9f35e8a53c372de3dd1ff373 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Mon, 25 Sep 2023 18:20:41 -0500 Subject: [PATCH 7/7] Moved AddMultiTargetCompatibleSampleDocs to dedicated Target file --- ProjectHeads/App.Head.props | 43 ++----------------- ...AddMultiTargetCompatibleSampleDocs.targets | 41 ++++++++++++++++++ 2 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index cca61a2e..5c77f6b3 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -3,6 +3,9 @@ + + + @@ -77,46 +80,6 @@ - - - - - - - uwp - wasm - wasdk - macos - ios - android - netstandard - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets b/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets new file mode 100644 index 00000000..02d0ea88 --- /dev/null +++ b/ProjectHeads/Targets/AddMultiTargetCompatibleSampleDocs.targets @@ -0,0 +1,41 @@ + + + + + + + + uwp + wasm + wasdk + macos + ios + android + netstandard + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file