Ensure all Visual Studio files are generated with CRLF

This commit is contained in:
Andreia Gaita 2024-04-10 16:59:57 +02:00
parent 1f0f81049f
commit 536ca28ea9
6 changed files with 26 additions and 18 deletions

2
.gitattributes vendored
View file

@ -9,6 +9,8 @@ thirdparty/* linguist-vendored
*.bat eol=crlf *.bat eol=crlf
# And some test files where the EOL matters # And some test files where the EOL matters
*.test.txt -text *.test.txt -text
# And also the templates for Visual Studio files, which VS will always force CRLF on
/misc/msvs/*.template eol=crlf
# The above only works properly for Git 2.10+, so for older versions # The above only works properly for Git 2.10+, so for older versions
# we need to manually list the binary files we don't want modified. # we need to manually list the binary files we don't want modified.

View file

@ -1326,7 +1326,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
filters_template = filters_template.replace("%%HASH%%", md5) filters_template = filters_template.replace("%%HASH%%", md5)
with open(f"{project_name}.vcxproj.filters", "w", encoding="utf-8", newline="\n") as f: with open(f"{project_name}.vcxproj.filters", "w", encoding="utf-8", newline="\r\n") as f:
f.write(filters_template) f.write(filters_template)
envsources = [] envsources = []
@ -1507,7 +1507,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
props_template = props_template.replace("%%CLEAN%%", cmd) props_template = props_template.replace("%%CLEAN%%", cmd)
with open( with open(
f"{project_name}.{platform}.{target}.{arch}.generated.props", "w", encoding="utf-8", newline="\n" f"{project_name}.{platform}.{target}.{arch}.generated.props", "w", encoding="utf-8", newline="\r\n"
) as f: ) as f:
f.write(props_template) f.write(props_template)
@ -1624,7 +1624,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
sln_template = sln_template.replace("%%SECTION1%%", "\n ".join(section1)) sln_template = sln_template.replace("%%SECTION1%%", "\n ".join(section1))
sln_template = sln_template.replace("%%SECTION2%%", "\n ".join(section2)) sln_template = sln_template.replace("%%SECTION2%%", "\n ".join(section2))
with open(f"{project_name}.sln", "w", encoding="utf-8", newline="\n") as f: with open(f"{project_name}.sln", "w", encoding="utf-8", newline="\r\n") as f:
f.write(sln_template) f.write(sln_template)
if get_bool(original_args, "vsproj_gen_only", True): if get_bool(original_args, "vsproj_gen_only", True):

View file

@ -18,4 +18,7 @@
<ItemGroup Condition="%%CONDITION%%"> <ItemGroup Condition="%%CONDITION%%">
%%EXTRA_ITEMS%% %%EXTRA_ITEMS%%
</ItemGroup> </ItemGroup>
</Project> </Project>
<!-- CHECKSUM
%%HASH%%
-->

View file

@ -5,16 +5,16 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%%NAME%%", "%%NAME%%.vcxproj", "{%%UUID%%}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%%NAME%%", "%%NAME%%.vcxproj", "{%%UUID%%}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
%%SECTION1%% %%SECTION1%%
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
%%SECTION2%% %%SECTION2%%
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {%%SLNUUID%%} SolutionGuid = {%%SLNUUID%%}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -27,4 +27,4 @@
</Project> </Project>
<!-- CHECKSUM <!-- CHECKSUM
%%HASH%% %%HASH%%
--> -->

View file

@ -37,4 +37,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
<!-- CHECKSUM
%%HASH%%
-->