Compare commits

..

No commits in common. "7d80f42a3e136fb7bb6a1836f1e01432be1e91d8" and "b2c8fc5f3c0b06f130b348f6fa35dc8cdd9f91ac" have entirely different histories.

19 changed files with 125 additions and 95 deletions

View File

@ -9,21 +9,32 @@ env:
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/ ACTIONS_RUNTIME_URL: ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
jobs: jobs:
build-zig-amd64-host: build-zig-0.11.0-amd64-host:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Need to use the default container with node and all that, so we can # Need to use the default container with node and all that, so we can
# use JS-based actions like actions/checkout@v3... # use JS-based actions like actions/checkout@v3...
# container: # container:
# image: alpine:3.15.0 # image: alpine:3.15.0
env:
ZIG_VERSION: 0.11.0
ARCH: x86_64
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Zig # ARCH is fine, but we can't substitute directly because zig
uses: https://git.lerch.org/lobo/setup-zig@v3 # uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
with: #
version: 0.12.0 # 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: Run tests - name: Run tests
run: zig build test --verbose 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, # 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 # which it then strips out on download. So we need to shove everything inside a directory
# the way GitHub/Gitea does for repo archives # the way GitHub/Gitea does for repo archives
@ -36,12 +47,7 @@ jobs:
tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ tar -czf ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \
--format ustar \ --format ustar \
--exclude 'zig-*' \ --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 # - name: Sign
# id: sign # id: sign
# uses: https://git.lerch.org/lobo/action-hsm-sign@v1 # uses: https://git.lerch.org/lobo/action-hsm-sign@v1
@ -64,8 +70,6 @@ jobs:
curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ runner.temp }}/${{ github.sha }}-with-models.tar.gz \ --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 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 - name: Notify
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2 uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
if: always() if: always()

View File

@ -16,15 +16,26 @@ jobs:
# use JS-based actions like actions/checkout@v3... # use JS-based actions like actions/checkout@v3...
# container: # container:
# image: alpine:3.15.0 # image: alpine:3.15.0
env:
ZIG_VERSION: mach-latest
ARCH: x86_64
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: # ARCH is fine, but we can't substitute directly because zig
ref: zig-develop # uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
- name: Setup Zig #
uses: https://git.lerch.org/lobo/setup-zig@v3 # However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
with: # TODO: https://github.com/ziglang/zig/issues/2443
version: mach-latest - 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
# Zig package manager expects everything to be inside a directory in the archive, # 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 # which it then strips out on download. So we need to shove everything inside a directory
# the way GitHub/Gitea does for repo archives # the way GitHub/Gitea does for repo archives

View File

@ -1,8 +1,6 @@
name: aws-zig nightly build name: aws-zig nightly build
run-name: ${{ github.actor }} building AWS Zig SDK run-name: ${{ github.actor }} building AWS Zig SDK
on: on:
schedule:
- cron: '0 12 30 * *' # 12:30 UTC, 4:30AM Pacific
push: push:
branches: branches:
- 'zig-develop*' - 'zig-develop*'
@ -16,15 +14,24 @@ jobs:
# use JS-based actions like actions/checkout@v3... # use JS-based actions like actions/checkout@v3...
# container: # container:
# image: alpine:3.15.0 # image: alpine:3.15.0
env:
ZIG_VERSION: master
ARCH: x86_64
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: # ARCH is fine, but we can't substitute directly because zig
ref: zig-develop # uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
- name: Setup Zig #
uses: https://git.lerch.org/lobo/setup-zig@v3 # However, arm64/linux isn't quite fully tier 1 yet, so this is more of a
with: # TODO: https://github.com/ziglang/zig/issues/2443
version: master - 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
- name: Run tests - name: Run tests
run: zig build test --verbose run: zig build test --verbose
# Zig package manager expects everything to be inside a directory in the archive, # Zig package manager expects everything to be inside a directory in the archive,

View File

@ -6,15 +6,15 @@ on:
- '*' - '*'
- '!zig-develop*' - '!zig-develop*'
jobs: jobs:
build-zig-0-12-0-amd64: build-zig-0.11.0-amd64-host:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
ZIG_VERSION: 0.12.0 ZIG_VERSION: 0.11.0
ARCH: x86_64 ARCH: x86_64
if: ${{ github.env.GITEA_ACTIONS != 'true' }} if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v3
# ARCH is fine, but we can't substitute directly because zig # ARCH is fine, but we can't substitute directly because zig
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64. # 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 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 sudo ln -s /usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
- name: Run tests - name: Run tests
run: zig build test -Dbroken-windows --verbose # Github runners try to run the windows tests despite disabling foreign checks run: zig build test --verbose
- name: Build example - name: Build example
run: ( cd example && zig build ) # Make sure example builds run: ( cd example && zig build ) # Make sure example builds

View File

@ -1,11 +1,13 @@
name: aws-zig mach nominated build name: aws-zig mach nominated build
run-name: ${{ github.actor }} building AWS Zig SDK run-name: ${{ github.actor }} building AWS Zig SDK
on: on:
schedule:
- cron: '0 12 * * *' # noon UTC, 4AM Pacific
push: push:
branches: branches:
- 'zig-develop*' - 'zig-develop*'
jobs: jobs:
build-zig-mach-latest: build-zig-nightly:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Need to use the default container with node and all that, so we can # Need to use the default container with node and all that, so we can
# use JS-based actions like actions/checkout@v3... # use JS-based actions like actions/checkout@v3...
@ -17,7 +19,7 @@ jobs:
if: ${{ github.env.GITEA_ACTIONS != 'true' }} if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v3
# ARCH is fine, but we can't substitute directly because zig # ARCH is fine, but we can't substitute directly because zig
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64. # uses x86_64 instead of amd64. They also use aarch64 instead of arm64.
# #
@ -31,6 +33,6 @@ jobs:
sudo ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig sudo ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
zig version zig version
- name: Run tests - name: Run tests
run: zig build test -Dbroken-windows --verbose run: zig build test --verbose
- name: Build example - name: Build example
run: ( cd example && zig build ) # Make sure example builds run: ( cd example && zig build ) # Make sure example builds

View File

@ -17,7 +17,7 @@ jobs:
if: ${{ github.env.GITEA_ACTIONS != 'true' }} if: ${{ github.env.GITEA_ACTIONS != 'true' }}
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v3
# ARCH is fine, but we can't substitute directly because zig # ARCH is fine, but we can't substitute directly because zig
# uses x86_64 instead of amd64. They also use aarch64 instead of arm64. # 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 sudo ln -s /usr/local/"${file%%.tar.xz}"/zig /usr/local/bin/zig
zig version zig version
- name: Run tests - name: Run tests
run: zig build test -Dbroken-windows --verbose run: zig build test --verbose
- name: Build example - name: Build example
run: ( cd example && zig build ) # Make sure example builds run: ( cd example && zig build ) # Make sure example builds

1
.gitignore vendored
View File

@ -11,4 +11,3 @@ libs/
src/git_version.zig src/git_version.zig
zig-out zig-out
core core
.zig-cache

View File

@ -1,17 +1,17 @@
AWS SDK for Zig 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/): [Last Mach Nominated Zig Version](https://machengine.org/about/nominated-zig/):
[![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) [![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)
[Nightly Zig](https://ziglang.org/download/): [Nightly Zig](https://ziglang.org/download/):
[![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) [![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**
Current executable size for the demo is 980k after compiling with -Doptimize=ReleaseSmall 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: in x86_linux, and will vary based on services used. Tested targets:
@ -69,6 +69,13 @@ variable that will supersede all other configuration.
Limitations 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. WebIdentityToken is not yet implemented.
TODO List: TODO List:
@ -85,12 +92,24 @@ TODO List:
* Implement timeouts and other TODO's in the code * Implement timeouts and other TODO's in the code
* Add option to cache signature keys * Add option to cache signature keys
Services without TLS 1.3 support Services without TLS 1.3 support (4 services out of 255 total)
-------------------------------- ---------------------------------------------------------------
All AWS services should support TLS 1.3 at this point, but there are many regions The following service list is based on limited testing against us-west-2
and several partitions, and not all of them have been tested, so your mileage region. Your mileage may vary, as there are thousands of endpoints against
may vary. 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
```
Dependency tree Dependency tree
--------------- ---------------

View File

@ -53,11 +53,6 @@ pub fn build(b: *Builder) !void {
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const optimize = b.standardOptimizeOption(.{}); 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 // 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, // 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 // grab that commit, and use b.addOptions/exe.addOptions to generate the
@ -72,7 +67,7 @@ pub fn build(b: *Builder) !void {
// It relies on code gen and is all fouled up when getting imported // It relies on code gen and is all fouled up when getting imported
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "demo", .name = "demo",
.root_source_file = b.path("src/main.zig"), .root_source_file = .{ .path = "src/main.zig" },
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -86,13 +81,13 @@ pub fn build(b: *Builder) !void {
// Expose module to others // Expose module to others
_ = b.addModule("aws", .{ _ = b.addModule("aws", .{
.root_source_file = b.path("src/aws.zig"), .root_source_file = .{ .path = "src/aws.zig" },
.imports = &.{.{ .name = "smithy", .module = smithy_module }}, .imports = &.{.{ .name = "smithy", .module = smithy_module }},
}); });
// Expose module to others // Expose module to others
_ = b.addModule("aws-signing", .{ _ = b.addModule("aws-signing", .{
.root_source_file = b.path("src/aws_signing.zig"), .root_source_file = .{ .path = "src/aws_signing.zig" },
.imports = &.{.{ .name = "smithy", .module = smithy_module }}, .imports = &.{.{ .name = "smithy", .module = smithy_module }},
}); });
// TODO: This does not work correctly due to https://github.com/ziglang/zig/issues/16354 // TODO: This does not work correctly due to https://github.com/ziglang/zig/issues/16354
@ -122,7 +117,7 @@ pub fn build(b: *Builder) !void {
const cg_exe = b.addExecutable(.{ const cg_exe = b.addExecutable(.{
.name = "codegen", .name = "codegen",
.root_source_file = b.path("codegen/src/main.zig"), .root_source_file = .{ .path = "codegen/src/main.zig" },
// We need this generated for the host, not the real target // We need this generated for the host, not the real target
.target = b.host, .target = b.host,
.optimize = if (b.verbose) .Debug else .ReleaseSafe, .optimize = if (b.verbose) .Debug else .ReleaseSafe,
@ -149,7 +144,7 @@ pub fn build(b: *Builder) !void {
}, },
)); ));
cg_cmd.addArg("--output"); cg_cmd.addArg("--output");
cg_cmd.addDirectoryArg(b.path("src/models")); cg_cmd.addDirectoryArg(std.Build.LazyPath.relative("src/models"));
if (b.verbose) if (b.verbose)
cg_cmd.addArg("--verbose"); cg_cmd.addArg("--verbose");
// cg_cmd.step.dependOn(&fetch_step.step); // cg_cmd.step.dependOn(&fetch_step.step);
@ -193,11 +188,10 @@ pub fn build(b: *Builder) !void {
// test_step.dependOn(&run_unit_tests.step); // test_step.dependOn(&run_unit_tests.step);
for (test_targets) |t| { 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 // Creates a step for unit testing. This only builds the test executable
// but does not run it. // but does not run it.
const unit_tests = b.addTest(.{ const unit_tests = b.addTest(.{
.root_source_file = b.path("src/aws.zig"), .root_source_file = .{ .path = "src/aws.zig" },
.target = b.resolveTargetQuery(t), .target = b.resolveTargetQuery(t),
.optimize = optimize, .optimize = optimize,
}); });

View File

@ -1,18 +1,12 @@
.{ .{
.name = "aws", .name = "aws-zig",
.version = "0.0.1", .version = "0.0.1",
.paths = .{ .paths = .{""},
"build.zig",
"build.zig.zon",
"src",
"README.md",
"LICENSE.md",
},
.dependencies = .{ .dependencies = .{
.smithy = .{ .smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/6083ceefe262bb016033a7dfbd995968c86b48b2.tar.gz", .url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
.hash = "122036fbf9a1aae606de5e1a622d7dbbc37338d0fad7a4a018920c1365a1c49ba497", .hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
}, },
.models = .{ .models = .{
.url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz", .url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz",

View File

@ -77,13 +77,13 @@ pub fn hex64(x: u64) [16]u8 {
return result; return result;
} }
pub const walkerFn = *const fn (std.fs.Dir.Walker.Entry) bool; pub const walkerFn = *const fn (std.fs.Dir.Walker.WalkerEntry) bool;
fn included(entry: std.fs.Dir.Walker.Entry) bool { fn included(entry: std.fs.Dir.Walker.WalkerEntry) bool {
_ = entry; _ = entry;
return true; return true;
} }
fn excluded(entry: std.fs.Dir.Walker.Entry) bool { fn excluded(entry: std.fs.Dir.Walker.WalkerEntry) bool {
_ = entry; _ = entry;
return false; return false;
} }
@ -206,6 +206,6 @@ fn isExecutable(file: std.fs.File) !bool {
return false; return false;
} else { } else {
const stat = try file.stat(); const stat = try file.stat();
return (stat.mode & std.posix.S.IXUSR) != 0; return (stat.mode & std.os.S.IXUSR) != 0;
} }
} }

View File

@ -34,7 +34,7 @@ pub fn main() anyerror!void {
models_dir = try std.fs.cwd().openDir(args[i + 1], .{ .iterate = true }); models_dir = try std.fs.cwd().openDir(args[i + 1], .{ .iterate = true });
} }
// TODO: Seems like we should remove this in favor of a package // TODO: Seems like we should remove this in favor of a package
try output_dir.writeFile(.{ .sub_path = "json.zig", .data = json_zig }); try output_dir.writeFile("json.zig", json_zig);
// TODO: We need a different way to handle this file... // TODO: We need a different way to handle this file...
const manifest_file_started = false; 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 // re-calculate so we can store the manifest
model_digest = calculated_manifest.model_dir_hash_digest; model_digest = calculated_manifest.model_dir_hash_digest;
calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool); calculated_manifest = try calculateDigests(models_dir, output_dir, &thread_pool);
try output_dir.writeFile(.{ .sub_path = "output_manifest.json", .data = try std.json.stringifyAlloc( try output_dir.writeFile("output_manifest.json", try std.json.stringifyAlloc(
allocator, allocator,
calculated_manifest, calculated_manifest,
.{ .whitespace = .indent_2 }, .{ .whitespace = .indent_2 },
) }); ));
} }
var model_digest: ?[Hasher.hex_multihash_len]u8 = null; 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 { 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{ 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 { .isIncluded = struct {
pub fn include(entry: std.fs.Dir.Walker.Entry) bool { pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool {
return std.mem.endsWith(u8, entry.basename, ".json"); return std.mem.endsWith(u8, entry.basename, ".json");
} }
}.include, }.include,
.isExcluded = struct { .isExcluded = struct {
pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool { pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool {
_ = entry; _ = entry;
return false; 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{ const output_hash = try Hasher.computeDirectoryHash(thread_pool, try output_dir.openDir(".", .{ .iterate = true }), @constCast(&Hasher.ComputeDirectoryOptions{
.isIncluded = struct { .isIncluded = struct {
pub fn include(entry: std.fs.Dir.Walker.Entry) bool { pub fn include(entry: std.fs.Dir.Walker.WalkerEntry) bool {
return std.mem.endsWith(u8, entry.basename, ".zig"); return std.mem.endsWith(u8, entry.basename, ".zig");
} }
}.include, }.include,
.isExcluded = struct { .isExcluded = struct {
pub fn exclude(entry: std.fs.Dir.Walker.Entry) bool { pub fn exclude(entry: std.fs.Dir.Walker.WalkerEntry) bool {
_ = entry; _ = entry;
return false; return false;
} }

View File

@ -9,8 +9,8 @@
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad", .hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
}, },
.@"aws-zig" = .{ .@"aws-zig" = .{
.url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/a0773971f2f52182c8a5235582500d36afda2e81/a0773971f2f52182c8a5235582500d36afda2e81-with-models.tar.gz", .url = "https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/b1b2a6cc7a6104f5e1f6ee4cae33e6ef3ed2ec1c/b1b2a6cc7a6104f5e1f6ee4cae33e6ef3ed2ec1c-with-models.tar.gz",
.hash = "1220198f7b734c1cc6a683ad13246439a59be934156a2df3a734bcaf15433b33eead", .hash = "12203d7c7aea80fd5e1f892b4928b89b2c70d5688cf1843e0d03e5af79632c5a9146",
}, },
}, },
} }

View File

@ -827,7 +827,7 @@ fn ServerResponse(comptime action: anytype) type {
}; };
const Result = @Type(.{ const Result = @Type(.{
.Struct = .{ .Struct = .{
.layout = .auto, .layout = .Auto,
.fields = &[_]std.builtin.Type.StructField{ .fields = &[_]std.builtin.Type.StructField{
.{ .{
.name = action.action_name ++ "Result", .name = action.action_name ++ "Result",
@ -850,7 +850,7 @@ fn ServerResponse(comptime action: anytype) type {
}); });
return @Type(.{ return @Type(.{
.Struct = .{ .Struct = .{
.layout = .auto, .layout = .Auto,
.fields = &[_]std.builtin.Type.StructField{ .fields = &[_]std.builtin.Type.StructField{
.{ .{
.name = action.action_name ++ "Response", .name = action.action_name ++ "Response",

View File

@ -574,7 +574,7 @@ fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 {
}; };
}, },
.macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { .macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
const home_dir = std.posix.getenv("HOME") orelse { const home_dir = std.os.getenv("HOME") orelse {
// TODO look in /etc/passwd // TODO look in /etc/passwd
return error.HomeDirUnavailable; return error.HomeDirUnavailable;
}; };

View File

@ -306,7 +306,7 @@ pub fn verifyServerRequest(allocator: std.mem.Allocator, request: *std.http.Serv
} }
pub const UnverifiedRequest = struct { pub const UnverifiedRequest = struct {
headers: []const std.http.Header, headers: []std.http.Header,
target: []const u8, target: []const u8,
method: std.http.Method, method: std.http.Method,
allocator: std.mem.Allocator, allocator: std.mem.Allocator,

View File

@ -1361,7 +1361,7 @@ test "Value.jsonStringify" {
var buffer: [10]u8 = undefined; var buffer: [10]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buffer); var fbs = std.io.fixedBufferStream(&buffer);
try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.writer()); try (Value{ .Float = 42 }).jsonStringify(.{}, fbs.writer());
try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e1"); try testing.expectEqualSlices(u8, fbs.getWritten(), "4.2e+01");
} }
{ {
var buffer: [10]u8 = undefined; var buffer: [10]u8 = undefined;
@ -2808,7 +2808,7 @@ pub fn stringify(
const T = @TypeOf(value); const T = @TypeOf(value);
switch (@typeInfo(T)) { switch (@typeInfo(T)) {
.Float, .ComptimeFloat => { .Float, .ComptimeFloat => {
return std.fmt.format(out_stream, "{e}", .{value}); return std.fmt.formatFloatScientific(value, std.fmt.FormatOptions{}, out_stream);
}, },
.Int, .ComptimeInt => { .Int, .ComptimeInt => {
return std.fmt.formatIntValue(value, "", std.fmt.FormatOptions{}, out_stream); 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(?u8, null), StringifyOptions{});
try teststringify("null", @as(?*u32, null), StringifyOptions{}); try teststringify("null", @as(?*u32, null), StringifyOptions{});
try teststringify("42", 42, StringifyOptions{}); try teststringify("42", 42, StringifyOptions{});
try teststringify("4.2e1", 42.0, StringifyOptions{}); try teststringify("4.2e+01", 42.0, StringifyOptions{});
try teststringify("42", @as(u8, 42), StringifyOptions{}); try teststringify("42", @as(u8, 42), StringifyOptions{});
try teststringify("42", @as(u128, 42), StringifyOptions{}); try teststringify("42", @as(u128, 42), StringifyOptions{});
try teststringify("4.2e1", @as(f32, 42), StringifyOptions{}); try teststringify("4.2e+01", @as(f32, 42), StringifyOptions{});
try teststringify("4.2e1", @as(f64, 42), StringifyOptions{}); try teststringify("4.2e+01", @as(f64, 42), StringifyOptions{});
try teststringify("\"ItBroke\"", @as(anyerror, error.ItBroke), StringifyOptions{}); try teststringify("\"ItBroke\"", @as(anyerror, error.ItBroke), StringifyOptions{});
} }

View File

@ -32,8 +32,8 @@ pub fn log(
const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix; const prefix = "[" ++ @tagName(level) ++ "] " ++ scope_prefix;
// Print the message to stderr, silently ignoring any errors // Print the message to stderr, silently ignoring any errors
std.debug.lockStdErr(); std.debug.getStderrMutex().lock();
defer std.debug.unlockStdErr(); defer std.debug.getStderrMutex().unlock();
const stderr = std.io.getStdErr().writer(); const stderr = std.io.getStdErr().writer();
nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return; nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return;
} }

View File

@ -21,7 +21,7 @@ pub fn Services(comptime service_imports: anytype) type {
// finally, generate the type // finally, generate the type
return @Type(.{ return @Type(.{
.Struct = .{ .Struct = .{
.layout = .auto, .layout = .Auto, // will be .auto in the future
.fields = &fields, .fields = &fields,
.decls = &[_]std.builtin.Type.Declaration{}, .decls = &[_]std.builtin.Type.Declaration{},
.is_tuple = false, .is_tuple = false,