Skip to content

Commit

Permalink
Update packaging to include root package (#291)
Browse files Browse the repository at this point in the history
* update packaging to include root package
* remove ch32 from package test
  • Loading branch information
mattnite authored Nov 22, 2024
1 parent eb8e5c7 commit 1421f56
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -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 = .{
Expand Down
1 change: 0 additions & 1 deletion core/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.{
.name = "core",
.version = "0.0.1",
.dependencies = .{},
.paths = .{
"LICENSE",
"thoughts.md",
Expand Down
19 changes: 19 additions & 0 deletions drivers/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions drivers/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.name = "microzig_driver_framework",
.version = "0.0.1",
.paths = .{
"LICENSE",
"build.zig",
"build.zig.zon",
"framework.zig",
Expand Down
44 changes: 37 additions & 7 deletions tools/package-test/build.zig
Original file line number Diff line number Diff line change
@@ -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,
};
1 change: 1 addition & 0 deletions tools/package-test/src/empty.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub fn main() void {}

0 comments on commit 1421f56

Please sign in to comment.