Skip to content

Commit

Permalink
Adding support of apply transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
vtrifonov committed Apr 21, 2015
1 parent c909f43 commit df3f41a
Show file tree
Hide file tree
Showing 17 changed files with 5,309 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.AllFilesInProjectFolder.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for collecting all files in the project folder.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="CollectFilesinFolder" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="EscapeTextForRegularExpressions" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="Microsoft.Web.Publishing.Tasks.dll"/>

<PropertyGroup>
<PublishPipelineCollectFilesCore>
$(PublishPipelineCollectFilesCore);
CollectFilesFromProjectFolder;
</PublishPipelineCollectFilesCore>
<_CollectFiles_IncludeIgnorableFile Condition="'$(_CollectFiles_IncludeIgnorableFile)'==''">False</_CollectFiles_IncludeIgnorableFile>

<!--Overwrite the default behavior. Don't remove the web.debug.config -->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">False</ExcludeTransformAssistFilesFromPublish>
<CollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(CollectFilesFromProjectFolder_ExcludeSccFiles)'==''">True</CollectFilesFromProjectFolder_ExcludeSccFiles>
</PropertyGroup>

<!--********************************************************************-->
<!-- Task SetExcludeFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<SetExcludeFromProjectFolderDependsOn Condition="'$(SetExcludeFromProjectFolderDependsOn)'==''">
</SetExcludeFromProjectFolderDependsOn>
</PropertyGroup>

<Target Name="SetExcludeFromProjectFolder"
DependsOnTargets="$(SetExcludeFromProjectFolderDependsOn)">

<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeIntermediateOutputFolderMessage"
LogType="Message" />

<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeFileExtentionOutMessage"
LogType="Message" />
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeSourceControlItems"
LogType="Message" />

<!--Maybe we need to introduce @(_ExcludeFromProjectFolder)-->
<ItemGroup>

<!--Split item to _KnowProjectItems is to keep the metadata for item collection.
Please see http://msdn.microsoft.com/en-us/library/bb629388.aspx for known Project item collection.-->
<_KnownProjectItems Include="@(EmbeddedResource)" />
<_KnownProjectItems Include="@(None)" />
<_KnownProjectItems Include="@(Content)" />
<_KnownProjectItems Include="@(Compile)" />


<!--Explicit exclude all files under the obj folder -->
<_ProjectBaseIntermediateOutputPath Include="$(BaseIntermediateOutputPath)"/>

</ItemGroup>

<!--Create the rgulare expression to exclude all root folder *.out, all folder *.scc and all folder*.vspscc file-->
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>^[^\\]*\.out$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>

<!--Create the rgulare expression to exclude all Intermedidate output path.-->
<EscapeTextForRegularExpressions Text="@(_ProjectBaseIntermediateOutputPath->'%(FullPath)')">
<Output TaskParameter="Result" PropertyName="_ExcludeFullPathFromProjectFolder" />
</EscapeTextForRegularExpressions>

</Target>


<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder_ExcludeSccFiles -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles)'==''">
SetExcludeFromProjectFolder;
</OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles>
<!--Targets get execute after this Target-->
<OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles)'==''">
</OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles>

<CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn Condition="'$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn)'==''">
$(OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles);
</CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder_ExcludeSccFiles"
DependsOnTargets="$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn)"
Condition="$(CollectFilesFromProjectFolder_ExcludeSccFiles)">
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>$(_ExcludeRelativePathFromProjectFolder);[^\\]*\.scc$;[^\\]*\.vssscc$;[^\\]*\.vspscc$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>

<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles)" RunEachTargetSeparately="false" />
</Target>



<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<!--Targets get execute before this Target-->
<OnBeforeCollectFilesFromProjectFolder Condition="'$(OnBeforeCollectFilesFromProjectFolder)'==''">
SetExcludeFromProjectFolder;
CollectFilesFromProjectFolder_ExcludeSccFiles;
</OnBeforeCollectFilesFromProjectFolder>
<!--Targets get execute after this Target-->
<OnAfterCollectFilesFromProjectFolder Condition="'$(OnAfterCollectFilesFromProjectFolder)'==''">
</OnAfterCollectFilesFromProjectFolder>

<CollectFilesFromProjectFolderDependsOn Condition="'$(CollectFilesFromProjectFolderDependsOn)'==''">
$(OnBeforeCollectFilesFromProjectFolder);
</CollectFilesFromProjectFolderDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder"
DependsOnTargets="$(CollectFilesFromProjectFolderDependsOn)" >

<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherAllFilesInProjectFolderExceptExclusion"
LogType="Message" />

<CollectFilesinFolder RootPath="$(WebPublishPipelineProjectDirectory)"
ExcludeFullPathMatchs="$(_ExcludeFullPathFromProjectFolder)"
ExcludeRelativePathMatchs="$(_ExcludeRelativePathFromProjectFolder)" >
<Output TaskParameter="Result" ItemName="_AllFilesUnderProjectFolderNoMetadata" />
</CollectFilesinFolder>






<!--The first two lines keeps the _KnowProjectItem's item metadata-->
<FilterByItems PipelineItems="@(_AllFilesUnderProjectFolderNoMetadata)"
Filter="@(_KnownProjectItems)">
<Output TaskParameter="OutFilter" ItemName="_AllFilesUnderProjectFolderExceptKnownProjectItems"/>
</FilterByItems>

<ItemGroup>
<!--Readd _KnowProjectItem's to keep item metadata. First for non-Link file -->
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'==''">
<DestinationRelativePath>%(_KnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(_KnownProjectItems.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>

<FilesForPackagingFromProject Include="@(_AllFilesUnderProjectFolderExceptKnownProjectItems)" >
<DestinationRelativePath>%(_AllFilesUnderProjectFolderExceptKnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.ExceptKonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>

</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder)" RunEachTargetSeparately="false" />
</Target>
</Project>
Loading

0 comments on commit df3f41a

Please sign in to comment.