Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all Visual Studio files are generated with CRLF #90495

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ thirdparty/* linguist-vendored
*.bat eol=crlf
# And some test files where the EOL matters
*.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
# we need to manually list the binary files we don't want modified.
Expand Down
6 changes: 3 additions & 3 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ def format_key_value(v):

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)

envsources = []
Expand Down Expand Up @@ -1507,7 +1507,7 @@ def format_key_value(v):
props_template = props_template.replace("%%CLEAN%%", cmd)

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:
f.write(props_template)

Expand Down Expand Up @@ -1624,7 +1624,7 @@ def format_key_value(v):
sln_template = sln_template.replace("%%SECTION1%%", "\n ".join(section1))
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)

if get_bool(original_args, "vsproj_gen_only", True):
Expand Down
5 changes: 4 additions & 1 deletion misc/msvs/props.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
<ItemGroup Condition="%%CONDITION%%">
%%EXTRA_ITEMS%%
</ItemGroup>
</Project>
</Project>
<!-- CHECKSUM
%%HASH%%
-->
24 changes: 12 additions & 12 deletions misc/msvs/sln.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%%NAME%%", "%%NAME%%.vcxproj", "{%%UUID%%}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
%%SECTION1%%
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
%%SECTION2%%
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {%%SLNUUID%%}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
%%SECTION1%%
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
%%SECTION2%%
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {%%SLNUUID%%}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion misc/msvs/vcxproj.filters.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
</Project>
<!-- CHECKSUM
%%HASH%%
-->
-->
5 changes: 4 additions & 1 deletion misc/msvs/vcxproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
<!-- CHECKSUM
%%HASH%%
-->
Loading