Skip to content

Commit

Permalink
Updates for v25.0.2 release (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcohler authored Sep 13, 2024
1 parent 1879f50 commit 81e65a6
Show file tree
Hide file tree
Showing 96 changed files with 781 additions and 782 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
.zig-cache
zig-cache
zig-out
.gen
.out
.main-*.zig
**/local.ini
.vscode/
workspace/zigem
workspace/.gen
workspace/.out
workspace/.main-*.zig
workspace/.zigem-main.zig
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# **Zig•EM**
## v25.0.2
- initial **VS Code** support through `vscode-zigem` extension
- new overall workspace organization
- renamed `em.test` bundle as `examples`
- critical bug-fix in `em.utils/FiberMgr`
- `em.examples.basic/TickerP` not fully operational
- additional information at [blog.zigem.tech/post-003](https://blog.zigem.tech/post-003/)

## v25.0.1
- first public release of the **Zig•EM** programming framework
- support for `windows-x86_64`, `linux-x86_64`, and `macos-x86_64` as development hosts
- support for the [TI CC2340R5](https://www.ti.com/product/CC2340R5) wireless MCU as an embedded hardware target
- a suite of basic programming examples, first introduced in EM and now re-written in Zig
- additional information at [blog.zigem.tech/post-002](https://blog.zigem.tech/post-002/)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# **Zig•EM**

Visit [blog.zigem.tech](https://blog.zigem.tech/post-001/) to learn more about this novel programming framework targeting resource-constrained embedded systems, where every byte of memory and μJoule of energy matters.
Visit [blog.zigem.tech](https://blog.zigem.tech/post-001/) to learn more about this novel programming framework targeting resource-constrained embedded systems, where every byte of memory and μJoule of energy matters.
14 changes: 10 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
const target = b.host;
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "zig-em",
.name = "zigem",
.root_source_file = std.Build.path(b, "src/main.zig"),
.target = target,
.optimize = optimize,
Expand Down Expand Up @@ -34,18 +34,24 @@ pub fn build(b: *std.Build) void {
}
}

b.installDirectory(.{
.source_dir = b.dependency("vscode-zigem", .{}).path("."),
.install_dir = std.Build.InstallDir{ .custom = "tools" },
.install_subdir = "",
});
b.installArtifact(b.dependency("zls-em", .{}).artifact("zls-em"));
b.installArtifact(exe);

const verify_exe = b.addRunArtifact(exe);
verify_exe.setCwd(std.Build.LazyPath{ .src_path = .{ .owner = b, .sub_path = "workspace" } });
verify_exe.addArgs(&.{ "compile", "-u", "em.test/em.examples.basic/BlinkerP.em.zig" });
const verify_step = b.step("verify", "Verify zig-em");
verify_exe.addArgs(&.{ "compile", "-f", "em.core/em.examples.basic/BlinkerP.em.zig" });
const verify_step = b.step("verify", "Verify ZigEM");
verify_step.dependOn(&verify_exe.step);

const zigem_exe = b.addRunArtifact(exe);
if (b.args) |args| zigem_exe.addArgs(args);
zigem_exe.setCwd(std.Build.LazyPath{ .src_path = .{ .owner = b, .sub_path = "workspace" } });
const zigem_step = b.step("zig-em", "Execute the ZigEM CLI");
const zigem_step = b.step("zigem", "Execute the ZigEM CLI");
zigem_step.dependOn(&zigem_exe.step);
}

Expand Down
8 changes: 8 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,13 @@
.hash = "1220e083de87e1aadeb0c0446c301d4214b2eebb2632389eb650556462c80ec9b71d",
.lazy = true,
},
.@"zls-em" = .{
.url = "https://github.com/em-foundation/zls-em/archive/refs/tags/v0.0.1.tar.gz",
.hash = "12201b80d7156dfba486ba255f282e67ee3e84f782b6816d93fcd68466f9193be267",
},
.@"vscode-zigem" = .{
.url = "https://github.com/em-foundation/vscode-zigem/releases/download/v0.0.2.202409131250/vscode-zigem.zip",
.hash = "1220291e6f88b53eb17dbd6c47ef8f45eb8bae0a7181e51b1a3158bbe414862c110b",
},
},
}
24 changes: 12 additions & 12 deletions src/Props.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ const LOCAL_FILE = "local.ini";
const ZIGEM_FILE = "zigem.ini";

const PROP_EXTENDS = "em.lang.SetupExtends";
const PROP_REQUIRES = "em.lang.BundleRequires";
const PROP_REQUIRES = "em.lang.PackageRequires";

const SETUP_SEP = "://";

const BundleList = std.ArrayList([]const u8);
const PkgList = std.ArrayList([]const u8);

const PropMap = std.StringHashMap([]const u8);
const PropSet = std.StringHashMap(void);

var cur_bundles = BundleList.init(Heap.get());
var cur_pkgs = PkgList.init(Heap.get());
var cur_props = PropMap.init(Heap.get());

var done_set = PropSet.init(Heap.get());
Expand All @@ -27,19 +27,19 @@ var work_set = PropSet.init(Heap.get());
var has_setup: bool = undefined;
var root_dir: []const u8 = undefined;

pub fn addBundle(name: []const u8) anyerror!void {
// std.log.info("adding bunding {s}", .{name});
pub fn addPackage(name: []const u8) anyerror!void {
// std.log.info("adding package {s}", .{name});
if (done_set.contains(name)) return;
if (work_set.contains(name)) std.zig.fatal("bundle cycle in {s}", .{name});
if (work_set.contains(name)) std.zig.fatal("package cycle in {s}", .{name});
try work_set.put(name, {});
const path = Fs.join(&.{ root_dir, name, "em-bundle.ini" });
const path = Fs.join(&.{ root_dir, name, "zigem-package.ini" });
const pm = try readProps(path);
try applyRequires(pm);
var ent_iter = pm.iterator();
while (ent_iter.next()) |e| try cur_props.put(e.key_ptr.*, e.value_ptr.*);
_ = work_set.remove(name);
try done_set.put(name, {});
try cur_bundles.insert(0, Fs.dirname(path));
try cur_pkgs.insert(0, Fs.dirname(path));
}

pub fn addSetup(name: []const u8) anyerror!void {
Expand Down Expand Up @@ -80,12 +80,12 @@ fn applyRequires(pm: PropMap) anyerror!void {
if (pm.contains(PROP_REQUIRES)) {
const reqs = std.mem.trim(u8, pm.get(PROP_REQUIRES).?, &std.ascii.whitespace);
var tok_iter = std.mem.tokenizeAny(u8, reqs, ", ");
while (tok_iter.next()) |bn| try addBundle(bn);
while (tok_iter.next()) |bn| try addPackage(bn);
}
}

pub fn getBundles() BundleList {
return cur_bundles;
pub fn getPackages() PkgList {
return cur_pkgs;
}

pub fn getProps() PropMap {
Expand All @@ -100,7 +100,7 @@ pub fn init(dir: []const u8, sflg: bool) void {
pub fn print() void {
var props_iter = cur_props.iterator();
while (props_iter.next()) |ent| std.log.debug("{s} = {s}", .{ ent.key_ptr.*, ent.value_ptr.* });
for (cur_bundles.items) |bn| std.log.debug("bundle {s}", .{bn});
for (cur_pkgs.items) |bn| std.log.debug("bundle {s}", .{bn});
}

fn readProps(path: []const u8) !PropMap {
Expand Down
Loading

0 comments on commit 81e65a6

Please sign in to comment.