Bug 15572. Lookup KnownTypeCollection element types in MSSimpleNamespace
[mono.git] / mcs / tools / xbuild / xbuild / 2.0 / Microsoft.Common.targets
index 1de2a07cf0863fb8a480946221d9727161d4028e..53c27b05869794a0d48f31c4cf698ef84455679f 100644 (file)
@@ -1,5 +1,7 @@
 <Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
+       <Import Project="$(MSBuildProjectFullPath).user" Condition="Exists('$(MSBuildProjectFullPath).user')"/>
+       
        <PropertyGroup>
                <TargetExt Condition="'$(OutputType)' == 'Winexe'">.exe</TargetExt>
                <TargetExt Condition="'$(OutputType)' == 'Exe'">.exe</TargetExt>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
        </PropertyGroup>
 
+       <PropertyGroup>
+               <SkipCopyUnchangedFiles Condition="'$(SkipCopyUnchangedFiles)' == ''">true</SkipCopyUnchangedFiles>
+       </PropertyGroup>
+
        <PropertyGroup>
                <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">obj\</BaseIntermediateOutputPath>
+               <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' != '' and !HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
                <CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FilesWrittenAbsolute.txt</CleanFile>
        </PropertyGroup>
 
                <IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
        </PropertyGroup>
 
+       <PropertyGroup>
+               <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' != '' and !HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
+       </PropertyGroup>
+
        <ItemGroup>
                <IntermediateAssembly Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" />
 
@@ -52,7 +63,8 @@
        <PropertyGroup>
                <TargetName Condition="'$(TargetName)' == '' ">$(AssemblyName)</TargetName>
                <TargetFileName Condition="'$(TargetFileName)' == '' ">$(TargetName)$(TargetExt)</TargetFileName>
-               <TargetPath>@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
+               <TargetDir Condition=" '$(TargetDir)' == '' ">@(_OutDirItem->'%(FullPath)')</TargetDir>
+               <TargetPath Condition=" '$(TargetPath)' == '' ">@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
                <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildToolsPath)\Microsoft.Common.targets</MSBuildAllProjects>
 
                <KeyOriginatorFile Condition=" '$(SignAssembly)' == 'true' ">$(AssemblyOriginatorKeyFile)</KeyOriginatorFile>
                />
        </Target>
 
-       <Target Name="GetFrameworkPaths">
+       <PropertyGroup>
+               <GetFrameworkPathsDependsOn />
+       </PropertyGroup>
+       <Target Name="GetFrameworkPaths" DependsOnTargets="$(GetFrameworkPathsDependsOn)">
                <GetFrameworkPath>
                        <Output Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                                TaskParameter="FrameworkVersion35Path"
-                               ItemName="TargetFrameworkDirectories"/>
+                               ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
                        <Output Condition="'$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'" 
                                TaskParameter="FrameworkVersion30Path"
-                               ItemName="TargetFrameworkDirectories"/>
+                               ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
                        <Output Condition="'$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'" 
                                TaskParameter="FrameworkVersion20Path"
-                               ItemName="TargetFrameworkDirectories"/>
+                               ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
                </GetFrameworkPath>
+               <CreateProperty Value="@(_CombinedTargetFrameworkDirectoriesItem)">
+                       <Output TaskParameter="Value" PropertyName="TargetFrameworkDirectory"/>
+               </CreateProperty>
+
                <Warning Text="TargetFrameworkVersion '$(TargetFrameworkVersion)' not supported by this toolset (ToolsVersion: $(MSBuildToolsVersion))."
                        Condition="'$(TargetFrameworkVersion)' != 'v3.5' and '$(TargetFrameworkVersion)' != 'v3.0' and '$(TargetFrameworkVersion)' != 'v2.0'"/>
        </Target>
                </AllowedReferenceAssemblyFileExtensions>
 
                <AllowedReferenceRelatedFileExtensions Condition=" '$(AllowedReferenceRelatedFileExtensions)' == '' ">
-                       .mdb
+                       .exe.mdb;
+                       .dll.mdb;
+                       .xml
                </AllowedReferenceRelatedFileExtensions>
 
                <AssemblySearchPaths Condition="'$(AssemblySearchPaths)' == ''">
                        {CandidateAssemblyFiles};
                        $(ReferencePath);
+                       @(AdditionalReferencePath);
                        {HintPathFromItem};
                        {TargetFrameworkDirectory};
                        {PkgConfig};
                        ResolveAssemblyReferences;
                        AfterResolveReferences
                </ResolveReferencesDependsOn>
+
+               <ResolveAssemblyReferencesDependsOn>
+                       GetFrameworkPaths;
+                       PrepareForBuild
+               </ResolveAssemblyReferencesDependsOn>
        </PropertyGroup>
 
        <Target Name="ResolveReferences" DependsOnTargets="$(ResolveReferencesDependsOn)"/>
        <Target Name="BeforeResolveReferences" />
        <Target Name="AfterResolveReferences" />
 
-       <Target Name="ResolveAssemblyReferences">
+       <Target Name="ResolveAssemblyReferences" DependsOnTargets="$(ResolveAssemblyReferencesDependsOn)">
                <ResolveAssemblyReference
                        Assemblies="@(Reference)"
                        AssemblyFiles="@(ChildProjectReferences)"
                        SearchPaths="$(AssemblySearchPaths)"
                        CandidateAssemblyFiles="@(Content);@(None)"
-                       TargetFrameworkDirectories="@(TargetFrameworkDirectories)"
+                       TargetFrameworkDirectories="$(TargetFrameworkDirectory)"
                        AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
                        AllowedRelatedFileExtensions="$(AllowedReferenceRelatedFileExtensions)"
                        FindDependencies="true"
        </Target>
 
        <Target
-               Name="AssignProjectConfigurations"
+               Name="AssignProjectConfiguration"
                Condition="'@(ProjectReference)' != ''">
 
                <!-- assign configs if building a solution file -->
                ProjectReferenceWithConfigurationNonExistent: Projects non-existent on disk -->
 
        <Target Name="SplitProjectReferencesByExistent"
-               DependsOnTargets="AssignProjectConfigurations">
+               DependsOnTargets="AssignProjectConfiguration">
 
                <CreateItem Include="@(ProjectReferenceWithConfiguration)" Condition="'@(ProjectReferenceWithConfiguration)' != ''">
                        <Output TaskParameter="Include" ItemName="ProjectReferenceWithConfigurationExistent"
                <Copy
                        SourceFiles="@(ReferenceCopyLocalPaths)"
                        DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
-                       SkipUnchangedFiles="true">
-                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
+                       <Output TaskParameter = "DestinationFiles" ItemName = "FileWritesShareable"/>
                </Copy>
        </Target>
 
                <MakeDir Directories="$(IntermediateOutputPath)%(ManifestNonResxWithCulture.Culture)"/>
                <Copy SourceFiles = "@(NonResxWithCulture)"
                        DestinationFiles = "@(ManifestNonResxWithCulture->'$(IntermediateOutputPath)%(Identity)')"
-                       SkipUnchangedFiles="true">
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter = "DestinationFiles" ItemName = "ManifestNonResxWithCultureOnDisk"/>
                        <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
                </Copy>
 
                <Copy SourceFiles = "@(NonResxWithNoCulture)"
                        DestinationFiles = "@(ManifestNonResxWithNoCulture->'$(IntermediateOutputPath)%(Identity)')"
-                       SkipUnchangedFiles="true">
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter = "DestinationFiles" ItemName = "ManifestNonResxWithNoCultureOnDisk"/>
                        <Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
                </Copy>
                        SourceFiles="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb"
                        Condition="'$(OutDir)' != '' and Exists('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb')"
                        DestinationFolder="$(OutDir)"
-                       SkipUnchangedFiles="true" >
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" >
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
 
-               <Copy SourceFiles="@(IntermediateAssembly)" Condition="'$(OutDir)' != '' and Exists ('@(IntermediateAssembly)')" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true">
+               <Copy SourceFiles="@(IntermediateAssembly)" Condition="'$(OutDir)' != '' and Exists ('@(IntermediateAssembly)')" DestinationFolder="$(OutDir)" SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
 
                        SourceFiles = "@(IntermediateSatelliteAssemblies)"
                        DestinationFiles = "@(IntermediateSatelliteAssemblies->'$(OutDir)\%(Culture)\$(AssemblyName).resources.dll')"
                        Condition = "'@(IntermediateSatelliteAssemblies)' != ''"
-                       SkipUnchangedFiles="true">
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
        </Target>
                Outputs="@(ItemsToCopyToOutputDirectoryPreserveNewest->'$(OutDir)%(TargetPath)')">
 
                <Copy SourceFiles="@(ItemsToCopyToOutputDirectoryPreserveNewest)"
-                       DestinationFiles="@(ItemsToCopyToOutputDirectoryPreserveNewest->'$(OutDir)%(TargetPath)')">
+                       DestinationFiles="@(ItemsToCopyToOutputDirectoryPreserveNewest->'$(OutDir)%(TargetPath)')"
+                       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
                        <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
                </Copy>
        </Target>
                        <Output TaskParameter="Lines" ItemName="PreviousFileWrites"/>
                </ReadLinesFromFile>
 
+               <!-- CopyLocal files: In case all the projects build to common output
+                    directory, then other projects might depend on some of these
+                    CopyLocal files, so delete only the ones under *this* project
+                    directory -->
+               <FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)">
+                       <Output TaskParameter="InPath" ItemName="FileWrites"/>
+               </FindUnderPath>
+
                <RemoveDuplicates Inputs="@(PreviousFileWrites);@(FileWrites->'%(FullPath)')">
                        <Output TaskParameter="Filtered" ItemName="CombinedFileWrites"/>
                </RemoveDuplicates>
        </Target>
 
        <Target Name="CleanReferencedProjects"
-               DependsOnTargets="AssignProjectConfigurations">
+               DependsOnTargets="AssignProjectConfiguration">
 
                <!-- If building from .sln.proj or from IDE, clean will get handled by them,
                     else we are building a project directly, from the command line, so