zcf 0.1.0__py3-none-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zcf/__init__.py +1 -0
- zcf/bin/zcf.exe +0 -0
- zcf/launcher.py +293 -0
- zcf/skills/zcf/SKILL.md +59 -0
- zcf-0.1.0.dist-info/METADATA +290 -0
- zcf-0.1.0.dist-info/RECORD +9 -0
- zcf-0.1.0.dist-info/WHEEL +5 -0
- zcf-0.1.0.dist-info/entry_points.txt +4 -0
- zcf-0.1.0.dist-info/licenses/LICENSE.txt +278 -0
zcf/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Python packaging support for the zcf native formatter."""
|
zcf/bin/zcf.exe
ADDED
|
Binary file
|
zcf/launcher.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import shlex
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
import tempfile
|
|
9
|
+
from importlib.resources import files
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _is_windows() -> bool:
|
|
14
|
+
return sys.platform == "win32"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _path_separator() -> str:
|
|
18
|
+
return ";" if _is_windows() else ":"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _application_name(name: str) -> str:
|
|
22
|
+
return f"{name}.exe" if _is_windows() else name
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _native_binary() -> Path:
|
|
26
|
+
name = _application_name("zcf")
|
|
27
|
+
path = Path(str(files("zcf").joinpath("bin", name)))
|
|
28
|
+
if not path.is_file():
|
|
29
|
+
raise RuntimeError(f"Bundled zcf binary was not found: {path}")
|
|
30
|
+
return path
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _skill_content() -> str:
|
|
34
|
+
resource = files("zcf").joinpath("skills", "zcf", "SKILL.md")
|
|
35
|
+
if not resource.is_file():
|
|
36
|
+
raise RuntimeError(f"Packaged zcf skill was not found: {resource}")
|
|
37
|
+
return resource.read_text(encoding="utf-8")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _install_skill(repository: Path, *, force: bool) -> int:
|
|
41
|
+
root = repository.expanduser().resolve()
|
|
42
|
+
if not (root / ".git").exists():
|
|
43
|
+
raise RuntimeError(f"Not a Git repository: {root}")
|
|
44
|
+
|
|
45
|
+
destination = root / ".github" / "skills" / "zcf" / "SKILL.md"
|
|
46
|
+
content = _skill_content()
|
|
47
|
+
if destination.is_file():
|
|
48
|
+
existing = destination.read_text(encoding="utf-8")
|
|
49
|
+
if existing == content:
|
|
50
|
+
print(f"zcf agent skill is already current: {destination}")
|
|
51
|
+
return 0
|
|
52
|
+
if not force:
|
|
53
|
+
raise RuntimeError(
|
|
54
|
+
f"Refusing to overwrite an existing skill: {destination}. "
|
|
55
|
+
"Use 'zcf install-skill --force' to replace it."
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
with tempfile.NamedTemporaryFile(
|
|
60
|
+
mode="w",
|
|
61
|
+
encoding="utf-8",
|
|
62
|
+
newline="\n",
|
|
63
|
+
dir=destination.parent,
|
|
64
|
+
prefix=".SKILL.",
|
|
65
|
+
suffix=".tmp",
|
|
66
|
+
delete=False,
|
|
67
|
+
) as stream:
|
|
68
|
+
stream.write(content)
|
|
69
|
+
temporary = Path(stream.name)
|
|
70
|
+
try:
|
|
71
|
+
os.replace(temporary, destination)
|
|
72
|
+
finally:
|
|
73
|
+
temporary.unlink(missing_ok=True)
|
|
74
|
+
print(f"Installed zcf agent skill: {destination}")
|
|
75
|
+
return 0
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _parse_install_skill_arguments(arguments: list[str]) -> tuple[Path, bool]:
|
|
79
|
+
force = False
|
|
80
|
+
repository: Path | None = None
|
|
81
|
+
for argument in arguments:
|
|
82
|
+
if argument == "--force":
|
|
83
|
+
force = True
|
|
84
|
+
elif argument.startswith("-"):
|
|
85
|
+
raise RuntimeError(
|
|
86
|
+
"Usage: zcf install-skill [--force] [repository]"
|
|
87
|
+
)
|
|
88
|
+
elif repository is None:
|
|
89
|
+
repository = Path(argument)
|
|
90
|
+
else:
|
|
91
|
+
raise RuntimeError(
|
|
92
|
+
"Usage: zcf install-skill [--force] [repository]"
|
|
93
|
+
)
|
|
94
|
+
return repository or Path.cwd(), force
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _run_native(*, clang_format_alias: bool) -> int:
|
|
98
|
+
binary = _native_binary()
|
|
99
|
+
environment = os.environ.copy()
|
|
100
|
+
if clang_format_alias:
|
|
101
|
+
environment["ZCF_INVOKED_AS_CLANG_FORMAT"] = "1"
|
|
102
|
+
|
|
103
|
+
arguments = [
|
|
104
|
+
"clang-format" if clang_format_alias else "zcf",
|
|
105
|
+
*sys.argv[1:],
|
|
106
|
+
]
|
|
107
|
+
if not _is_windows():
|
|
108
|
+
os.execve(binary, arguments, environment)
|
|
109
|
+
raise AssertionError("os.execve returned unexpectedly")
|
|
110
|
+
|
|
111
|
+
completed = subprocess.run(
|
|
112
|
+
[str(binary), *arguments[1:]],
|
|
113
|
+
env=environment,
|
|
114
|
+
check=False,
|
|
115
|
+
)
|
|
116
|
+
return completed.returncode
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _command_paths(name: str) -> list[Path]:
|
|
120
|
+
suffixes = [""]
|
|
121
|
+
if _is_windows() and not Path(name).suffix:
|
|
122
|
+
suffixes.extend(
|
|
123
|
+
suffix.lower()
|
|
124
|
+
for suffix in os.environ.get("PATHEXT", ".EXE;.CMD;.BAT").split(";")
|
|
125
|
+
if suffix
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
results: list[Path] = []
|
|
129
|
+
seen: set[str] = set()
|
|
130
|
+
for entry in os.environ.get("PATH", "").split(_path_separator()):
|
|
131
|
+
if not entry:
|
|
132
|
+
continue
|
|
133
|
+
for suffix in suffixes:
|
|
134
|
+
candidate = Path(entry) / f"{name}{suffix}"
|
|
135
|
+
if not candidate.is_file() or (
|
|
136
|
+
not _is_windows() and not os.access(candidate, os.X_OK)
|
|
137
|
+
):
|
|
138
|
+
continue
|
|
139
|
+
key = os.path.normcase(os.path.abspath(candidate))
|
|
140
|
+
if key not in seen:
|
|
141
|
+
seen.add(key)
|
|
142
|
+
results.append(candidate)
|
|
143
|
+
return results
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _pipx_executable() -> str:
|
|
147
|
+
pipx = shutil.which("pipx")
|
|
148
|
+
if not pipx:
|
|
149
|
+
raise RuntimeError(
|
|
150
|
+
"pipx was not found on PATH. Install pipx or run "
|
|
151
|
+
"'pipx ensurepath --prepend' manually."
|
|
152
|
+
)
|
|
153
|
+
return pipx
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _managed_app_directory(pipx: str | None = None) -> Path:
|
|
157
|
+
alias_name = _application_name("clang-format")
|
|
158
|
+
|
|
159
|
+
configured_directory = os.environ.get("PIPX_BIN_DIR")
|
|
160
|
+
if not configured_directory and pipx:
|
|
161
|
+
completed = subprocess.run(
|
|
162
|
+
[pipx, "environment", "--value", "PIPX_BIN_DIR"],
|
|
163
|
+
check=False,
|
|
164
|
+
stdout=subprocess.PIPE,
|
|
165
|
+
stderr=subprocess.PIPE,
|
|
166
|
+
text=True,
|
|
167
|
+
)
|
|
168
|
+
if completed.returncode == 0:
|
|
169
|
+
configured_directory = completed.stdout.strip()
|
|
170
|
+
|
|
171
|
+
candidates: list[Path] = []
|
|
172
|
+
if configured_directory:
|
|
173
|
+
candidates.append(Path(configured_directory).absolute())
|
|
174
|
+
exposed_zcf = shutil.which("zcf")
|
|
175
|
+
if exposed_zcf:
|
|
176
|
+
candidates.append(Path(exposed_zcf).absolute().parent)
|
|
177
|
+
|
|
178
|
+
for directory in candidates:
|
|
179
|
+
zcf_name = _application_name("zcf")
|
|
180
|
+
if (directory / zcf_name).is_file() and (
|
|
181
|
+
directory / alias_name
|
|
182
|
+
).is_file():
|
|
183
|
+
return directory
|
|
184
|
+
|
|
185
|
+
searched = ", ".join(str(path) for path in candidates) or "<none>"
|
|
186
|
+
raise RuntimeError(
|
|
187
|
+
"The pipx-managed zcf and clang-format entry points were not found. "
|
|
188
|
+
f"Searched: {searched}. Reinstall zcf with pipx."
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _managed_alias(pipx: str | None = None) -> Path:
|
|
193
|
+
directory = _managed_app_directory(pipx)
|
|
194
|
+
alias_name = _application_name("clang-format")
|
|
195
|
+
alias = directory / alias_name
|
|
196
|
+
if not alias.is_file():
|
|
197
|
+
raise RuntimeError(
|
|
198
|
+
f"The pipx-managed clang-format entry point is missing: {alias}. "
|
|
199
|
+
"Reinstall zcf with pipx."
|
|
200
|
+
)
|
|
201
|
+
return alias
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _same_path(left: Path, right: Path) -> bool:
|
|
205
|
+
return os.path.normcase(os.path.abspath(left)) == os.path.normcase(
|
|
206
|
+
os.path.abspath(right)
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _print_clang_format_candidates() -> list[Path]:
|
|
211
|
+
candidates = _command_paths("clang-format")
|
|
212
|
+
if candidates:
|
|
213
|
+
print("clang-format candidates:")
|
|
214
|
+
for index, candidate in enumerate(candidates, start=1):
|
|
215
|
+
marker = "active" if index == 1 else "shadowed"
|
|
216
|
+
print(f" {index}. {candidate} ({marker})")
|
|
217
|
+
else:
|
|
218
|
+
print("No clang-format command is currently discoverable on PATH.")
|
|
219
|
+
return candidates
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def _status() -> int:
|
|
223
|
+
pipx = _pipx_executable()
|
|
224
|
+
managed_alias = _managed_alias(pipx)
|
|
225
|
+
candidates = _print_clang_format_candidates()
|
|
226
|
+
if candidates and _same_path(candidates[0], managed_alias):
|
|
227
|
+
print(f"zcf is the active clang-format: {managed_alias}")
|
|
228
|
+
return 0
|
|
229
|
+
|
|
230
|
+
print(f"zcf's managed clang-format is not active: {managed_alias}")
|
|
231
|
+
print("Run 'zcf activate' and restart the terminal or IDE.")
|
|
232
|
+
return 1
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _activate(*, dry_run: bool) -> int:
|
|
236
|
+
pipx = _pipx_executable()
|
|
237
|
+
managed_directory = _managed_app_directory(pipx)
|
|
238
|
+
print(f"zcf pipx application directory: {managed_directory}")
|
|
239
|
+
_print_clang_format_candidates()
|
|
240
|
+
|
|
241
|
+
command = [pipx, "ensurepath", "--prepend"]
|
|
242
|
+
if dry_run:
|
|
243
|
+
command.append("--dry-run")
|
|
244
|
+
print("Running preview: " + shlex.join(command))
|
|
245
|
+
|
|
246
|
+
completed = subprocess.run(command, check=False)
|
|
247
|
+
if completed.returncode != 0:
|
|
248
|
+
raise RuntimeError(
|
|
249
|
+
f"pipx ensurepath failed with exit code {completed.returncode}."
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
if dry_run:
|
|
253
|
+
return 0
|
|
254
|
+
|
|
255
|
+
current_entries = os.environ.get("PATH", "").split(_path_separator())
|
|
256
|
+
current_entries = [
|
|
257
|
+
entry
|
|
258
|
+
for entry in current_entries
|
|
259
|
+
if entry and not _same_path(Path(entry), managed_directory)
|
|
260
|
+
]
|
|
261
|
+
os.environ["PATH"] = _path_separator().join(
|
|
262
|
+
[str(managed_directory), *current_entries]
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
print("zcf's pipx directory was prepended to PATH.")
|
|
266
|
+
print("Restart running terminals and IDEs, then run 'zcf status'.")
|
|
267
|
+
return _status()
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def zcf_main() -> int:
|
|
271
|
+
try:
|
|
272
|
+
if len(sys.argv) >= 2 and sys.argv[1] == "activate":
|
|
273
|
+
dry_run = len(sys.argv) == 3 and sys.argv[2] == "--dry-run"
|
|
274
|
+
if len(sys.argv) > 2 and not dry_run:
|
|
275
|
+
raise RuntimeError("Usage: zcf activate [--dry-run]")
|
|
276
|
+
return _activate(dry_run=dry_run)
|
|
277
|
+
if len(sys.argv) == 2 and sys.argv[1] == "status":
|
|
278
|
+
return _status()
|
|
279
|
+
if len(sys.argv) >= 2 and sys.argv[1] == "install-skill":
|
|
280
|
+
repository, force = _parse_install_skill_arguments(sys.argv[2:])
|
|
281
|
+
return _install_skill(repository, force=force)
|
|
282
|
+
return _run_native(clang_format_alias=False)
|
|
283
|
+
except RuntimeError as error:
|
|
284
|
+
print(f"zcf: error: {error}", file=sys.stderr)
|
|
285
|
+
return 1
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def clang_format_main() -> int:
|
|
289
|
+
try:
|
|
290
|
+
return _run_native(clang_format_alias=True)
|
|
291
|
+
except RuntimeError as error:
|
|
292
|
+
print(f"clang-format: error: {error}", file=sys.stderr)
|
|
293
|
+
return 1
|
zcf/skills/zcf/SKILL.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zcf
|
|
3
|
+
description: Format or check clang-format-compatible source files with zcf. Use when asked to format code, apply clang-format, fix formatting, or validate repository formatting.
|
|
4
|
+
license: Apache-2.0 WITH LLVM-exception
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# zcf
|
|
8
|
+
|
|
9
|
+
Use `zcf` as the repository's clang-format-compatible formatter.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Confirm that `zcf` is available:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
zcf --version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If it is missing, ask before installing it:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
pipx install zcf
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Locate the nearest `.clang-format` or `_clang-format` file. Reuse it with
|
|
26
|
+
`-style=file`; do not invent or replace repository formatting policy.
|
|
27
|
+
|
|
28
|
+
3. Inspect the working tree before formatting. Preserve unrelated user changes
|
|
29
|
+
and do not format an entire repository unless the user explicitly requests
|
|
30
|
+
it.
|
|
31
|
+
|
|
32
|
+
4. Format only the requested or changed source files:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
zcf -style=file -i path/to/file.cpp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For a narrow edit in a file with unrelated changes, prefer one or more
|
|
39
|
+
explicit line ranges:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
zcf -style=file -i -lines=START:END path/to/file.cpp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
5. Verify the result:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
zcf -style=file --dry-run -Werror path/to/file.cpp
|
|
49
|
+
git diff --check
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
6. Review the diff and report the formatted files and validation result.
|
|
53
|
+
|
|
54
|
+
## Safety
|
|
55
|
+
|
|
56
|
+
- Do not silently fall back to a different formatter.
|
|
57
|
+
- Do not overwrite repository configuration.
|
|
58
|
+
- Do not discard pre-existing changes.
|
|
59
|
+
- Surface formatter errors instead of treating partial output as success.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zcf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: z-clang-format with a reviewed custom C++ policy
|
|
5
|
+
License-Expression: Apache-2.0 WITH LLVM-exception
|
|
6
|
+
License-File: LICENSE.txt
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: MacOS
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: C++
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# zcf
|
|
20
|
+
|
|
21
|
+
**zcf** means **z-clang-format**. It is a clang-format-compatible native
|
|
22
|
+
formatter built from LLVM 20.1.8 with a reviewed custom C++ policy.
|
|
23
|
+
|
|
24
|
+
zcf extends the original clang-format rather than replacing its configuration
|
|
25
|
+
model. Existing `.clang-format` and `_clang-format` files, predefined styles,
|
|
26
|
+
command-line options, editor integrations, and supported languages remain
|
|
27
|
+
compatible. Projects can adopt zcf without rewriting their clang-format
|
|
28
|
+
configuration; zcf-specific options are additive and upstream behavior is
|
|
29
|
+
preserved when those options are not enabled.
|
|
30
|
+
|
|
31
|
+
The build produces one formatter under two names:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
zcf user-facing command
|
|
35
|
+
clang-format byte-identical alias for IDE discovery
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The custom policy is enabled only for C++. Every upstream style and non-C++
|
|
39
|
+
language retains upstream behavior unless a configuration explicitly enables
|
|
40
|
+
an extension.
|
|
41
|
+
|
|
42
|
+
## Install with pipx
|
|
43
|
+
|
|
44
|
+
Once zcf is published to PyPI:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
pipx install zcf
|
|
48
|
+
zcf activate
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If pipx reports that its application directory is not yet on `PATH`, use:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
pipx run zcf activate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The wheel exposes both `zcf` and `clang-format`. `zcf activate`:
|
|
58
|
+
|
|
59
|
+
1. lists every `clang-format` currently visible on `PATH`;
|
|
60
|
+
2. asks pipx to prepend its managed application directory;
|
|
61
|
+
3. verifies that pipx's zcf-backed `clang-format` is active; and
|
|
62
|
+
4. never deletes or overwrites another package manager's files.
|
|
63
|
+
|
|
64
|
+
Preview or diagnose without changing `PATH`:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
zcf activate --dry-run
|
|
68
|
+
zcf status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Restart running terminals and IDEs after activation.
|
|
72
|
+
|
|
73
|
+
Install the zcf agent skill into a repository so compatible coding agents can
|
|
74
|
+
discover and use the formatter automatically:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
cd path/to/repository
|
|
78
|
+
zcf install-skill
|
|
79
|
+
git add .github/skills/zcf/SKILL.md
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The command is idempotent and refuses to overwrite an existing skill unless
|
|
83
|
+
`--force` is specified. A different repository can be provided explicitly:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
zcf install-skill path/to/repository
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Each wheel contains one platform-native zcf binary. Separate wheels are needed
|
|
90
|
+
for each supported operating system and architecture, but they are independent
|
|
91
|
+
of the Python runtime version (`py3-none-<platform>`).
|
|
92
|
+
|
|
93
|
+
The wheel workflow covers:
|
|
94
|
+
|
|
95
|
+
- Windows x64 and ARM64;
|
|
96
|
+
- macOS Intel and ARM64; and
|
|
97
|
+
- manylinux 2.28 x64 and ARM64.
|
|
98
|
+
|
|
99
|
+
To publish a release, run **Actions > Cross-platform wheels > Run workflow** on
|
|
100
|
+
`main` with **Publish** checked. **Version** (for example `0.1.1`) sets the
|
|
101
|
+
package version for that build; leave it empty to use `pyproject.toml`. After
|
|
102
|
+
all six wheels pass, the workflow uploads them to PyPI through trusted
|
|
103
|
+
publishing and creates GitHub release `v<version>` with the wheels attached.
|
|
104
|
+
The same can be started from the command line:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
gh workflow run wheels.yml --ref main -f version=0.1.1 -f publish=true
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Pushing a tag `v<project-version>` also publishes; the tag must match the
|
|
111
|
+
version in `pyproject.toml`. PyPI must list the repository's `wheels.yml`
|
|
112
|
+
workflow and `pypi` environment as a trusted publisher for `zcf`.
|
|
113
|
+
|
|
114
|
+
## Use zcf
|
|
115
|
+
|
|
116
|
+
Command-line usage is the same as clang-format:
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
zcf -style=LLVM file.cpp
|
|
120
|
+
zcf -style=file -i file.cpp
|
|
121
|
+
clang-format -style=file file.cpp
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The reviewed C++ policy uses `ColumnLimit: 140`, leading binary operators, no
|
|
125
|
+
consecutive assignment alignment, right-aligned scalar matrices, lambda bodies
|
|
126
|
+
with their opening brace on its own line, progressive call and arithmetic
|
|
127
|
+
expansion, and 22 independently configurable extensions. `BasedOnStyle: ZCF`
|
|
128
|
+
enables every extension.
|
|
129
|
+
|
|
130
|
+
## Build from source
|
|
131
|
+
|
|
132
|
+
Initialize the pinned LLVM submodule:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
git submodule update --init --recursive
|
|
136
|
+
git -C third_party/llvm-project rev-parse HEAD
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Expected LLVM commit:
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
87f0227cb60147a26a1eeb4fb06e3b505e9c7261
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Configure and build with a single-config generator:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
cmake --preset release
|
|
149
|
+
cmake --build --preset zcf
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Output:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
build/release/bin/zcf
|
|
156
|
+
build/release/bin/clang-format
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
On Windows the files use the `.exe` suffix. A regular PowerShell prompt should
|
|
160
|
+
run the build inside the Visual Studio developer environment so Windows SDK
|
|
161
|
+
tools are available:
|
|
162
|
+
|
|
163
|
+
```powershell
|
|
164
|
+
$vcvars = 'C:\Program Files\Microsoft Visual Studio\18\Professional\VC\Auxiliary\Build\vcvars64.bat'
|
|
165
|
+
cmd /c "call `"$vcvars`" >nul && pwsh -File scripts\build.ps1 -Jobs 4"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
To reuse an existing static LLVM build:
|
|
169
|
+
|
|
170
|
+
```powershell
|
|
171
|
+
.\scripts\prepare-llvm-static.ps1 -Jobs 8
|
|
172
|
+
|
|
173
|
+
cmake -S . -B build\release -G Ninja `
|
|
174
|
+
-DCMAKE_BUILD_TYPE=Release `
|
|
175
|
+
-DLLVM_PROJECT_SOURCE_DIR=third_party\llvm-project `
|
|
176
|
+
-DCUSTOM_LLVM_DIR=build\llvm-static\lib\cmake\llvm `
|
|
177
|
+
-DCUSTOM_LLVM_TABLEGEN=build\llvm-static\bin\llvm-tblgen.exe
|
|
178
|
+
|
|
179
|
+
cmake --build build\release --target zcf
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The LLVM libraries and generated tables must come from the same pinned commit as
|
|
183
|
+
the Clang sources.
|
|
184
|
+
|
|
185
|
+
## Build a wheel
|
|
186
|
+
|
|
187
|
+
Build zcf first, then package that platform's native executable:
|
|
188
|
+
|
|
189
|
+
```powershell
|
|
190
|
+
py -m pip install build "scikit-build-core>=1.1,<2" pipx
|
|
191
|
+
py -m build --wheel `
|
|
192
|
+
-C "cmake.args=-DZCF_EXECUTABLE=$PWD\build\release\bin\zcf.exe"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Validate the resulting wheel with an isolated pipx installation:
|
|
196
|
+
|
|
197
|
+
```powershell
|
|
198
|
+
py tests\validate_pipx_package.py `
|
|
199
|
+
--wheel .\dist\zcf-0.1.0-py3-none-win_amd64.whl
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The test verifies both entry points, version reporting, custom-policy formatting,
|
|
203
|
+
conflict discovery, dry-run activation, and uninstall cleanup.
|
|
204
|
+
|
|
205
|
+
## Architecture
|
|
206
|
+
|
|
207
|
+
Upstream LibFormat remains pristine:
|
|
208
|
+
|
|
209
|
+
```text
|
|
210
|
+
third_party/llvm-project/ pinned upstream submodule
|
|
211
|
+
integration/patches/ minimal policy-free bridge
|
|
212
|
+
integration/clang-format/ private LibFormat adapter
|
|
213
|
+
extensions/clang-format/ custom C++ policy and options
|
|
214
|
+
build/llvm-overlay/ ignored generated patched worktree
|
|
215
|
+
clang-format/ClangFormat.cpp zcf command-line tool
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`scripts/prepare_llvm_overlay.py` verifies the upstream worktree, creates the
|
|
219
|
+
overlay at the pinned commit, applies the bridge, and rejects unexpected overlay
|
|
220
|
+
edits. Formatting policy remains in the separately compiled extension modules.
|
|
221
|
+
|
|
222
|
+
The extension context is scoped per formatting call. With every extension
|
|
223
|
+
disabled—or outside C++—the bridge remains behaviorally identical to upstream.
|
|
224
|
+
|
|
225
|
+
## Validation
|
|
226
|
+
|
|
227
|
+
Build and smoke tests:
|
|
228
|
+
|
|
229
|
+
```text
|
|
230
|
+
cmake --build build/release --target zcf
|
|
231
|
+
cmake --build build/release --target smoke-zcf
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Custom-policy contract tests:
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
cmake --build build/release --target validate-signature-format
|
|
238
|
+
cmake --build build/release --target validate-structure-format
|
|
239
|
+
cmake --build build/release --target validate-complete-format
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Upstream parity:
|
|
243
|
+
|
|
244
|
+
```text
|
|
245
|
+
cmake --build build/release --target compare-format-gtest
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The parity suite covers 210 formatting, style-dump, round-trip, language, and CLI
|
|
249
|
+
cases. The most recent validated state passes all 210.
|
|
250
|
+
|
|
251
|
+
Real-code invariants (opt-in, several minutes):
|
|
252
|
+
|
|
253
|
+
```text
|
|
254
|
+
cmake --build build/release --target validate-corpus-invariants
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
This formats a fixed sample of 600 files from the pinned LLVM sources with the
|
|
258
|
+
ZCF preset, LLVM with every extension, and the preset with tabs and
|
|
259
|
+
`ColumnLimit: 0`. Extensions must not crash, must be stable across a second
|
|
260
|
+
run, and may change only whitespace and integer-literal case. Problems that
|
|
261
|
+
also occur with extensions disabled are reported as upstream and do not fail
|
|
262
|
+
the check.
|
|
263
|
+
|
|
264
|
+
Python launcher and wheel tests:
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
py -m unittest tests/test_zcf_launcher.py -v
|
|
268
|
+
python tests/validate_pipx_package.py --wheel <wheel>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Static-link behavior
|
|
272
|
+
|
|
273
|
+
The LLVM and Clang child builds disable shared LLVM/Clang libraries and optional
|
|
274
|
+
compression/XML dependencies. `-StaticMsvcRuntime` additionally selects `/MT`
|
|
275
|
+
for Windows builds.
|
|
276
|
+
|
|
277
|
+
Verify runtime dependencies:
|
|
278
|
+
|
|
279
|
+
```powershell
|
|
280
|
+
dumpbin /dependents build\release\bin\zcf.exe
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
ldd build/release/bin/zcf # Linux
|
|
285
|
+
otool -L build/release/bin/zcf # macOS
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
LLVM or Clang shared libraries should not appear. Normal platform runtime
|
|
289
|
+
libraries may remain unless the selected toolchain supports a fully static
|
|
290
|
+
runtime.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
zcf/__init__.py,sha256=PeCPjsGv_TUS_oGnnaSgaCDZwdjcaXOEBN0BMHHinwg,62
|
|
2
|
+
zcf/bin/zcf.exe,sha256=sGBjq07yQfn7v3l2g_6LIMaArEwqNqSq6TcBrRbGhlQ,3700224
|
|
3
|
+
zcf/launcher.py,sha256=JsRp0BryIzczM0Xw7GLtLf35UBd6GFDF_kUgb5U98IM,9582
|
|
4
|
+
zcf/skills/zcf/SKILL.md,sha256=2pWrCUfpcp7F5FSiur_wjqke5zzeY_k1T4845kEJAMw,1559
|
|
5
|
+
zcf-0.1.0.dist-info/METADATA,sha256=WAqzvdRhAlSwYOANDZc5HAn29QGSqsX5BuoImcix29g,8682
|
|
6
|
+
zcf-0.1.0.dist-info/WHEEL,sha256=TLy2JsjgjRkoFEIL0xT5dFYfPx8ihociKr5TgFJLjJI,102
|
|
7
|
+
zcf-0.1.0.dist-info/entry_points.txt,sha256=NSlsLkL9kFYIlnrXOBaS7kpINb8o1OmdbIlWGHGdxO4,93
|
|
8
|
+
zcf-0.1.0.dist-info/licenses/LICENSE.txt,sha256=GYGGI5Hf1vWrrSgxe9xZm82_yCOx3Bcgjz0_IiFs7TU,15418
|
|
9
|
+
zcf-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
==============================================================================
|
|
2
|
+
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
|
3
|
+
==============================================================================
|
|
4
|
+
|
|
5
|
+
Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
+
|
|
11
|
+
1. Definitions.
|
|
12
|
+
|
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
+
|
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
+
the copyright owner that is granting the License.
|
|
18
|
+
|
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
+
other entities that control, are controlled by, or are under common
|
|
21
|
+
control with that entity. For the purposes of this definition,
|
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
+
direction or management of such entity, whether by contract or
|
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to software source code, documentation
|
|
32
|
+
source, and configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
40
|
+
Object form, made available under the License, as indicated by a
|
|
41
|
+
copyright notice that is included in or attached to the work
|
|
42
|
+
(an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
50
|
+
the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
|
53
|
+
the original version of the Work and any modifications or additions
|
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
56
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
57
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
58
|
+
means any form of electronic, verbal, or written communication sent
|
|
59
|
+
to the Licensor or its representatives, including but not limited to
|
|
60
|
+
communication on electronic mailing lists, source code control systems,
|
|
61
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
62
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
63
|
+
excluding communication that is conspicuously marked or otherwise
|
|
64
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
65
|
+
|
|
66
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
67
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
68
|
+
subsequently incorporated within the Work.
|
|
69
|
+
|
|
70
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
89
|
+
or contributory patent infringement, then any patent licenses
|
|
90
|
+
granted to You under this License for that Work shall terminate
|
|
91
|
+
as of the date such litigation is filed.
|
|
92
|
+
|
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
95
|
+
modifications, and in Source or Object form, provided that You
|
|
96
|
+
meet the following conditions:
|
|
97
|
+
|
|
98
|
+
(a) You must give any other recipients of the Work or
|
|
99
|
+
Derivative Works a copy of this License; and
|
|
100
|
+
|
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
|
102
|
+
stating that You changed the files; and
|
|
103
|
+
|
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
|
106
|
+
attribution notices from the Source form of the Work,
|
|
107
|
+
excluding those notices that do not pertain to any part of
|
|
108
|
+
the Derivative Works; and
|
|
109
|
+
|
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
|
112
|
+
include a readable copy of the attribution notices contained
|
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
|
115
|
+
of the following places: within a NOTICE text file distributed
|
|
116
|
+
as part of the Derivative Works; within the Source form or
|
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
|
118
|
+
within a display generated by the Derivative Works, if and
|
|
119
|
+
wherever such third-party notices normally appear. The contents
|
|
120
|
+
of the NOTICE file are for informational purposes only and
|
|
121
|
+
do not modify the License. You may add Your own attribution
|
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
124
|
+
that such additional attribution notices cannot be construed
|
|
125
|
+
as modifying the License.
|
|
126
|
+
|
|
127
|
+
You may add Your own copyright statement to Your modifications and
|
|
128
|
+
may provide additional or different license terms and conditions
|
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
132
|
+
the conditions stated in this License.
|
|
133
|
+
|
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
137
|
+
this License, without any additional terms or conditions.
|
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
139
|
+
the terms of any separate license agreement you may have executed
|
|
140
|
+
with Licensor regarding such Contributions.
|
|
141
|
+
|
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
144
|
+
except as required for reasonable and customary use in describing the
|
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
|
156
|
+
|
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
|
162
|
+
incidental, or consequential damages of any character arising as a
|
|
163
|
+
result of this License or out of the use or inability to use the
|
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
166
|
+
other commercial damages or losses), even if such Contributor
|
|
167
|
+
has been advised of the possibility of such damages.
|
|
168
|
+
|
|
169
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
170
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
171
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
172
|
+
or other liability obligations and/or rights consistent with this
|
|
173
|
+
License. However, in accepting such obligations, You may act only
|
|
174
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
175
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
176
|
+
defend, and hold each Contributor harmless for any liability
|
|
177
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
178
|
+
of your accepting any such warranty or additional liability.
|
|
179
|
+
|
|
180
|
+
END OF TERMS AND CONDITIONS
|
|
181
|
+
|
|
182
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
183
|
+
|
|
184
|
+
To apply the Apache License to your work, attach the following
|
|
185
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
186
|
+
replaced with your own identifying information. (Don't include
|
|
187
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
188
|
+
comment syntax for the file format. We also recommend that a
|
|
189
|
+
file or class name and description of purpose be included on the
|
|
190
|
+
same "printed page" as the copyright notice for easier
|
|
191
|
+
identification within third-party archives.
|
|
192
|
+
|
|
193
|
+
Copyright [yyyy] [name of copyright owner]
|
|
194
|
+
|
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
you may not use this file except in compliance with the License.
|
|
197
|
+
You may obtain a copy of the License at
|
|
198
|
+
|
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
|
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
See the License for the specific language governing permissions and
|
|
205
|
+
limitations under the License.
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
---- LLVM Exceptions to the Apache 2.0 License ----
|
|
209
|
+
|
|
210
|
+
As an exception, if, as a result of your compiling your source code, portions
|
|
211
|
+
of this Software are embedded into an Object form of such source code, you
|
|
212
|
+
may redistribute such embedded portions in such Object form without complying
|
|
213
|
+
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
|
214
|
+
|
|
215
|
+
In addition, if you combine or link compiled forms of this Software with
|
|
216
|
+
software that is licensed under the GPLv2 ("Combined Software") and if a
|
|
217
|
+
court of competent jurisdiction determines that the patent provision (Section
|
|
218
|
+
3), the indemnity provision (Section 9) or other Section of the License
|
|
219
|
+
conflicts with the conditions of the GPLv2, you may retroactively and
|
|
220
|
+
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
|
221
|
+
the License, but only in their entirety and only with respect to the Combined
|
|
222
|
+
Software.
|
|
223
|
+
|
|
224
|
+
==============================================================================
|
|
225
|
+
Software from third parties included in the LLVM Project:
|
|
226
|
+
==============================================================================
|
|
227
|
+
The LLVM Project contains third party software which is under different license
|
|
228
|
+
terms. All such code will be identified clearly using at least one of two
|
|
229
|
+
mechanisms:
|
|
230
|
+
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
|
231
|
+
`LICENSE` file at the top containing the specific license and restrictions
|
|
232
|
+
which apply to that software, or
|
|
233
|
+
2) It will contain specific license and restriction terms at the top of every
|
|
234
|
+
file.
|
|
235
|
+
|
|
236
|
+
==============================================================================
|
|
237
|
+
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
|
238
|
+
==============================================================================
|
|
239
|
+
University of Illinois/NCSA
|
|
240
|
+
Open Source License
|
|
241
|
+
|
|
242
|
+
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
|
|
243
|
+
All rights reserved.
|
|
244
|
+
|
|
245
|
+
Developed by:
|
|
246
|
+
|
|
247
|
+
LLVM Team
|
|
248
|
+
|
|
249
|
+
University of Illinois at Urbana-Champaign
|
|
250
|
+
|
|
251
|
+
http://llvm.org
|
|
252
|
+
|
|
253
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
254
|
+
this software and associated documentation files (the "Software"), to deal with
|
|
255
|
+
the Software without restriction, including without limitation the rights to
|
|
256
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
257
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
258
|
+
so, subject to the following conditions:
|
|
259
|
+
|
|
260
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
261
|
+
this list of conditions and the following disclaimers.
|
|
262
|
+
|
|
263
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
264
|
+
this list of conditions and the following disclaimers in the
|
|
265
|
+
documentation and/or other materials provided with the distribution.
|
|
266
|
+
|
|
267
|
+
* Neither the names of the LLVM Team, University of Illinois at
|
|
268
|
+
Urbana-Champaign, nor the names of its contributors may be used to
|
|
269
|
+
endorse or promote products derived from this Software without specific
|
|
270
|
+
prior written permission.
|
|
271
|
+
|
|
272
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
273
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
274
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
275
|
+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
276
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
277
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
|
278
|
+
SOFTWARE.
|