Skip to content
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
25 changes: 5 additions & 20 deletions .hypertext/formatter-tools/native-addons-rules.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{
"setup": [
[
"python3",
"{repo}/.hypertext/formatter-tools/native-addons.py",
"setup-swift"
],
[
"python3",
"{repo}/.hypertext/formatter-tools/native-addons.py",
"setup-terraform"
]
["python3", "{repo}/.hypertext/formatter-tools/native-addons.py", "setup-swift"],
["python3", "{repo}/.hypertext/formatter-tools/native-addons.py", "setup-terraform"]
],
"rules": [
{
"name": "SwiftFormat 0.64.0",
"name": "SwiftFormat",
"patterns": ["**/*.swift", "*.swift"],
"argv": [
"python3",
Expand All @@ -24,15 +16,8 @@
]
},
{
"name": "Terraform 1.15.5",
"patterns": [
"**/*.tf",
"*.tf",
"**/*.tfvars",
"*.tfvars",
"**/*.hcl",
"*.hcl"
],
"name": "Terraform",
"patterns": ["**/*.tf", "*.tf", "**/*.tfvars", "*.tfvars", "**/*.hcl", "*.hcl"],
"argv": [
"python3",
"{repo}/.hypertext/formatter-tools/native-addons.py",
Expand Down
36 changes: 25 additions & 11 deletions .hypertext/formatter-tools/native-addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
Path(os.environ.get("XDG_CACHE_HOME", str(Path.home() / ".cache")))
/ "hypertext-formatters"
)
SWIFT_VERSION = "0.64.0"
SWIFT_ARCHIVE = "95ea62625d0b898a7af870293311ae6f09e4a3147ecd900593687e4b9ab2fd98"
SWIFT_BINARY = "c2b098cc3ae30ff9fdd1acf7342f9b6efac4c403cf0b4e2d473690c92ac41210"
TF_VERSION = "1.15.5"
SWIFT_VERSION = "0.64.1"
SWIFT_ARCHIVE = "0e5762a848d738602c7a983b26812031e634d85e357db070968b9c805f253eff"
SWIFT_BINARY = "8814dbe3f89c833e990948f692b3c063bc67fdd6dc5db49f7b205e7c541c8620"
TF_VERSION = "1.17.0"
TF_HASHES = {
"darwin_arm64": "01137660510005b918bba82154866fbeac4393163d8277c2abe861dfb5842c3c",
"darwin_amd64": "3687d07c034b3e7deed5b072cd8ae2b34835bcb139baec3fc4f5fd534dabf5ed",
"linux_arm64": "06e7b48de826146c6d9331ba35b13da12332d8392be30d1dd6b789ba4713fff0",
"linux_amd64": "702b2136af6728c8ff037f843dd2dbce2b7ad88786b7381d1d72aefa250f601c",
"darwin_arm64": "7472a54cca911d46c0e399a5ebbce44444912d0d4dad7495f37f1fa51e7ca6b7",
"darwin_amd64": "3773397524196e4ebbf7167e2b9fb478dff1962d555d649f616ba97ca446a143",
"linux_arm64": "f32478134ffc6d710eec474bbd316652cdddc0f4e336973a3745e8d3a3309cdf",
"linux_amd64": "c168cab7c637a8769fdb90089ddd19de701bc6ff8aca64dc2e2185fe46f59f67",
}
# Archive digests from HashiCorp's versioned SHA256SUMS and PyPI release metadata.
CLANG_VERSION = "23.1.3"
Expand Down Expand Up @@ -154,9 +154,11 @@ def main():
"swift",
"terraform",
"metal",
"c",
"setup-swift",
"setup-terraform",
"setup-metal",
"setup-c",
],
)
parser.add_argument("--path", default="input.swift")
Expand All @@ -182,19 +184,31 @@ def main():
elif tool == "terraform":
command = [str(binary), "fmt", "-no-color", "-"]
else:
# Metal's shader syntax is C++ based. The virtual .cpp extension selects
# that parser while retaining the source directory for native style lookup.
# Preserve C virtual paths; Metal shader syntax uses the C++ parser.
# Both retain the source directory for native style configuration lookup.
command = [
str(binary),
"--assume-filename",
str(Path(args.path).with_suffix(".cpp")),
args.path if tool == "c" else str(Path(args.path).with_suffix(".cpp")),
"--style=file",
"--fallback-style=LLVM",
]
environment = {
k: v for k, v in os.environ.items() if not k.startswith("TF_CLI_ARGS")
}
environment.update(CHECKPOINT_DISABLE="1", TF_IN_AUTOMATION="1")
if tool == "swift":
result = subprocess.run(
command,
input=sys.stdin.buffer.read(),
capture_output=True,
cwd=ROOT,
env=environment,
)
sys.stderr.buffer.write(result.stderr)
if not result.returncode:
sys.stdout.buffer.write(result.stdout)
return result.returncode
return subprocess.call(command, cwd=ROOT, env=environment)


Expand Down
Loading
Loading