diff --git a/amaranth/build/plat.py b/amaranth/build/plat.py index 328f4759e..293c5a918 100644 --- a/amaranth/build/plat.py +++ b/amaranth/build/plat.py @@ -2,9 +2,11 @@ from collections.abc import Iterable from abc import ABCMeta, abstractmethod import os -import textwrap import re +import json +import shlex import jinja2 +import textwrap import warnings from .. import __version__ @@ -217,6 +219,12 @@ class TemplatedPlatform(Platform): if defined {{platform._toolchain_env_var}} call "%{{platform._toolchain_env_var}}%" {{emit_commands("bat")}} """, + "build_{{name}}.json": """ + { + "comment": "{{autogenerated}}", + "commands": {{emit_commands("json")}} + } + """, } def iter_signal_clock_constraints(self): @@ -315,6 +323,8 @@ def emit_commands(syntax): template = \ "if [!{env_var}!] equ [\"\"] set {env_var}=\n" \ "if [!{env_var}!] equ [] set {env_var}={name}" + elif syntax == "json": + continue else: assert False commands.append(template.format(env_var=env_var, name=name)) @@ -327,10 +337,15 @@ def emit_commands(syntax): commands.append(command) elif syntax == "bat": commands.append(command + " || exit /b") + elif syntax == "json": + commands.append(command) else: assert False - return "\n".join(commands) + "\n" + if syntax == "json": + return json.dumps([shlex.split(command) for command in commands]) + else: + return "\n".join(commands) + "\n" @jinja2.pass_context def invoke_tool(context, name): @@ -339,6 +354,8 @@ def invoke_tool(context, name): return f"\"${env_var}\"" elif context.parent["syntax"] == "bat": return f"call %{env_var}%" + elif context.parent["syntax"] == "json": + return name else: assert False diff --git a/docs/changes.rst b/docs/changes.rst index be8c2eac8..9a22400d9 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -9,6 +9,8 @@ Documentation for past releases Documentation for past releases of the Amaranth language and toolchain is available online: +* `Amaranth 0.5.7 `_ +* `Amaranth 0.5.6 `_ * `Amaranth 0.5.5 `_ * `Amaranth 0.5.4 `_ * `Amaranth 0.5.3 `_ @@ -92,6 +94,23 @@ Platform integration changes * Changed: the Gowin platform now uses ``nextpnr-himbaechel`` rather than ``nextpnr-gowin``. +Version 0.5.7 +============= + +Platform integration changes +---------------------------- + +.. currentmodule:: amaranth.vendor + +* Added: build commands are also serialized to ``build_{{name}}.json``. + + +Version 0.5.6 +============= + +Updated to address compatibility with PyPy 3.11. + + Version 0.5.5 ============= diff --git a/docs/conf.py b/docs/conf.py index a6ad80da5..563e05a49 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -68,6 +68,8 @@ r"^http://127\.0\.0\.1:8000$", # Picked up automatically by ReST and doesn't have an index. r"^https://amaranth-lang\.org/schema/$", + # Rejects requests from GHA infra. + r"^https://.+\.sourceforge\.net/" ] linkcheck_anchors_ignore_for_url = [