From 1421f56ad86066dbbd1d34ea92283da52b535569 Mon Sep 17 00:00:00 2001 From: Matt Knight Date: Thu, 21 Nov 2024 18:51:58 -0800 Subject: [PATCH] Update packaging to include root package (#291) * update packaging to include root package * remove ch32 from package test --- .github/workflows/build.yml | 4 +-- build.zig | 2 +- build.zig.zon | 5 ++-- core/build.zig.zon | 1 - drivers/LICENSE | 19 ++++++++++++++ drivers/build.zig.zon | 1 + tools/package-test/build.zig | 44 +++++++++++++++++++++++++++----- tools/package-test/src/empty.zig | 1 + 8 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 drivers/LICENSE create mode 100644 tools/package-test/src/empty.zig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5007abaf..c58f3368 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,9 +50,9 @@ jobs: sleep 1 cd tools/package-test - zig fetch --save=microzig/port/raspberrypi/rp2xxx http://localhost:8000/${MICROZIG_VERSION}/port/raspberrypi/rp2xxx.tar.gz + zig fetch --save=microzig http://localhost:8000/${MICROZIG_VERSION}/microzig.tar.gz zig build -Doptimize=ReleaseSmall - zig build run-port-tests + # zig build run-port-tests # clean up server jobs -p | xargs kill diff --git a/build.zig b/build.zig index 793a92b5..b243d2ff 100644 --- a/build.zig +++ b/build.zig @@ -24,7 +24,7 @@ const port_list: []const struct { .{ .name = "lpc", .dep_name = "port/nxp/lpc" }, .{ .name = "rp2xxx", .dep_name = "port/raspberrypi/rp2xxx" }, .{ .name = "stm32", .dep_name = "port/stmicro/stm32" }, - .{ .name = "ch32", .dep_name = "port/wch/ch32" }, + //.{ .name = "ch32v", .dep_name = "port/wch/ch32v" }, }; pub fn build(b: *Build) void { diff --git a/build.zig.zon b/build.zig.zon index a60bdf6d..769caadf 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -20,11 +20,12 @@ .@"port/nxp/lpc" = .{ .path = "port/nxp/lpc", .lazy = true }, .@"port/raspberrypi/rp2xxx" = .{ .path = "port/raspberrypi/rp2xxx", .lazy = true }, .@"port/stmicro/stm32" = .{ .path = "port/stmicro/stm32", .lazy = true }, + //.@"port/wch/ch32v" = .{ .path = "port/wch/ch32v", .lazy = true }, // used for creating package tarballs .boxzer = .{ - .url = "git+https://github.com/mattnite/boxzer#2297a84eb11f3c6476a133c25689d10714e2e1f7", - .hash = "12202157366306cd7fb005defe138bf8aeccfa903850d234b1c1edc1ca8071e4a931", + .url = "git+https://github.com/mattnite/boxzer#a23c802f15deb848e6019580c01ba5a342ce7bc9", + .hash = "12201941f33c88dfebeb894d6693b94501cca0d7ce1f3e268fe2825723085ab93ba7", }, }, .paths = .{ diff --git a/core/build.zig.zon b/core/build.zig.zon index a9cff3fa..600c732b 100644 --- a/core/build.zig.zon +++ b/core/build.zig.zon @@ -1,7 +1,6 @@ .{ .name = "core", .version = "0.0.1", - .dependencies = .{}, .paths = .{ "LICENSE", "thoughts.md", diff --git a/drivers/LICENSE b/drivers/LICENSE new file mode 100644 index 00000000..33640972 --- /dev/null +++ b/drivers/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) Zig Embedded Group contributors + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use +of this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, + an acknowledgment in the product documentation would be appreciated but is + not required. + +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. diff --git a/drivers/build.zig.zon b/drivers/build.zig.zon index 9a8b2553..3ee0d71d 100644 --- a/drivers/build.zig.zon +++ b/drivers/build.zig.zon @@ -2,6 +2,7 @@ .name = "microzig_driver_framework", .version = "0.0.1", .paths = .{ + "LICENSE", "build.zig", "build.zig.zon", "framework.zig", diff --git a/tools/package-test/build.zig b/tools/package-test/build.zig index 85bfb096..f7338af1 100644 --- a/tools/package-test/build.zig +++ b/tools/package-test/build.zig @@ -1,15 +1,45 @@ const std = @import("std"); +const microzig = @import("microzig"); -const ports: []const []const u8 = &.{ - "microzig/port/raspberrypi/rp2xxx", -}; +const MicroBuild = microzig.MicroBuild(.{ + .rp2xxx = true, + .gd32 = true, + .atsam = true, + .avr = true, + .nrf5x = true, + .lpc = true, + .stm32 = true, +}); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); - const test_ports_step = b.step("run-port-tests", "Run all platform agnostic tests for Ports"); - for (ports) |port| { - const dep = b.dependency(port, .{ .optimize = optimize }); - test_ports_step.dependOn(&dep.builder.top_level_steps.get("test").?.step); + const mz_dep = b.dependency("microzig", .{}); + const mb = MicroBuild.init(b, mz_dep); + + const examples: []const Example = &.{ + .{ .target = mb.ports.rp2xxx.boards.raspberrypi.pico, .name = "rp2xxx" }, + .{ .target = mb.ports.gd32.boards.sipeed.longan_nano, .name = "gd32" }, + .{ .target = mb.ports.atsam.chips.atsamd51j19, .name = "atsam" }, + .{ .target = mb.ports.avr.boards.arduino.nano, .name = "avr" }, + .{ .target = mb.ports.nrf5x.boards.nordic.nrf52840_dongle, .name = "nrf5x" }, + .{ .target = mb.ports.lpc.boards.nordic.mbed.lpc1768, .name = "lpc" }, + .{ .target = mb.ports.stm32.boards.stm32f3discovery, .name = "stm32" }, + }; + + for (examples) |example| { + const firmware = mb.add_firmware(.{ + .name = example.name, + .target = example.target, + .optimize = optimize, + .root_source_file = b.path("src/empty.zig"), + }); + + mb.install_firmware(firmware, .{}); } } + +const Example = struct { + target: *microzig.Target, + name: []const u8, +}; diff --git a/tools/package-test/src/empty.zig b/tools/package-test/src/empty.zig new file mode 100644 index 00000000..902b554d --- /dev/null +++ b/tools/package-test/src/empty.zig @@ -0,0 +1 @@ +pub fn main() void {}