Compare commits
17 Commits
b2c8fc5f3c
...
7d80f42a3e
Author | SHA1 | Date | |
---|---|---|---|
7d80f42a3e | |||
be9a52ed6a | |||
e847af6d4c | |||
c60c40f627 | |||
c40539b7b0 | |||
007f2f588a | |||
dc5f040a2f | |||
3887e630d6 | |||
c825ef72fe | |||
52a5865caa | |||
bf4097cd5b | |||
18d8258eaf | |||
b49bb9ad90 | |||
a0773971f2 | |||
484b504090 | |||
45e87cf202 | |||
99a61c0bd2 |
|
@ -9,32 +9,21 @@ env:
|
|||
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
|
||||
jobs:
|
||||
build-zig-0.11.0-amd64-host:
|
||||
build-zig-amd64-host:
|
||||
runs-on: ubuntu-latest
|
||||
# Need to use the default container with node and all that, so we can
|
||||
# use JS-based actions like actions/checkout@v3...
|
||||
# container:
|
||||
# image: alpine:3.15.0
|
||||
env:
|
||||
ZIG_VERSION: 0.11.0
|
||||
ARCH: x86_64
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
# However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
|
||||
# TODO: https://github.com/ziglang/zig/issues/2443
|
||||
- name: Install zig
|
||||
run: |
|
||||
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
||||
tar x -C /usr/local -f zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
||||
ln -s /usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
|
||||
- name: Setup Zig
|
||||
uses: https://git.lerch.org/lobo/setup-zig@v3
|
||||
with:
|
||||
version: 0.12.0
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
- name: Build example
|
||||
run: ( cd example && zig build ) # Make sure example builds
|
||||
# Zig package manager expects everything to be inside a directory in the archive,
|
||||
# which it then strips out on download. So we need to shove everything inside a directory
|
||||
# the way GitHub/Gitea does for repo archives
|
||||
|
@ -47,7 +36,12 @@ jobs:
|
|||
tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
|
||||
--format ustar \
|
||||
--exclude 'zig-*' \
|
||||
--transform 's,^,${{ github.sha }}/,' *
|
||||
*
|
||||
# Something in this PR broke this transform. I don't mind removing it, but
|
||||
# the PR attempts to handle situations with or without a prefix, but it
|
||||
# doesn't. I have not yet determined what the problem is, though
|
||||
# https://github.com/ziglang/zig/pull/19111/files
|
||||
# --transform 's,^,${{ github.sha }}/,' *
|
||||
# - name: Sign
|
||||
# id: sign
|
||||
# uses: https://git.lerch.org/lobo/action-hsm-sign@v1
|
||||
|
@ -70,6 +64,8 @@ jobs:
|
|||
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
|
||||
--upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
|
||||
https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/${{ github.sha }}-with-models.tar.gz
|
||||
- name: Build example
|
||||
run: ( cd example && zig build ) # Make sure example builds
|
||||
- name: Notify
|
||||
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
|
||||
if: always()
|
||||
|
|
|
@ -16,26 +16,15 @@ jobs:
|
|||
# use JS-based actions like actions/checkout@v3...
|
||||
# container:
|
||||
# image: alpine:3.15.0
|
||||
env:
|
||||
ZIG_VERSION: mach-latest
|
||||
ARCH: x86_64
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
# However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
|
||||
# TODO: https://github.com/ziglang/zig/issues/2443
|
||||
- name: Install zig
|
||||
run: |
|
||||
apt-get update && apt-get install -y jq
|
||||
file="$(curl -Osw '%{filename_effective}' "$(curl -s https://machengine.org/zig/index.json |jq -r '."'${ZIG_VERSION}'"."x86_64-linux".tarball')")"
|
||||
tar x -C /usr/local -f "${file}"
|
||||
ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
|
||||
zig version
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
with:
|
||||
ref: zig-develop
|
||||
- name: Setup Zig
|
||||
uses: https://git.lerch.org/lobo/setup-zig@v3
|
||||
with:
|
||||
version: mach-latest
|
||||
# Zig package manager expects everything to be inside a directory in the archive,
|
||||
# which it then strips out on download. So we need to shove everything inside a directory
|
||||
# the way GitHub/Gitea does for repo archives
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
name: aws-zig nightly build
|
||||
run-name: ${{ github.actor }} building AWS Zig SDK
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 12 30 * *' # 12:30 UTC, 4:30AM Pacific
|
||||
push:
|
||||
branches:
|
||||
- 'zig-develop*'
|
||||
|
@ -14,24 +16,15 @@ jobs:
|
|||
# use JS-based actions like actions/checkout@v3...
|
||||
# container:
|
||||
# image: alpine:3.15.0
|
||||
env:
|
||||
ZIG_VERSION: master
|
||||
ARCH: x86_64
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
# However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
|
||||
# TODO: https://github.com/ziglang/zig/issues/2443
|
||||
- name: Install zig
|
||||
run: |
|
||||
apt-get update && apt-get install -y jq
|
||||
file="$(curl -Osw '%{filename_effective}' "$(curl -s https://ziglang.org/download/index.json |jq -r '."'${ZIG_VERSION}'"."x86_64-linux".tarball')")"
|
||||
tar x -C /usr/local -f "${file}"
|
||||
ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
|
||||
zig version
|
||||
with:
|
||||
ref: zig-develop
|
||||
- name: Setup Zig
|
||||
uses: https://git.lerch.org/lobo/setup-zig@v3
|
||||
with:
|
||||
version: master
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
# Zig package manager expects everything to be inside a directory in the archive,
|
||||
|
|
8
.github/workflows/build.yaml
vendored
8
.github/workflows/build.yaml
vendored
|
@ -6,15 +6,15 @@ on:
|
|||
- '*'
|
||||
- '!zig-develop*'
|
||||
jobs:
|
||||
build-zig-0.11.0-amd64-host:
|
||||
build-zig-0-12-0-amd64:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ZIG_VERSION: 0.11.0
|
||||
ZIG_VERSION: 0.12.0
|
||||
ARCH: x86_64
|
||||
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
|
@ -26,6 +26,6 @@ jobs:
|
|||
sudo tar x -C /usr/local -f zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz
|
||||
sudo ln -s /usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
run: zig build test -Dbroken-windows --verbose # Github runners try to run the windows tests despite disabling foreign checks
|
||||
- name: Build example
|
||||
run: ( cd example && zig build ) # Make sure example builds
|
||||
|
|
8
.github/workflows/zig-mach.yaml
vendored
8
.github/workflows/zig-mach.yaml
vendored
|
@ -1,13 +1,11 @@
|
|||
name: aws-zig mach nominated build
|
||||
run-name: ${{ github.actor }} building AWS Zig SDK
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 12 * * *' # noon UTC, 4AM Pacific
|
||||
push:
|
||||
branches:
|
||||
- 'zig-develop*'
|
||||
jobs:
|
||||
build-zig-nightly:
|
||||
build-zig-mach-latest:
|
||||
runs-on: ubuntu-latest
|
||||
# Need to use the default container with node and all that, so we can
|
||||
# use JS-based actions like actions/checkout@v3...
|
||||
|
@ -19,7 +17,7 @@ jobs:
|
|||
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
|
@ -33,6 +31,6 @@ jobs:
|
|||
sudo ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
|
||||
zig version
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
run: zig build test -Dbroken-windows --verbose
|
||||
- name: Build example
|
||||
run: ( cd example && zig build ) # Make sure example builds
|
||||
|
|
4
.github/workflows/zig-nightly.yaml
vendored
4
.github/workflows/zig-nightly.yaml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
if: ${{ github.env.GITEA_ACTIONS != 'true' }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
# ARCH is fine, but we can't substitute directly because zig
|
||||
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
|
||||
#
|
||||
|
@ -31,6 +31,6 @@ jobs:
|
|||
sudo ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
|
||||
zig version
|
||||
- name: Run tests
|
||||
run: zig build test --verbose
|
||||
run: zig build test -Dbroken-windows --verbose
|
||||
- name: Build example
|
||||
run: ( cd example && zig build ) # Make sure example builds
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,3 +11,4 @@ libs/
|
|||
src/git_version.zig
|
||||
zig-out
|
||||
core
|
||||
.zig-cache
|
||||
|
|
41
README.md
41
README.md
|
@ -1,17 +1,17 @@
|
|||
AWS SDK for Zig
|
||||
===============
|
||||
|
||||
[Zig 0.12](https://ziglang.org/download/#release-0.12.0):
|
||||
|
||||
[![Build Status: Zig 0.12.0](https://git.lerch.org/lobo/aws-sdk-for-zig/actions/workflows/build.yaml/badge.svg)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=build.yaml&state=closed)
|
||||
|
||||
[Last Mach Nominated Zig Version](https://machengine.org/about/nominated-zig/):
|
||||
|
||||
[![Build Status: Zig 0.12.0-dev.3180+83e578a18](https://actions-status.lerch.org/lobo/aws-sdk-for-zig/zig-mach)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=zig-mach.yaml&state=closed)
|
||||
[![Build Status: Mach nominated](https://git.lerch.org/lobo/aws-sdk-for-zig/actions/workflows/zig-mach.yaml/badge.svg?branch=zig-develop)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=zig-mach.yaml&state=closed)
|
||||
|
||||
[Nightly Zig](https://ziglang.org/download/):
|
||||
|
||||
[![Build Status: Zig Nightly](https://actions-status.lerch.org/lobo/aws-sdk-for-zig/zig-nightly)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=zig-nightly.yaml&state=closed)
|
||||
|
||||
**NOTE: TLS 1.3 support is still deploying across AWS. Some services, especially S3,
|
||||
may or may not be available without a proxy, depending on the region.
|
||||
See limitations section below**
|
||||
[![Build Status: Zig Nightly](https://git.lerch.org/lobo/aws-sdk-for-zig/actions/workflows/zig-nightly.yaml/badge.svg?branch=zig-develop)](https://git.lerch.org/lobo/aws-sdk-for-zig/actions?workflow=zig-nightly.yaml&state=closed)
|
||||
|
||||
Current executable size for the demo is 980k after compiling with -Doptimize=ReleaseSmall
|
||||
in x86_linux, and will vary based on services used. Tested targets:
|
||||
|
@ -69,13 +69,6 @@ variable that will supersede all other configuration.
|
|||
Limitations
|
||||
-----------
|
||||
|
||||
The zig 0.11 HTTP client supports TLS 1.3 only. AWS has committed to
|
||||
[TLS 1.3 support across all services by the end of 2023](https://aws.amazon.com/blogs/security/faster-aws-cloud-connections-with-tls-1-3/),
|
||||
but a few services as of April 1, 2024 have not been upgraded, and S3 is
|
||||
a bit intermittent. Proxy support has been added, so to get to the services that
|
||||
do not yet support TLS 1.3, you can use something like [mitmproxy](https://mitmproxy.org/)
|
||||
to proxy those requests until roll out is complete.
|
||||
|
||||
WebIdentityToken is not yet implemented.
|
||||
|
||||
TODO List:
|
||||
|
@ -92,24 +85,12 @@ TODO List:
|
|||
* Implement timeouts and other TODO's in the code
|
||||
* Add option to cache signature keys
|
||||
|
||||
Services without TLS 1.3 support (4 services out of 255 total)
|
||||
---------------------------------------------------------------
|
||||
Services without TLS 1.3 support
|
||||
--------------------------------
|
||||
|
||||
The following service list is based on limited testing against us-west-2
|
||||
region. Your mileage may vary, as there are thousands of endpoints against
|
||||
many regions. It appears the TLS 1.3 rollout is fairly far along at
|
||||
this point.
|
||||
|
||||
NOTE ON S3: For me, S3 is currently intermittently available using TLS 1.3, so
|
||||
it appears deployments are in progress. The last couple days it has been
|
||||
not been available consistently, so I have added it back to the list.
|
||||
|
||||
```
|
||||
data.iot
|
||||
models.lex
|
||||
opsworks
|
||||
s3
|
||||
```
|
||||
All AWS services should support TLS 1.3 at this point, but there are many regions
|
||||
and several partitions, and not all of them have been tested, so your mileage
|
||||
may vary.
|
||||
|
||||
Dependency tree
|
||||
---------------
|
||||
|
|
18
build.zig
18
build.zig
|
@ -53,6 +53,11 @@ pub fn build(b: *Builder) !void {
|
|||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const broken_windows = b.option(
|
||||
bool,
|
||||
"broken-windows",
|
||||
"Windows is broken in this environment (do not run Windows tests)",
|
||||
) orelse false;
|
||||
// TODO: Embed the current git version in the code. We can do this
|
||||
// by looking for .git/HEAD (if it exists, follow the ref to /ref/heads/whatevs,
|
||||
// grab that commit, and use b.addOptions/exe.addOptions to generate the
|
||||
|
@ -67,7 +72,7 @@ pub fn build(b: *Builder) !void {
|
|||
// It relies on code gen and is all fouled up when getting imported
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "demo",
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
@ -81,13 +86,13 @@ pub fn build(b: *Builder) !void {
|
|||
|
||||
// Expose module to others
|
||||
_ = b.addModule("aws", .{
|
||||
.root_source_file = .{ .path = "src/aws.zig" },
|
||||
.root_source_file = b.path("src/aws.zig"),
|
||||
.imports = &.{.{ .name = "smithy", .module = smithy_module }},
|
||||
});
|
||||
|
||||
// Expose module to others
|
||||
_ = b.addModule("aws-signing", .{
|
||||
.root_source_file = .{ .path = "src/aws_signing.zig" },
|
||||
.root_source_file = b.path("src/aws_signing.zig"),
|
||||
.imports = &.{.{ .name = "smithy", .module = smithy_module }},
|
||||
});
|
||||
// TODO: This does not work correctly due to https://github.com/ziglang/zig/issues/16354
|
||||
|
@ -117,7 +122,7 @@ pub fn build(b: *Builder) !void {
|
|||
|
||||
const cg_exe = b.addExecutable(.{
|
||||
.name = "codegen",
|
||||
.root_source_file = .{ .path = "codegen/src/main.zig" },
|
||||
.root_source_file = b.path("codegen/src/main.zig"),
|
||||
// We need this generated for the host, not the real target
|
||||
.target = b.host,
|
||||
.optimize = if (b.verbose) .Debug else .ReleaseSafe,
|
||||
|
@ -144,7 +149,7 @@ pub fn build(b: *Builder) !void {
|
|||
},
|
||||
));
|
||||
cg_cmd.addArg("--output");
|
||||
cg_cmd.addDirectoryArg(std.Build.LazyPath.relative("src/models"));
|
||||
cg_cmd.addDirectoryArg(b.path("src/models"));
|
||||
if (b.verbose)
|
||||
cg_cmd.addArg("--verbose");
|
||||
// cg_cmd.step.dependOn(&fetch_step.step);
|
||||
|
@ -188,10 +193,11 @@ pub fn build(b: *Builder) !void {
|
|||
|
||||
// test_step.dependOn(&run_unit_tests.step);
|
||||
for (test_targets) |t| {
|
||||
if (broken_windows and t.os_tag == .windows) continue;
|
||||
// Creates a step for unit testing. This only builds the test executable
|
||||
// but does not run it.
|
||||
const unit_tests = b.addTest(.{
|
||||
.root_source_file = .{ .path = "src/aws.zig" },
|
||||
.root_source_file = b.path("src/aws.zig"),
|
||||
.target = b.resolveTargetQuery(t),
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
.{
|
||||
.name = "aws-zig",
|
||||
.name = "aws",
|
||||
.version = "0.0.1",
|
||||
.paths = .{""},
|
||||
.paths = .{
|
||||
"build.zig",
|
||||
"build.zig.zon",
|
||||
"src",
|
||||
"README.md",
|
||||
"LICENSE.md",
|
||||
},
|
||||
|
||||
.dependencies = .{
|
||||
.smithy = .{
|
||||
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
|
||||
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
|
||||
.url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz",
|
||||
.hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497",
|
||||
},
|
||||
.models = .{
|
||||
.url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz",
|
||||
|
|
|
@ -77,13 +77,13 @@ pub fn hex64(x: u64) [16]u8 {
|
|||
return result;
|
||||
}
|
||||
|
||||
pub const walkerFn = *const fn (std.fs.Dir.Walker.WalkerEntry) bool;
|
||||
pub const walkerFn = *const fn (std.fs.Dir.Walker.Entry) bool;
|
||||
|
||||
fn included(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
fn included(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
_ = entry;
|
||||
return true;
|
||||
}
|
||||
fn excluded(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
fn excluded(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
_ = entry;
|
||||
return false;
|
||||
}
|
||||
|
@ -206,6 +206,6 @@ fn isExecutable(file: std.fs.File) !bool {
|
|||
return false;
|
||||
} else {
|
||||
const stat = try file.stat();
|
||||
return (stat.mode & std.os.S.IXUSR) != 0;
|
||||
return (stat.mode & std.posix.S.IXUSR) != 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn main() anyerror!void {
|
|||
models_dir = try std.fs.cwd().openDir(args[i + 1], .{ .iterate = true });
|
||||
}
|
||||
// TODO: Seems like we should remove this in favor of a package
|
||||
try output_dir.writeFile("json.zig", json_zig);
|
||||
try output_dir.writeFile(.{ .sub_path = "json.zig", .data = json_zig });
|
||||
|
||||
// TODO: We need a different way to handle this file...
|
||||
const manifest_file_started = false;
|
||||
|
@ -123,23 +123,23 @@ fn processDirectories(models_dir: std.fs.Dir, output_dir: std.fs.Dir) !void {
|
|||
// re-calculate so we can store the manifest
|
||||
model_digest = calculated_manifest.model_dir_hash_digest;
|
||||
calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool);
|
||||
try output_dir.writeFile("output_manifest.json", try std.json.stringifyAlloc(
|
||||
try output_dir.writeFile(.{ .sub_path = "output_manifest.json", .data = try std.json.stringifyAlloc(
|
||||
allocator,
|
||||
calculated_manifest,
|
||||
.{ .whitespace = .indent_2 },
|
||||
));
|
||||
) });
|
||||
}
|
||||
|
||||
var model_digest: ?[Hasher.hex_multihash_len]u8 = null;
|
||||
fn calculateDigests(models_dir: std.fs.Dir, output_dir: std.fs.Dir, thread_pool: *std.Thread.Pool) !OutputManifest {
|
||||
const model_hash = if (model_digest) |m| m[0..Hasher.digest_len].* else try Hasher.computeDirectoryHash(thread_pool, models_dir, @constCast(&Hasher.ComputeDirectoryOptions{
|
||||
.isIncluded = struct {
|
||||
pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
pub fn include(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
return std.mem.endsWith(u8, entry.basename, ".json");
|
||||
}
|
||||
}.include,
|
||||
.isExcluded = struct {
|
||||
pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
_ = entry;
|
||||
return false;
|
||||
}
|
||||
|
@ -150,12 +150,12 @@ fn calculateDigests(models_dir: std.fs.Dir, output_dir: std.fs.Dir, thread_pool:
|
|||
|
||||
const output_hash = try Hasher.computeDirectoryHash(thread_pool, try output_dir.openDir(".", .{ .iterate = true }), @constCast(&Hasher.ComputeDirectoryOptions{
|
||||
.isIncluded = struct {
|
||||
pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
pub fn include(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
return std.mem.endsWith(u8, entry.basename, ".zig");
|
||||
}
|
||||
}.include,
|
||||
.isExcluded = struct {
|
||||
pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool {
|
||||
pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool {
|
||||
_ = entry;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
|
||||
},
|
||||
.@"aws-zig" = .{
|
||||
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/b1b2a6cc7a6104f5e1f6ee4cae33e6ef3ed2ec1c/b1b2a6cc7a6104f5e1f6ee4cae33e6ef3ed2ec1c-with-models.tar.gz",
|
||||
.hash = "12203d7c7aea80fd5e1f892b4928b89b2c70d5688cf1843e0d03e5af79632c5a9146",
|
||||
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/a0773971f2f52182c8a5235582500d36afda2e81/a0773971f2f52182c8a5235582500d36afda2e81-with-models.tar.gz",
|
||||
.hash = "1220198f7b734c1cc6a683ad13246439a59be934156a2df3a734bcaf15433b33eead",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -827,7 +827,7 @@ fn ServerResponse(comptime action: anytype) type {
|
|||
};
|
||||
const Result = @Type(.{
|
||||
.Struct = .{
|
||||
.layout = .Auto,
|
||||
.layout = .auto,
|
||||
.fields = &[_]std.builtin.Type.StructField{
|
||||
.{
|
||||
.name = action.action_name ++ "Result",
|
||||
|
@ -850,7 +850,7 @@ fn ServerResponse(comptime action: anytype) type {
|
|||
});
|
||||
return @Type(.{
|
||||
.Struct = .{
|
||||
.layout = .Auto,
|
||||
.layout = .auto,
|
||||
.fields = &[_]std.builtin.Type.StructField{
|
||||
.{
|
||||
.name = action.action_name ++ "Response",
|
||||
|
|
|
@ -574,7 +574,7 @@ fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 {
|
|||
};
|
||||
},
|
||||
.macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
|
||||
const home_dir = std.os.getenv("HOME") orelse {
|
||||
const home_dir = std.posix.getenv("HOME") orelse {
|
||||
// TODO look in /etc/passwd
|
||||
return error.HomeDirUnavailable;
|
||||
};
|
||||
|
|
|
@ -306,7 +306,7 @@ pub fn verifyServerRequest(allocator: std.mem.Allocator, request: *std.http.Serv
|
|||
}
|
||||
|
||||
pub const UnverifiedRequest = struct {
|
||||
headers: []std.http.Header,
|
||||
headers: []const std.http.Header,
|
||||
target: []const u8,
|
||||
method: std.http.Method,
|
||||
allocator: std.mem.Allocator,
|
||||
|
|
10
src/json.zig
10
src/json.zig
|
@ -1361,7 +1361,7 @@ test "Value.jsonStringify" {
|
|||
var buffer: [10]u8 = undefined;
|
||||
var fbs = std.io.fixedBufferStream(&buffer);
|
||||
try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.writer());
|
||||
try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e+01");
|
||||
try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e1");
|
||||
}
|
||||
{
|
||||
var buffer: [10]u8 = undefined;
|
||||
|
@ -2808,7 +2808,7 @@ pub fn stringify(
|
|||
const T = @TypeOf(value);
|
||||
switch (@typeInfo(T)) {
|
||||
.Float, .ComptimeFloat => {
|
||||
return std.fmt.formatFloatScientific(value, std.fmt.FormatOptions{}, out_stream);
|
||||
return std.fmt.format(out_stream, "{e}", .{value});
|
||||
},
|
||||
.Int, .ComptimeInt => {
|
||||
return std.fmt.formatIntValue(value, "", std.fmt.FormatOptions{}, out_stream);
|
||||
|
@ -3057,11 +3057,11 @@ test "stringify basic types" {
|
|||
try teststringify("null", @as(?u8, null), StringifyOptions{});
|
||||
try teststringify("null", @as(?*u32, null), StringifyOptions{});
|
||||
try teststringify("42", 42, StringifyOptions{});
|
||||
try teststringify("4.2e+01", 42.0, StringifyOptions{});
|
||||
try teststringify("4.2e1", 42.0, StringifyOptions{});
|
||||
try teststringify("42", @as(u8, 42), StringifyOptions{});
|
||||
try teststringify("42", @as(u128, 42), StringifyOptions{});
|
||||
try teststringify("4.2e+01", @as(f32, 42), StringifyOptions{});
|
||||
try teststringify("4.2e+01", @as(f64, 42), StringifyOptions{});
|
||||
try teststringify("4.2e1", @as(f32, 42), StringifyOptions{});
|
||||
try teststringify("4.2e1", @as(f64, 42), StringifyOptions{});
|
||||
try teststringify("\"ItBroke\"", @as(anyerror, error.ItBroke), StringifyOptions{});
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ pub fn log(
|
|||
const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix;
|
||||
|
||||
// Print the message to stderr, silently ignoring any errors
|
||||
std.debug.getStderrMutex().lock();
|
||||
defer std.debug.getStderrMutex().unlock();
|
||||
std.debug.lockStdErr();
|
||||
defer std.debug.unlockStdErr();
|
||||
const stderr = std.io.getStdErr().writer();
|
||||
nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn Services(comptime service_imports: anytype) type {
|
|||
// finally, generate the type
|
||||
return @Type(.{
|
||||
.Struct = .{
|
||||
.layout = .Auto, // will be .auto in the future
|
||||
.layout = .auto,
|
||||
.fields = &fields,
|
||||
.decls = &[_]std.builtin.Type.Declaration{},
|
||||
.is_tuple = false,
|
||||
|
|
Loading…
Reference in New Issue
Block a user