Compare commits

...

9 Commits

12 changed files with 155 additions and 89 deletions

56
Cargo.lock generated
View File

@@ -114,7 +114,7 @@ version = "0.1.0"
dependencies = [
"clap",
"color-eyre",
"dagger-sdk 0.2.10",
"dagger-sdk",
"eyre",
"tokio",
]
@@ -246,10 +246,10 @@ dependencies = [
[[package]]
name = "dagger-codegen"
version = "0.2.6"
version = "0.2.7"
dependencies = [
"convert_case",
"dagger-core 0.2.4",
"dagger-core",
"eyre",
"genco",
"itertools",
@@ -260,32 +260,7 @@ dependencies = [
[[package]]
name = "dagger-core"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e18641c2b159006cab7d750c05d3272f0cabfe9532df20b47076353aa73bf1e"
dependencies = [
"clap",
"dirs",
"eyre",
"flate2",
"genco",
"graphql-introspection-query",
"graphql_client",
"hex",
"hex-literal",
"platform-info",
"reqwest",
"serde",
"serde_json",
"sha2",
"tar",
"tempfile",
"tokio",
]
[[package]]
name = "dagger-core"
version = "0.2.4"
version = "0.2.6"
dependencies = [
"clap",
"dirs",
@@ -313,7 +288,7 @@ dependencies = [
"clap",
"color-eyre",
"dagger-codegen",
"dagger-core 0.2.4",
"dagger-core",
"dirs",
"eyre",
"flate2",
@@ -334,27 +309,10 @@ dependencies = [
[[package]]
name = "dagger-sdk"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af3b3404f52ddf367998475bc48e5a08699950ee7ba54ba334b7ffe1681df0c5"
version = "0.2.12"
dependencies = [
"base64",
"dagger-core 0.2.3",
"derive_builder",
"eyre",
"futures",
"gql_client",
"serde",
"serde_json",
"tokio",
]
[[package]]
name = "dagger-sdk"
version = "0.2.11"
dependencies = [
"base64",
"dagger-core 0.2.4",
"dagger-core",
"derive_builder",
"eyre",
"futures",

View File

@@ -8,6 +8,6 @@ edition = "2021"
[dependencies]
clap = "4.1.6"
color-eyre = "0.6.2"
dagger-sdk = "0.2.10"
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.12" }
eyre = "0.6.8"
tokio = { version = "1.25.0", features = ["full"] }

View File

@@ -5,13 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.6 (2023-02-20)
## v0.2.7 (2023-02-20)
<csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/>
### Bug Fixes
### Chore
- <csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/> ran clippy
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
### Commit Statistics
@@ -28,6 +26,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.5, dagger-sdk v0.2.12, dagger-codegen v0.2.7 ([`1725c51`](https://github.com/kjuulh/dagger-rs/commit/1725c5188e8a81069ec4a4de569484c921a94927))
- race condition in process ([`a13a2a9`](https://github.com/kjuulh/dagger-rs/commit/a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de))
</details>
## v0.2.6 (2023-02-20)
<csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/>
### Chore
- <csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/> ran clippy
### Commit Statistics
<csr-read-only-do-not-edit/>
- 3 commits contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`f869e57`](https://github.com/kjuulh/dagger-rs/commit/f869e574dd788cd60e5b1b5d502bec68e300694c))
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`17ec62a`](https://github.com/kjuulh/dagger-rs/commit/17ec62a5d58232ff57391523b9851fb7b07d02ab))
- ran clippy ([`803cfc4`](https://github.com/kjuulh/dagger-rs/commit/803cfc4f8c4d72ab7d011be5523b3bfc6039de39))
</details>

View File

@@ -1,6 +1,6 @@
[package]
name = "dagger-codegen"
version = "0.2.6"
version = "0.2.7"
edition = "2021"
readme = "README.md"
license-file = "LICENSE.MIT"
@@ -11,7 +11,7 @@ publish = true
[dependencies]
convert_case = "0.6.0"
dagger-core = { path = "../dagger-core", version = "^0.2.4" }
dagger-core = { path = "../dagger-core", version = "^0.2.6" }
eyre = "0.6.8"
genco = "0.17.3"

View File

@@ -3,7 +3,7 @@ use genco::prelude::rust;
use genco::quote;
use itertools::Itertools;
use crate::functions::{CommonFunctions};
use crate::functions::CommonFunctions;
use crate::rust::functions::{
field_options_struct_name, format_function, format_name, format_optional_args,
format_struct_comment, format_struct_name,
@@ -12,7 +12,7 @@ use crate::utility::OptionExt;
pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
let selection = rust::import("crate::querybuilder", "Selection");
let child = rust::import("std::process", "Child");
let child = rust::import("tokio::process", "Child");
let conn = rust::import("dagger_core::connect_params", "ConnectParams");
let arc = rust::import("std::sync", "Arc");

View File

@@ -5,6 +5,60 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.6 (2023-02-20)
### Chore
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
### Bug Fixes
- <csr-id-8dfecf976c5537cc2c03881de2b2fd2b2508683a/> cli session keep session alive
### Commit Statistics
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- ran clippy ([`1f77d90`](https://github.com/kjuulh/dagger-rs/commit/1f77d90c0f0ac832a181b2322350ea395612986c))
- cli session keep session alive ([`8dfecf9`](https://github.com/kjuulh/dagger-rs/commit/8dfecf976c5537cc2c03881de2b2fd2b2508683a))
</details>
## v0.2.5 (2023-02-20)
### Bug Fixes
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
### Commit Statistics
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.5, dagger-sdk v0.2.12, dagger-codegen v0.2.7 ([`1725c51`](https://github.com/kjuulh/dagger-rs/commit/1725c5188e8a81069ec4a4de569484c921a94927))
- race condition in process ([`a13a2a9`](https://github.com/kjuulh/dagger-rs/commit/a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de))
</details>
## v0.2.4 (2023-02-20)
### Bug Fixes
@@ -16,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<csr-read-only-do-not-edit/>
- 3 commits contributed to the release.
- 4 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
@@ -27,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`f869e57`](https://github.com/kjuulh/dagger-rs/commit/f869e574dd788cd60e5b1b5d502bec68e300694c))
- remove blocking ([`921e61b`](https://github.com/kjuulh/dagger-rs/commit/921e61b5e248013cb5fbf4f1bad3eef5a2673145))
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`17ec62a`](https://github.com/kjuulh/dagger-rs/commit/17ec62a5d58232ff57391523b9851fb7b07d02ab))
- remove blocking ([`8385aa8`](https://github.com/kjuulh/dagger-rs/commit/8385aa8a15ff7b45fecc3462c482b998118c14eb))

View File

@@ -1,6 +1,6 @@
[package]
name = "dagger-core"
version = "0.2.4"
version = "0.2.6"
edition = "2021"
readme = "README.md"
license-file = "LICENSE.MIT"

View File

@@ -1,11 +1,12 @@
use std::{
fs::canonicalize,
io::{BufRead, BufReader},
path::PathBuf,
process::{Child, Stdio},
process::Stdio,
sync::Arc,
};
use tokio::io::AsyncBufReadExt;
use crate::{config::Config, connect_params::ConnectParams};
#[derive(Clone, Debug)]
@@ -24,7 +25,7 @@ impl CliSession {
&self,
config: &Config,
cli_path: &PathBuf,
) -> eyre::Result<(ConnectParams, Child)> {
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
self.inner.connect(config, cli_path).await
}
}
@@ -37,13 +38,13 @@ impl InnerCliSession {
&self,
config: &Config,
cli_path: &PathBuf,
) -> eyre::Result<(ConnectParams, Child)> {
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
let proc = self.start(config, cli_path)?;
let params = self.get_conn(proc).await?;
Ok(params)
}
fn start(&self, config: &Config, cli_path: &PathBuf) -> eyre::Result<std::process::Child> {
fn start(&self, config: &Config, cli_path: &PathBuf) -> eyre::Result<tokio::process::Child> {
let mut args: Vec<String> = vec!["session".into()];
if let Some(workspace) = &config.workdir_path {
let abs_path = canonicalize(workspace)?;
@@ -54,7 +55,7 @@ impl InnerCliSession {
args.extend(["--project".into(), abs_path.to_string_lossy().to_string()])
}
let proc = std::process::Command::new(
let proc = tokio::process::Command::new(
cli_path
.to_str()
.ok_or(eyre::anyhow!("could not get string from path"))?,
@@ -72,8 +73,8 @@ impl InnerCliSession {
async fn get_conn(
&self,
mut proc: std::process::Child,
) -> eyre::Result<(ConnectParams, std::process::Child)> {
mut proc: tokio::process::Child,
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
let stdout = proc
.stdout
.take()
@@ -87,25 +88,20 @@ impl InnerCliSession {
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
tokio::spawn(async move {
let stdout_bufr = BufReader::new(stdout);
for line in stdout_bufr.lines() {
let out = line.as_ref().unwrap();
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&out) {
let mut stdout_bufr = tokio::io::BufReader::new(stdout).lines();
while let Ok(Some(line)) = stdout_bufr.next_line().await {
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&line) {
sender.send(conn).await.unwrap();
}
if let Ok(line) = line {
println!("dagger: {}", line);
}
println!("dagger: {}", line);
}
});
tokio::spawn(async move {
let stderr_bufr = BufReader::new(stderr);
for line in stderr_bufr.lines() {
if let Ok(line) = line {
println!("dagger: {}", line);
}
//panic!("could not start dagger session: {}", out)
let mut stdout_bufr = tokio::io::BufReader::new(stderr).lines();
while let Ok(Some(line)) = stdout_bufr.next_line().await {
println!("dagger: {}", line);
}
});

View File

@@ -1,4 +1,4 @@
use std::process::Child;
use crate::{
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
@@ -11,7 +11,7 @@ impl Engine {
Self {}
}
async fn from_cli(&self, cfg: &Config) -> eyre::Result<(ConnectParams, Child)> {
async fn from_cli(&self, cfg: &Config) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
let cli = Downloader::new("0.3.12".into())?.get_cli().await?;
let cli_session = CliSession::new();
@@ -19,7 +19,7 @@ impl Engine {
Ok(cli_session.connect(cfg, &cli).await?)
}
pub async fn start(&self, cfg: &Config) -> eyre::Result<(ConnectParams, Child)> {
pub async fn start(&self, cfg: &Config) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
// TODO: Add from existing session as well
self.from_cli(cfg).await
}

View File

@@ -6,6 +6,36 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.12 (2023-02-20)
### Chore
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
### Bug Fixes
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
### Commit Statistics
<csr-read-only-do-not-edit/>
- 3 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- ran clippy ([`1f77d90`](https://github.com/kjuulh/dagger-rs/commit/1f77d90c0f0ac832a181b2322350ea395612986c))
- Release dagger-core v0.2.5, dagger-sdk v0.2.12, dagger-codegen v0.2.7 ([`1725c51`](https://github.com/kjuulh/dagger-rs/commit/1725c5188e8a81069ec4a4de569484c921a94927))
- race condition in process ([`a13a2a9`](https://github.com/kjuulh/dagger-rs/commit/a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de))
</details>
## v0.2.11 (2023-02-20)
<csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/>
@@ -18,7 +48,7 @@ and this project adheres to
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 3 commits contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
@@ -29,6 +59,7 @@ and this project adheres to
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`f869e57`](https://github.com/kjuulh/dagger-rs/commit/f869e574dd788cd60e5b1b5d502bec68e300694c))
- Release dagger-core v0.2.4, dagger-codegen v0.2.6, dagger-sdk v0.2.11 ([`17ec62a`](https://github.com/kjuulh/dagger-rs/commit/17ec62a5d58232ff57391523b9851fb7b07d02ab))
- ran clippy ([`803cfc4`](https://github.com/kjuulh/dagger-rs/commit/803cfc4f8c4d72ab7d011be5523b3bfc6039de39))
</details>

View File

@@ -1,6 +1,6 @@
[package]
name = "dagger-sdk"
version = "0.2.11"
version = "0.2.12"
edition = "2021"
readme = "README.md"
license-file = "LICENSE.MIT"
@@ -11,7 +11,7 @@ publish = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dagger-core = { path = "../dagger-core", version = "^0.2.4" }
dagger-core = { path = "../dagger-core", version = "^0.2.6" }
base64 = "0.21.0"
eyre = "0.6.8"

View File

@@ -3,8 +3,8 @@ use crate::querybuilder::Selection;
use dagger_core::connect_params::ConnectParams;
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
use std::process::Child;
use std::sync::Arc;
use tokio::process::Child;
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct CacheId(String);