Public dry run dryrun-1714a9eedd5b
Source commit: 1714a9eedd5b1e30c6c9aceb7a999f2f695ba83c Public tree identity: sha256:e5daffad23fa7c7f1822adccd3c3b4ee0bc7f1a45e0d321eb9a6fb8282b269db
This commit is contained in:
commit
20c72e6066
102 changed files with 32054 additions and 0 deletions
17
examples/launch-build-demo/Cargo.toml
Normal file
17
examples/launch-build-demo/Cargo.toml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[package]
|
||||
name = "launch-build-demo"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/build.rs"
|
||||
crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[dependencies]
|
||||
disasmer = { package = "disasmer-sdk", path = "../../crates/disasmer-sdk" }
|
||||
serde.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
futures-executor.workspace = true
|
||||
11
examples/launch-build-demo/README.md
Normal file
11
examples/launch-build-demo/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Launch Build Demo
|
||||
|
||||
This demo is the MVP build workflow expressed as Rust source code. It uses `env!("linux")`, recognizes `env!("windows")` when a Windows development node is attached, spawns debugger-visible virtual tasks, and returns artifact/source handles instead of moving large bytes through task arguments.
|
||||
|
||||
The Linux environment is defined by `envs/linux/Containerfile`. The Windows environment is a user-attached development contract and does not claim secure managed Windows sandboxing.
|
||||
|
||||
Inspect the bundle metadata:
|
||||
|
||||
```bash
|
||||
disasmer bundle inspect --project examples/launch-build-demo
|
||||
```
|
||||
3
examples/launch-build-demo/envs/linux/Containerfile
Normal file
3
examples/launch-build-demo/envs/linux/Containerfile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
FROM docker.io/library/alpine:3.20
|
||||
RUN apk add --no-cache build-base tar zstd
|
||||
WORKDIR /workspace
|
||||
2
examples/launch-build-demo/envs/windows/Dockerfile
Normal file
2
examples/launch-build-demo/envs/windows/Dockerfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# User-attached Windows development execution contract for the MVP.
|
||||
# This is not a managed untrusted Windows sandbox.
|
||||
97
examples/launch-build-demo/src/build.rs
Normal file
97
examples/launch-build-demo/src/build.rs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
use disasmer::{Artifact, EnvRef, SourceSnapshot};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BuildReport {
|
||||
pub linux_thread: u64,
|
||||
pub package_thread: u64,
|
||||
pub linux_artifact: Artifact,
|
||||
pub package_artifact: Artifact,
|
||||
pub source: SourceSnapshot,
|
||||
}
|
||||
|
||||
pub fn linux_env() -> EnvRef {
|
||||
disasmer::env!("linux")
|
||||
}
|
||||
|
||||
pub fn windows_env() -> EnvRef {
|
||||
disasmer::env!("windows")
|
||||
}
|
||||
|
||||
#[disasmer::task]
|
||||
pub fn compile_linux() -> Artifact {
|
||||
Artifact {
|
||||
id: "artifact://linux/app.tar.zst".to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
#[disasmer::task]
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn task_add_one(input: i32) -> i32 {
|
||||
input + 1
|
||||
}
|
||||
|
||||
#[disasmer::task]
|
||||
pub fn package_release() -> Artifact {
|
||||
Artifact {
|
||||
id: "artifact://package/release.tar.zst".to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
#[disasmer::main]
|
||||
pub fn build_main() -> &'static str {
|
||||
"launch-build-demo"
|
||||
}
|
||||
|
||||
pub async fn run_build_workflow() -> BuildReport {
|
||||
let linux = disasmer::spawn::task(compile_linux)
|
||||
.name("compile linux")
|
||||
.env(linux_env())
|
||||
.start()
|
||||
.await;
|
||||
let package = disasmer::spawn::task(package_release)
|
||||
.name("package artifacts")
|
||||
.env(linux_env())
|
||||
.start()
|
||||
.await;
|
||||
|
||||
let linux_thread = linux.virtual_thread_id();
|
||||
let package_thread = package.virtual_thread_id();
|
||||
let linux_artifact = linux.join().await;
|
||||
let package_artifact = package.join().await;
|
||||
|
||||
BuildReport {
|
||||
linux_thread,
|
||||
package_thread,
|
||||
linux_artifact,
|
||||
package_artifact,
|
||||
source: SourceSnapshot {
|
||||
digest: "source://local-checkout".to_owned(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use futures_executor::block_on;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn flagship_workflow_is_rust_source_with_spawned_virtual_tasks() {
|
||||
assert_eq!(build_main(), "launch-build-demo");
|
||||
assert_eq!(task_add_one(41), 42);
|
||||
assert_eq!(linux_env().name, "linux");
|
||||
assert_eq!(windows_env().name, "windows");
|
||||
|
||||
let report = block_on(run_build_workflow());
|
||||
|
||||
assert_ne!(report.linux_thread, report.package_thread);
|
||||
assert_eq!(report.linux_artifact.id, "artifact://linux/app.tar.zst");
|
||||
assert_eq!(
|
||||
report.package_artifact.id,
|
||||
"artifact://package/release.tar.zst"
|
||||
);
|
||||
assert_eq!(report.source.digest, "source://local-checkout");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue