diff --git a/ProjectHeads/App.Head.props b/ProjectHeads/App.Head.props index 5e36c67c..5c77f6b3 100644 --- a/ProjectHeads/App.Head.props +++ b/ProjectHeads/App.Head.props @@ -3,6 +3,9 @@ + + + @@ -64,7 +67,7 @@ - + @@ -76,6 +79,8 @@ + + @@ -92,8 +97,6 @@ SourceAssets/%(RecursiveDir)%(FileName)%(Extension).dat - - 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 diff --git a/ProjectHeads/Tasks/CheckMultiTarget.props b/ProjectHeads/Tasks/CheckMultiTarget.props new file mode 100644 index 00000000..812b68fe --- /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()); + ]]> + + + + + +