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
22 changes: 20 additions & 2 deletions amaranth/build/plat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
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__
from .._toolchain import *
Expand Down Expand Up @@ -202,6 +205,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):
Expand Down Expand Up @@ -300,6 +309,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))
Expand All @@ -312,10 +323,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):
Expand All @@ -324,6 +340,8 @@ def invoke_tool(context, name):
return f"\"${env_var}\""
elif context.parent["syntax"] == "bat":
return f"\"%{env_var}%\""
elif context.parent["syntax"] == "json":
return name
else:
assert False

Expand Down
19 changes: 19 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Documentation for past releases

Documentation for past releases of the Amaranth language and toolchain is available online:

* `Amaranth 0.5.6 <https://amaranth-lang.org/docs/amaranth/v0.5.6/>`_
* `Amaranth 0.5.5 <https://amaranth-lang.org/docs/amaranth/v0.5.5/>`_
* `Amaranth 0.5.4 <https://amaranth-lang.org/docs/amaranth/v0.5.4/>`_
* `Amaranth 0.5.3 <https://amaranth-lang.org/docs/amaranth/v0.5.3/>`_
* `Amaranth 0.5.2 <https://amaranth-lang.org/docs/amaranth/v0.5.2/>`_
Expand All @@ -23,6 +25,23 @@ Documentation for past releases of the Amaranth language and toolchain is availa
* `Amaranth 0.3 <https://amaranth-lang.org/docs/amaranth/v0.3/>`_


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
=============

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down