diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/container.cue b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/container.cue index 9e2a0b80..e8440c0b 100644 --- a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/container.cue +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/container.cue @@ -19,8 +19,7 @@ import ( docker.#Run & { input: *_image.output | docker.#Image - workdir: "/src" - command: name: "rust" + workdir: _sourcePath mounts: "source": { dest: _sourcePath contents: source diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/publish.cue b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/publish.cue index 5bebcf65..c02da498 100644 --- a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/publish.cue +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/publish.cue @@ -9,26 +9,25 @@ import ( // Source code source: dagger.#FS - // Target package to publish - package: *"." | string - env: [string]: string container: #Container & { "source": source "env": { env + CARGO_TARGET_DIR: "/output/" } command: { - args: [package] + name: "cargo" flags: { - publish: true - "-o": "/output/" + "build": true + "--release": true + "--manifest-path": "/src/Cargo.toml" } } export: directories: "/output": _ } // Directory containing the output of the publish - output: container.export.directories."/output" + output: container.export.directories."/output/target/release" } diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test.cue b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test.cue index 4e584ae0..6e9a36eb 100644 --- a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test.cue +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test.cue @@ -3,12 +3,8 @@ package rust // Test a rust package #Test: { - // Package to test - package: *"." | string - #Container & { command: { - args: [package] flags: test: true } } diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/Dockerfile b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/Dockerfile new file mode 100644 index 00000000..66dab6dc --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/Dockerfile @@ -0,0 +1,5 @@ +FROM rust:1.60-alpine + +ENV CARGO_TARGET_DIR "/output/" + +CMD cargo build --manifest-path "/src/Cargo.toml" --release diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.lock b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.lock new file mode 100644 index 00000000..3496d5ab --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "hello_world" +version = "0.1.0" diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello_world/Cargo.toml b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.toml similarity index 100% rename from pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello_world/Cargo.toml rename to pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.toml diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello_world/src/main.rs b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/src/main.rs similarity index 100% rename from pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello_world/src/main.rs rename to pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/src/main.rs diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/.rustc_info.json b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/.rustc_info.json new file mode 100644 index 00000000..bc8bbaa6 --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":6791022512809778958,"outputs":{"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.a\nlib___.so\n/usr/local/rustup/toolchains/1.60.0-aarch64-unknown-linux-musl\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"musl\"\ntarget_family=\"unix\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":"warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\n\nwarning: dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\n\nwarning: 2 warnings emitted\n\n"},"5309432699494263626":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.a\nlib___.so\n","stderr":"{\"message\":\"dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\\n\\n\"}\n{\"message\":\"dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\\n\\n\"}\n{\"message\":\"2 warnings emitted\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: 2 warnings emitted\\n\\n\"}\n"},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.60.0 (7737e0b5c 2022-04-04)\nbinary: rustc\ncommit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\ncommit-date: 2022-04-04\nhost: aarch64-unknown-linux-musl\nrelease: 1.60.0\nLLVM version: 14.0.0\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.cargo-lock b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.cargo-lock new file mode 100644 index 00000000..e69de29b diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world new file mode 100644 index 00000000..2bd45923 --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world @@ -0,0 +1 @@ +b2e13b44d430fdf9 \ No newline at end of file diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world.json b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world.json new file mode 100644 index 00000000..beae7117 --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/bin-hello_world.json @@ -0,0 +1 @@ +{"rustc":9685964557043657374,"features":"[]","target":6051735750501971553,"profile":6269190295429226618,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/hello_world-12d244dedbde71e2/dep-bin-hello_world"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/dep-bin-hello_world b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/dep-bin-hello_world new file mode 100644 index 00000000..5fdf103f Binary files /dev/null and b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/dep-bin-hello_world differ diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/invoked.timestamp b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/invoked.timestamp new file mode 100644 index 00000000..e00328da --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/.fingerprint/hello_world-12d244dedbde71e2/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2 b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2 new file mode 100755 index 00000000..e17e3c4e Binary files /dev/null and b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2 differ diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2.d b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2.d new file mode 100644 index 00000000..f68efbe3 --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/deps/hello_world-12d244dedbde71e2.d @@ -0,0 +1,5 @@ +/output/release/deps/hello_world-12d244dedbde71e2: src/main.rs + +/output/release/deps/hello_world-12d244dedbde71e2.d: src/main.rs + +src/main.rs: diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world new file mode 100755 index 00000000..e17e3c4e Binary files /dev/null and b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world differ diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world.d b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world.d new file mode 100644 index 00000000..2d4379c5 --- /dev/null +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world.d @@ -0,0 +1 @@ +/output/release/hello_world: /src/src/main.rs diff --git a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/publish.cue b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/publish.cue index a2f53f7e..e795c0c3 100644 --- a/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/publish.cue +++ b/pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/publish.cue @@ -2,57 +2,51 @@ package rust import ( "dagger.io/dagger" - "dagger.io/dagger/core" +// "dagger.io/dagger/core" "universe.dagger.io/x/contact@kjuulh.io/rust" - "universe.dagger.io/docker" +// "universe.dagger.io/docker" "universe.dagger.io/alpine" ) dagger.#Plan & { - client: filesystem: "./data/hello_world": read: contents: dagger.#FS + client: { + filesystem: { + ".": { + read: { + contents: dagger.#FS + } + } + } + } - actions: test: { - _baseImage: { - build: alpine.#Build & { - packages: { - "ca-certificates": {} - "krb5-libs": {} - libgcc: {} - libintl: {} - "libssl1.1": {} - "libstdc++": {} - zlib: {} - } - } - output: build.output - } + actions: { + test: { + _baseImage: alpine.#Build - simple: { publish: rust.#Publish & { - source: client.filesystem."./data".read.contents - package: "hello" + source: client.filesystem.".".read.contents } - exec: docker.#Run & { - input: _baseImage.output - command: { - name: "/bin/sh" - args: ["-c", "/app/hello_world >> /output.txt"] - } - env: NAME: "dagger" - mounts: binary: { - dest: "/app" - contents: publish.output - source: "/" - } - } +// exec: docker.#Run & { +// input: _baseImage.output +// command: { +// name: "/bin/sh" +// args: ["-c", "/app/hello_world >> /output.txt"] +// } +// env: NAME: "dagger" +// mounts: binary: { +// dest: "/app" +// contents: publish.output +// source: "/" +// } +// } - verify: core.#ReadFile & { - input: exec.output.rootfs - path: "/output.txt" - } & { - contents: "Hi dagger!" - } - } +// verify: core.#ReadFile & { +// input: exec.output.rootfs +// path: "/output.txt" +// } & { +// contents: "Hi dagger!" +// } + } } }