Use LF in generated files (#7305)

This commit is contained in:
Ryan Blue
2024-10-28 22:28:58 -04:00
committed by GitHub
parent f44c3eda43
commit 412c042c6c
9 changed files with 10 additions and 9 deletions

View File

@@ -49,7 +49,7 @@ def generate_usage_reporting(output_directory: Path, template_directory: Path):
)
frc_net_comm = output_directory / f"main/java/{java_package}/FRCNetComm.java"
frc_net_comm.write_text(contents, encoding="utf-8")
frc_net_comm.write_text(contents, encoding="utf-8", newline="\n")
with (template_directory / "FRCUsageReporting.h.in").open(
encoding="utf-8"
@@ -65,7 +65,7 @@ def generate_usage_reporting(output_directory: Path, template_directory: Path):
usage_reporting_hdr = (
output_directory / "main/native/include/hal/FRCUsageReporting.h"
)
usage_reporting_hdr.write_text(contents, encoding="utf-8")
usage_reporting_hdr.write_text(contents, encoding="utf-8", newline="\n")
def main(argv):

View File

@@ -10,7 +10,7 @@ from jinja2 import Environment, FileSystemLoader
def Output(output_dir: Path, controller_name: str, contents: str):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / controller_name
output_file.write_text(contents, encoding="utf-8")
output_file.write_text(contents, encoding="utf-8", newline="\n")
def generate_topics(

View File

@@ -14,7 +14,7 @@ from jinja2 import Environment, FileSystemLoader
def write_controller_file(output_dir: Path, controller_name: str, contents: str):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / controller_name
output_file.write_text(contents, encoding="utf-8")
output_file.write_text(contents, encoding="utf-8", newline="\n")
def generate_hids(output_directory: Path, template_directory: Path, schema_file: Path):

View File

@@ -14,7 +14,7 @@ from jinja2 import Environment, FileSystemLoader
def write_controller_file(output_dir: Path, controller_name: str, contents: str):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / controller_name
output_file.write_text(contents, encoding="utf-8")
output_file.write_text(contents, encoding="utf-8", newline="\n")
def generate_hids(output_directory: Path, template_directory: Path, schema_file: Path):

View File

@@ -20,7 +20,7 @@ def render_template(
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / filename
output_file.write_text(template.render(controller), encoding="utf-8")
output_file.write_text(template.render(controller), encoding="utf-8", newline="\n")
def generate_cpp_headers(

View File

@@ -14,7 +14,7 @@ from jinja2 import Environment, FileSystemLoader
def write_controller_file(output_dir: Path, controller_name: str, contents: str):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / controller_name
output_file.write_text(contents, encoding="utf-8")
output_file.write_text(contents, encoding="utf-8", newline="\n")
def generate_hids(output_directory: Path, template_directory: Path):

View File

@@ -19,7 +19,7 @@ def render_template(
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / filename
output_file.write_text(template.render(controller), encoding="utf-8")
output_file.write_text(template.render(controller), encoding="utf-8", newline="\n")
def generate_pwm_motor_controllers(output_root, template_root):

View File

@@ -13,7 +13,7 @@ from pathlib import Path
def output(output_dir: Path, outfn: str, contents: str):
output_dir.mkdir(parents=True, exist_ok=True)
output_file = output_dir / outfn
output_file.write_text(contents, encoding="utf-8")
output_file.write_text(contents, encoding="utf-8", newline="\n")
def generate_numbers(output_directory: Path, template_root: Path):

View File

@@ -34,6 +34,7 @@ def generate_quickbuf(
"// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n"
+ content,
encoding="utf-8",
newline="\n",
)