未验证 提交 ba2b1840 编写于 作者: A Andrii Kurdiumov 提交者: GitHub

Remove flacky and redundant codegen (#4909)

* Remove flacky and redundant codegen
I belive that bringing these two relatively simple classes directly in source control will benefit more then attempt to codegen them. Anyway nobody touch them. This code gen is flacky and cause unnescessary frictions when build repo.
Thanks there #748 and #2968 which explain how to move forward, but unlikey this is needed. Rationale why with was created, most likely do not applied to existing runtime. NGen is no more, and we have much better JIT

Closes #749

* Add licese header
上级 4b759636
::BEGIN_TEMPLATE
COLLECTIONTYPE:ColumnDefinitionCollection
ITEMTYPE:ColumnDefinition
OWNERTYPE:Grid
WIDTHHEIGHT:Width
::END_TEMPLATE
::END
using MS.Utility;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using MS.Internal;
using System.Reflection;
using System.ComponentModel;
using BuildInfo=MS.Internal.PresentationFramework.BuildInfo;
\ No newline at end of file
::BEGIN_TEMPLATE
COLLECTIONTYPE:RowDefinitionCollection
ITEMTYPE:RowDefinition
OWNERTYPE:Grid
WIDTHHEIGHT:Height
::END_TEMPLATE
::END
......@@ -31,16 +31,6 @@
<WithCulture>false</WithCulture>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<CollectionTemplate Include="ColumnDefinition.cs">
<Pattern>MS\Utility\GridContentElementCollection</Pattern>
<Template>MS\Utility\ColumnDefinition</Template>
</CollectionTemplate>
<CollectionTemplate Include="RowDefinition.cs">
<Pattern>MS\Utility\GridContentElementCollection</Pattern>
<Template>MS\Utility\RowDefinition</Template>
</CollectionTemplate>
</ItemGroup>
<ItemGroup>
<Compile Include="$(WpfCommonDir)\src\System\LocalAppContext.cs" />
<Compile Include="$(WpfCommonDir)\src\System\AppContextDefaultValues.cs" />
......@@ -555,6 +545,7 @@
<Compile Include="System\Windows\Controls\CheckBox.cs" />
<Compile Include="System\Windows\Controls\CleanUpVirtualizedItemEventArgs.cs" />
<Compile Include="System\Windows\Controls\ClickMode.cs" />
<Compile Include="System\Windows\Controls\ColumnDefinition.cs" />
<Compile Include="System\Windows\Controls\ComboBox.cs" />
<Compile Include="System\Windows\Controls\ComboBoxItem.cs" />
<Compile Include="System\Windows\Controls\ContainerTracking.cs" />
......@@ -746,6 +737,7 @@
<Compile Include="System\Windows\Controls\RadioButton.cs" />
<Compile Include="System\Windows\Controls\RealizedColumnsBlock.cs" />
<Compile Include="System\Windows\Controls\RichTextBox.cs" />
<Compile Include="System\Windows\Controls\RowDefinition.cs" />
<Compile Include="System\Windows\Controls\ScrollChangedEventArgs.cs" />
<Compile Include="System\Windows\Controls\ScrollUnit.cs" />
<Compile Include="System\Windows\Controls\ScrollViewer.cs" />
......@@ -1461,31 +1453,6 @@
doesn’t run before the Build target.-->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- This has to come after the import of Sdk.targets, otherwise the CompileDependsOn property will be overwritten.
Once we move these templates to .tt this can be removed. -->
<PropertyGroup>
<CompileDependsOn>
GenerateTemplates;
$(CompileDependsOn)
</CompileDependsOn>
</PropertyGroup>
<Target Name="GenerateTemplates" DependsOnTargets="GenerateTemplatesCore" Returns="@(Compile)">
<Error Condition="!Exists('$(IntermediateOutputPath)\%(CollectionTemplate.Identity)')" Text="$(IntermediateOutputPath)\%(CollectionTemplate.Identity) does not exist" />
<ItemGroup>
<Compile Include="$(IntermediateOutputPath)%(CollectionTemplate.Identity)" />
</ItemGroup>
</Target>
<Target Name="GenerateTemplatesCore" Inputs="%(CollectionTemplate.Template).ti;%(CollectionTemplate.Pattern).tb;%(CollectionTemplate.Pattern).th" Outputs="$(IntermediateOutputPath)\%(CollectionTemplate.Identity)">
<MakeDir Condition="!Exists('$(IntermediateOutputPath)')" Directories="$(IntermediateOutputPath)" />
<Error Text="CollectionTemplate must have Pattern (header and body) and Template (instances) child elements set." Condition="'%(CollectionTemplate.Pattern)' == '' OR '%(CollectionTemplate.Template)' == ''" />
<Error Text="The header file %(CollectionTemplate.Pattern).th is missing. Cannot generate template in %(CollectionTemplate.Identity)" Condition="!Exists('%(CollectionTemplate.Pattern).th')" />
<Error Text="The body file %(CollectionTemplate.Pattern).tb is missing. Cannot generate template in %(CollectionTemplate.Identity)" Condition="!Exists('%(CollectionTemplate.Pattern).tb')" />
<Error Text="The instances file %(Template).ti is missing. Cannot generate template in %(CollectionTemplate.Identity)" Condition="!Exists('%(CollectionTemplate.Template).ti')" />
<Message Text="Generating template in %(CollectionTemplate.Identity)" />
<Exec Command="$(PerlCommand) template.pl %(CollectionTemplate.Pattern) %(CollectionTemplate.Template) &gt; $(IntermediateOutputPath)\%(CollectionTemplate.Identity)" Outputs="$(IntermediateOutputPath)\%(CollectionTemplate.Identity)" StandardOutputImportance="normal" />
</Target>
<Import Project="$(WpfCodeGenDir)AvTrace\GenAvMessages.targets" />
<!-- DevDiv Bug 888747: Re-enable AvTrace codegen -->
<!-- <Import Project="$(WpfCodeGenDir)DesignTimeTextTemplating.targets" /> -->
......
#------------------------------------------------------------------------------
# Microsoft Windows Client Platform
#
#
# Description: Allows CLR generic-like type creation without using actual
# generics. Performance (lack of ngen support was the main
# motivation behind this approach)
#------------------------------------------------------------------------------
if (@ARGV < 1)
{
print "Usage: template.pl <template name> [<instance template>]";
exit();
}
$templateName = $ARGV[0];
$templateHeader = $templateName . ".th";
$templateBody = $templateName . ".tb";
$templateInstances = $templateName . ".ti";
if (@ARGV > 1)
{
$templateInstances = $ARGV[1] . ".ti";
}
# Output the header file.
open(FHANDLE3, $templateHeader) || die "Can not open header file: $templateHeader";
while (<FHANDLE3>)
{
print $_;
}
close(FHANDLE3);
print "\n";
print "\n";
# Instantiate the template.
open(FHANDLE2, $templateInstances) || die "Can not open instantiation file: $templateInstances";
NEXT:
while (1)
{
$x = <FHANDLE2>;
if ($x =~ m/::BEGIN_TEMPLATE/)
{
@searchString = {};
@replaceString = {};
}
elsif ($x =~ m/::END_TEMPLATE/)
{
goto REPLACE;
}
elsif ($x =~ m/::END/)
{
goto END;
}
elsif ($x =~ m/(.*):([^\r\n]*)/)
{
$searchString[$#searchString++] = "<<$1>>";
$replaceString[$#replaceString++] = "$2";
}
}
REPLACE:
open(FHANDLE, $templateBody) || die "Can not open file.";
while (<FHANDLE>)
{
for ($i=0; $i<$#searchString; $i++)
{
$_ =~ s/$searchString[$i]/$replaceString[$i]/g;
}
print $_;
}
close(FHANDLE);
print "\n";
print "\n";
goto NEXT;
END:
close(FHANDLE2);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册