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;$(GeneratedPyConfigDir)pyconfig.h;$(PySourcePath)Tools\jit\**"/> 33 <_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils.h"/> 34 <_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\optimizer_bytecodes.c;"/> 35 <_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"/> 36 <_SbomSources Include="$(PySourcePath)PCbuild\get_externals.bat" /> 37 <_SbomOutputs Include="$(PySourcePath)Misc\externals.spdx.json;$(PySourcePath)Misc\sbom.spdx.json"> 38 <Format>json</Format> 39 </_SbomOutputs> 40 </ItemGroup> 41 42 <Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'"> 43 <Message Text="Touching source files to force regeneration" Importance="high" /> 44 <Touch Files="@(_PegenSources);@(_ASTSources);@(_TokenSources);@(_KeywordOutputs);@(_CasesSources);@(_SbomSources)" 45 AlwaysCreate="False" /> 46 </Target> 47 48 <Target Name="_RegenPegen" 49 Inputs="@(_PegenSources)" Outputs="@(_PegenOutputs)" 50 DependsOnTargets="FindPythonForBuild"> 51 <Message Text="Regenerate @(_PegenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> 52 <!-- Specify python.gram with POSIX-like path because the argument gets written into the file verbatim --> 53 <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen -q c ./Grammar/python.gram Grammar\Tokens -o Parser\parser.c" 54 WorkingDirectory="$(PySourcePath)" /> 55 </Target> 56 57 <Target Name="_RegenAST_H" 58 Inputs="@(_ASTSources)" Outputs="@(_ASTOutputs)" 59 DependsOnTargets="FindPythonForBuild"> 60 <Message Text="Regenerate @(_ASTOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> 61 <Exec Command="$(PythonForBuild) Parser\asdl_c.py Parser\Python.asdl @(_ASTOutputs->'%(Argument) "%(Identity)"',' ')" 62 WorkingDirectory="$(PySourcePath)" /> 63 </Target> 64 65 <Target Name="_RegenTokens" 66 Inputs="@(_TokenSources)" Outputs="@(_TokenOutputs)" 67 DependsOnTargets="FindPythonForBuild"> 68 <Message Text="Regenerate @(_TokenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> 69 <Exec Command="$(PythonForBuild) Tools\build\generate_token.py %(_TokenOutputs.Format) Grammar\Tokens "%(_TokenOutputs.Identity)"" 70 WorkingDirectory="$(PySourcePath)" /> 71 <Touch Files="@(_TokenOutputs)" /> 72 </Target> 73 74 <Target Name="_RegenKeywords" 75 Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)" 76 DependsOnTargets="FindPythonForBuild"> 77 <Message Text="Regenerate @(_KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" /> 78 <Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py" 79 WorkingDirectory="$(PySourcePath)" /> 80 </Target> 81 82 <Target Name="_RegenGlobalObjects" 83 DependsOnTargets="FindPythonForBuild"> 84 <Message Text="Regenerate Global Objects" Importance="high" /> 85 <Exec Command="$(PythonForBuild) Tools\build\generate_global_objects.py" 86 WorkingDirectory="$(PySourcePath)" /> 87 </Target> 88 89 <Target Name="_RegenCases" 90 Inputs="@(_CasesSources)" Outputs="@(_CasesOutputs)" 91 DependsOnTargets="FindPythonForBuild"> 92 <Message Text="Regenerate cases" Importance="high" /> 93 <Exec Command="$(PythonForBuild) Tools\cases_generator\opcode_id_generator.py Python\bytecodes.c" 94 WorkingDirectory="$(PySourcePath)" /> 95 <Exec Command="$(PythonForBuild) Tools\cases_generator\target_generator.py Python\bytecodes.c" 96 WorkingDirectory="$(PySourcePath)" /> 97 <Exec Command="$(PythonForBuild) Tools\cases_generator\uop_id_generator.py Python\bytecodes.c" 98 WorkingDirectory="$(PySourcePath)" /> 99 <Exec Command="$(PythonForBuild) Tools\cases_generator\py_metadata_generator.py Python\bytecodes.c" 100 WorkingDirectory="$(PySourcePath)" /> 101 <Exec Command="$(PythonForBuild) Tools\cases_generator\tier1_generator.py Python\bytecodes.c" 102 WorkingDirectory="$(PySourcePath)" /> 103 <Exec Command="$(PythonForBuild) Tools\cases_generator\tier2_generator.py Python\bytecodes.c" 104 WorkingDirectory="$(PySourcePath)" /> 105 <Exec Command="$(PythonForBuild) Tools\cases_generator\optimizer_generator.py Python\optimizer_bytecodes.c Python\bytecodes.c" 106 WorkingDirectory="$(PySourcePath)" /> 107 <Exec Command="$(PythonForBuild) Tools\cases_generator\opcode_metadata_generator.py Python\bytecodes.c" 108 WorkingDirectory="$(PySourcePath)" /> 109 <Exec Command="$(PythonForBuild) Tools\cases_generator\uop_metadata_generator.py Python\bytecodes.c" 110 WorkingDirectory="$(PySourcePath)" /> 111 </Target> 112 113 <Target Name="_RegenJIT" 114 Condition="'$(UseJIT)' == 'true'" 115 DependsOnTargets="_UpdatePyconfig;FindPythonForBuild" 116 Inputs="@(_JITSources)" 117 Outputs="@(_JITOutputs)"> 118 <PropertyGroup> 119 <JITArgs Condition="$(Platform) == 'ARM64'">aarch64-pc-windows-msvc</JITArgs> 120 <JITArgs Condition="$(Platform) == 'Win32'">i686-pc-windows-msvc</JITArgs> 121 <JITArgs Condition="$(Platform) == 'x64'">x86_64-pc-windows-msvc</JITArgs> 122 <JITArgs Condition="$(Configuration) == 'Debug'">$(JITArgs) --debug</JITArgs> 123 </PropertyGroup> 124 <Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs)' 125 WorkingDirectory="$(GeneratedPyConfigDir)"/> 126 </Target> 127 128 <Target Name="_RegenNoPGUpdate" 129 Condition="$(Configuration) != 'PGUpdate'" 130 DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenTokens;_RegenKeywords;_RegenGlobalObjects"> 131 </Target> 132 133 <Target Name="_RegenSbom" 134 DependsOnTargets="FindPythonForBuild" 135 Inputs="@(_SbomSources)" 136 Outputs="@(_SbomOutputs)"> 137 <Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\build\generate_sbom.py"'/> 138 </Target> 139 140 <Target Name="Regen" DependsOnTargets="_RegenNoPGUpdate;_RegenJIT;_RegenCases;_RegenSbom"> 141 <Message Text="Generated sources are up to date" Importance="high" /> 142 </Target> 143 144 145 <ItemGroup> 146 <_TestFrozenSources Include="$(PySourcePath)Programs\freeze_test_frozenmain.py; 147 $(PySourcePath)Programs\test_frozenmain.py; 148 @(_OpcodeOutputs)" /> 149 <_TestFrozenOutputs Include="$(PySourcePath)Programs\test_frozenmain.h" /> 150 <_LicenseSources Include="$(PySourcePath)LICENSE; 151 $(PySourcePath)PC\crtlicense.txt; 152 $(bz2Dir)LICENSE; 153 $(libffiDir)LICENSE;" /> 154 <_LicenseSources Include="$(opensslOutDir)LICENSE.txt" Condition="Exists('$(opensslOutDir)LICENSE.txt')" /> 155 <_LicenseSources Include="$(opensslOutDir)LICENSE" Condition="!Exists('$(opensslOutDir)LICENSE.txt')" /> 156 <_LicenseSources Include="$(tcltkDir)tcllicense.terms; 157 $(tcltkDir)tklicense.terms" Condition="$(IncludeTkinter)" /> 158 </ItemGroup> 159 160 <Target Name="_RegenTestFrozenmain" Inputs="@(_TestFrozenSources)" Outputs="@(_TestFrozenOutputs)" 161 Condition="($(Platform) == 'Win32' or $(Platform) == 'x64') and 162 $(Configuration) != 'PGInstrument' and $(Configuration) != 'PGUpdate'"> 163 <Message Text="Regenerate @(_TestFrozenOutputs->'%(Filename)%(Extension)', ' ')" Importance="high" /> 164 <Exec Command='setlocal%0D%0Aset PYTHONPATH=$(PySourcePath)Lib%0D%0A"$(PythonExe)" Programs\freeze_test_frozenmain.py Programs\test_frozenmain.h' 165 WorkingDirectory="$(PySourcePath)" /> 166 </Target> 167 168 <Target Name="_RegenLicense"> 169 <ItemGroup> 170 <_Text1 Include="@(_LicenseSources)"> 171 <Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content> 172 </_Text1> 173 <_Text Include="@(_Text1->'%(Content)')" /> 174 </ItemGroup> 175 176 <WriteLinesToFile File="$(OutDir)LICENSE.txt" Overwrite="true" Lines="@(_Text)" /> 177 <Warning Text="License file %(_LicenseSources.FullPath) is missing" 178 Condition="!Exists(@(_LicenseSources))" /> 179 <Message Text="Wrote $(OutDir)LICENSE.txt" Importance="high" /> 180 </Target> 181 182 <Target Name="PostBuildRegen" DependsOnTargets="_RegenTestFrozenmain;_RegenLicense" /> 183</Project> 184