Skip to content

Commit

Permalink
Merge pull request #83 from vkottler/dev/wasm
Browse files Browse the repository at this point in the history
Initial sync.
  • Loading branch information
vkottler committed Mar 15, 2024
2 parents 6611c46 + fa23d24 commit f8e9c06
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 91 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
python-version:
- "3.11"
- "3.12"
system:
- ubuntu-latest
- macos-latest
Expand Down Expand Up @@ -54,6 +55,10 @@ jobs:
if: matrix.system == 'ubuntu-latest'
- run: sudo apt-get install gcc-13 g++-13 clang-17 clang-format-17
if: matrix.system == 'ubuntu-latest'
- run: sudo apt-get install emscripten
if: matrix.system == 'ubuntu-latest'
- run: em++ --version
if: matrix.system == 'ubuntu-latest'
# End project-specific setup.

- run: mk python-sa-types
Expand All @@ -72,7 +77,7 @@ jobs:
env:
PY_TEST_EXTRA_ARGS: --cov-report=xml

- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v3.1.5

- run: mk pypi-upload-ci
env:
Expand All @@ -85,7 +90,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=yambs version=2.8.1
repo=yambs version=3.0.0
if: |
matrix.python-version == '3.11'
&& matrix.system == 'ubuntu-latest'
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.4
hash=4976235943725fd73fdb02c40af8f1cb
hash=807e0a42a738120cbe4629477dbbafe5
=====================================
-->

# yambs ([2.8.1](https://pypi.org/project/yambs/))
# yambs ([3.0.0](https://pypi.org/project/yambs/))

[![python](https://img.shields.io/pypi/pyversions/yambs.svg)](https://pypi.org/project/yambs/)
![Build Status](https://github.com/vkottler/yambs/workflows/Python%20Package/badge.svg)
Expand All @@ -30,6 +30,7 @@
This package is tested with the following Python minor versions:

* [`python3.11`](https://docs.python.org/3.11/)
* [`python3.12`](https://docs.python.org/3.12/)

## Platform Support

Expand Down
8 changes: 8 additions & 0 deletions local/configs/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ci_local:
- "- run: mk python-editable"
- " if: matrix.system == 'ubuntu-latest'"

# Get latest clang.
- "- name: setup clang 17"
- " run: |"
- " wget https://apt.llvm.org/llvm.sh"
Expand All @@ -22,9 +23,16 @@ ci_local:
- " rm llvm.sh"
- " if: matrix.system == 'ubuntu-latest'"

# Native toolchains.
- "- run: sudo apt-get install gcc-13 g++-13 clang-17 clang-format-17"
- " if: matrix.system == 'ubuntu-latest'"

# WASM.
- "- run: sudo apt-get install emscripten"
- " if: matrix.system == 'ubuntu-latest'"
- "- run: em++ --version"
- " if: matrix.system == 'ubuntu-latest'"

requirements:
- datazen
- vcorelib>=2.4.2
Expand Down
3 changes: 2 additions & 1 deletion local/configs/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ author_info:
name: Vaughn Kottler
email: vaughnkottler@gmail.com
username: vkottler
versions: ["3.11"]

# CI matrix.
versions: ["3.11", "3.12"]
systems:
- macos-latest
- windows-latest
6 changes: 3 additions & 3 deletions local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 2
minor: 8
patch: 1
major: 3
minor: 0
patch: 0
entry: mbs
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "yambs"
version = "2.8.1"
version = "3.0.0"
description = "Yet another meta build-system."
readme = "README.md"
requires-python = ">=3.11"
Expand All @@ -16,6 +16,7 @@ maintainers = [
]
classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=f3af34a4b5815c617489419b194b30b5
# hash=ce50fe613526c5b8b8b7fd8527e3566d
# =====================================

"""
Expand Down Expand Up @@ -29,6 +29,7 @@
"description": DESCRIPTION,
"versions": [
"3.11",
"3.12",
],
}
setup(
Expand Down
14 changes: 7 additions & 7 deletions tasks/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=9f62028523c3b5a953733ca89dcc3018
# hash=7d378a1752611508007a77d4ca39a5af
# =====================================
"""
A module for project-specific task registration.
Expand All @@ -20,14 +20,9 @@ def audit_local_tasks() -> None:
"""Ensure that shared task infrastructure is present."""

local = Path(__file__).parent.joinpath("mklocal")

# Also link a top-level file.
top_level = local.parent.parent.joinpath("mklocal")
if not top_level.is_symlink():
assert not top_level.exists()
top_level.symlink_to(local)

if local.is_symlink():
if local.is_symlink() and top_level.is_symlink():
return

# If it's not a symlink, it shouldn't be any other kind of file.
Expand All @@ -48,6 +43,11 @@ def audit_local_tasks() -> None:
# Create the link.
local.symlink_to(vmklib)

# Also link a top-level file.
if not top_level.is_symlink():
assert not top_level.exists()
top_level.symlink_to(local)


def register(
manager: TaskManager,
Expand Down
12 changes: 12 additions & 0 deletions tests/commands/test_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@
from yambs.entry import main as yambs_main


def test_native_command_wasm():
"""Test the 'native' command with WASM variants."""

with in_dir(clean_scenario("native3")):
assert yambs_main([PKG_NAME, "native"]) == 0

# Try to build (if we can).
if platform == "linux" and which("ninja"):
run(["ninja", "wasm"], check=True)


def test_native_command_basic():
"""Test the 'native' command."""

path = str(clean_scenario("native"))

# Ensure the directory dependency is cleaned as well.
clean_scenario("native2")
clean_scenario("native3")

with in_dir(path):
assert yambs_main([PKG_NAME, "native", "-w", "-i"]) == 0
Expand Down
3 changes: 3 additions & 0 deletions tests/data/valid/scenarios/native3/yambs.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
includes:
- package://yambs/includes/wasm.yaml

project:
name: yambs3
4 changes: 2 additions & 2 deletions yambs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=62d7b56325a95261f3a945bf98673529
# hash=eb43e10924888ea3ff0d4f7e0f7089f0
# =====================================

"""
Expand All @@ -10,4 +10,4 @@

DESCRIPTION = "Yet another meta build-system."
PKG_NAME = "yambs"
VERSION = "2.8.1"
VERSION = "3.0.0"
4 changes: 4 additions & 0 deletions yambs/config/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
class Native(CommonConfig):
"""The top-level configuration object for the package."""

def has_variant(self, name: str) -> bool:
"""Determine whether or not"""
return name in self.data.get("variants", {})


def load_native(
path: Pathlike = DEFAULT_CONFIG, root: Pathlike = None
Expand Down
8 changes: 8 additions & 0 deletions yambs/data/includes/wasm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
variants:
wasm:
cc: emcc
cxx: em++
ld: em++

targets: [htmls]
3 changes: 3 additions & 0 deletions yambs/data/templates/native_rules.ninja.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ ldflags = $common_ldflags $variant_ldflags
rule link
command = $ld $cflags -Wl,-Map=$out.map $in $ldflags -o $out

rule link_no_map
command = $ld $cflags $in $ldflags -o $out

rule bin
command = ${toolchain_prefix}objcopy -O binary $in $out

Expand Down
3 changes: 1 addition & 2 deletions yambs/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def first_party_sources_headers(self) -> Iterator[Path]:
yield source
visited.add(source)

for item in self.first_party_headers:
yield item
yield from self.first_party_headers

def set_board_sources(
self, board: Board, regular: Set[Path], apps: Set[Path]
Expand Down
Loading

0 comments on commit f8e9c06

Please sign in to comment.