Make Is*Project properties unambiguous and improve IsGeneratorProject detection ...
authorViktor Hofer <viktor.hofer@microsoft.com>
Mon, 28 Feb 2022 20:13:22 +0000 (21:13 +0100)
committerGitHub <noreply@github.com>
Mon, 28 Feb 2022 20:13:22 +0000 (21:13 +0100)
commita6f45395354fdcf63ee7f6abdadfb33f32e88459
treee1cffad4025d02bbd1e874de74942b6d01a3822f
parente652e007df4b7e6a66dbdc4e981496537bd0fcc1
Make Is*Project properties unambiguous and improve IsGeneratorProject detection (#65896)

* Make Is*Project properties unambiguous

Currently these properties exist which categorize projects:
- IsReferenceAssembly: The project's parent directory is 'ref'
- IsGeneratorProject: The project's parent directory is 'gen'
- IsTestProject: The project is located somewhere under a '/tests/'
                 directory and the project name's suffix is either
                 '.Tests' or '.UnitTests'.
- IsTrimmingTestProject: Same as IsTestProject but the project name's
                         suffix is '.TrimmingTests'.
- IsTestSupportProject: The project is located somewhere under a
                        '/tests/' directory and the above IsTestProject
                        property is false.
- UsingMicrosoftNoTargetsSdk: The project uses the NoTargets msbuild SDK
- UsingMicrosoftTraversalSdk: The project uses the Traversal msbuild SDK
- IsRuntimeAssembly: True when all above is false
- IsSourceProject: True when the project's parent directory is 'src'

The IsRuntimeAssembly and IsSourceProject properties meanings are
ambiguous and the property names aren't consistent (IsReferenceAssembly
vs IsGeneratorProject).

I'm changing the above to the following:
- **IsReferenceSourceProject: The project's parent directory is 'ref'
                        or the parent of the parent directory is 'ref'**
- IsGeneratorProject: The project's parent directory is 'gen'
- IsTestProject: The project is located somewhere under a '/tests/'
                 directory and the project name's suffix is either
                 '.Tests' or '.UnitTests'.
- IsTrimmingTestProject: Same as IsTestProject but the project name's
                         suffix is '.TrimmingTests'.
- IsTestSupportProject: The project is located somewhere under a
                        '/tests/' directory and the above IsTestProject
                        **and IsTrimmingTestProject** props are false.
- UsingMicrosoftNoTargetsSdk: The project uses the NoTargets msbuild SDK
- UsingMicrosoftTraversalSdk: The project uses the Traversal msbuild SDK
- IsSourceProject: **True when all above is false.**

* React to PR feedback
eng/codeOptimization.targets
eng/generators.targets
eng/references.targets
eng/slngen.targets
src/libraries/Directory.Build.props
src/libraries/Directory.Build.targets
src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
src/libraries/System.Runtime.InteropServices/gen/Directory.Build.props