Debian Codegraph @

PCbuild/regen.targets

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup>
4 <_PegenSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
5 <_PegenOutputs Include="$(PySourcePath)Parser\parser.c" />
6 <_ASTSources Include="$(PySourcePath)Parser\Python.asdl" />
7 <_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast.h">
8 <Argument>-H</Argument>
9 </_ASTOutputs>
10 <_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast_state.h">
11 <Argument>-I</Argument>
12 </_ASTOutputs>
13 <_ASTOutputs Include="$(PySourcePath)Python\Python-ast.c">
14 <Argument>-C</Argument>
15 </_ASTOutputs>
16 <_TokenSources Include="$(PySourcePath)Grammar\Tokens" />
17 <_TokenOutputs Include="$(PySourcePath)Doc\library\token-list.inc">
18 <Format>rst</Format>
19 </_TokenOutputs>
20 <_TokenOutputs Include="$(PySourcePath)Include\internal\pycore_token.h">
21 <Format>h</Format>
22 </_TokenOutputs>
23 <_TokenOutputs Include="$(PySourcePath)Parser\token.c">
24 <Format>c</Format>
25 </_TokenOutputs>
26 <_TokenOutputs Include="$(PySourcePath)Lib\token.py">
27 <Format>py</Format>
28 </_TokenOutputs>
29 <_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
30 <_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" />
31 <!-- Taken from _Target._compute_digest in Tools\jit\_targets.py: -->
32 <_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(PySourcePath)PC\pyconfig.h;$(PySourcePath)Tools\jit\**"/>
33 <!-- Need to explicitly enumerate these, since globbing doesn't work for missing outputs: -->
34 <_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils.h"/>
35 <_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-aarch64-pc-windows-msvc.h" Condition="$(Platform) == 'ARM64'"/>
36 <_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-i686-pc-windows-msvc.h" Condition="$(Platform) == 'Win32'"/>
37 <_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-x86_64-pc-windows-msvc.h" Condition="$(Platform) == 'x64'"/>
38 <_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\optimizer_bytecodes.c;"/>
39 <_CasesOutputs Include="$(PySourcePath)Python\generated_cases.c.h;$(PySourcePath)Include\opcode_ids.h;$(PySourcePath)Include\internal\pycore_uop_ids.h;$(PySourcePath)Python\opcode_targets.h;$(PySourcePath)Include\internal\pycore_opcode_metadata.h;$(PySourcePath)Include\internal\pycore_uop_metadata.h;$(PySourcePath)Python\optimizer_cases.c.h;$(PySourcePath)Lib\_opcode_metadata.py"/>
40 <_SbomSources Include="$(PySourcePath)PCbuild\get_externals.bat" />
41 <_SbomOutputs Include="$(PySourcePath)Misc\externals.spdx.json;$(PySourcePath)Misc\sbom.spdx.json">
42 <Format>json</Format>
43 </_SbomOutputs>
44 </ItemGroup>
45
46 <Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
47 <Message Text="Touching source files to force regeneration" Importance="high" />
48 <Touch Files="@(_PegenSources);@(_ASTSources);@(_TokenSources);@(_KeywordOutputs);@(_CasesSources);@(_SbomSources)"
49 AlwaysCreate="False" />
50 </Target>
51
52 <Target Name="_RegenPegen"
53 Inputs="@(_PegenSources)" Outputs="@(_PegenOutputs)"
54 DependsOnTargets="FindPythonForBuild">
55 <Message Text="Regenerate @(_PegenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
56 <!-- Specify python.gram with POSIX-like path because the argument gets written into the file verbatim -->
57 <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen -q c ./Grammar/python.gram Grammar\Tokens -o Parser\parser.c"
58 WorkingDirectory="$(PySourcePath)" />
59 </Target>
60
61 <Target Name="_RegenAST_H"
62 Inputs="@(_ASTSources)" Outputs="@(_ASTOutputs)"
63 DependsOnTargets="FindPythonForBuild">
64 <Message Text="Regenerate @(_ASTOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
65 <Exec Command="$(PythonForBuild) Parser\asdl_c.py Parser\Python.asdl @(_ASTOutputs->'%(Argument) &quot;%(Identity)&quot;',' ')"
66 WorkingDirectory="$(PySourcePath)" />
67 </Target>
68
69 <Target Name="_RegenTokens"
70 Inputs="@(_TokenSources)" Outputs="@(_TokenOutputs)"
71 DependsOnTargets="FindPythonForBuild">
72 <Message Text="Regenerate @(_TokenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
73 <Exec Command="$(PythonForBuild) Tools\build\generate_token.py %(_TokenOutputs.Format) Grammar\Tokens &quot;%(_TokenOutputs.Identity)&quot;"
74 WorkingDirectory="$(PySourcePath)" />
75 <Touch Files="@(_TokenOutputs)" />
76 </Target>
77
78 <Target Name="_RegenKeywords"
79 Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)"
80 DependsOnTargets="FindPythonForBuild">
81 <Message Text="Regenerate @(_KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
82 <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py"
83 WorkingDirectory="$(PySourcePath)" />
84 </Target>
85
86 <Target Name="_RegenGlobalObjects"
87 DependsOnTargets="FindPythonForBuild">
88 <Message Text="Regenerate Global Objects" Importance="high" />
89 <Exec Command="$(PythonForBuild) Tools\build\generate_global_objects.py"
90 WorkingDirectory="$(PySourcePath)" />
91 </Target>
92
93 <Target Name="_RegenCases"
94 Inputs="@(_CasesSources)" Outputs="@(_CasesOutputs)"
95 DependsOnTargets="FindPythonForBuild">
96 <Message Text="Regenerate cases" Importance="high" />
97 <Exec Command="$(PythonForBuild) Tools\cases_generator\opcode_id_generator.py Python\bytecodes.c"
98 WorkingDirectory="$(PySourcePath)" />
99 <Exec Command="$(PythonForBuild) Tools\cases_generator\target_generator.py Python\bytecodes.c"
100 WorkingDirectory="$(PySourcePath)" />
101 <Exec Command="$(PythonForBuild) Tools\cases_generator\uop_id_generator.py Python\bytecodes.c"
102 WorkingDirectory="$(PySourcePath)" />
103 <Exec Command="$(PythonForBuild) Tools\cases_generator\py_metadata_generator.py Python\bytecodes.c"
104 WorkingDirectory="$(PySourcePath)" />
105 <Exec Command="$(PythonForBuild) Tools\cases_generator\tier1_generator.py Python\bytecodes.c"
106 WorkingDirectory="$(PySourcePath)" />
107 <Exec Command="$(PythonForBuild) Tools\cases_generator\tier2_generator.py Python\bytecodes.c"
108 WorkingDirectory="$(PySourcePath)" />
109 <Exec Command="$(PythonForBuild) Tools\cases_generator\optimizer_generator.py Python\optimizer_bytecodes.c Python\bytecodes.c"
110 WorkingDirectory="$(PySourcePath)" />
111 <Exec Command="$(PythonForBuild) Tools\cases_generator\opcode_metadata_generator.py Python\bytecodes.c"
112 WorkingDirectory="$(PySourcePath)" />
113 <Exec Command="$(PythonForBuild) Tools\cases_generator\uop_metadata_generator.py Python\bytecodes.c"
114 WorkingDirectory="$(PySourcePath)" />
115 </Target>
116
117 <Target Name="_RegenJIT"
118 Condition="'$(UseJIT)' == 'true'"
119 DependsOnTargets="FindPythonForBuild"
120 Inputs="@(_JITSources)"
121 Outputs="@(_JITOutputs)">
122 <PropertyGroup>
123 <JITArgs Condition="$(Platform) == 'ARM64'">aarch64-pc-windows-msvc</JITArgs>
124 <JITArgs Condition="$(Platform) == 'Win32'">i686-pc-windows-msvc</JITArgs>
125 <JITArgs Condition="$(Platform) == 'x64'">x86_64-pc-windows-msvc</JITArgs>
126 <JITArgs Condition="$(Configuration) == 'Debug'">$(JITArgs) --debug</JITArgs>
127 </PropertyGroup>
128 <Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs) --output-dir "$(GeneratedJitStencilsDir)" --pyconfig-dir "$(PySourcePath)PC"'/>
129 </Target>
130 <Target Name="_CleanJIT" AfterTargets="Clean">
131 <Delete Files="@(_JITOutputs)"/>
132 </Target>
133
134 <Target Name="_RegenNoPGUpdate"
135 Condition="$(Configuration) != 'PGUpdate'"
136 DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenTokens;_RegenKeywords;_RegenGlobalObjects">
137 </Target>
138
139 <Target Name="_RegenSbom"
140 DependsOnTargets="FindPythonForBuild"
141 Inputs="@(_SbomSources)"
142 Outputs="@(_SbomOutputs)">
143 <Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\build\generate_sbom.py"'/>
144 </Target>
145
146 <Target Name="Regen" DependsOnTargets="_RegenNoPGUpdate;_RegenJIT;_RegenCases;_RegenSbom">
147 <Message Text="Generated sources are up to date" Importance="high" />
148 </Target>
149
150
151 <ItemGroup>
152 <_TestFrozenSources Include="$(PySourcePath)Programs\freeze_test_frozenmain.py;
153 $(PySourcePath)Programs\test_frozenmain.py;
154 @(_OpcodeOutputs)" />
155 <_TestFrozenOutputs Include="$(PySourcePath)Programs\test_frozenmain.h" />
156 <_LicenseSources Include="$(PySourcePath)LICENSE;
157 $(PySourcePath)PC\crtlicense.txt;
158 $(bz2Dir)LICENSE;
159 $(libffiDir)LICENSE;
160 $(zstdDir)\LICENSE;" />
161 <_LicenseSources Include="$(opensslOutDir)LICENSE.txt" Condition="Exists('$(opensslOutDir)LICENSE.txt')" />
162 <_LicenseSources Include="$(opensslOutDir)LICENSE" Condition="!Exists('$(opensslOutDir)LICENSE.txt')" />
163 <_LicenseSources Include="$(tcltkDir)tcllicense.terms;
164 $(tcltkDir)tklicense.terms" Condition="$(IncludeTkinter)" />
165 </ItemGroup>
166
167 <Target Name="_RegenTestFrozenmain" Inputs="@(_TestFrozenSources)" Outputs="@(_TestFrozenOutputs)"
168 Condition="($(Platform) == 'Win32' or $(Platform) == 'x64') and
169 $(Configuration) != 'PGInstrument' and $(Configuration) != 'PGUpdate'">
170 <Message Text="Regenerate @(_TestFrozenOutputs->'%(Filename)%(Extension)', ' ')" Importance="high" />
171 <Exec Command='setlocal%0D%0Aset PYTHONPATH=$(PySourcePath)Lib%0D%0A"$(PythonExe)" Programs\freeze_test_frozenmain.py Programs\test_frozenmain.h'
172 WorkingDirectory="$(PySourcePath)" />
173 </Target>
174
175 <Target Name="_RegenLicense">
176 <ItemGroup>
177 <_Text1 Include="@(_LicenseSources)">
178 <Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
179 </_Text1>
180 <_Text Include="@(_Text1->'%(Content)')" />
181 </ItemGroup>
182
183 <WriteLinesToFile File="$(OutDir)LICENSE.txt" Overwrite="true" Lines="@(_Text)" />
184 <Warning Text="License file %(_LicenseSources.FullPath) is missing"
185 Condition="!Exists(@(_LicenseSources))" />
186 <Message Text="Wrote $(OutDir)LICENSE.txt" Importance="high" />
187 </Target>
188
189 <Target Name="PostBuildRegen" DependsOnTargets="_RegenTestFrozenmain;_RegenLicense" />
190 </Project>