mirror of
https://github.com/fairyglade/ly.git
synced 2026-02-04 00:14:55 +00:00
Split core code into ly-core library
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -72,6 +72,9 @@ pub fn build(b: *std.Build) !void {
|
||||
.use_llvm = true,
|
||||
});
|
||||
|
||||
const ly_core = b.dependency("ly_core", .{ .target = target, .optimize = optimize });
|
||||
exe.root_module.addImport("ly-core", ly_core.module("ly-core"));
|
||||
|
||||
const zigini = b.dependency("zigini", .{ .target = target, .optimize = optimize });
|
||||
exe.root_module.addImport("zigini", zigini.module("zigini"));
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
.fingerprint = 0xa148ffcc5dc2cb59,
|
||||
.minimum_zig_version = "0.15.0",
|
||||
.dependencies = .{
|
||||
.ly_core = .{
|
||||
.path = "ly-core",
|
||||
},
|
||||
.clap = .{
|
||||
.url = "git+https://github.com/Hejsil/zig-clap#5289e0753cd274d65344bef1c114284c633536ea",
|
||||
.hash = "clap-0.11.0-oBajB-HnAQDPCKYzwF7rO3qDFwRcD39Q0DALlTSz5H7e",
|
||||
|
||||
19
ly-core/build.zig
Normal file
19
ly-core/build.zig
Normal file
@@ -0,0 +1,19 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const mod = b.addModule("ly-core", .{
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const mod_tests = b.addTest(.{
|
||||
.root_module = mod,
|
||||
});
|
||||
const run_mod_tests = b.addRunArtifact(mod_tests);
|
||||
|
||||
const test_step = b.step("test", "Run tests");
|
||||
test_step.dependOn(&run_mod_tests.step);
|
||||
}
|
||||
12
ly-core/build.zig.zon
Normal file
12
ly-core/build.zig.zon
Normal file
@@ -0,0 +1,12 @@
|
||||
.{
|
||||
.name = .ly_core,
|
||||
.version = "1.0.0",
|
||||
.fingerprint = 0xddda7afda795472,
|
||||
.minimum_zig_version = "0.15.0",
|
||||
.dependencies = .{},
|
||||
.paths = .{
|
||||
"build.zig",
|
||||
"build.zig.zon",
|
||||
"src",
|
||||
},
|
||||
}
|
||||
@@ -2,8 +2,6 @@ const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const UidRange = @import("UidRange.zig");
|
||||
|
||||
pub const termbox = @import("termbox2");
|
||||
|
||||
pub const pam = @cImport({
|
||||
@cInclude("security/pam_appl.h");
|
||||
});
|
||||
4
ly-core/src/root.zig
Normal file
4
ly-core/src/root.zig
Normal file
@@ -0,0 +1,4 @@
|
||||
pub const interop = @import("interop.zig");
|
||||
pub const UidRange = @import("UidRange.zig");
|
||||
pub const LogFile = @import("LogFile.zig");
|
||||
pub const SharedError = @import("SharedError.zig");
|
||||
@@ -1,12 +1,13 @@
|
||||
const std = @import("std");
|
||||
const build_options = @import("build_options");
|
||||
const builtin = @import("builtin");
|
||||
const ly_core = @import("ly-core");
|
||||
const Environment = @import("Environment.zig");
|
||||
const interop = @import("interop.zig");
|
||||
const SharedError = @import("SharedError.zig");
|
||||
const LogFile = @import("LogFile.zig");
|
||||
|
||||
const Md5 = std.crypto.hash.Md5;
|
||||
const interop = ly_core.interop;
|
||||
const SharedError = ly_core.SharedError;
|
||||
const LogFile = ly_core.LogFile;
|
||||
const utmp = interop.utmp;
|
||||
const Utmp = utmp.utmpx;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
const std = @import("std");
|
||||
const interop = @import("interop.zig");
|
||||
const ly_core = @import("ly-core");
|
||||
const enums = @import("enums.zig");
|
||||
const Lang = @import("bigclock/Lang.zig");
|
||||
const en = @import("bigclock/en.zig");
|
||||
const fa = @import("bigclock/fa.zig");
|
||||
const Cell = @import("tui/Cell.zig");
|
||||
|
||||
const interop = ly_core.interop;
|
||||
const Bigclock = enums.Bigclock;
|
||||
pub const WIDTH = Lang.WIDTH;
|
||||
pub const HEIGHT = Lang.HEIGHT;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const interop = @import("../interop.zig");
|
||||
const ly_core = @import("ly-core");
|
||||
|
||||
pub const WIDTH = 5;
|
||||
pub const HEIGHT = 5;
|
||||
pub const SIZE = WIDTH * HEIGHT;
|
||||
|
||||
pub const X: u32 = if (interop.supportsUnicode()) 0x2593 else '#';
|
||||
pub const X: u32 = if (ly_core.interop.supportsUnicode()) 0x2593 else '#';
|
||||
pub const O: u32 = 0;
|
||||
|
||||
// zig fmt: off
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub const Animation = enum {
|
||||
none,
|
||||
doom,
|
||||
|
||||
11
src/main.zig
11
src/main.zig
@@ -1,13 +1,13 @@
|
||||
const std = @import("std");
|
||||
const build_options = @import("build_options");
|
||||
const builtin = @import("builtin");
|
||||
const ly_core = @import("ly-core");
|
||||
const clap = @import("clap");
|
||||
const ini = @import("zigini");
|
||||
const auth = @import("auth.zig");
|
||||
const bigclock = @import("bigclock.zig");
|
||||
const enums = @import("enums.zig");
|
||||
const Environment = @import("Environment.zig");
|
||||
const interop = @import("interop.zig");
|
||||
const ColorMix = @import("animations/ColorMix.zig");
|
||||
const Doom = @import("animations/Doom.zig");
|
||||
const Dummy = @import("animations/Dummy.zig");
|
||||
@@ -25,15 +25,16 @@ const Lang = @import("config/Lang.zig");
|
||||
const OldSave = @import("config/OldSave.zig");
|
||||
const SavedUsers = @import("config/SavedUsers.zig");
|
||||
const migrator = @import("config/migrator.zig");
|
||||
const SharedError = @import("SharedError.zig");
|
||||
const LogFile = @import("LogFile.zig");
|
||||
const UidRange = @import("UidRange.zig");
|
||||
|
||||
const StringList = std.ArrayListUnmanaged([]const u8);
|
||||
const Ini = ini.Ini;
|
||||
const DisplayServer = enums.DisplayServer;
|
||||
const Entry = Environment.Entry;
|
||||
const termbox = interop.termbox;
|
||||
const interop = ly_core.interop;
|
||||
const UidRange = ly_core.UidRange;
|
||||
const LogFile = ly_core.LogFile;
|
||||
const SharedError = ly_core.SharedError;
|
||||
const termbox = TerminalBuffer.termbox;
|
||||
const temporary_allocator = std.heap.page_allocator;
|
||||
const ly_version_str = "Ly version " ++ build_options.version;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const interop = @import("../interop.zig");
|
||||
const TerminalBuffer = @import("TerminalBuffer.zig");
|
||||
|
||||
const termbox = interop.termbox;
|
||||
const termbox = TerminalBuffer.termbox;
|
||||
|
||||
const Cell = @This();
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
const std = @import("std");
|
||||
const interop = @import("../interop.zig");
|
||||
const ly_core = @import("ly-core");
|
||||
const Cell = @import("Cell.zig");
|
||||
|
||||
pub const termbox = @import("termbox2");
|
||||
|
||||
const Random = std.Random;
|
||||
|
||||
const termbox = interop.termbox;
|
||||
const interop = ly_core.interop;
|
||||
|
||||
const TerminalBuffer = @This();
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
const std = @import("std");
|
||||
const interop = @import("../../interop.zig");
|
||||
const TerminalBuffer = @import("../TerminalBuffer.zig");
|
||||
|
||||
const Allocator = std.mem.Allocator;
|
||||
const DynamicString = std.ArrayListUnmanaged(u8);
|
||||
|
||||
const termbox = interop.termbox;
|
||||
const termbox = TerminalBuffer.termbox;
|
||||
|
||||
const Text = @This();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const std = @import("std");
|
||||
const interop = @import("../../interop.zig");
|
||||
const TerminalBuffer = @import("../TerminalBuffer.zig");
|
||||
|
||||
pub fn CyclableLabel(comptime ItemType: type, comptime ChangeItemType: type) type {
|
||||
@@ -9,7 +8,7 @@ pub fn CyclableLabel(comptime ItemType: type, comptime ChangeItemType: type) typ
|
||||
const DrawItemFn = *const fn (*Self, ItemType, usize, usize) bool;
|
||||
const ChangeItemFn = *const fn (ItemType, ?ChangeItemType) void;
|
||||
|
||||
const termbox = interop.termbox;
|
||||
const termbox = TerminalBuffer.termbox;
|
||||
|
||||
const Self = @This();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user