Compare commits
170 Commits
99bab8e1b0
...
dagger-sdk
| Author | SHA1 | Date | |
|---|---|---|---|
|
37b8b1212b
|
|||
|
2c04387c3d
|
|||
|
1b31331765
|
|||
|
a8e6dde615
|
|||
| 1bfd084cd2 | |||
| 5593fce2e1 | |||
| 2cc0231c5f | |||
| 9ba01396cb | |||
| c025d17424 | |||
| e9e35edb1c | |||
| d7317e5cf3 | |||
| f67928155f | |||
|
|
44fa0240f8 | ||
|
62de24153a
|
|||
|
9513bb5653
|
|||
|
6b43d5bc36
|
|||
|
f390eac29f
|
|||
|
e642778d90
|
|||
| 7133bfae95 | |||
| 41b20b6268 | |||
| 13b7805e7e | |||
| 4381af0295 | |||
| 5f9b3a19c0 | |||
| f9e7af931d | |||
| ecca036bc6 | |||
|
6a9a560cdc
|
|||
| e578b0e371 | |||
| 3e8ca8d86e | |||
|
88b055cb47
|
|||
|
e331ca0035
|
|||
|
456f48389b
|
|||
|
7c3654d276
|
|||
|
266ad32dff
|
|||
|
7179f8b598
|
|||
|
1f77d90c0f
|
|||
|
8dfecf976c
|
|||
|
085a998bc6
|
|||
|
1725c5188e
|
|||
|
a13a2a9ecb
|
|||
|
b86710d71e
|
|||
|
08a2e30967
|
|||
|
b552dc5d75
|
|||
|
f869e574dd
|
|||
|
921e61b5e2
|
|||
|
17ec62a5d5
|
|||
|
803cfc4f8c
|
|||
|
8385aa8a15
|
|||
|
60f2cb2f2e
|
|||
|
30b7511e45
|
|||
|
06e2638e1f
|
|||
|
48433cf368
|
|||
|
fc01755b99
|
|||
|
5cb97296b6
|
|||
|
b100285312
|
|||
|
8ed06476e5
|
|||
|
09aa658b6f
|
|||
|
b436f27a53
|
|||
|
577a293c67
|
|||
|
76bb1fcedd
|
|||
|
dc3487b840
|
|||
|
0c21d58c71
|
|||
|
e3fd23c64e
|
|||
|
82de43aa91
|
|||
| f40ba9b403 | |||
| 75bc17e57d | |||
|
45d6462037
|
|||
|
04990247ba
|
|||
| 978ede68ae | |||
|
a1887afc8b
|
|||
|
d3faa996e6
|
|||
| 93f40b356c | |||
| 9be6f435d9 | |||
|
c35c104b49
|
|||
|
c312bc57ad
|
|||
|
04e70ce964
|
|||
|
f72731807d
|
|||
| c627595fd2 | |||
| 3f13c40ab8 | |||
| f29ff836cf | |||
| 9762da895a | |||
| 02006d40fc | |||
| 94336d0637 | |||
|
6e2292cf11
|
|||
|
cc81124f89
|
|||
|
7d04ab1240
|
|||
|
92350306b3
|
|||
| 19ed6c267f | |||
| de063eae85 | |||
| 5d66736990 | |||
| 9ada74960a | |||
| 90ab2e2b7d | |||
| 818ef6f74d | |||
| 691ecfbf52 | |||
|
e921ba1363
|
|||
|
1638f15fba
|
|||
| 10bc6f3846 | |||
| 6e5f407432 | |||
|
3cb83bb79c
|
|||
|
|
199fe16dbf | ||
|
3cfd032a85
|
|||
|
83ae5b476a
|
|||
|
60dfad0aaa
|
|||
|
25fb9d4f24
|
|||
|
f42da8416a
|
|||
|
98781f2496
|
|||
|
aa0c397b15
|
|||
|
11a5247933
|
|||
|
20c71189f6
|
|||
|
d72313051b
|
|||
|
a2036838de
|
|||
|
4ebe0d12b5
|
|||
|
084ffafa3e
|
|||
|
5c9ab3756b
|
|||
|
4ac89b6457
|
|||
|
4b9f1e4320
|
|||
|
3a45202a21
|
|||
|
7c8d8a3e9c
|
|||
|
0470093912
|
|||
|
4d60d25a1f
|
|||
|
1332bc842c
|
|||
|
a064684fcf
|
|||
|
922ad3a794
|
|||
|
a7d97c2342
|
|||
|
f4a20fda79
|
|||
|
32665d8fa0
|
|||
| 03e022fcac | |||
| 4ce58a418c | |||
|
468bca4a69
|
|||
|
d60c8f0a79
|
|||
|
8fa33e9aeb
|
|||
| 789b0e69c8 | |||
|
44e125e00c
|
|||
|
83699de4ad
|
|||
|
459014b233
|
|||
|
d365a9f8e2
|
|||
|
f61afa73df
|
|||
|
e4f614fdbf
|
|||
|
fb6768a6fc
|
|||
|
49d3fc6b22
|
|||
|
7f3399f1d8
|
|||
|
0eaf0dd3be
|
|||
|
91e39f4e65
|
|||
|
a71f60784f
|
|||
|
5a5b0e40f7
|
|||
|
f03452840c
|
|||
|
7153c24f01
|
|||
|
989d5bc260
|
|||
|
c625ae49ba
|
|||
|
31eb44517d
|
|||
|
e5383b51f3
|
|||
|
1e26b383d4
|
|||
|
533b9dfef0
|
|||
|
bec62de62f
|
|||
|
571963163f
|
|||
|
36b0ecdabf
|
|||
|
578c2a6883
|
|||
|
6be8482b46
|
|||
|
0cbd1790b0
|
|||
|
728840ca8e
|
|||
|
59e2572173
|
|||
|
d894def70c
|
|||
|
cb9a4dd84f
|
|||
|
d1726a052a
|
|||
| 4a4c03f3c2 | |||
|
2eb027754b
|
|||
|
19b46b6cf0
|
|||
|
c4edd29f50
|
|||
|
04526c052b
|
|||
|
52a0db3e31
|
|||
|
3b5b59ba1c
|
32
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
name: ci
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
_EXPERIMENTAL_DAGGER_CACHE_CONFIG: type=gha;mode=max
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Update rust toolchain
|
||||||
|
run: rustup update stable && rustup default stable
|
||||||
|
- name: Set up cargo cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
continue-on-error: false
|
||||||
|
with:
|
||||||
|
path: "~/.cargo/bin/\n~/.cargo/registry/index/\n~/.cargo/registry/cache/\n~/.cargo/git/db/\ntarget/"
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-cargo
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2.0.0
|
||||||
|
- name: Run dagger [CI]
|
||||||
|
run: cargo run -p ci -- pr
|
||||||
15
.github/workflows/lint-pr.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: "Lint PR"
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
name: Validate PR title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
12
ARCHITECTURE.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Architecture
|
||||||
|
|
||||||
|
- `.` Root project mainly used for generating the CLI, which in turn is used to
|
||||||
|
bootstrap the code generation from `dagger`
|
||||||
|
- `crates/dagger-core` Contains all base types used during actual usage. This is
|
||||||
|
where the primary logic lives in which the user interacts (\*disclaimer: most
|
||||||
|
stuff haven't moved in here yet.)
|
||||||
|
- `crates/dagger-sdk` Contains the actual sdk in which the user interacts,
|
||||||
|
`dagger-core` is reexported through this API as well.
|
||||||
|
- `crates/dagger-codegen` This is the bulk of the work, it takes the input
|
||||||
|
graphql and spits out the API in which the user interacts, this is heavily
|
||||||
|
inspired by other `dagger-sdk's`. It primarily turns graphql into rust code.
|
||||||
266
CHANGELOG.md
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
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.10 (2023-02-20)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-75bc17e57db222492c6ffd2dfe80208d2bda75c9/> Fix async panic on blocking #19
|
||||||
|
Replaced internal threads with tokio spawn functions
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- Fix async panic on blocking #19 ([`75bc17e`](https://github.com/kjuulh/dagger-rs/commit/75bc17e57db222492c6ffd2dfe80208d2bda75c9))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.9 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-19ed6c267f779b72430422c463ceed553f6fc618/> re-export through lib.rs
|
||||||
|
this means that you can now use dagger_sdk::connect() instead of
|
||||||
|
dagger_sdk::client::connect();
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- re-export through lib.rs ([`19ed6c2`](https://github.com/kjuulh/dagger-rs/commit/19ed6c267f779b72430422c463ceed553f6fc618))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.8 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-f42da8416a5450c7c3c924353c3cc9112afd18f0/> with sccache
|
||||||
|
|
||||||
|
### 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**
|
||||||
|
- with sccache ([`f42da84`](https://github.com/kjuulh/dagger-rs/commit/f42da8416a5450c7c3c924353c3cc9112afd18f0))
|
||||||
|
- test change ([`98781f2`](https://github.com/kjuulh/dagger-rs/commit/98781f2496deaea4bc13c9e90e60543b7daac9d7))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.7 (2023-02-18)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-d72313051b9b46a6eeaa909a11850b3d8fc75e81/> with test changes
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- with test changes ([`d723130`](https://github.com/kjuulh/dagger-rs/commit/d72313051b9b46a6eeaa909a11850b3d8fc75e81))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.6 (2023-02-18)
|
||||||
|
|
||||||
|
With smart releaser
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-4ebe0d12b50028a8b79d8c76a2257c9c2b7b3429/> cleanup
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- cleanup ([`4ebe0d1`](https://github.com/kjuulh/dagger-rs/commit/4ebe0d12b50028a8b79d8c76a2257c9c2b7b3429))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.5 (2023-02-18)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-4ac89b645712dd8c357832a817af131c2d2e0686/> trying agian
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- trying agian ([`4ac89b6`](https://github.com/kjuulh/dagger-rs/commit/4ac89b645712dd8c357832a817af131c2d2e0686))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.4 (2023-02-18)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-4ac89b645712dd8c357832a817af131c2d2e0686/> trying agian
|
||||||
|
|
||||||
|
## v0.2.3 (2023-02-18)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-3a45202a21b24d8331a2ead72944df9ac7c70839/> some test
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- some test ([`3a45202`](https://github.com/kjuulh/dagger-rs/commit/3a45202a21b24d8331a2ead72944df9ac7c70839))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.2 (2023-02-18)
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit contributed to the release.
|
||||||
|
- 0 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**
|
||||||
|
- with test commit ([`0470093`](https://github.com/kjuulh/dagger-rs/commit/0470093912622640913ac34661be72a546dd1ba5))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.1 (2023-02-18)
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit contributed to the release.
|
||||||
|
- 0 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**
|
||||||
|
- add color eyre ([`32665d8`](https://github.com/kjuulh/dagger-rs/commit/32665d8fa0c97d39a1b43c5e8343f23e87497c16))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.0 (2023-02-17)
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 19 commits contributed to the release over the course of 21 calendar days.
|
||||||
|
- 0 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||||
|
- 1 unique issue was worked on: [#6](https://github.com/kjuulh/dagger-rs/issues/6)
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **[#6](https://github.com/kjuulh/dagger-rs/issues/6)**
|
||||||
|
- feature/add impl ([`4a4c03f`](https://github.com/kjuulh/dagger-rs/commit/4a4c03f3c2ee7f6268c65976715e70767b4ea78d))
|
||||||
|
* **Uncategorized**
|
||||||
|
- move code to dagger-core ([`ec0d0b2`](https://github.com/kjuulh/dagger-rs/commit/ec0d0b22e646c97acb3ce93f3afb3ddb8590e68f))
|
||||||
|
- add fields ([`496a687`](https://github.com/kjuulh/dagger-rs/commit/496a687bc34f7c58cc86df60c183be741b0b8a9c))
|
||||||
|
- with codegen output ([`0bf6b0e`](https://github.com/kjuulh/dagger-rs/commit/0bf6b0e91ecc31c1f6b51338234137eb185810a0))
|
||||||
|
- added scalars ([`e587414`](https://github.com/kjuulh/dagger-rs/commit/e5874141b3b6256b7ac2a0bf653089fa7bcc5d14))
|
||||||
|
- split out codegen parts ([`3263f1d`](https://github.com/kjuulh/dagger-rs/commit/3263f1d589aee78065401c666533cb0cbadd06ce))
|
||||||
|
- add collection of types ([`7433453`](https://github.com/kjuulh/dagger-rs/commit/7433453c6dd1447f8ad09c06c13a02cfac5ace05))
|
||||||
|
- with type filtering ([`2eb5d98`](https://github.com/kjuulh/dagger-rs/commit/2eb5d98c8a28ab8dfdc4eb959809191bc483bd08))
|
||||||
|
- with fixes ([`3eb8914`](https://github.com/kjuulh/dagger-rs/commit/3eb891422fa1404f88cfe259bddbb67e2843f1d3))
|
||||||
|
- add todo for not dropping proc ([`b63c44a`](https://github.com/kjuulh/dagger-rs/commit/b63c44adedfa0c8ef4899198bea75a5744570a87))
|
||||||
|
- can get schema ([`06fd730`](https://github.com/kjuulh/dagger-rs/commit/06fd730a1c23af88eaffa1dde8acdea202247f91))
|
||||||
|
- with session ([`83ecbd2`](https://github.com/kjuulh/dagger-rs/commit/83ecbd238ab87396c9645cb93741e89a34c92766))
|
||||||
|
- with engine ([`ee655d0`](https://github.com/kjuulh/dagger-rs/commit/ee655d02ef9670b2c0cbaa600c3e2af9f54dbf65))
|
||||||
|
- Can download dagger ([`1e88bb3`](https://github.com/kjuulh/dagger-rs/commit/1e88bb327035bd156588716202b8d982a50c114c))
|
||||||
|
- with out keeper ([`59e59fd`](https://github.com/kjuulh/dagger-rs/commit/59e59fd55d17f7e24ccb3c64471bf82332af5a21))
|
||||||
|
- more allow dead_code ([`a804dd9`](https://github.com/kjuulh/dagger-rs/commit/a804dd97a6ed08ad51c8552bc5d4c845491dca1c))
|
||||||
|
- allow dead_code ([`e2d32ed`](https://github.com/kjuulh/dagger-rs/commit/e2d32ede7621123a3db9d5e2cd3e7d276d0b5e2f))
|
||||||
|
- without integration ([`b6186aa`](https://github.com/kjuulh/dagger-rs/commit/b6186aa9015f8ddb5d59d1346a2cdc935a26d061))
|
||||||
|
- Add base sdk ([`078e2d9`](https://github.com/kjuulh/dagger-rs/commit/078e2d9c2c43fc2b4752ab1dcf4627c840009992))
|
||||||
|
</details>
|
||||||
|
|
||||||
11
CONTRIBUTING.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
The sdk is still quite young, so feel free to either:
|
||||||
|
|
||||||
|
- Refactor
|
||||||
|
- Document
|
||||||
|
- Improve the code
|
||||||
|
|
||||||
|
Feel free to ping me on discord @Hermansen#4325, or just create an issue if
|
||||||
|
there is a missing feature, or you'd like some mentorship in getting into the
|
||||||
|
code
|
||||||
443
Cargo.lock
generated
@@ -2,6 +2,15 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "addr2line"
|
||||||
|
version = "0.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
|
||||||
|
dependencies = [
|
||||||
|
"gimli",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler"
|
name = "adler"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@@ -33,6 +42,21 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "backtrace"
|
||||||
|
version = "0.3.67"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
|
||||||
|
dependencies = [
|
||||||
|
"addr2line",
|
||||||
|
"cc",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"miniz_oxide",
|
||||||
|
"object",
|
||||||
|
"rustc-demangle",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
@@ -68,15 +92,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.3.0"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.78"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
|
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -84,11 +108,22 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ci"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
|
"dagger-sdk",
|
||||||
|
"eyre",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.1.4"
|
version = "4.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
|
checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
@@ -106,6 +141,33 @@ dependencies = [
|
|||||||
"os_str_bytes",
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color-eyre"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204"
|
||||||
|
dependencies = [
|
||||||
|
"backtrace",
|
||||||
|
"color-spantrace",
|
||||||
|
"eyre",
|
||||||
|
"indenter",
|
||||||
|
"once_cell",
|
||||||
|
"owo-colors",
|
||||||
|
"tracing-error",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color-spantrace"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"owo-colors",
|
||||||
|
"tracing-core",
|
||||||
|
"tracing-error",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "3.8.1"
|
version = "3.8.1"
|
||||||
@@ -184,7 +246,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-codegen"
|
name = "dagger-codegen"
|
||||||
version = "0.1.0"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
@@ -198,7 +260,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-core"
|
name = "dagger-core"
|
||||||
version = "0.1.0"
|
version = "0.2.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -216,13 +278,15 @@ dependencies = [
|
|||||||
"sha2",
|
"sha2",
|
||||||
"tar",
|
"tar",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-rs"
|
name = "dagger-rs"
|
||||||
version = "0.1.2"
|
version = "0.2.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
"dagger-codegen",
|
"dagger-codegen",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -240,24 +304,93 @@ dependencies = [
|
|||||||
"sha2",
|
"sha2",
|
||||||
"tar",
|
"tar",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.1.0"
|
version = "0.2.18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
|
"derive_builder",
|
||||||
"eyre",
|
"eyre",
|
||||||
"futures",
|
"futures",
|
||||||
"genco",
|
"genco",
|
||||||
"gql_client",
|
"gql_client",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
"rand",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling"
|
||||||
|
version = "0.14.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"darling_macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_core"
|
||||||
|
version = "0.14.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
|
||||||
|
dependencies = [
|
||||||
|
"fnv",
|
||||||
|
"ident_case",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"strsim",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_macro"
|
||||||
|
version = "0.14.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive_builder"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
|
||||||
|
dependencies = [
|
||||||
|
"derive_builder_macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive_builder_core"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
|
||||||
|
dependencies = [
|
||||||
|
"darling",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive_builder_macro"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
|
||||||
|
dependencies = [
|
||||||
|
"derive_builder_core",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diff"
|
name = "diff"
|
||||||
version = "0.1.13"
|
version = "0.1.13"
|
||||||
@@ -302,9 +435,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.31"
|
version = "0.8.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
|
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -342,23 +475,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "1.8.0"
|
version = "1.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filetime"
|
name = "filetime"
|
||||||
version = "0.2.19"
|
version = "0.2.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"
|
checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -404,9 +537,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
|
checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -419,9 +552,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures-channel"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
|
checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
@@ -429,15 +562,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-core"
|
name = "futures-core"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
|
checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-executor"
|
name = "futures-executor"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
|
checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
@@ -446,15 +579,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
|
checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-macro"
|
name = "futures-macro"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
|
checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -463,21 +596,21 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
|
checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-task"
|
name = "futures-task"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
|
checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-util"
|
name = "futures-util"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
|
checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -534,6 +667,12 @@ dependencies = [
|
|||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gimli"
|
||||||
|
version = "0.27.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gql_client"
|
name = "gql_client"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
@@ -632,9 +771,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
@@ -645,6 +784,12 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex"
|
name = "hex"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@@ -659,9 +804,9 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -693,9 +838,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "0.14.23"
|
version = "0.14.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"
|
checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -728,6 +873,12 @@ dependencies = [
|
|||||||
"tokio-native-tls",
|
"tokio-native-tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ident_case"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -765,12 +916,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "io-lifetimes"
|
name = "io-lifetimes"
|
||||||
version = "1.0.4"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -781,14 +932,14 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-terminal"
|
name = "is-terminal"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
|
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi 0.3.1",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -808,9 +959,9 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.60"
|
version = "0.3.61"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
@@ -886,14 +1037,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
|
checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi",
|
"wasi",
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -920,15 +1071,24 @@ version = "1.15.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
|
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi 0.2.6",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "object"
|
||||||
version = "1.17.0"
|
version = "0.30.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.17.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
@@ -990,6 +1150,12 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "owo-colors"
|
||||||
|
version = "3.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -1047,6 +1213,12 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pretty_assertions"
|
name = "pretty_assertions"
|
||||||
version = "1.3.0"
|
version = "1.3.0"
|
||||||
@@ -1061,9 +1233,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.50"
|
version = "1.0.51"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
|
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@@ -1077,6 +1249,36 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.16"
|
version = "0.2.16"
|
||||||
@@ -1153,17 +1355,23 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustc-demangle"
|
||||||
version = "0.36.7"
|
version = "0.1.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
|
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.36.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"errno",
|
"errno",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1189,9 +1397,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework"
|
name = "security-framework"
|
||||||
version = "2.8.1"
|
version = "2.8.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c4437699b6d34972de58652c68b98cb5b53a4199ab126db8e20ec8ded29a721"
|
checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
@@ -1232,9 +1440,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.92"
|
version = "1.0.93"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7434af0dc1cbd59268aa98b4c22c131c0584d2232f6fb166efb993e2832e896a"
|
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
@@ -1265,19 +1473,28 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signal-hook-registry"
|
name = "sharded-slab"
|
||||||
version = "1.4.0"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
|
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook-registry"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.7"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
@@ -1369,6 +1586,16 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thread_local"
|
||||||
|
version = "1.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@@ -1380,9 +1607,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec_macros"
|
name = "tinyvec_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
@@ -1417,9 +1644,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-native-tls"
|
name = "tokio-native-tls"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
|
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"native-tls",
|
"native-tls",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -1427,9 +1654,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-util"
|
name = "tokio-util"
|
||||||
version = "0.7.4"
|
version = "0.7.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
|
checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -1463,6 +1690,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"valuable",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-error"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e"
|
||||||
|
dependencies = [
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-subscriber"
|
||||||
|
version = "0.3.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
|
||||||
|
dependencies = [
|
||||||
|
"sharded-slab",
|
||||||
|
"thread_local",
|
||||||
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1500,9 +1749,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.10.0"
|
version = "1.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
|
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unreachable"
|
name = "unreachable"
|
||||||
@@ -1524,6 +1773,12 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "valuable"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
@@ -1560,9 +1815,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
@@ -1570,9 +1825,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"log",
|
"log",
|
||||||
@@ -1585,9 +1840,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.4.33"
|
version = "0.4.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
|
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -1597,9 +1852,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -1607,9 +1862,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1620,9 +1875,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.83"
|
version = "0.2.84"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-streams"
|
name = "wasm-streams"
|
||||||
@@ -1639,9 +1894,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.60"
|
version = "0.3.61"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|||||||
28
Cargo.toml
@@ -1,36 +1,42 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-rs"
|
name = "dagger-rs"
|
||||||
version = "0.1.2"
|
version = "0.2.10"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license-file = "LICENSE.MIT"
|
license-file = "LICENSE.MIT"
|
||||||
description = "A dagger sdk for rust, written in rust"
|
description = "A dagger sdk for rust, written in rust"
|
||||||
|
repository = "https://github.com/kjuulh/dagger-rs"
|
||||||
|
publish = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["crates/dagger-codegen", "crates/dagger-sdk", "crates/dagger-core"]
|
members = [
|
||||||
|
"crates/dagger-codegen",
|
||||||
|
"crates/dagger-sdk",
|
||||||
|
"crates/dagger-core",
|
||||||
|
"ci",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dagger-codegen = { path = "crates/dagger-codegen" }
|
dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" }
|
||||||
dagger-core = { path = "crates/dagger-core" }
|
dagger-core = { path = "crates/dagger-core", version = "^0.2.8" }
|
||||||
|
|
||||||
clap = "4.1.4"
|
clap = "4.1.6"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
flate2 = { version = "1.0.25", features = ["zlib"] }
|
flate2 = { version = "1.0.25", features = ["zlib"] }
|
||||||
genco = "0.17.3"
|
genco = "0.17.3"
|
||||||
graphql-introspection-query = "0.2.0"
|
graphql-introspection-query = "0.2.0"
|
||||||
graphql_client = { version = "0.12.0", features = [
|
graphql_client = { version = "0.12.0", features = ["reqwest"] }
|
||||||
"reqwest",
|
|
||||||
"reqwest-blocking",
|
|
||||||
] }
|
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
hex-literal = "0.3.4"
|
hex-literal = "0.3.4"
|
||||||
platform-info = "1.0.2"
|
platform-info = "1.0.2"
|
||||||
reqwest = { version = "0.11.14", features = ["stream", "blocking", "deflate"] }
|
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
serde_json = "1.0.91"
|
serde_json = "1.0.93"
|
||||||
sha2 = "0.10.6"
|
sha2 = "0.10.6"
|
||||||
tar = "0.4.38"
|
tar = "0.4.38"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
|
color-eyre = "0.6.2"
|
||||||
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
|
|||||||
43
Makefile.toml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
[tasks.codegen]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["run", "-p", "ci", "--", "codegen"]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[tasks.build]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["run", "-p", "ci", "--", "ci"]
|
||||||
|
dependencies = ["codegen"]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[tasks.fmt]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["fmt", "--all"]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[tasks.fix]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["fix", "--workspace", "--allow-dirty"]
|
||||||
|
dependencies = ["fmt"]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[tasks.release_crate]
|
||||||
|
command = "cargo"
|
||||||
|
args = [
|
||||||
|
"smart-release",
|
||||||
|
"--allow-fully-generated-changelogs",
|
||||||
|
"--update-crates-index",
|
||||||
|
"dagger-sdk",
|
||||||
|
]
|
||||||
|
dependencies = ["codegen", "fix"]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[tasks.release_crate_commit]
|
||||||
|
command = "cargo"
|
||||||
|
args = [
|
||||||
|
"smart-release",
|
||||||
|
"-e",
|
||||||
|
"--allow-fully-generated-changelogs",
|
||||||
|
"--update-crates-index",
|
||||||
|
"dagger-sdk",
|
||||||
|
]
|
||||||
|
workspace = false
|
||||||
78
README.md
@@ -1,39 +1,55 @@
|
|||||||
# dagger-rs
|
# dagger-sdk
|
||||||
|
|
||||||
A dagger sdk written in rust for rust.
|
A dagger sdk written in rust for rust.
|
||||||
|
|
||||||
## Disclaimer
|
## Examples
|
||||||
|
|
||||||
Work in progress. This is not ready for usage yet
|
See [examples](./crates/dagger-sdk/examples/)
|
||||||
|
|
||||||
### Status
|
Run them like so
|
||||||
|
|
||||||
- [x] dagger cli downloader
|
```bash
|
||||||
- [x] dagger network session
|
cargo run --example first-pipeline
|
||||||
- [x] graphql rust codegen (User API)
|
```
|
||||||
- [x] Scalars
|
|
||||||
- [x] Enums
|
|
||||||
- [x] Input
|
|
||||||
- [x] Objects
|
|
||||||
- [ ] Implement context and querier
|
|
||||||
- [x] Marshaller
|
|
||||||
- [x] Querier
|
|
||||||
- [x] Context
|
|
||||||
- [ ] Deserializer for nested response (bind)
|
|
||||||
- [ ] Add codegen to hook into querier
|
|
||||||
- [ ] fix build / release cycle
|
|
||||||
- [ ] general api stabilisation
|
|
||||||
- [ ] document usage
|
|
||||||
|
|
||||||
## Architecture
|
The examples match the folder name in each directory in examples
|
||||||
|
|
||||||
- `.` Root project mainly used for generating the CLI, which in turn is used to
|
## Install
|
||||||
bootstrap the code generation from `dagger`
|
|
||||||
- `crates/dagger-core` Contains all base types used during actual usage. This is
|
Simply install like:
|
||||||
where the primary logic lives in which the user interacts (\*disclaimer: most
|
|
||||||
stuff haven't moved in here yet.)
|
```bash
|
||||||
- `crates/dagger-sdk` Contains the actual sdk in which the user interacts,
|
cargo add dagger-sdk
|
||||||
`dagger-core` is reexported through this API as well.
|
```
|
||||||
- `crates/dagger-codegen` This is the bulk of the work, it takes the input
|
|
||||||
graphql and spits out the API in which the user interacts, this is heavily
|
### Usage
|
||||||
inspired by other `dagger-sdk's`. It primarily turns graphql into rust code.
|
|
||||||
|
```rust
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
let client = dagger_sdk::connect().await?;
|
||||||
|
|
||||||
|
let version = client
|
||||||
|
.container()
|
||||||
|
.from("golang:1.19")
|
||||||
|
.with_exec(vec!["go", "version"])
|
||||||
|
.stdout()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Hello from Dagger and {}", version.trim());
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And run it like a normal application:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
|
||||||
|
### Contributing
|
||||||
|
|
||||||
|
See [CONTRIBUTING](./CONTRIBUTING.md)
|
||||||
|
|
||||||
|
or just cargo make codegen
|
||||||
|
|||||||
73
ci/CHANGELOG.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
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.1.0 (2023-02-20)
|
||||||
|
|
||||||
|
<csr-id-06e2638e1fec0579d992792b94838629739bb1f0/>
|
||||||
|
<csr-id-48433cf36884ec9fa4cfed8bc5d4b3e8422c0ab9/>
|
||||||
|
<csr-id-45d646203704aed317ee2273b825ae708e83ca32/>
|
||||||
|
<csr-id-c35c104b49dc2f4456ed18e353bf8d4017cff640/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-06e2638e1fec0579d992792b94838629739bb1f0/> with actual await on connect
|
||||||
|
- <csr-id-48433cf36884ec9fa4cfed8bc5d4b3e8422c0ab9/> with dagger v0.2.10
|
||||||
|
- <csr-id-45d646203704aed317ee2273b825ae708e83ca32/> with async/await
|
||||||
|
- <csr-id-c35c104b49dc2f4456ed18e353bf8d4017cff640/> update ci to use dagger-sdk v0.2.6
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- <csr-id-30b7511e454d4695cc1106a3d303b20aa8647fe4/> add changelog
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-691ecfbf52fa24a466d554b7b9701d67c33a42a5/> ci with dagger v0.2.2
|
||||||
|
- <csr-id-f42da8416a5450c7c3c924353c3cc9112afd18f0/> with sccache
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-f40ba9b40312a66b7699209fdddc0153ef139931/> with older version of dagger-sdk
|
||||||
|
- <csr-id-02006d40fc2c0383e0412c15c36db9af7eda991f/> without phantom data
|
||||||
|
- <csr-id-199fe16dbf426f287a7a5237c25bc16a4cae49bc/> update rust crate dagger-sdk to 0.2.1
|
||||||
|
- <csr-id-25fb9d4f24af8e7d6d81463c19a07a718b8a312a/> with secret
|
||||||
|
- <csr-id-d72313051b9b46a6eeaa909a11850b3d8fc75e81/> with test changes
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 16 commits contributed to the release over the course of 2 calendar days.
|
||||||
|
- 12 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||||
|
- 2 unique issues were worked on: [#7](https://github.com/kjuulh/dagger-rs/issues/7), [#8](https://github.com/kjuulh/dagger-rs/issues/8)
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **[#7](https://github.com/kjuulh/dagger-rs/issues/7)**
|
||||||
|
- add ci ([`4ce58a4`](https://github.com/kjuulh/dagger-rs/commit/4ce58a418c0ccef6cc0bfbaa878453f03c02dffb))
|
||||||
|
* **[#8](https://github.com/kjuulh/dagger-rs/issues/8)**
|
||||||
|
- feature with workspace ([`03e022f`](https://github.com/kjuulh/dagger-rs/commit/03e022fcaccd30ef0566dcfe31beb3473706bd1d))
|
||||||
|
* **Uncategorized**
|
||||||
|
- add changelog ([`30b7511`](https://github.com/kjuulh/dagger-rs/commit/30b7511e454d4695cc1106a3d303b20aa8647fe4))
|
||||||
|
- with actual await on connect ([`06e2638`](https://github.com/kjuulh/dagger-rs/commit/06e2638e1fec0579d992792b94838629739bb1f0))
|
||||||
|
- with dagger v0.2.10 ([`48433cf`](https://github.com/kjuulh/dagger-rs/commit/48433cf36884ec9fa4cfed8bc5d4b3e8422c0ab9))
|
||||||
|
- with older version of dagger-sdk ([`f40ba9b`](https://github.com/kjuulh/dagger-rs/commit/f40ba9b40312a66b7699209fdddc0153ef139931))
|
||||||
|
- with async/await ([`45d6462`](https://github.com/kjuulh/dagger-rs/commit/45d646203704aed317ee2273b825ae708e83ca32))
|
||||||
|
- update ci to use dagger-sdk v0.2.6 ([`c35c104`](https://github.com/kjuulh/dagger-rs/commit/c35c104b49dc2f4456ed18e353bf8d4017cff640))
|
||||||
|
- without phantom data ([`02006d4`](https://github.com/kjuulh/dagger-rs/commit/02006d40fc2c0383e0412c15c36db9af7eda991f))
|
||||||
|
- ci with dagger v0.2.2 ([`691ecfb`](https://github.com/kjuulh/dagger-rs/commit/691ecfbf52fa24a466d554b7b9701d67c33a42a5))
|
||||||
|
- with bin cache ([`3cb83bb`](https://github.com/kjuulh/dagger-rs/commit/3cb83bb79ceda52a0bf459850252e3902b7352fa))
|
||||||
|
- update rust crate dagger-sdk to 0.2.1 ([`199fe16`](https://github.com/kjuulh/dagger-rs/commit/199fe16dbf426f287a7a5237c25bc16a4cae49bc))
|
||||||
|
- with secret ([`25fb9d4`](https://github.com/kjuulh/dagger-rs/commit/25fb9d4f24af8e7d6d81463c19a07a718b8a312a))
|
||||||
|
- with sccache ([`f42da84`](https://github.com/kjuulh/dagger-rs/commit/f42da8416a5450c7c3c924353c3cc9112afd18f0))
|
||||||
|
- with test changes ([`d723130`](https://github.com/kjuulh/dagger-rs/commit/d72313051b9b46a6eeaa909a11850b3d8fc75e81))
|
||||||
|
- add ci ([`468bca4`](https://github.com/kjuulh/dagger-rs/commit/468bca4a69ec321b3ae1304d29d1be66a921a7db))
|
||||||
|
</details>
|
||||||
|
|
||||||
13
ci/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "ci"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = "4.1.6"
|
||||||
|
color-eyre = "0.6.2"
|
||||||
|
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.18" }
|
||||||
|
eyre = "0.6.8"
|
||||||
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
230
ci/src/main.rs
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use clap::ArgMatches;
|
||||||
|
use dagger_sdk::{Container, HostDirectoryOpts, Query};
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
color_eyre::install().unwrap();
|
||||||
|
|
||||||
|
let matches = clap::Command::new("ci")
|
||||||
|
.subcommand_required(true)
|
||||||
|
.subcommand(clap::Command::new("pr"))
|
||||||
|
.subcommand(clap::Command::new("release"))
|
||||||
|
.subcommand(clap::Command::new("codegen"))
|
||||||
|
.get_matches();
|
||||||
|
|
||||||
|
let client = dagger_sdk::connect().await?;
|
||||||
|
|
||||||
|
match matches.subcommand() {
|
||||||
|
Some(("pr", _)) => {
|
||||||
|
let base = select_base_image(client.clone()).await?;
|
||||||
|
return validate_pr(client, base).await;
|
||||||
|
}
|
||||||
|
Some(("release", subm)) => return release(client, subm).await,
|
||||||
|
Some(("codegen", subm)) => return run_codegen(client, subm).await,
|
||||||
|
Some(_) => {
|
||||||
|
panic!("invalid subcommand selected!")
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
panic!("no command selected!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn run_codegen(client: Arc<Query>, _subm: &ArgMatches) -> eyre::Result<()> {
|
||||||
|
let docker_cli = client
|
||||||
|
.container()
|
||||||
|
.from("docker:cli")
|
||||||
|
.file("/usr/local/bin/docker");
|
||||||
|
let socket = client.host().unix_socket("/var/run/docker.sock");
|
||||||
|
|
||||||
|
let container = get_dependencies(client).await?;
|
||||||
|
|
||||||
|
let generated_image = container
|
||||||
|
.with_exec(vec!["mkdir", "-p", "/mnt/output"])
|
||||||
|
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
|
||||||
|
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
|
||||||
|
.with_exec(vec![
|
||||||
|
"cargo",
|
||||||
|
"run",
|
||||||
|
"--",
|
||||||
|
"generate",
|
||||||
|
"--output",
|
||||||
|
"crates/dagger-sdk/gen.rs",
|
||||||
|
])
|
||||||
|
.with_exec(vec!["cargo", "fmt", "--all"])
|
||||||
|
.with_exec(vec!["cargo", "fix", "--workspace", "--allow-dirty"])
|
||||||
|
.with_exec(vec!["cargo", "fmt", "--all"])
|
||||||
|
.with_exec(vec!["mv", "crates/dagger-sdk/gen.rs", "/mnt/output/gen.rs"]);
|
||||||
|
|
||||||
|
let _ = generated_image.exit_code().await?;
|
||||||
|
|
||||||
|
generated_image
|
||||||
|
.file("/mnt/output/gen.rs")
|
||||||
|
.export("crates/dagger-sdk/src/gen.rs")
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> {
|
||||||
|
let src_dir = client.host().directory_opts(
|
||||||
|
".",
|
||||||
|
HostDirectoryOpts {
|
||||||
|
exclude: Some(vec!["target/"]),
|
||||||
|
include: None,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
let base_image = client
|
||||||
|
.container()
|
||||||
|
.from("rust:latest")
|
||||||
|
.with_workdir("app")
|
||||||
|
.with_mounted_directory("/app/", src_dir.id().await?);
|
||||||
|
|
||||||
|
let container = base_image
|
||||||
|
.with_exec(vec!["cargo", "install", "cargo-smart-release"])
|
||||||
|
.with_exec(vec![
|
||||||
|
"cargo",
|
||||||
|
"smart-release",
|
||||||
|
"--execute",
|
||||||
|
"--allow-fully-generated-changelogs",
|
||||||
|
"--no-changelog-preview",
|
||||||
|
"dagger-rs",
|
||||||
|
"dagger-sdk",
|
||||||
|
]);
|
||||||
|
let exit = container.exit_code().await?;
|
||||||
|
if exit != 0 {
|
||||||
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("released pr succeeded!");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
|
||||||
|
let cargo_dir = client.host().directory_opts(
|
||||||
|
".",
|
||||||
|
HostDirectoryOpts {
|
||||||
|
exclude: None,
|
||||||
|
include: Some(vec![
|
||||||
|
"**/Cargo.lock",
|
||||||
|
"**/Cargo.toml",
|
||||||
|
"**/main.rs",
|
||||||
|
"**/lib.rs",
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let src_dir = client.host().directory_opts(
|
||||||
|
".",
|
||||||
|
HostDirectoryOpts {
|
||||||
|
exclude: Some(vec!["target/"]),
|
||||||
|
include: None,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let cache_cargo_index_dir = client.cache_volume("cargo_index");
|
||||||
|
let _cache_cargo_deps = client.cache_volume("cargo_deps");
|
||||||
|
let cache_cargo_bin = client.cache_volume("cargo_bin_cache");
|
||||||
|
|
||||||
|
let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz";
|
||||||
|
|
||||||
|
let base_image = client
|
||||||
|
.container()
|
||||||
|
.from("rustlang/rust:nightly")
|
||||||
|
.with_workdir("app")
|
||||||
|
.with_exec(vec!["apt-get", "update"])
|
||||||
|
.with_exec(vec!["apt-get", "install", "--yes", "libpq-dev", "wget"])
|
||||||
|
.with_exec(vec!["wget", minio_url])
|
||||||
|
.with_exec(vec![
|
||||||
|
"tar",
|
||||||
|
"xzf",
|
||||||
|
"sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz",
|
||||||
|
])
|
||||||
|
.with_exec(vec![
|
||||||
|
"mv",
|
||||||
|
"sccache-v0.3.3-x86_64-unknown-linux-musl/sccache",
|
||||||
|
"/usr/local/bin/sccache",
|
||||||
|
])
|
||||||
|
.with_exec(vec!["chmod", "+x", "/usr/local/bin/sccache"])
|
||||||
|
//.with_env_variable("RUSTC_WRAPPER", "/usr/local/bin/sccache")
|
||||||
|
.with_env_variable(
|
||||||
|
"AWS_ACCESS_KEY_ID",
|
||||||
|
std::env::var("AWS_ACCESS_KEY_ID").unwrap_or("".into()),
|
||||||
|
)
|
||||||
|
.with_env_variable(
|
||||||
|
"AWS_SECRET_ACCESS_KEY",
|
||||||
|
std::env::var("AWS_SECRET_ACCESS_KEY").unwrap_or("".into()),
|
||||||
|
)
|
||||||
|
.with_env_variable("SCCACHE_BUCKET", "sccache")
|
||||||
|
.with_env_variable("SCCACHE_REGION", "auto")
|
||||||
|
.with_env_variable("SCCACHE_ENDPOINT", "https://api-minio.front.kjuulh.io")
|
||||||
|
.with_mounted_cache("~/.cargo/bin", cache_cargo_bin.id().await?)
|
||||||
|
.with_mounted_cache("~/.cargo/registry/index", cache_cargo_bin.id().await?)
|
||||||
|
.with_mounted_cache("~/.cargo/registry/cache", cache_cargo_bin.id().await?)
|
||||||
|
.with_mounted_cache("~/.cargo/git/db", cache_cargo_bin.id().await?)
|
||||||
|
.with_mounted_cache("target/", cache_cargo_bin.id().await?)
|
||||||
|
.with_exec(vec!["cargo", "install", "cargo-chef"]);
|
||||||
|
|
||||||
|
let recipe = base_image
|
||||||
|
.with_mounted_directory(".", cargo_dir.id().await?)
|
||||||
|
.with_mounted_cache("~/.cargo/.package-cache", cache_cargo_index_dir.id().await?)
|
||||||
|
.with_exec(vec![
|
||||||
|
"cargo",
|
||||||
|
"chef",
|
||||||
|
"prepare",
|
||||||
|
"--recipe-path",
|
||||||
|
"recipe.json",
|
||||||
|
])
|
||||||
|
.file("/app/recipe.json");
|
||||||
|
|
||||||
|
let builder_start = base_image
|
||||||
|
.with_mounted_file("/app/recipe.json", recipe.id().await?)
|
||||||
|
.with_exec(vec![
|
||||||
|
"cargo",
|
||||||
|
"chef",
|
||||||
|
"cook",
|
||||||
|
"--release",
|
||||||
|
"--workspace",
|
||||||
|
"--recipe-path",
|
||||||
|
"recipe.json",
|
||||||
|
])
|
||||||
|
.with_directory("/app/", src_dir.id().await?)
|
||||||
|
.with_exec(vec!["cargo", "build", "--all", "--release"]);
|
||||||
|
|
||||||
|
return Ok(builder_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
|
||||||
|
let src_dir = get_dependencies(client.clone()).await;
|
||||||
|
|
||||||
|
src_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn validate_pr(client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
||||||
|
let exit = container.exit_code().await?;
|
||||||
|
if exit != 0 {
|
||||||
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
|
}
|
||||||
|
let docker_cli = client
|
||||||
|
.container()
|
||||||
|
.from("docker:cli")
|
||||||
|
.file("/usr/local/bin/docker");
|
||||||
|
let socket = client.host().unix_socket("/var/run/docker.sock");
|
||||||
|
|
||||||
|
let container = container
|
||||||
|
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
|
||||||
|
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
|
||||||
|
.with_exec(vec!["cargo", "test", "--all"]);
|
||||||
|
|
||||||
|
let exit = container.exit_code().await?;
|
||||||
|
if exit != 0 {
|
||||||
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("validating pr succeeded!");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
317
crates/dagger-codegen/CHANGELOG.md
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
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.8 (2023-02-22)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c/> with clone
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit contributed to the release.
|
||||||
|
- 2 days passed between releases.
|
||||||
|
- 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**
|
||||||
|
- with clone ([`266ad32`](https://github.com/kjuulh/dagger-rs/commit/266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.7 (2023-02-20)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||||
|
|
||||||
|
### 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.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||||
|
- 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>
|
||||||
|
|
||||||
|
## v0.2.5 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4/> add documentation strings
|
||||||
|
- <csr-id-9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598/> Use async runtime instead of blocking.
|
||||||
|
Default to using async runtime instead of blocking. I.e.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn main() -> eyre::Result<()> {
|
||||||
|
// ...
|
||||||
|
|
||||||
|
client.container().from("rust").publish("somewhere")?;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
// to
|
||||||
|
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
// ...
|
||||||
|
|
||||||
|
client.container().from("rust").publish("somewhere").await?;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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**
|
||||||
|
- Release dagger-sdk v0.2.8, dagger-codegen v0.2.5 ([`0499024`](https://github.com/kjuulh/dagger-rs/commit/04990247ba8e9d0555847f582fef14849dbedebf))
|
||||||
|
- add documentation strings ([`978ede6`](https://github.com/kjuulh/dagger-rs/commit/978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4))
|
||||||
|
- Use async runtime instead of blocking. ([`9be6f43`](https://github.com/kjuulh/dagger-rs/commit/9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.4 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-f29ff836cfd72d5e051ca6a71a230ba1e9933091/> without Some in _opts functions
|
||||||
|
Option has been removed as a wrapper around opts. This makes it much
|
||||||
|
more convenient to use
|
||||||
|
|
||||||
|
```rust
|
||||||
|
client.container_opts(Some(ContainerOpts{}))
|
||||||
|
// ->
|
||||||
|
client.container_opts(ContainerOpts{})
|
||||||
|
```
|
||||||
|
|
||||||
|
The same options are still available, either an empty object can be
|
||||||
|
passed, or a non _opts function can be used
|
||||||
|
- <csr-id-9762da895a164e30c5dc60e89a83e934ceae47ab/> with _opts methods
|
||||||
|
Now all opt values enter into a _opts function instead of the original.
|
||||||
|
This avoids a lot of verbosity for both None in the case opts are
|
||||||
|
unwanted, and Some() if they actually are.
|
||||||
|
|
||||||
|
They are used like so:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
client.container().from("...");
|
||||||
|
client.container_opts(Some(ContainerOpts{ ... }))
|
||||||
|
```
|
||||||
|
|
||||||
|
Some from opts will be removed in a future commit/pr
|
||||||
|
- <csr-id-94336d06378f035464e233b921dc3858070f582d/> move to &str instead of String and introduce builder.
|
||||||
|
This will make the api much easier to use, as we can now rely on ""
|
||||||
|
instead of "".into() for normal string values.
|
||||||
|
|
||||||
|
Introduced builder as well, which makes it much easier to use *Opts, as
|
||||||
|
it can handle the building of that, and get the benefits from String ->
|
||||||
|
&str, as that is currently not allowed for optional values
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-c627595fd2695e236924175d137c42f1480ccd6b/> cargo clippy
|
||||||
|
- <csr-id-02006d40fc2c0383e0412c15c36db9af7eda991f/> without phantom data
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 6 commits contributed to the release.
|
||||||
|
- 5 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**
|
||||||
|
- Release dagger-sdk v0.2.5, dagger-codegen v0.2.4 ([`f727318`](https://github.com/kjuulh/dagger-rs/commit/f72731807d8358fdb3d80432136b7a08bb7b1773))
|
||||||
|
- cargo clippy ([`c627595`](https://github.com/kjuulh/dagger-rs/commit/c627595fd2695e236924175d137c42f1480ccd6b))
|
||||||
|
- without Some in _opts functions ([`f29ff83`](https://github.com/kjuulh/dagger-rs/commit/f29ff836cfd72d5e051ca6a71a230ba1e9933091))
|
||||||
|
- with _opts methods ([`9762da8`](https://github.com/kjuulh/dagger-rs/commit/9762da895a164e30c5dc60e89a83e934ceae47ab))
|
||||||
|
- without phantom data ([`02006d4`](https://github.com/kjuulh/dagger-rs/commit/02006d40fc2c0383e0412c15c36db9af7eda991f))
|
||||||
|
- move to &str instead of String and introduce builder. ([`94336d0`](https://github.com/kjuulh/dagger-rs/commit/94336d06378f035464e233b921dc3858070f582d))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.3 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-de063eae858eb3335d2558a57ee6a88689635200/> with return result instead of unwrap
|
||||||
|
- <csr-id-5d667369900a47d3a6015cd3814c240bc5c54436/> remove unnecessary option returns
|
||||||
|
|
||||||
|
### 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**
|
||||||
|
- Release dagger-sdk v0.2.3, dagger-codegen v0.2.3, dagger-rs v0.2.9 ([`9235030`](https://github.com/kjuulh/dagger-rs/commit/92350306b3f0da40b4fc6dcaffcd90b891e83f70))
|
||||||
|
- with return result instead of unwrap ([`de063ea`](https://github.com/kjuulh/dagger-rs/commit/de063eae858eb3335d2558a57ee6a88689635200))
|
||||||
|
- remove unnecessary option returns ([`5d66736`](https://github.com/kjuulh/dagger-rs/commit/5d667369900a47d3a6015cd3814c240bc5c54436))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.2 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-6e5f4074329ab0462445b31d4153f8497c483438/> update to dagger v0.3.12
|
||||||
|
|
||||||
|
### 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.2, dagger-codegen v0.2.2, dagger-rs v0.2.8 ([`1638f15`](https://github.com/kjuulh/dagger-rs/commit/1638f15fba9d16512e8452f87b908d6dce417cd9))
|
||||||
|
- update to dagger v0.3.12 ([`6e5f407`](https://github.com/kjuulh/dagger-rs/commit/6e5f4074329ab0462445b31d4153f8497c483438))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.1 (2023-02-18)
|
||||||
|
|
||||||
|
<csr-id-6afe141d34308f18f9d46419931d2c9b822a7aef/>
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-789b0e69c8c53d0e86d9cec89ab5345507aad514/> update all dependencies
|
||||||
|
|
||||||
|
### Other
|
||||||
|
|
||||||
|
- <csr-id-6afe141d34308f18f9d46419931d2c9b822a7aef/> fix
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 35 commits contributed to the release over the course of 20 calendar days.
|
||||||
|
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||||
|
- 2 unique issues were worked on: [#5](https://github.com/kjuulh/dagger-rs/issues/5), [#6](https://github.com/kjuulh/dagger-rs/issues/6)
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **[#5](https://github.com/kjuulh/dagger-rs/issues/5)**
|
||||||
|
- update all dependencies ([`789b0e6`](https://github.com/kjuulh/dagger-rs/commit/789b0e69c8c53d0e86d9cec89ab5345507aad514))
|
||||||
|
* **[#6](https://github.com/kjuulh/dagger-rs/issues/6)**
|
||||||
|
- feature/add impl ([`4a4c03f`](https://github.com/kjuulh/dagger-rs/commit/4a4c03f3c2ee7f6268c65976715e70767b4ea78d))
|
||||||
|
* **Uncategorized**
|
||||||
|
- Release dagger-core v0.2.1, dagger-codegen v0.2.1, dagger-rs v0.2.1 ([`1332bc8`](https://github.com/kjuulh/dagger-rs/commit/1332bc842ce2ea0254c651419813b63b36ca590c))
|
||||||
|
- add changelogs ([`a064684`](https://github.com/kjuulh/dagger-rs/commit/a064684fcf80196188a57d9ff9067c0b5769fb09))
|
||||||
|
- Adjusting changelogs prior to release of dagger-core v0.2.1, dagger-codegen v0.2.1, dagger-rs v0.2.1 ([`f4a20fd`](https://github.com/kjuulh/dagger-rs/commit/f4a20fda79063b29829cc899793775ba8cb17214))
|
||||||
|
- remove toolchain ([`f034528`](https://github.com/kjuulh/dagger-rs/commit/f03452840cf9260cd1d5e5aa8d7ee2897384c745))
|
||||||
|
- with actual versions ([`7153c24`](https://github.com/kjuulh/dagger-rs/commit/7153c24f0105a05f170efd10ef2535d83ce0c87e))
|
||||||
|
- with publish ([`989d5bc`](https://github.com/kjuulh/dagger-rs/commit/989d5bc26036d46a199d939b5cbbe72aff2f8fb1))
|
||||||
|
- codegen also with repository ([`c625ae4`](https://github.com/kjuulh/dagger-rs/commit/c625ae49ba4d2112ea9d4907a6689fd8e74b808c))
|
||||||
|
- with readme and license ([`1e26b38`](https://github.com/kjuulh/dagger-rs/commit/1e26b383d4f6dbcbe20f5f7c19c749e743f6e607))
|
||||||
|
- with wildcard version ([`533b9df`](https://github.com/kjuulh/dagger-rs/commit/533b9dfef0165c514127a8437d08daf52adf5739))
|
||||||
|
- cargo version 0.2.0 ([`bec62de`](https://github.com/kjuulh/dagger-rs/commit/bec62de62ff5638428174e232a36eee3ddd0f5ef))
|
||||||
|
- bump version ([`36b0ecd`](https://github.com/kjuulh/dagger-rs/commit/36b0ecdabf4c220cffb2d0660fb6480387e3249a))
|
||||||
|
- fix all clippy ([`6be8482`](https://github.com/kjuulh/dagger-rs/commit/6be8482b461e098384bbf1371ed7d67b259197fa))
|
||||||
|
- fmt tests ([`2eb0277`](https://github.com/kjuulh/dagger-rs/commit/2eb027754b357100544fe0c8f7c5f6125e017c6f))
|
||||||
|
- add tests ([`19b46b6`](https://github.com/kjuulh/dagger-rs/commit/19b46b6cf04ff3cff49047699dea20ca784c5536))
|
||||||
|
- pull out args wip ([`c4edd29`](https://github.com/kjuulh/dagger-rs/commit/c4edd29f50b6ada2cc3afd2f4df2ec47920c4607))
|
||||||
|
- implement sort by name and type ([`d9b51c1`](https://github.com/kjuulh/dagger-rs/commit/d9b51c1ac90c00fb3af24332b6140e1201bc9be7))
|
||||||
|
- fix optional types for real ([`26069a8`](https://github.com/kjuulh/dagger-rs/commit/26069a82a69ec7265216c8ddaceb37228dd0fb81))
|
||||||
|
- fix description ([`f4581ba`](https://github.com/kjuulh/dagger-rs/commit/f4581ba4cd1693a906eaf6c58054398ceae3bfac))
|
||||||
|
- with proper optional types ([`f4a812a`](https://github.com/kjuulh/dagger-rs/commit/f4a812a7d24e9e09cb4e3cbde56ee0b3ac774b62))
|
||||||
|
- set proper option type ([`8549cfc`](https://github.com/kjuulh/dagger-rs/commit/8549cfc3a7d9f831febaeadc22db36604e465ea8))
|
||||||
|
- add fields ([`496a687`](https://github.com/kjuulh/dagger-rs/commit/496a687bc34f7c58cc86df60c183be741b0b8a9c))
|
||||||
|
- add input_fields ([`d2cddff`](https://github.com/kjuulh/dagger-rs/commit/d2cddff365c636feceb3f20a73df812fcab11a19))
|
||||||
|
- with objects ([`5fef514`](https://github.com/kjuulh/dagger-rs/commit/5fef5148010f384d0158361d64b8e17d357d4819))
|
||||||
|
- remove hardcoded test ([`910ff4a`](https://github.com/kjuulh/dagger-rs/commit/910ff4a72e10f5384287fed35f56bc7f662e7ccd))
|
||||||
|
- fix ([`6afe141`](https://github.com/kjuulh/dagger-rs/commit/6afe141d34308f18f9d46419931d2c9b822a7aef))
|
||||||
|
- formatting ([`3a7ee33`](https://github.com/kjuulh/dagger-rs/commit/3a7ee33e1ed317288b2022ea5a4ce721d59fb11e))
|
||||||
|
- remove dummy string ([`e7f6560`](https://github.com/kjuulh/dagger-rs/commit/e7f6560247768afbca0c350df7d4ccf3909b74fa))
|
||||||
|
- with input objects ([`dc53fc1`](https://github.com/kjuulh/dagger-rs/commit/dc53fc1d474b549bb1c580865a049e2fac2f5e6d))
|
||||||
|
- with enum ([`2a1f7c3`](https://github.com/kjuulh/dagger-rs/commit/2a1f7c3f2666f1f4caebf7c22707709741c2cfad))
|
||||||
|
- with codegen output ([`0bf6b0e`](https://github.com/kjuulh/dagger-rs/commit/0bf6b0e91ecc31c1f6b51338234137eb185810a0))
|
||||||
|
- added scalars ([`e587414`](https://github.com/kjuulh/dagger-rs/commit/e5874141b3b6256b7ac2a0bf653089fa7bcc5d14))
|
||||||
|
- with scalars ([`0d6e6e5`](https://github.com/kjuulh/dagger-rs/commit/0d6e6e57ae6a3b8a1f450d719c9973130af873b7))
|
||||||
|
- split out codegen parts ([`3263f1d`](https://github.com/kjuulh/dagger-rs/commit/3263f1d589aee78065401c666533cb0cbadd06ce))
|
||||||
|
</details>
|
||||||
|
|
||||||
@@ -1,17 +1,21 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-codegen"
|
name = "dagger-codegen"
|
||||||
version = "0.1.0"
|
version = "0.2.8"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
readme = "README.md"
|
||||||
|
license-file = "LICENSE.MIT"
|
||||||
|
description = "dagger sdk codegen library"
|
||||||
|
repository = "https://github.com/kjuulh/dagger-rs"
|
||||||
|
publish = true
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
convert_case = "0.6.0"
|
convert_case = "0.6.0"
|
||||||
dagger-core = { path = "../dagger-core" }
|
dagger-core = { path = "../dagger-core", version = "^0.2.8" }
|
||||||
|
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
genco = "0.17.3"
|
genco = "0.17.3"
|
||||||
itertools = "0.10.5"
|
itertools = "0.10.5"
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.3.0"
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
serde_json = "1.0.91"
|
serde_json = "1.0.93"
|
||||||
|
|||||||
7
crates/dagger-codegen/LICENSE.MIT
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2023 Kasper J. Hermansen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
0
crates/dagger-codegen/README.md
Normal file
@@ -1 +0,0 @@
|
|||||||
nightly
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
use std::{
|
|
||||||
io::{BufWriter, Write},
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
use dagger_core::introspection::{FullType, IntrospectionResponse, Schema};
|
|
||||||
use genco::{fmt, prelude::rust, prelude::*, quote};
|
|
||||||
|
|
||||||
use crate::handlers::{
|
|
||||||
enumeration::Enumeration, input::Input, object::Object, scalar::Scalar, DynHandler, Handlers,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub struct CodeGeneration {
|
|
||||||
handlers: Handlers,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CodeGeneration {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
handlers: vec![
|
|
||||||
Arc::new(Scalar {}),
|
|
||||||
Arc::new(Enumeration {}),
|
|
||||||
Arc::new(Input {}),
|
|
||||||
Arc::new(Object {}),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn generate(&self, schema: &IntrospectionResponse) -> eyre::Result<String> {
|
|
||||||
let code = self.generate_from_schema(
|
|
||||||
schema
|
|
||||||
.as_schema()
|
|
||||||
.schema
|
|
||||||
.as_ref()
|
|
||||||
.ok_or(eyre::anyhow!("could not get schema to generate code from"))?,
|
|
||||||
)?;
|
|
||||||
Ok(code)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn generate_from_schema(&self, schema: &Schema) -> eyre::Result<String> {
|
|
||||||
let mut output = rust::Tokens::new();
|
|
||||||
output.push();
|
|
||||||
output.append(quote! {
|
|
||||||
$(format!("// code generated by dagger. DO NOT EDIT."))
|
|
||||||
});
|
|
||||||
|
|
||||||
output.push();
|
|
||||||
output.append(render_base_types());
|
|
||||||
output.push();
|
|
||||||
|
|
||||||
let mut types = get_types(schema)?;
|
|
||||||
//let remaining: Vec<Option<String>> = types.into_iter().map(type_name).collect();
|
|
||||||
|
|
||||||
types.sort_by_key(|a| a.name.as_ref());
|
|
||||||
|
|
||||||
for (handler, types) in self.group_by_handlers(&types) {
|
|
||||||
for t in types {
|
|
||||||
if let Some(_) = self.type_name(&t) {
|
|
||||||
let rendered = handler.render(&t)?;
|
|
||||||
output.push();
|
|
||||||
output.append(rendered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut buffer = BufWriter::new(Vec::new());
|
|
||||||
let mut w = fmt::IoWriter::new(buffer.by_ref());
|
|
||||||
let fmt = fmt::Config::from_lang::<Rust>().with_indentation(fmt::Indentation::Space(4));
|
|
||||||
let config = rust::Config::default();
|
|
||||||
// Prettier imports and use.
|
|
||||||
//.with_default_import(rust::ImportMode::Qualified);
|
|
||||||
|
|
||||||
output.format_file(&mut w.as_formatter(&fmt), &config)?;
|
|
||||||
|
|
||||||
let out = String::from_utf8(buffer.into_inner()?)?;
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn group_by_handlers(&self, types: &Vec<&FullType>) -> Vec<(DynHandler, Vec<FullType>)> {
|
|
||||||
let mut group = vec![];
|
|
||||||
|
|
||||||
for handler in self.handlers.iter() {
|
|
||||||
let mut group_types: Vec<FullType> = vec![];
|
|
||||||
for t in types.iter() {
|
|
||||||
if handler.predicate(*t) {
|
|
||||||
group_types.push(t.clone().clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
group.push((handler.clone(), group_types))
|
|
||||||
}
|
|
||||||
|
|
||||||
group
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn type_name(&self, t: &FullType) -> Option<String> {
|
|
||||||
let name = t.name.as_ref();
|
|
||||||
if let Some(name) = name {
|
|
||||||
if name.starts_with("_") {
|
|
||||||
//|| !is_custom_scalar_type(t) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Some(name.replace("Query", "Client"));
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn group_key(&self, t: &FullType) -> Option<DynHandler> {
|
|
||||||
for handler in self.handlers.iter() {
|
|
||||||
if handler.predicate(&t) {
|
|
||||||
return Some(handler.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sort_key(&self, t: &FullType) -> (isize, String) {
|
|
||||||
for (i, handler) in self.handlers.iter().enumerate() {
|
|
||||||
if handler.predicate(t) {
|
|
||||||
return (i as isize, t.name.as_ref().unwrap().clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (-1, t.name.as_ref().unwrap().clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_base_types() -> rust::Tokens {
|
|
||||||
let i = rust::import("dagger_core", "Int");
|
|
||||||
let b = rust::import("dagger_core", "Boolean");
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
$(register(i))
|
|
||||||
$(register(b))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_types(schema: &Schema) -> eyre::Result<Vec<&FullType>> {
|
|
||||||
let types = schema
|
|
||||||
.types
|
|
||||||
.as_ref()
|
|
||||||
.ok_or(eyre::anyhow!("types not found on schema"))?;
|
|
||||||
|
|
||||||
let types: Vec<&FullType> = types
|
|
||||||
.iter()
|
|
||||||
.map(|t| t.as_ref().map(|t| &t.full_type))
|
|
||||||
.flatten()
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
Ok(types)
|
|
||||||
}
|
|
||||||
452
crates/dagger-codegen/src/functions.rs
Normal file
@@ -0,0 +1,452 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use dagger_core::introspection::{FullType, FullTypeFields, InputValue, TypeRef, __TypeKind};
|
||||||
|
use eyre::ContextCompat;
|
||||||
|
|
||||||
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
|
pub trait FormatTypeFuncs {
|
||||||
|
fn format_kind_list(&self, representation: &str, input: bool, immutable: bool) -> String;
|
||||||
|
fn format_kind_scalar_string(&self, representation: &str, input: bool) -> String;
|
||||||
|
fn format_kind_scalar_int(&self, representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_float(&self, representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_boolean(&self, representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_default(
|
||||||
|
&self,
|
||||||
|
representation: &str,
|
||||||
|
ref_name: &str,
|
||||||
|
input: bool,
|
||||||
|
) -> String;
|
||||||
|
fn format_kind_object(&self, representation: &str, ref_name: &str) -> String;
|
||||||
|
fn format_kind_input_object(&self, representation: &str, ref_name: &str) -> String;
|
||||||
|
fn format_kind_enum(&self, representation: &str, ref_name: &str) -> String;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type DynFormatTypeFuncs = Arc<dyn FormatTypeFuncs + Send + Sync>;
|
||||||
|
|
||||||
|
pub struct CommonFunctions {
|
||||||
|
format_type_funcs: DynFormatTypeFuncs,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CommonFunctions {
|
||||||
|
pub fn new(funcs: DynFormatTypeFuncs) -> Self {
|
||||||
|
Self {
|
||||||
|
format_type_funcs: funcs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_input_type(&self, t: &TypeRef) -> String {
|
||||||
|
self.format_type(t, true, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_output_type(&self, t: &TypeRef) -> String {
|
||||||
|
self.format_type(t, false, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_immutable_input_type(&self, t: &TypeRef) -> String {
|
||||||
|
self.format_type(t, true, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_type(&self, t: &TypeRef, input: bool, immutable: bool) -> String {
|
||||||
|
let mut representation = String::new();
|
||||||
|
let mut r = Some(t.clone());
|
||||||
|
while r.is_some() {
|
||||||
|
return match r.as_ref() {
|
||||||
|
Some(rf) => match rf.kind.as_ref() {
|
||||||
|
Some(k) => match k {
|
||||||
|
__TypeKind::SCALAR => match Scalar::from(rf) {
|
||||||
|
Scalar::Int => self
|
||||||
|
.format_type_funcs
|
||||||
|
.format_kind_scalar_int(&mut representation),
|
||||||
|
Scalar::Float => self
|
||||||
|
.format_type_funcs
|
||||||
|
.format_kind_scalar_float(&mut representation),
|
||||||
|
Scalar::String => {
|
||||||
|
if immutable {
|
||||||
|
"&'a str".into()
|
||||||
|
} else {
|
||||||
|
self.format_type_funcs
|
||||||
|
.format_kind_scalar_string(&mut representation, input)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Scalar::Boolean => self
|
||||||
|
.format_type_funcs
|
||||||
|
.format_kind_scalar_boolean(&mut representation),
|
||||||
|
Scalar::Default => self.format_type_funcs.format_kind_scalar_default(
|
||||||
|
&mut representation,
|
||||||
|
rf.name.as_ref().unwrap(),
|
||||||
|
input,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
__TypeKind::OBJECT => self
|
||||||
|
.format_type_funcs
|
||||||
|
.format_kind_object(&mut representation, rf.name.as_ref().unwrap()),
|
||||||
|
__TypeKind::ENUM => self
|
||||||
|
.format_type_funcs
|
||||||
|
.format_kind_enum(&mut representation, rf.name.as_ref().unwrap()),
|
||||||
|
__TypeKind::INPUT_OBJECT => {
|
||||||
|
self.format_type_funcs.format_kind_input_object(
|
||||||
|
&mut representation,
|
||||||
|
&rf.name.as_ref().unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
__TypeKind::LIST => {
|
||||||
|
let mut inner_type = rf
|
||||||
|
.of_type
|
||||||
|
.as_ref()
|
||||||
|
.map(|t| t.clone())
|
||||||
|
.map(|t| *t)
|
||||||
|
.map(|t| self.format_type(&t, input, immutable))
|
||||||
|
.context("could not get inner type of list")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
representation = self.format_type_funcs.format_kind_list(
|
||||||
|
&mut inner_type,
|
||||||
|
input,
|
||||||
|
immutable,
|
||||||
|
);
|
||||||
|
|
||||||
|
return representation;
|
||||||
|
}
|
||||||
|
__TypeKind::NON_NULL => {
|
||||||
|
r = rf.of_type.as_ref().map(|t| t.clone()).map(|t| *t);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
__TypeKind::Other(_) => {
|
||||||
|
r = rf.of_type.as_ref().map(|t| t.clone()).map(|t| *t);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
__TypeKind::INTERFACE => break,
|
||||||
|
__TypeKind::UNION => break,
|
||||||
|
},
|
||||||
|
None => break,
|
||||||
|
},
|
||||||
|
None => break,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("rep: {}", representation);
|
||||||
|
println!("{:?}", t);
|
||||||
|
|
||||||
|
representation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum Scalar {
|
||||||
|
Int,
|
||||||
|
Float,
|
||||||
|
String,
|
||||||
|
Boolean,
|
||||||
|
Default,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&TypeRef> for Scalar {
|
||||||
|
fn from(value: &TypeRef) -> Self {
|
||||||
|
match value.name.as_ref().map(|n| n.as_str()) {
|
||||||
|
Some("Int") => Scalar::Int,
|
||||||
|
Some("Float") => Scalar::Float,
|
||||||
|
Some("String") => Scalar::String,
|
||||||
|
Some("Boolean") => Scalar::Boolean,
|
||||||
|
Some(_) => Scalar::Default,
|
||||||
|
None => Scalar::Default,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn get_type_from_name<'t>(types: &'t [FullType], name: &'t str) -> Option<&'t FullType> {
|
||||||
|
types
|
||||||
|
.into_iter()
|
||||||
|
.find(|t| t.name.as_ref().map(|s| s.as_str()) == Some(name))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_optional(type_ref: &TypeRef) -> bool {
|
||||||
|
type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k != __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_field_has_optional(field: &FullTypeFields) -> bool {
|
||||||
|
field
|
||||||
|
.args
|
||||||
|
.pipe(|a| {
|
||||||
|
a.iter()
|
||||||
|
.map(|a| a.pipe(|a| &a.input_value))
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
.pipe(|s| input_values_has_optionals(s.as_slice()))
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
|
||||||
|
let mut type_ref = type_ref.clone();
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::SCALAR)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_enum(type_ref: &TypeRef) -> bool {
|
||||||
|
let mut type_ref = type_ref.clone();
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::ENUM)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_object(type_ref: &TypeRef) -> bool {
|
||||||
|
let mut type_ref = type_ref.clone();
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::OBJECT)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_list(type_ref: &TypeRef) -> bool {
|
||||||
|
let mut type_ref = type_ref.clone();
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::LIST)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn type_ref_is_list_of_objects(type_ref: &TypeRef) -> bool {
|
||||||
|
let mut type_ref = type_ref.clone();
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
if type_ref
|
||||||
|
.kind
|
||||||
|
.pipe(|k| *k == __TypeKind::LIST)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
type_ref = *type_ref.of_type.unwrap().clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
type_ref_is_object(&type_ref)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn input_values_has_optionals(input_values: &[&InputValue]) -> bool {
|
||||||
|
input_values
|
||||||
|
.into_iter()
|
||||||
|
.map(|k| type_ref_is_optional(&k.type_))
|
||||||
|
.filter(|k| *k)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.len()
|
||||||
|
> 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn input_values_is_empty(input_values: &[InputValue]) -> bool {
|
||||||
|
input_values.len() > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use dagger_core::introspection::{FullType, InputValue, TypeRef, __TypeKind};
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
|
use crate::functions::{input_values_has_optionals, type_ref_is_optional};
|
||||||
|
|
||||||
|
use super::get_type_from_name;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_type_from_name_has_no_item() {
|
||||||
|
let input = vec![];
|
||||||
|
let output = get_type_from_name(&input, "some-name");
|
||||||
|
|
||||||
|
assert_eq!(output.is_none(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_type_from_name_has_item() {
|
||||||
|
let name = "some-name";
|
||||||
|
let input = vec![FullType {
|
||||||
|
kind: None,
|
||||||
|
name: Some(name.to_string()),
|
||||||
|
description: None,
|
||||||
|
fields: None,
|
||||||
|
input_fields: None,
|
||||||
|
interfaces: None,
|
||||||
|
enum_values: None,
|
||||||
|
possible_types: None,
|
||||||
|
}];
|
||||||
|
let output = get_type_from_name(&input, name);
|
||||||
|
|
||||||
|
assert_eq!(output.is_some(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_type_from_name_has_item_multiple_entries() {
|
||||||
|
let name = "some-name";
|
||||||
|
let input = vec![
|
||||||
|
FullType {
|
||||||
|
kind: None,
|
||||||
|
name: Some(name.to_string()),
|
||||||
|
description: None,
|
||||||
|
fields: None,
|
||||||
|
input_fields: None,
|
||||||
|
interfaces: None,
|
||||||
|
enum_values: None,
|
||||||
|
possible_types: None,
|
||||||
|
},
|
||||||
|
FullType {
|
||||||
|
kind: None,
|
||||||
|
name: Some(name.to_string()),
|
||||||
|
description: None,
|
||||||
|
fields: None,
|
||||||
|
input_fields: None,
|
||||||
|
interfaces: None,
|
||||||
|
enum_values: None,
|
||||||
|
possible_types: None,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
let output = get_type_from_name(&input, name);
|
||||||
|
|
||||||
|
assert_eq!(output.is_some(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn type_ref_is_optional_has_none() {
|
||||||
|
let input = TypeRef {
|
||||||
|
kind: None,
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
};
|
||||||
|
let output = type_ref_is_optional(&input);
|
||||||
|
|
||||||
|
assert_eq!(output, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn type_ref_is_optional_is_required() {
|
||||||
|
let input = TypeRef {
|
||||||
|
kind: Some(__TypeKind::NON_NULL),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
};
|
||||||
|
let output = type_ref_is_optional(&input);
|
||||||
|
|
||||||
|
assert_eq!(output, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn type_ref_is_optional_is_optional() {
|
||||||
|
let input = TypeRef {
|
||||||
|
kind: Some(__TypeKind::OBJECT),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
};
|
||||||
|
let output = type_ref_is_optional(&input);
|
||||||
|
|
||||||
|
assert_eq!(output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn input_values_has_optionals_none() {
|
||||||
|
let input = vec![];
|
||||||
|
|
||||||
|
let output = input_values_has_optionals(&input);
|
||||||
|
|
||||||
|
assert_eq!(output, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn input_values_has_optionals_has_optional() {
|
||||||
|
let input = vec![
|
||||||
|
InputValue {
|
||||||
|
name: "some-name".to_string(),
|
||||||
|
description: None,
|
||||||
|
type_: TypeRef {
|
||||||
|
kind: Some(__TypeKind::NON_NULL),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
},
|
||||||
|
default_value: None,
|
||||||
|
},
|
||||||
|
InputValue {
|
||||||
|
name: "some-other-name".to_string(),
|
||||||
|
description: None,
|
||||||
|
type_: TypeRef {
|
||||||
|
kind: Some(__TypeKind::OBJECT),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
},
|
||||||
|
default_value: None,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let output = input_values_has_optionals(input.iter().collect::<Vec<_>>().as_slice());
|
||||||
|
|
||||||
|
assert_eq!(output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn input_values_has_optionals_is_required() {
|
||||||
|
let input = vec![
|
||||||
|
InputValue {
|
||||||
|
name: "some-name".to_string(),
|
||||||
|
description: None,
|
||||||
|
type_: TypeRef {
|
||||||
|
kind: Some(__TypeKind::NON_NULL),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
},
|
||||||
|
default_value: None,
|
||||||
|
},
|
||||||
|
InputValue {
|
||||||
|
name: "some-other-name".to_string(),
|
||||||
|
description: None,
|
||||||
|
type_: TypeRef {
|
||||||
|
kind: Some(__TypeKind::NON_NULL),
|
||||||
|
name: None,
|
||||||
|
of_type: None,
|
||||||
|
},
|
||||||
|
default_value: None,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let output = input_values_has_optionals(input.iter().collect::<Vec<_>>().as_slice());
|
||||||
|
|
||||||
|
assert_eq!(output, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
crates/dagger-codegen/src/generator.rs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use dagger_core::introspection::Schema;
|
||||||
|
|
||||||
|
pub trait Generator {
|
||||||
|
fn generate(&self, schema: Schema) -> eyre::Result<String>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type DynGenerator = Arc<dyn Generator + Send + Sync>;
|
||||||
|
|
||||||
|
pub trait FormatTypeRefs {
|
||||||
|
fn format_kind_list(representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_string(representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_int(representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_float(representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_boolean(representation: &str) -> String;
|
||||||
|
fn format_kind_scalar_default(representation: &str, ref_name: &str, input: bool) -> String;
|
||||||
|
fn format_kind_object(representation: &str, ref_name: &str) -> String;
|
||||||
|
fn format_kind_input_object(representation: &str, ref_name: &str) -> String;
|
||||||
|
fn format_kind_enum(representation: &str, ref_name: &str) -> String;
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
use dagger_core::introspection::FullType;
|
|
||||||
use genco::{prelude::rust, quote};
|
|
||||||
|
|
||||||
use crate::predicates::is_enum_type;
|
|
||||||
|
|
||||||
use super::{utility::render_description, Handler};
|
|
||||||
|
|
||||||
pub struct Enumeration;
|
|
||||||
|
|
||||||
impl Handler for Enumeration {
|
|
||||||
fn predicate(&self, t: &FullType) -> bool {
|
|
||||||
is_enum_type(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
||||||
let name = t
|
|
||||||
.name
|
|
||||||
.as_ref()
|
|
||||||
.ok_or(eyre::anyhow!("could not get name from type"))?;
|
|
||||||
|
|
||||||
let description =
|
|
||||||
render_description(t).ok_or(eyre::anyhow!("could not find description"))?;
|
|
||||||
|
|
||||||
let out = quote! {
|
|
||||||
$description
|
|
||||||
pub enum $name {
|
|
||||||
// TODO: Add individual items
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
use convert_case::{Case, Casing};
|
|
||||||
use dagger_core::introspection::{FullTypeFields, FullTypeFieldsArgs};
|
|
||||||
use genco::{prelude::rust, quote};
|
|
||||||
|
|
||||||
use super::{
|
|
||||||
type_ref::{self, render_type_ref},
|
|
||||||
utility::{render_description_from_field, render_description_from_input_value},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn render_fields(fields: &Vec<FullTypeFields>) -> eyre::Result<Option<rust::Tokens>> {
|
|
||||||
let mut collected_fields: Vec<rust::Tokens> = vec![];
|
|
||||||
for field in fields.iter() {
|
|
||||||
let name = field.name.as_ref().map(|n| n.to_case(Case::Snake)).unwrap();
|
|
||||||
let output = render_field_output(field)?;
|
|
||||||
let description = render_description_from_field(field);
|
|
||||||
let args = match field.args.as_ref() {
|
|
||||||
Some(a) => render_args(a),
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut tkns = rust::Tokens::new();
|
|
||||||
if let Some(desc) = &description {
|
|
||||||
tkns.append(desc);
|
|
||||||
tkns.push()
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(args) = args.as_ref() {
|
|
||||||
if let Some(desc) = args.description.as_ref() {
|
|
||||||
tkns.append("/// # Arguments");
|
|
||||||
tkns.push();
|
|
||||||
tkns.append("///");
|
|
||||||
tkns.push();
|
|
||||||
tkns.append(desc);
|
|
||||||
tkns.push();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tkns.append(quote! {
|
|
||||||
pub fn $name(
|
|
||||||
&self,
|
|
||||||
$(if let Some(args) = args.as_ref() => $(&args.args))
|
|
||||||
) -> $output {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
collected_fields.push(tkns);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(quote! {
|
|
||||||
$(for field in collected_fields => $field $['\n'] )
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Arg {
|
|
||||||
name: String,
|
|
||||||
description: Option<rust::Tokens>,
|
|
||||||
type_: rust::Tokens,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CollectedArgs {
|
|
||||||
description: Option<rust::Tokens>,
|
|
||||||
args: rust::Tokens,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_args(args: &[Option<FullTypeFieldsArgs>]) -> Option<CollectedArgs> {
|
|
||||||
let mut collected_args: Vec<Arg> = vec![];
|
|
||||||
|
|
||||||
for arg in args {
|
|
||||||
if let Some(arg) = arg.as_ref().map(|a| &a.input_value) {
|
|
||||||
let name = arg.name.clone();
|
|
||||||
let description = render_description_from_input_value(&arg, &name);
|
|
||||||
let t = render_type_ref(&arg.type_).unwrap();
|
|
||||||
|
|
||||||
collected_args.push(Arg {
|
|
||||||
name,
|
|
||||||
description,
|
|
||||||
type_: t,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if collected_args.len() > 0 {
|
|
||||||
let mut collected_arg = CollectedArgs {
|
|
||||||
description: Some(rust::Tokens::new()),
|
|
||||||
args: rust::Tokens::new(),
|
|
||||||
};
|
|
||||||
|
|
||||||
for arg in collected_args {
|
|
||||||
if let Some(desc) = arg.description {
|
|
||||||
if let Some(inner_desc) = collected_arg.description.as_mut() {
|
|
||||||
inner_desc.append(desc);
|
|
||||||
inner_desc.push();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
collected_arg.args.append(quote! {
|
|
||||||
$(arg.name.to_case(Case::Snake)): $(arg.type_),
|
|
||||||
});
|
|
||||||
collected_arg.args.push();
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(desc) = collected_arg.description.as_ref() {
|
|
||||||
if desc.is_empty() {
|
|
||||||
collected_arg.description = None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(collected_arg)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn render_field_output(field: &FullTypeFields) -> eyre::Result<rust::Tokens> {
|
|
||||||
let inner = &field.type_.as_ref().unwrap();
|
|
||||||
type_ref::render_type_ref(&inner.type_ref)
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
use dagger_core::introspection::FullType;
|
|
||||||
use genco::prelude::rust;
|
|
||||||
use genco::prelude::*;
|
|
||||||
|
|
||||||
use crate::predicates::is_input_object_type;
|
|
||||||
|
|
||||||
use super::{input_field::render_input_fields, utility::render_description, Handler};
|
|
||||||
|
|
||||||
pub struct Input;
|
|
||||||
|
|
||||||
impl Handler for Input {
|
|
||||||
fn predicate(&self, t: &FullType) -> bool {
|
|
||||||
is_input_object_type(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
||||||
let name = t
|
|
||||||
.name
|
|
||||||
.as_ref()
|
|
||||||
.ok_or(eyre::anyhow!("could not find name"))?;
|
|
||||||
let description = render_description(t);
|
|
||||||
|
|
||||||
let input = rust::import("dagger_core", "Input");
|
|
||||||
|
|
||||||
let fields = match t.input_fields.as_ref() {
|
|
||||||
Some(i) => render_input_fields(i)?,
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let out = quote! {
|
|
||||||
$(if description.is_some() => $description)
|
|
||||||
pub struct $name {
|
|
||||||
$(if fields.is_some() => $fields)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl $input for $name {}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use dagger_core::introspection::{
|
|
||||||
FullType, FullTypeInputFields, InputValue, TypeRef, __TypeKind,
|
|
||||||
};
|
|
||||||
use pretty_assertions::assert_eq;
|
|
||||||
|
|
||||||
use crate::handlers::Handler;
|
|
||||||
|
|
||||||
use super::Input;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_gen_input() {
|
|
||||||
let input = Input {};
|
|
||||||
let t = FullType {
|
|
||||||
kind: Some(__TypeKind::INPUT_OBJECT),
|
|
||||||
name: Some("BuildArg".into()),
|
|
||||||
description: None,
|
|
||||||
input_fields: Some(vec![
|
|
||||||
FullTypeInputFields {
|
|
||||||
input_value: InputValue {
|
|
||||||
name: "name".into(),
|
|
||||||
description: None,
|
|
||||||
type_: TypeRef {
|
|
||||||
name: None,
|
|
||||||
kind: Some(__TypeKind::NON_NULL),
|
|
||||||
of_type: Some(Box::new(TypeRef {
|
|
||||||
kind: Some(__TypeKind::SCALAR),
|
|
||||||
name: Some("String".into()),
|
|
||||||
of_type: None,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
default_value: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
FullTypeInputFields {
|
|
||||||
input_value: InputValue {
|
|
||||||
name: "value".into(),
|
|
||||||
description: None,
|
|
||||||
type_: TypeRef {
|
|
||||||
name: None,
|
|
||||||
kind: Some(__TypeKind::NON_NULL),
|
|
||||||
of_type: Some(Box::new(TypeRef {
|
|
||||||
kind: Some(__TypeKind::SCALAR),
|
|
||||||
name: Some("String".into()),
|
|
||||||
of_type: None,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
default_value: None,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
interfaces: None,
|
|
||||||
enum_values: None,
|
|
||||||
possible_types: None,
|
|
||||||
fields: None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let expected = r#"use dagger_core::Input;
|
|
||||||
|
|
||||||
pub struct BuildArg {
|
|
||||||
pub name: Option<String>,
|
|
||||||
|
|
||||||
pub value: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Input for BuildArg {}
|
|
||||||
"#;
|
|
||||||
|
|
||||||
let output = input.render(&t).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(output.to_file_string().unwrap(), expected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
use dagger_core::introspection::FullTypeInputFields;
|
|
||||||
use genco::{prelude::rust, quote};
|
|
||||||
|
|
||||||
use super::type_ref;
|
|
||||||
|
|
||||||
pub fn render_input_fields(
|
|
||||||
input_fields: &Vec<FullTypeInputFields>,
|
|
||||||
) -> eyre::Result<Option<rust::Tokens>> {
|
|
||||||
let mut fields: Vec<(String, rust::Tokens)> = vec![];
|
|
||||||
for field in input_fields.iter() {
|
|
||||||
fields.push((field.input_value.name.clone(), render_input_field(field)?));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(quote! {
|
|
||||||
$(for (name, field) in fields => pub $name: $field, $['\n'] )
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn render_input_field(field: &FullTypeInputFields) -> eyre::Result<rust::Tokens> {
|
|
||||||
let inner = &field.input_value.type_;
|
|
||||||
type_ref::render_type_ref(inner)
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
pub mod enumeration;
|
|
||||||
mod fields;
|
|
||||||
pub mod input;
|
|
||||||
mod input_field;
|
|
||||||
pub mod object;
|
|
||||||
pub mod scalar;
|
|
||||||
mod type_ref;
|
|
||||||
mod utility;
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use dagger_core::introspection::FullType;
|
|
||||||
use genco::prelude::rust::Tokens;
|
|
||||||
use genco::prelude::*;
|
|
||||||
|
|
||||||
pub trait Handler {
|
|
||||||
fn predicate(&self, _t: &FullType) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
||||||
let tstruct = self.render_struct(t)?;
|
|
||||||
let timpl = self.render_impl(t)?;
|
|
||||||
let mut out = rust::Tokens::new();
|
|
||||||
out.append(tstruct);
|
|
||||||
out.push();
|
|
||||||
out.append(timpl);
|
|
||||||
out.push();
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_struct(&self, t: &FullType) -> eyre::Result<Tokens> {
|
|
||||||
let name = t.name.as_ref().ok_or(eyre::anyhow!("name not found"))?;
|
|
||||||
|
|
||||||
Ok(quote! {
|
|
||||||
pub struct $name {} {
|
|
||||||
// TODO: Add fields
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_impl(&self, t: &FullType) -> eyre::Result<Tokens> {
|
|
||||||
let name = t.name.as_ref().ok_or(eyre::anyhow!("name not found"))?;
|
|
||||||
|
|
||||||
Ok(quote! {
|
|
||||||
impl $name {} {
|
|
||||||
// TODO: Add fields
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type DynHandler = Arc<dyn Handler + Send + Sync>;
|
|
||||||
pub type Handlers = Vec<DynHandler>;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use dagger_core::introspection::FullType;
|
|
||||||
use pretty_assertions::assert_eq;
|
|
||||||
|
|
||||||
use super::Handler;
|
|
||||||
|
|
||||||
struct DefaultHandler;
|
|
||||||
impl Handler for DefaultHandler {}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn render_returns_expected() {
|
|
||||||
let handler = DefaultHandler {};
|
|
||||||
let t = FullType {
|
|
||||||
kind: None,
|
|
||||||
name: Some("SomeName".into()),
|
|
||||||
description: None,
|
|
||||||
fields: None,
|
|
||||||
input_fields: None,
|
|
||||||
interfaces: None,
|
|
||||||
enum_values: None,
|
|
||||||
possible_types: None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let res = handler.render(&t).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
res.to_string().unwrap(),
|
|
||||||
"pub struct SomeName {} {
|
|
||||||
|
|
||||||
}
|
|
||||||
impl SomeName {} {
|
|
||||||
|
|
||||||
}"
|
|
||||||
.to_string()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
use dagger_core::introspection::FullType;
|
|
||||||
use genco::{prelude::rust, quote};
|
|
||||||
|
|
||||||
use crate::predicates::is_object_type;
|
|
||||||
|
|
||||||
use super::{fields, input_field, utility::render_description, Handler};
|
|
||||||
|
|
||||||
pub struct Object;
|
|
||||||
|
|
||||||
impl Handler for Object {
|
|
||||||
fn predicate(&self, t: &FullType) -> bool {
|
|
||||||
is_object_type(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
||||||
let name = t
|
|
||||||
.name
|
|
||||||
.as_ref()
|
|
||||||
.ok_or(eyre::anyhow!("could not find name"))?;
|
|
||||||
let description = render_description(t);
|
|
||||||
|
|
||||||
let input = rust::import("dagger_core", "Input");
|
|
||||||
|
|
||||||
let fields = match t.fields.as_ref() {
|
|
||||||
Some(i) => fields::render_fields(i)?,
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let input_fields = match t.input_fields.as_ref() {
|
|
||||||
Some(i) => input_field::render_input_fields(i)?,
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let out = quote! {
|
|
||||||
$(if description.is_some() => $description)
|
|
||||||
pub struct $name {
|
|
||||||
$(if input_fields.is_some() => $input_fields)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl $name {
|
|
||||||
$(if fields.is_some() => $fields)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl $input for $name {}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use dagger_core::introspection::{
|
|
||||||
FullType, FullTypeFields, FullTypeFieldsType, TypeRef, __TypeKind,
|
|
||||||
};
|
|
||||||
use pretty_assertions::assert_eq;
|
|
||||||
|
|
||||||
use crate::handlers::Handler;
|
|
||||||
|
|
||||||
use super::Object;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_render_object() {
|
|
||||||
let t: FullType = FullType {
|
|
||||||
kind: Some(__TypeKind::OBJECT),
|
|
||||||
name: Some("CacheVolume".into()),
|
|
||||||
description: Some("A directory whose contents persists across sessions".into()),
|
|
||||||
fields: Some(vec![FullTypeFields {
|
|
||||||
name: Some("id".into()),
|
|
||||||
description: None,
|
|
||||||
args: None,
|
|
||||||
type_: Some(FullTypeFieldsType {
|
|
||||||
type_ref: TypeRef {
|
|
||||||
kind: Some(__TypeKind::NON_NULL),
|
|
||||||
name: None,
|
|
||||||
of_type: Some(Box::new(TypeRef {
|
|
||||||
kind: Some(__TypeKind::SCALAR),
|
|
||||||
name: Some("CacheID".into()),
|
|
||||||
of_type: None,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
is_deprecated: Some(false),
|
|
||||||
deprecation_reason: None,
|
|
||||||
}]),
|
|
||||||
input_fields: None,
|
|
||||||
interfaces: None,
|
|
||||||
enum_values: None,
|
|
||||||
possible_types: None,
|
|
||||||
};
|
|
||||||
let expected = r#"use dagger_core::Input;
|
|
||||||
|
|
||||||
|
|
||||||
/// A directory whose contents persists across sessions
|
|
||||||
pub struct CacheVolume {}
|
|
||||||
|
|
||||||
impl CacheVolume {
|
|
||||||
pub fn id(
|
|
||||||
&self,
|
|
||||||
) -> Option<CacheID> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Input for CacheVolume {}
|
|
||||||
"#;
|
|
||||||
let handler = Object {};
|
|
||||||
let obj = handler.render(&t).unwrap();
|
|
||||||
let actual = obj.to_file_string().unwrap();
|
|
||||||
|
|
||||||
assert_eq!(actual, expected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
use dagger_core::introspection::FullType;
|
|
||||||
use genco::{prelude::rust, quote};
|
|
||||||
|
|
||||||
use crate::predicates::is_custom_scalar_type;
|
|
||||||
|
|
||||||
use super::{utility::render_description, Handler};
|
|
||||||
|
|
||||||
pub struct Scalar;
|
|
||||||
|
|
||||||
impl Handler for Scalar {
|
|
||||||
fn predicate(&self, t: &FullType) -> bool {
|
|
||||||
is_custom_scalar_type(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&self, t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
||||||
let mut out = rust::Tokens::new();
|
|
||||||
|
|
||||||
let description =
|
|
||||||
render_description(t).ok_or(eyre::anyhow!("could not find description"))?;
|
|
||||||
let tstruct = self.render_struct(t)?;
|
|
||||||
|
|
||||||
out.append(description);
|
|
||||||
out.push();
|
|
||||||
out.append(tstruct);
|
|
||||||
|
|
||||||
Ok(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_struct(&self, t: &FullType) -> eyre::Result<genco::prelude::rust::Tokens> {
|
|
||||||
let name = t.name.as_ref().ok_or(eyre::anyhow!("name not found"))?;
|
|
||||||
|
|
||||||
let scalar = rust::import("dagger_core", "Scalar");
|
|
||||||
|
|
||||||
Ok(quote! {
|
|
||||||
pub struct $name($scalar);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_impl(&self, _t: &FullType) -> eyre::Result<genco::prelude::rust::Tokens> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
use dagger_core::introspection::TypeRef;
|
|
||||||
use genco::prelude::rust;
|
|
||||||
use genco::prelude::*;
|
|
||||||
|
|
||||||
use crate::predicates::{
|
|
||||||
is_custom_scalar_type_ref, is_list_type, is_required_type_ref, is_scalar_type_ref,
|
|
||||||
};
|
|
||||||
|
|
||||||
//fn optional(t: rust::Tokens) -> impl FormatInto<Rust> {
|
|
||||||
// quote_fn! {"Option<$[const](t)>"}
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//fn required(t: rust::Tokens) -> impl FormatInto<Rust> {
|
|
||||||
// quote_fn! {"$[const](t)"}
|
|
||||||
//}
|
|
||||||
|
|
||||||
pub fn render_type_ref(inner: &TypeRef) -> eyre::Result<rust::Tokens> {
|
|
||||||
let extract_of_type = |t: &TypeRef| -> Option<TypeRef> {
|
|
||||||
return t.clone().of_type.map(|t| *t);
|
|
||||||
};
|
|
||||||
|
|
||||||
let (optional, inner) = if !is_required_type_ref(inner) {
|
|
||||||
(true, inner.clone())
|
|
||||||
} else {
|
|
||||||
(false, extract_of_type(inner).unwrap())
|
|
||||||
};
|
|
||||||
|
|
||||||
if is_list_type(&inner) {
|
|
||||||
if let Some(inner_of_type) = extract_of_type(&inner) {
|
|
||||||
let inner_field = render_type_ref(&inner_of_type)?;
|
|
||||||
if optional {
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<Vec<$inner_field>>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Ok(quote! {
|
|
||||||
Vec<$inner_field>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_custom_scalar_type_ref(&inner) {
|
|
||||||
if let Some(inner_of_type) = extract_of_type(&inner) {
|
|
||||||
let inner_field = render_type_ref(&inner_of_type)?;
|
|
||||||
if optional {
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<$inner_field>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Ok(quote! {
|
|
||||||
$inner_field
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_scalar_type_ref(&inner) {
|
|
||||||
let name = match inner.name.as_ref().map(|s| s.as_str()) {
|
|
||||||
Some("ID") => "ID",
|
|
||||||
Some("Int") => "Int",
|
|
||||||
Some("String") => "String",
|
|
||||||
Some("Float") => "Float",
|
|
||||||
Some("Boolean") => "Boolean",
|
|
||||||
Some("Date") => "Date",
|
|
||||||
Some("DateTime") => "DateTime",
|
|
||||||
Some("Time") => "Time",
|
|
||||||
Some("Decimal") => "Decimal",
|
|
||||||
Some(n) => n,
|
|
||||||
_ => eyre::bail!("missing type in the end of chain"),
|
|
||||||
};
|
|
||||||
|
|
||||||
if optional {
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<$name>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(quote! {
|
|
||||||
$name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(inner_type) = inner.of_type.as_ref() {
|
|
||||||
let inner_field = render_type_ref(&inner_type)?;
|
|
||||||
if optional {
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<$inner_field>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(inner_field);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(name) = inner.name.as_ref() {
|
|
||||||
if optional {
|
|
||||||
return Ok(quote! {
|
|
||||||
Option<$name>
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Ok(quote! {
|
|
||||||
$name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
eyre::bail!("could not determine type")
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
use dagger_core::introspection::{FullType, FullTypeFields, InputValue};
|
|
||||||
use genco::{prelude::*, quote};
|
|
||||||
|
|
||||||
pub fn render_description(t: &FullType) -> Option<rust::Tokens> {
|
|
||||||
if let Some(description) = t.description.as_ref() {
|
|
||||||
let lines = description.split('\n');
|
|
||||||
let output: rust::Tokens = quote! {
|
|
||||||
$(for line in lines => $(format!("\n/// {line}")))
|
|
||||||
};
|
|
||||||
|
|
||||||
return Some(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn render_description_from_field(t: &FullTypeFields) -> Option<rust::Tokens> {
|
|
||||||
if let Some(description) = t.description.as_ref() {
|
|
||||||
let lines = description.split('\n');
|
|
||||||
let output: rust::Tokens = quote! {
|
|
||||||
$(for line in lines => $(format!("\n/// {line}")))
|
|
||||||
};
|
|
||||||
|
|
||||||
return Some(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn render_description_from_input_value(t: &InputValue, name: &String) -> Option<rust::Tokens> {
|
|
||||||
if let Some(description) = t.description.as_ref() {
|
|
||||||
if description == "" {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let lines = description.split('\n').collect::<Vec<&str>>();
|
|
||||||
let mut output = rust::Tokens::new();
|
|
||||||
|
|
||||||
if let Some(line) = lines.first() {
|
|
||||||
output.append(quote! {
|
|
||||||
$(format!("/// * `{name}` - {line}"))
|
|
||||||
});
|
|
||||||
output.push();
|
|
||||||
}
|
|
||||||
|
|
||||||
for line in lines.iter().skip(1) {
|
|
||||||
output.append(quote! {
|
|
||||||
$(format!("/// {line}"))
|
|
||||||
});
|
|
||||||
output.push();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Some(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,27 @@
|
|||||||
pub mod codegen;
|
#![deny(warnings)]
|
||||||
mod handlers;
|
|
||||||
mod models;
|
mod functions;
|
||||||
mod predicates;
|
mod generator;
|
||||||
|
pub mod rust;
|
||||||
|
pub mod utility;
|
||||||
|
mod visitor;
|
||||||
|
|
||||||
|
use dagger_core::introspection::Schema;
|
||||||
|
|
||||||
|
use self::generator::DynGenerator;
|
||||||
|
|
||||||
|
fn set_schema_parents(mut schema: Schema) -> Schema {
|
||||||
|
for t in schema.types.as_mut().into_iter().flatten().flatten() {
|
||||||
|
let t_parent = t.full_type.clone();
|
||||||
|
for mut field in t.full_type.fields.as_mut().into_iter().flatten() {
|
||||||
|
field.parent_type = Some(t_parent.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn generate(schema: Schema, generator: DynGenerator) -> eyre::Result<String> {
|
||||||
|
let schema = set_schema_parents(schema);
|
||||||
|
generator.generate(schema)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
pub enum Scalars {
|
|
||||||
ID(String),
|
|
||||||
Int(usize),
|
|
||||||
String(String),
|
|
||||||
Float(f64),
|
|
||||||
Boolean(bool),
|
|
||||||
Date(String),
|
|
||||||
DateTime(String),
|
|
||||||
Time(String),
|
|
||||||
Decimal(f64),
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
use dagger_core::introspection::{FullType, FullTypeInputFields, TypeRef, __TypeKind};
|
|
||||||
|
|
||||||
use crate::models::Scalars;
|
|
||||||
|
|
||||||
pub fn is_scalar_type(t: &FullType) -> bool {
|
|
||||||
if let Some(__TypeKind::SCALAR) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_scalar_type_ref(t: &TypeRef) -> bool {
|
|
||||||
if let Some(__TypeKind::SCALAR) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_enum_type(t: &FullType) -> bool {
|
|
||||||
if let Some(__TypeKind::ENUM) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_input_object_type(t: &FullType) -> bool {
|
|
||||||
if let Some(__TypeKind::INPUT_OBJECT) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_required_type(t: &FullTypeInputFields) -> bool {
|
|
||||||
match t.input_value.type_.kind {
|
|
||||||
Some(__TypeKind::NON_NULL) => return true,
|
|
||||||
Some(_) => return false,
|
|
||||||
_ => return false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_required_type_ref(t: &TypeRef) -> bool {
|
|
||||||
match t.kind {
|
|
||||||
Some(__TypeKind::NON_NULL) => return true,
|
|
||||||
Some(_) => return false,
|
|
||||||
_ => return false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_list_type(t: &TypeRef) -> bool {
|
|
||||||
if let Some(__TypeKind::LIST) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_object_type(t: &FullType) -> bool {
|
|
||||||
if let Some(__TypeKind::OBJECT) = t.kind {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_custom_scalar_type(t: &FullType) -> bool {
|
|
||||||
if is_scalar_type(t) {
|
|
||||||
// TODO: Insert scalar
|
|
||||||
let _ = match t.name.as_ref().map(|s| s.as_str()) {
|
|
||||||
Some("ID") => Scalars::ID("ID".into()),
|
|
||||||
Some("Int") => Scalars::Int(0),
|
|
||||||
Some("String") => Scalars::String("ID".into()),
|
|
||||||
Some("Float") => Scalars::Float(0.0),
|
|
||||||
Some("Boolean") => Scalars::Boolean(false),
|
|
||||||
Some("Date") => Scalars::Date("ID".into()),
|
|
||||||
Some("DateTime") => Scalars::DateTime("ID".into()),
|
|
||||||
Some("Time") => Scalars::Time("ID".into()),
|
|
||||||
Some("Decimal") => Scalars::Decimal(0.0),
|
|
||||||
Some(_) => return true,
|
|
||||||
None => return false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_custom_scalar_type_ref(t: &TypeRef) -> bool {
|
|
||||||
if is_scalar_type_ref(t) {
|
|
||||||
// TODO: Insert scalar
|
|
||||||
let _ = match t.name.as_ref().map(|s| s.as_str()) {
|
|
||||||
Some("ID") => Scalars::ID("ID".into()),
|
|
||||||
Some("Int") => Scalars::Int(0),
|
|
||||||
Some("String") => Scalars::String("ID".into()),
|
|
||||||
Some("Float") => Scalars::Float(0.0),
|
|
||||||
Some("Boolean") => Scalars::Boolean(false),
|
|
||||||
Some("Date") => Scalars::Date("ID".into()),
|
|
||||||
Some("DateTime") => Scalars::DateTime("ID".into()),
|
|
||||||
Some("Time") => Scalars::Time("ID".into()),
|
|
||||||
Some("Decimal") => Scalars::Decimal(0.0),
|
|
||||||
Some(_) => return true,
|
|
||||||
None => return false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
68
crates/dagger-codegen/src/rust/format.rs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
use crate::functions::FormatTypeFuncs;
|
||||||
|
|
||||||
|
use super::functions::format_name;
|
||||||
|
|
||||||
|
pub struct FormatTypeFunc;
|
||||||
|
|
||||||
|
impl FormatTypeFuncs for FormatTypeFunc {
|
||||||
|
fn format_kind_list(&self, representation: &str, _input: bool, _immutable: bool) -> String {
|
||||||
|
format!("Vec<{}>", representation)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_scalar_string(&self, representation: &str, input: bool) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
if input {
|
||||||
|
rep.push_str("impl Into<String>");
|
||||||
|
} else {
|
||||||
|
rep.push_str("String");
|
||||||
|
}
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_scalar_int(&self, representation: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str("isize");
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_scalar_float(&self, representation: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str("float");
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_scalar_boolean(&self, representation: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str("bool");
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_scalar_default(
|
||||||
|
&self,
|
||||||
|
representation: &str,
|
||||||
|
ref_name: &str,
|
||||||
|
_input: bool,
|
||||||
|
) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str(&format_name(ref_name));
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_object(&self, representation: &str, ref_name: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str(&format_name(ref_name));
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_input_object(&self, representation: &str, ref_name: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str(&format_name(ref_name));
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_kind_enum(&self, representation: &str, ref_name: &str) -> String {
|
||||||
|
let mut rep = representation.to_string();
|
||||||
|
rep.push_str(&format_name(ref_name));
|
||||||
|
rep
|
||||||
|
}
|
||||||
|
}
|
||||||
445
crates/dagger-codegen/src/rust/functions.rs
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
use convert_case::{Case, Casing};
|
||||||
|
use dagger_core::introspection::{FullTypeFields, TypeRef};
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
use genco::tokens::quoted;
|
||||||
|
|
||||||
|
use crate::functions::{
|
||||||
|
type_field_has_optional, type_ref_is_enum, type_ref_is_list, type_ref_is_list_of_objects,
|
||||||
|
type_ref_is_object, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
|
||||||
|
};
|
||||||
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
|
use super::templates::object_tmpl::render_optional_field_args;
|
||||||
|
|
||||||
|
pub fn format_name(s: &str) -> String {
|
||||||
|
s.to_case(Case::Pascal)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_struct_name(s: &str) -> String {
|
||||||
|
s.to_case(Case::Snake)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn field_options_struct_name(field: &FullTypeFields) -> Option<String> {
|
||||||
|
field
|
||||||
|
.parent_type
|
||||||
|
.as_ref()
|
||||||
|
.map(|p| p.name.as_ref().map(|n| format_name(n)))
|
||||||
|
.flatten()
|
||||||
|
.zip(field.name.as_ref().map(|n| format_name(n)))
|
||||||
|
.map(|(parent_name, field_name)| format!("{parent_name}{field_name}Opts"))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_function(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
let is_async = field.type_.pipe(|t| &t.type_ref).pipe(|t| {
|
||||||
|
if type_ref_is_object(&t) || type_ref_is_list_of_objects(&t) {
|
||||||
|
return None;
|
||||||
|
} else {
|
||||||
|
return Some(quote! {
|
||||||
|
async
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let signature = quote! {
|
||||||
|
pub $(is_async) fn $(field.name.pipe(|n | format_struct_name(n)))
|
||||||
|
};
|
||||||
|
|
||||||
|
let lifecycle = format_optional_args(funcs, field)
|
||||||
|
.pipe(|(_, contains_lifecycle)| contains_lifecycle)
|
||||||
|
.and_then(|c| {
|
||||||
|
if *c {
|
||||||
|
Some(quote! {
|
||||||
|
<'a>
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let args = format_function_args(funcs, field, lifecycle.as_ref());
|
||||||
|
|
||||||
|
let output_type = field
|
||||||
|
.type_
|
||||||
|
.pipe(|t| &t.type_ref)
|
||||||
|
.pipe(|t| render_output_type(funcs, t));
|
||||||
|
|
||||||
|
if let Some((args, desc, true)) = args {
|
||||||
|
let required_args = format_required_function_args(funcs, field);
|
||||||
|
Some(quote! {
|
||||||
|
$(field.description.pipe(|d| format_struct_comment(d)))
|
||||||
|
$(&desc)
|
||||||
|
$(&signature)(
|
||||||
|
$(required_args)
|
||||||
|
) -> $(output_type.as_ref()) {
|
||||||
|
let mut query = self.selection.select($(quoted(field.name.as_ref())));
|
||||||
|
|
||||||
|
$(render_required_args(funcs, field))
|
||||||
|
|
||||||
|
$(render_execution(funcs, field))
|
||||||
|
}
|
||||||
|
|
||||||
|
$(field.description.pipe(|d| format_struct_comment(d)))
|
||||||
|
$(&desc)
|
||||||
|
$(&signature)_opts$(lifecycle)(
|
||||||
|
$args
|
||||||
|
) -> $(output_type) {
|
||||||
|
let mut query = self.selection.select($(quoted(field.name.as_ref())));
|
||||||
|
|
||||||
|
$(render_required_args(funcs, field))
|
||||||
|
$(render_optional_args(funcs, field))
|
||||||
|
|
||||||
|
$(render_execution(funcs, field))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Some(quote! {
|
||||||
|
$(field.description.pipe(|d| format_struct_comment(d)))
|
||||||
|
$(if let Some((_, desc, _)) = &args => $desc)
|
||||||
|
$(signature)(
|
||||||
|
$(if let Some((args, _, _)) = &args => $args)
|
||||||
|
) -> $(output_type) {
|
||||||
|
let mut query = self.selection.select($(quoted(field.name.as_ref())));
|
||||||
|
|
||||||
|
$(render_required_args(funcs, field))
|
||||||
|
$(render_optional_args(funcs, field))
|
||||||
|
|
||||||
|
$(render_execution(funcs, field))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
if let Some(args) = field.args.as_ref() {
|
||||||
|
let args = args
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| {
|
||||||
|
a.as_ref().and_then(|s| {
|
||||||
|
if type_ref_is_optional(&s.input_value.type_) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let n = format_struct_name(&s.input_value.name);
|
||||||
|
let name = &s.input_value.name;
|
||||||
|
|
||||||
|
if type_ref_is_scalar(&s.input_value.type_) {
|
||||||
|
if let Scalar::String =
|
||||||
|
Scalar::from(&*s.input_value.type_.of_type.as_ref().unwrap().clone())
|
||||||
|
{
|
||||||
|
return Some(quote! {
|
||||||
|
query = query.arg($(quoted(name)), $(&n).into());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if type_ref_is_enum(&s.input_value.type_) {
|
||||||
|
return Some(quote! {
|
||||||
|
query = query.arg_enum($(quoted(name)), $(n));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if type_ref_is_list(&s.input_value.type_) {
|
||||||
|
let inner = *s
|
||||||
|
.input_value
|
||||||
|
.type_
|
||||||
|
.of_type
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone()
|
||||||
|
.of_type
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.clone();
|
||||||
|
println!("type: {:?}", inner);
|
||||||
|
if type_ref_is_scalar(&inner) {
|
||||||
|
if let Scalar::String =
|
||||||
|
Scalar::from(&*inner.of_type.as_ref().unwrap().clone())
|
||||||
|
{
|
||||||
|
return Some(quote! {
|
||||||
|
query = query.arg($(quoted(name)), $(&n).into_iter().map(|i| i.into()).collect::<Vec<String>>());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
query = query.arg($(quoted(name)), $(n));
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let required_args = quote! {
|
||||||
|
$(for arg in args join ($['\r']) => $arg)
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(required_args)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
if let Some(args) = field.args.as_ref() {
|
||||||
|
let args = args
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| {
|
||||||
|
a.as_ref().and_then(|s| {
|
||||||
|
if !type_ref_is_optional(&s.input_value.type_) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let n = format_struct_name(&s.input_value.name);
|
||||||
|
let name = &s.input_value.name;
|
||||||
|
|
||||||
|
if type_ref_is_enum(&s.input_value.type_) {
|
||||||
|
return Some(quote! {
|
||||||
|
if let Some($(&n)) = opts.$(&n) {
|
||||||
|
query = query.arg_enum($(quoted(name)), $(n));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
if let Some($(&n)) = opts.$(&n) {
|
||||||
|
query = query.arg($(quoted(name)), $(&n));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if args.len() == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let required_args = quote! {
|
||||||
|
$(for arg in args join ($['\r']) => $arg)
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(required_args)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_output_type(funcs: &CommonFunctions, type_ref: &TypeRef) -> rust::Tokens {
|
||||||
|
let output_type = funcs.format_output_type(type_ref);
|
||||||
|
|
||||||
|
if type_ref_is_object(type_ref) || type_ref_is_list_of_objects(type_ref) {
|
||||||
|
return quote! {
|
||||||
|
$(output_type)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
quote! {
|
||||||
|
eyre::Result<$output_type>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::Tokens {
|
||||||
|
if let Some(true) = field.type_.pipe(|t| type_ref_is_object(&t.type_ref)) {
|
||||||
|
let output_type = funcs.format_output_type(&field.type_.as_ref().unwrap().type_ref);
|
||||||
|
return quote! {
|
||||||
|
return $(output_type) {
|
||||||
|
proc: self.proc.clone(),
|
||||||
|
selection: query,
|
||||||
|
conn: self.conn.clone(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(true) = field
|
||||||
|
.type_
|
||||||
|
.pipe(|t| type_ref_is_list_of_objects(&t.type_ref))
|
||||||
|
{
|
||||||
|
let output_type = funcs.format_output_type(
|
||||||
|
&field
|
||||||
|
.type_
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.type_ref
|
||||||
|
.of_type
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.of_type
|
||||||
|
.as_ref()
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
return quote! {
|
||||||
|
return vec![$(output_type) {
|
||||||
|
proc: self.proc.clone(),
|
||||||
|
selection: query,
|
||||||
|
conn: self.conn.clone(),
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let graphql_client = rust::import("crate::client", "graphql_client");
|
||||||
|
|
||||||
|
quote! {
|
||||||
|
query.execute(&$graphql_client(&self.conn)).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_function_args(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
field: &FullTypeFields,
|
||||||
|
lifecycle: Option<&rust::Tokens>,
|
||||||
|
) -> Option<(rust::Tokens, rust::Tokens, bool)> {
|
||||||
|
let mut argument_description = Vec::new();
|
||||||
|
if let Some(args) = field.args.as_ref() {
|
||||||
|
let args = args
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| {
|
||||||
|
a.as_ref().and_then(|s| {
|
||||||
|
if type_ref_is_optional(&s.input_value.type_) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let t = funcs.format_input_type(&s.input_value.type_);
|
||||||
|
let n = format_struct_name(&s.input_value.name);
|
||||||
|
|
||||||
|
if let Some(desc) = s.input_value.description.as_ref().and_then(|d| {
|
||||||
|
if d != "" {
|
||||||
|
Some(write_comment_line(&format!("* `{n}` - {}", d)))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
argument_description.push(quote! {
|
||||||
|
$(desc)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
$(n): $(t),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let required_args = quote! {
|
||||||
|
&self,
|
||||||
|
$(for arg in args join ($['\r']) => $arg)
|
||||||
|
};
|
||||||
|
|
||||||
|
if type_field_has_optional(field) {
|
||||||
|
let field_name = field_options_struct_name(field);
|
||||||
|
argument_description.push(quote! {
|
||||||
|
$(field_name.pipe(|_| write_comment_line(&format!("* `opt` - optional argument, see inner type for documentation, use <func>_opts to use"))))
|
||||||
|
});
|
||||||
|
|
||||||
|
let description = quote! {
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// ")))
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// # Arguments")))
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// ")))
|
||||||
|
$(for arg_desc in argument_description join ($['\r']) => $arg_desc)
|
||||||
|
};
|
||||||
|
|
||||||
|
Some((
|
||||||
|
quote! {
|
||||||
|
$(required_args)
|
||||||
|
opts: $(field_name)$(lifecycle)
|
||||||
|
},
|
||||||
|
description,
|
||||||
|
true,
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
let description = quote! {
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// ")))
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// # Arguments")))
|
||||||
|
$(if argument_description.len() > 0 => $(format!("/// ")))
|
||||||
|
$(for arg_desc in argument_description join ($['\r']) => $arg_desc)
|
||||||
|
};
|
||||||
|
Some((required_args, description, false))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_required_function_args(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
field: &FullTypeFields,
|
||||||
|
) -> Option<rust::Tokens> {
|
||||||
|
if let Some(args) = field.args.as_ref() {
|
||||||
|
let args = args
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| {
|
||||||
|
a.as_ref().and_then(|s| {
|
||||||
|
if type_ref_is_optional(&s.input_value.type_) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let t = funcs.format_input_type(&s.input_value.type_);
|
||||||
|
let n = format_struct_name(&s.input_value.name);
|
||||||
|
|
||||||
|
Some(quote! {
|
||||||
|
$(n): $(t),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let required_args = quote! {
|
||||||
|
&self,
|
||||||
|
$(for arg in args join ($['\r']) => $arg)
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(required_args)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_optional_args(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
field: &FullTypeFields,
|
||||||
|
) -> Option<(rust::Tokens, bool)> {
|
||||||
|
field
|
||||||
|
.args
|
||||||
|
.pipe(|t| t.into_iter().flatten().collect::<Vec<_>>())
|
||||||
|
.map(|t| {
|
||||||
|
t.into_iter()
|
||||||
|
.filter(|t| type_ref_is_optional(&t.input_value.type_))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
})
|
||||||
|
.pipe(|t| render_optional_field_args(funcs, t))
|
||||||
|
.flatten()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write_comment_line(content: &str) -> Option<rust::Tokens> {
|
||||||
|
let cnt = content.trim();
|
||||||
|
if cnt == "" {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut tokens = rust::Tokens::new();
|
||||||
|
|
||||||
|
for line in content.split('\n') {
|
||||||
|
tokens.append(format!("/// {}", line.trim()));
|
||||||
|
tokens.push();
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(tokens)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format_struct_comment(desc: &str) -> Option<rust::Tokens> {
|
||||||
|
let lines = desc.trim().split("\n");
|
||||||
|
|
||||||
|
let formatted_lines = lines
|
||||||
|
.into_iter()
|
||||||
|
.map(write_comment_line)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if formatted_lines.len() > 0 {
|
||||||
|
Some(quote! {
|
||||||
|
$(for line in formatted_lines join($['\r']) => $line)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
114
crates/dagger-codegen/src/rust/mod.rs
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
pub mod format;
|
||||||
|
mod functions;
|
||||||
|
pub mod templates;
|
||||||
|
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use dagger_core::introspection::Schema;
|
||||||
|
use eyre::Context;
|
||||||
|
use genco::prelude::rust;
|
||||||
|
|
||||||
|
use crate::functions::CommonFunctions;
|
||||||
|
use crate::generator::Generator;
|
||||||
|
use crate::visitor::{VisitHandlers, Visitor};
|
||||||
|
|
||||||
|
use self::format::FormatTypeFunc;
|
||||||
|
use self::templates::enum_tmpl::render_enum;
|
||||||
|
use self::templates::input_tmpl::render_input;
|
||||||
|
use self::templates::object_tmpl::render_object;
|
||||||
|
use self::templates::scalar_tmpl::render_scalar;
|
||||||
|
|
||||||
|
pub struct RustGenerator {}
|
||||||
|
|
||||||
|
impl Generator for RustGenerator {
|
||||||
|
fn generate(&self, schema: Schema) -> eyre::Result<String> {
|
||||||
|
let render = Arc::new(Mutex::new(rust::Tokens::new()));
|
||||||
|
let common_funcs = Arc::new(CommonFunctions::new(Arc::new(FormatTypeFunc {})));
|
||||||
|
println!("generating dagger for rust");
|
||||||
|
|
||||||
|
let visitor = Visitor {
|
||||||
|
schema,
|
||||||
|
handlers: VisitHandlers {
|
||||||
|
visit_scalar: Arc::new({
|
||||||
|
let render = render.clone();
|
||||||
|
let _common_funcs = common_funcs.clone();
|
||||||
|
|
||||||
|
move |t| {
|
||||||
|
println!("generating scalar");
|
||||||
|
let rendered_scalar = render_scalar(t)?;
|
||||||
|
|
||||||
|
let mut render = render.lock().unwrap();
|
||||||
|
|
||||||
|
render.append(rendered_scalar);
|
||||||
|
render.push();
|
||||||
|
|
||||||
|
println!("generated scalar");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
visit_object: Arc::new({
|
||||||
|
let render = render.clone();
|
||||||
|
let common_funcs = common_funcs.clone();
|
||||||
|
|
||||||
|
move |t| {
|
||||||
|
println!("generating object");
|
||||||
|
let rendered_scalar = render_object(&common_funcs, t)?;
|
||||||
|
|
||||||
|
let mut render = render.lock().unwrap();
|
||||||
|
|
||||||
|
render.append(rendered_scalar);
|
||||||
|
render.push();
|
||||||
|
println!("generated object");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
visit_input: Arc::new({
|
||||||
|
let render = render.clone();
|
||||||
|
let common_funcs = common_funcs.clone();
|
||||||
|
|
||||||
|
move |t| {
|
||||||
|
println!("generating input");
|
||||||
|
let rendered_scalar = render_input(&common_funcs, t)?;
|
||||||
|
|
||||||
|
let mut render = render.lock().unwrap();
|
||||||
|
|
||||||
|
render.append(rendered_scalar);
|
||||||
|
render.push();
|
||||||
|
println!("generated input");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
visit_enum: Arc::new({
|
||||||
|
let render = render.clone();
|
||||||
|
let _common_funcs = common_funcs.clone();
|
||||||
|
|
||||||
|
move |t| {
|
||||||
|
println!("generating enum");
|
||||||
|
let rendered_scalar = render_enum(t)?;
|
||||||
|
|
||||||
|
let mut render = render.lock().unwrap();
|
||||||
|
|
||||||
|
render.append(rendered_scalar);
|
||||||
|
render.push();
|
||||||
|
println!("generated enum");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
visitor.run()?;
|
||||||
|
|
||||||
|
println!("done generating objects");
|
||||||
|
|
||||||
|
let rendered = render.lock().unwrap();
|
||||||
|
|
||||||
|
rendered
|
||||||
|
.to_file_string()
|
||||||
|
.context("could not render to file string")
|
||||||
|
}
|
||||||
|
}
|
||||||
37
crates/dagger-codegen/src/rust/templates/enum_tmpl.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
use dagger_core::introspection::FullType;
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
|
||||||
|
fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
|
||||||
|
let values = values
|
||||||
|
.enum_values
|
||||||
|
.as_ref()
|
||||||
|
.into_iter()
|
||||||
|
.map(|values| {
|
||||||
|
values
|
||||||
|
.into_iter()
|
||||||
|
.map(|val| quote! { $(val.name.as_ref()), })
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let mut tokens = rust::Tokens::new();
|
||||||
|
for val in values {
|
||||||
|
tokens.append(val);
|
||||||
|
tokens.push();
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(tokens)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_enum(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
|
let serialize = rust::import("serde", "Serialize");
|
||||||
|
let deserialize = rust::import("serde", "Deserialize");
|
||||||
|
|
||||||
|
Ok(quote! {
|
||||||
|
#[derive($serialize, $deserialize, Clone, PartialEq, Debug)]
|
||||||
|
pub enum $(t.name.as_ref()) {
|
||||||
|
$(render_enum_values(t))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
38
crates/dagger-codegen/src/rust/templates/input_tmpl.rs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
use dagger_core::introspection::{FullType, FullTypeInputFields};
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
|
||||||
|
use crate::functions::CommonFunctions;
|
||||||
|
use crate::rust::functions::{format_name, format_struct_name};
|
||||||
|
|
||||||
|
pub fn render_input(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
|
let deserialize = rust::import("serde", "Deserialize");
|
||||||
|
let serialize = rust::import("serde", "Serialize");
|
||||||
|
Ok(quote! {
|
||||||
|
#[derive($serialize, $deserialize, Debug, PartialEq, Clone)]
|
||||||
|
pub struct $(format_name(t.name.as_ref().unwrap())) {
|
||||||
|
$(render_input_fields(funcs, t.input_fields.as_ref().unwrap_or(&Vec::new()) ))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_input_fields(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
fields: &[FullTypeInputFields],
|
||||||
|
) -> Option<rust::Tokens> {
|
||||||
|
let rendered_fields = fields.iter().map(|f| render_input_field(funcs, f));
|
||||||
|
|
||||||
|
if rendered_fields.len() == 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(quote! {
|
||||||
|
$(for field in rendered_fields join ($['\r']) => $field)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_input_field(funcs: &CommonFunctions, field: &FullTypeInputFields) -> rust::Tokens {
|
||||||
|
quote! {
|
||||||
|
pub $(format_struct_name(&field.input_value.name)): $(funcs.format_output_type(&field.input_value.type_)),
|
||||||
|
}
|
||||||
|
}
|
||||||
4
crates/dagger-codegen/src/rust/templates/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
pub mod enum_tmpl;
|
||||||
|
pub mod input_tmpl;
|
||||||
|
pub mod object_tmpl;
|
||||||
|
pub mod scalar_tmpl;
|
||||||
121
crates/dagger-codegen/src/rust/templates/object_tmpl.rs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
use dagger_core::introspection::{FullType, FullTypeFields, FullTypeFieldsArgs};
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
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("tokio::process", "Child");
|
||||||
|
let conn = rust::import("dagger_core::connect_params", "ConnectParams");
|
||||||
|
let arc = rust::import("std::sync", "Arc");
|
||||||
|
|
||||||
|
Ok(quote! {
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct $(t.name.pipe(|s| format_name(s))) {
|
||||||
|
pub proc: $arc<$child>,
|
||||||
|
pub selection: $selection,
|
||||||
|
pub conn: $conn,
|
||||||
|
}
|
||||||
|
|
||||||
|
$(t.fields.pipe(|f| render_optional_args(funcs, f)))
|
||||||
|
|
||||||
|
impl $(t.name.pipe(|s| format_name(s))) {
|
||||||
|
$(t.fields.pipe(|f| render_functions(funcs, f)))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_optional_args(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
fields: &Vec<FullTypeFields>,
|
||||||
|
) -> Option<rust::Tokens> {
|
||||||
|
let rendered_fields = fields
|
||||||
|
.iter()
|
||||||
|
.map(|f| render_optional_arg(funcs, f))
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if rendered_fields.len() == 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(quote! {
|
||||||
|
$(for field in rendered_fields join ($['\r']) => $field)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_optional_arg(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
let output_type = field_options_struct_name(field);
|
||||||
|
let fields = format_optional_args(funcs, field);
|
||||||
|
|
||||||
|
let builder = rust::import("derive_builder", "Builder");
|
||||||
|
let _phantom_data = rust::import("std::marker", "PhantomData");
|
||||||
|
|
||||||
|
if let Some((fields, contains_lifetime)) = fields {
|
||||||
|
Some(quote! {
|
||||||
|
#[derive($builder, Debug, PartialEq)]
|
||||||
|
pub struct $output_type$(if contains_lifetime => <'a>) {
|
||||||
|
//#[builder(default, setter(skip))]
|
||||||
|
//pub marker: $(phantom_data)<&'a ()>,
|
||||||
|
$fields
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render_optional_field_args(
|
||||||
|
funcs: &CommonFunctions,
|
||||||
|
args: &Vec<&FullTypeFieldsArgs>,
|
||||||
|
) -> Option<(rust::Tokens, bool)> {
|
||||||
|
if args.len() == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let mut contains_lifetime = false;
|
||||||
|
let rendered_args = args.into_iter().map(|a| &a.input_value).map(|a| {
|
||||||
|
let type_ = funcs.format_immutable_input_type(&a.type_);
|
||||||
|
if type_.contains("str") {
|
||||||
|
contains_lifetime = true;
|
||||||
|
}
|
||||||
|
quote! {
|
||||||
|
$(a.description.pipe(|d| format_struct_comment(d)))
|
||||||
|
#[builder(setter(into, strip_option), default)]
|
||||||
|
pub $(format_struct_name(&a.name)): Option<$(type_)>,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Some((
|
||||||
|
quote! {
|
||||||
|
$(for arg in rendered_args join ($['\r']) => $arg)
|
||||||
|
},
|
||||||
|
contains_lifetime,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_functions(funcs: &CommonFunctions, fields: &Vec<FullTypeFields>) -> Option<rust::Tokens> {
|
||||||
|
let rendered_functions = fields
|
||||||
|
.iter()
|
||||||
|
.map(|f| render_function(funcs, f))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if rendered_functions.len() > 0 {
|
||||||
|
Some(quote! {
|
||||||
|
$(for func in rendered_functions join ($['\r']) => $func)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_function(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
|
||||||
|
Some(quote! {
|
||||||
|
$(format_function(funcs, field))
|
||||||
|
})
|
||||||
|
}
|
||||||
28
crates/dagger-codegen/src/rust/templates/scalar_tmpl.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
use dagger_core::introspection::FullType;
|
||||||
|
use genco::prelude::rust;
|
||||||
|
use genco::quote;
|
||||||
|
|
||||||
|
use crate::rust::functions::format_name;
|
||||||
|
use crate::utility::OptionExt;
|
||||||
|
|
||||||
|
pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||||
|
let deserialize = rust::import("serde", "Deserialize");
|
||||||
|
let serialize = rust::import("serde", "Serialize");
|
||||||
|
|
||||||
|
Ok(quote! {
|
||||||
|
#[derive($serialize, $deserialize, PartialEq, Debug, Clone)]
|
||||||
|
pub struct $(t.name.pipe(|n|format_name(n)))(pub String);
|
||||||
|
|
||||||
|
impl Into<$(t.name.pipe(|n| format_name(n)))> for &str {
|
||||||
|
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
|
||||||
|
$(t.name.pipe(|n| format_name(n)))(self.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<$(t.name.pipe(|n| format_name(n)))> for String {
|
||||||
|
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
|
||||||
|
$(t.name.pipe(|n| format_name(n)))(self.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
18
crates/dagger-codegen/src/utility.rs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
pub trait OptionExt<'t, T: 't> {
|
||||||
|
fn pipe<U, F>(&'t self, f: F) -> Option<U>
|
||||||
|
where
|
||||||
|
F: FnOnce(&'t T) -> U;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'t, T: 't> OptionExt<'t, T> for Option<T> {
|
||||||
|
#[inline]
|
||||||
|
fn pipe<U, F>(&'t self, f: F) -> Option<U>
|
||||||
|
where
|
||||||
|
F: FnOnce(&'t T) -> U,
|
||||||
|
{
|
||||||
|
match *self {
|
||||||
|
Some(ref x) => Some(f(x)),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
106
crates/dagger-codegen/src/visitor.rs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use dagger_core::introspection::{FullType, Schema, __TypeKind};
|
||||||
|
use itertools::Itertools;
|
||||||
|
|
||||||
|
pub struct Visitor {
|
||||||
|
pub schema: Schema,
|
||||||
|
pub handlers: VisitHandlers,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type VisitFunc = Arc<dyn Fn(&FullType) -> eyre::Result<()>>;
|
||||||
|
|
||||||
|
pub struct VisitHandlers {
|
||||||
|
pub visit_scalar: VisitFunc,
|
||||||
|
pub visit_object: VisitFunc,
|
||||||
|
pub visit_input: VisitFunc,
|
||||||
|
pub visit_enum: VisitFunc,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SequenceItem {
|
||||||
|
kind: __TypeKind,
|
||||||
|
handler: VisitFunc,
|
||||||
|
ignore: Option<Vec<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Visitor {
|
||||||
|
pub fn run(&self) -> eyre::Result<()> {
|
||||||
|
let sequence = vec![
|
||||||
|
SequenceItem {
|
||||||
|
kind: __TypeKind::SCALAR,
|
||||||
|
handler: self.handlers.visit_scalar.clone(),
|
||||||
|
ignore: Some(vec![
|
||||||
|
"String".into(),
|
||||||
|
"Float".into(),
|
||||||
|
"Int".into(),
|
||||||
|
"Boolean".into(),
|
||||||
|
"DateTime".into(),
|
||||||
|
"ID".into(),
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
SequenceItem {
|
||||||
|
kind: __TypeKind::INPUT_OBJECT,
|
||||||
|
handler: self.handlers.visit_input.clone(),
|
||||||
|
ignore: None,
|
||||||
|
},
|
||||||
|
SequenceItem {
|
||||||
|
kind: __TypeKind::OBJECT,
|
||||||
|
handler: self.handlers.visit_object.clone(),
|
||||||
|
ignore: None,
|
||||||
|
},
|
||||||
|
SequenceItem {
|
||||||
|
kind: __TypeKind::ENUM,
|
||||||
|
handler: self.handlers.visit_enum.clone(),
|
||||||
|
ignore: None,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
for item in sequence {
|
||||||
|
self.visit(&item)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit(&self, item: &SequenceItem) -> eyre::Result<()> {
|
||||||
|
self.schema
|
||||||
|
.types
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.into_iter()
|
||||||
|
.map(|t| t.as_ref().unwrap())
|
||||||
|
.filter(|t| match t.full_type.kind.as_ref().unwrap() == &item.kind {
|
||||||
|
true => match (item.ignore.as_ref(), t.full_type.name.as_ref()) {
|
||||||
|
(Some(ignore), Some(name)) => {
|
||||||
|
if name.starts_with("__") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ignore.contains(name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
(None, Some(name)) => {
|
||||||
|
if name.starts_with("__") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
false => false,
|
||||||
|
})
|
||||||
|
.sorted_by(|a, b| {
|
||||||
|
a.full_type
|
||||||
|
.name
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.cmp(&b.full_type.name.as_ref().unwrap())
|
||||||
|
})
|
||||||
|
.map(|t| (*item.handler)(&t.full_type))
|
||||||
|
.collect::<eyre::Result<Vec<_>>>()?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
246
crates/dagger-core/CHANGELOG.md
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
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.8 (2023-03-10)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-41b20b6268db9d8defe333694e4d3ec019d7c923/> bump version
|
||||||
|
- <csr-id-5f9b3a19c0ab6988bc335b020052074f3f101305/> set internal warnings as errors
|
||||||
|
- <csr-id-f9e7af931d94fbedacf74f5da9a2f71b1992324b/> introduce tests again
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-ecca036bc644fee93fbcb69bf6da9f29169e473e/> fix builder pattern to actually work with default values
|
||||||
|
In previous versions the builder pattern required all values to be set.
|
||||||
|
This has not been fixed, so that default values are allowed.
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 4 commits contributed to the release over the course of 13 calendar days.
|
||||||
|
- 13 days passed between releases.
|
||||||
|
- 4 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**
|
||||||
|
- bump version ([`41b20b6`](https://github.com/kjuulh/dagger-rs/commit/41b20b6268db9d8defe333694e4d3ec019d7c923))
|
||||||
|
- set internal warnings as errors ([`5f9b3a1`](https://github.com/kjuulh/dagger-rs/commit/5f9b3a19c0ab6988bc335b020052074f3f101305))
|
||||||
|
- introduce tests again ([`f9e7af9`](https://github.com/kjuulh/dagger-rs/commit/f9e7af931d94fbedacf74f5da9a2f71b1992324b))
|
||||||
|
- fix builder pattern to actually work with default values ([`ecca036`](https://github.com/kjuulh/dagger-rs/commit/ecca036bc644fee93fbcb69bf6da9f29169e473e))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.7 (2023-02-24)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f/> update to dagger-v0.3.13
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 2 commits contributed to the release.
|
||||||
|
- 4 days passed between releases.
|
||||||
|
- 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.7, dagger-sdk v0.2.15 ([`6a9a560`](https://github.com/kjuulh/dagger-rs/commit/6a9a560cdca097abf23371d44599a2f1b726ae7f))
|
||||||
|
- update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.6 (2023-02-20)
|
||||||
|
|
||||||
|
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-8dfecf976c5537cc2c03881de2b2fd2b2508683a/> cli session keep session alive
|
||||||
|
|
||||||
|
### 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**
|
||||||
|
- Release dagger-core v0.2.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- <csr-id-8385aa8a15ff7b45fecc3462c482b998118c14eb/> remove blocking
|
||||||
|
- <csr-id-921e61b5e248013cb5fbf4f1bad3eef5a2673145/> remove blocking
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
### 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))
|
||||||
|
- 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))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.3 (2023-02-20)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-75bc17e57db222492c6ffd2dfe80208d2bda75c9/> Fix async panic on blocking #19
|
||||||
|
Replaced internal threads with tokio spawn functions
|
||||||
|
|
||||||
|
### 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.3, dagger-sdk v0.2.9, dagger-rs v0.2.10 ([`82de43a`](https://github.com/kjuulh/dagger-rs/commit/82de43aa91d6a5e09a247d1959137fdc36a40d35))
|
||||||
|
- Fix async panic on blocking #19 ([`75bc17e`](https://github.com/kjuulh/dagger-rs/commit/75bc17e57db222492c6ffd2dfe80208d2bda75c9))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.2 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-6e5f4074329ab0462445b31d4153f8497c483438/> update to dagger v0.3.12
|
||||||
|
|
||||||
|
### 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.2, dagger-codegen v0.2.2, dagger-rs v0.2.8 ([`1638f15`](https://github.com/kjuulh/dagger-rs/commit/1638f15fba9d16512e8452f87b908d6dce417cd9))
|
||||||
|
- update to dagger v0.3.12 ([`6e5f407`](https://github.com/kjuulh/dagger-rs/commit/6e5f4074329ab0462445b31d4153f8497c483438))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.1 (2023-02-18)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-789b0e69c8c53d0e86d9cec89ab5345507aad514/> update all dependencies
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 16 commits contributed to the release over the course of 19 calendar days.
|
||||||
|
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
|
||||||
|
- 2 unique issues were worked on: [#5](https://github.com/kjuulh/dagger-rs/issues/5), [#6](https://github.com/kjuulh/dagger-rs/issues/6)
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **[#5](https://github.com/kjuulh/dagger-rs/issues/5)**
|
||||||
|
- update all dependencies ([`789b0e6`](https://github.com/kjuulh/dagger-rs/commit/789b0e69c8c53d0e86d9cec89ab5345507aad514))
|
||||||
|
* **[#6](https://github.com/kjuulh/dagger-rs/issues/6)**
|
||||||
|
- feature/add impl ([`4a4c03f`](https://github.com/kjuulh/dagger-rs/commit/4a4c03f3c2ee7f6268c65976715e70767b4ea78d))
|
||||||
|
* **Uncategorized**
|
||||||
|
- Release dagger-core v0.2.1, dagger-codegen v0.2.1, dagger-rs v0.2.1 ([`1332bc8`](https://github.com/kjuulh/dagger-rs/commit/1332bc842ce2ea0254c651419813b63b36ca590c))
|
||||||
|
- add changelogs ([`a064684`](https://github.com/kjuulh/dagger-rs/commit/a064684fcf80196188a57d9ff9067c0b5769fb09))
|
||||||
|
- Adjusting changelogs prior to release of dagger-core v0.2.1, dagger-codegen v0.2.1, dagger-rs v0.2.1 ([`f4a20fd`](https://github.com/kjuulh/dagger-rs/commit/f4a20fda79063b29829cc899793775ba8cb17214))
|
||||||
|
- with publish ([`989d5bc`](https://github.com/kjuulh/dagger-rs/commit/989d5bc26036d46a199d939b5cbbe72aff2f8fb1))
|
||||||
|
- with repo ([`e5383b5`](https://github.com/kjuulh/dagger-rs/commit/e5383b51f3b290a87b729929c377e93bda3873e0))
|
||||||
|
- with readme and license ([`1e26b38`](https://github.com/kjuulh/dagger-rs/commit/1e26b383d4f6dbcbe20f5f7c19c749e743f6e607))
|
||||||
|
- bump version ([`36b0ecd`](https://github.com/kjuulh/dagger-rs/commit/36b0ecdabf4c220cffb2d0660fb6480387e3249a))
|
||||||
|
- with println ([`d1726a0`](https://github.com/kjuulh/dagger-rs/commit/d1726a052a6dc4e57f364864446cab3cbda7e0bf))
|
||||||
|
- context and querier done ([`52a0db3`](https://github.com/kjuulh/dagger-rs/commit/52a0db3e311f9f88447882f1406701d4cd612b1c))
|
||||||
|
- tested full flow initially ([`7a008be`](https://github.com/kjuulh/dagger-rs/commit/7a008be59e5ca183809e5840cdfae1d87665aa20))
|
||||||
|
- move code to dagger-core ([`ec0d0b2`](https://github.com/kjuulh/dagger-rs/commit/ec0d0b22e646c97acb3ce93f3afb3ddb8590e68f))
|
||||||
|
- add fields ([`496a687`](https://github.com/kjuulh/dagger-rs/commit/496a687bc34f7c58cc86df60c183be741b0b8a9c))
|
||||||
|
- with objects ([`5fef514`](https://github.com/kjuulh/dagger-rs/commit/5fef5148010f384d0158361d64b8e17d357d4819))
|
||||||
|
- with enum ([`2a1f7c3`](https://github.com/kjuulh/dagger-rs/commit/2a1f7c3f2666f1f4caebf7c22707709741c2cfad))
|
||||||
|
</details>
|
||||||
|
|
||||||
@@ -1,27 +1,29 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-core"
|
name = "dagger-core"
|
||||||
version = "0.1.0"
|
version = "0.2.8"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
readme = "README.md"
|
||||||
|
license-file = "LICENSE.MIT"
|
||||||
|
description = "dagger sdk core library"
|
||||||
|
repository = "https://github.com/kjuulh/dagger-rs"
|
||||||
|
publish = true
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "4.1.4"
|
clap = "4.1.6"
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
flate2 = { version = "1.0.25", features = ["zlib"] }
|
flate2 = { version = "1.0.25", features = ["zlib"] }
|
||||||
genco = "0.17.3"
|
genco = "0.17.3"
|
||||||
graphql-introspection-query = "0.2.0"
|
graphql-introspection-query = "0.2.0"
|
||||||
graphql_client = { version = "0.12.0", features = [
|
graphql_client = { version = "0.12.0", features = ["reqwest"] }
|
||||||
"reqwest",
|
|
||||||
"reqwest-blocking",
|
|
||||||
] }
|
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
hex-literal = "0.3.4"
|
hex-literal = "0.3.4"
|
||||||
platform-info = "1.0.2"
|
platform-info = "1.0.2"
|
||||||
reqwest = { version = "0.11.14", features = ["stream", "blocking", "deflate"] }
|
reqwest = { version = "0.11.14", features = ["stream", "deflate"] }
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
serde_json = "1.0.91"
|
serde_json = "1.0.93"
|
||||||
sha2 = "0.10.6"
|
sha2 = "0.10.6"
|
||||||
tar = "0.4.38"
|
tar = "0.4.38"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
|
|||||||
7
crates/dagger-core/LICENSE.MIT
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2023 Kasper J. Hermansen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
0
crates/dagger-core/README.md
Normal file
@@ -1,11 +1,6 @@
|
|||||||
|
use std::{fs::canonicalize, path::PathBuf, process::Stdio, sync::Arc};
|
||||||
|
|
||||||
use std::{
|
use tokio::io::AsyncBufReadExt;
|
||||||
fs::canonicalize,
|
|
||||||
io::{BufRead, BufReader},
|
|
||||||
path::PathBuf,
|
|
||||||
process::{Child, Stdio},
|
|
||||||
sync::{mpsc::sync_channel, Arc},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{config::Config, connect_params::ConnectParams};
|
use crate::{config::Config, connect_params::ConnectParams};
|
||||||
|
|
||||||
@@ -21,12 +16,12 @@ impl CliSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn connect(
|
pub async fn connect(
|
||||||
&self,
|
&self,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
cli_path: &PathBuf,
|
cli_path: &PathBuf,
|
||||||
) -> eyre::Result<(ConnectParams, Child)> {
|
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||||
self.inner.connect(config, cli_path)
|
self.inner.connect(config, cli_path).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,17 +29,17 @@ impl CliSession {
|
|||||||
struct InnerCliSession {}
|
struct InnerCliSession {}
|
||||||
|
|
||||||
impl InnerCliSession {
|
impl InnerCliSession {
|
||||||
pub fn connect(
|
pub async fn connect(
|
||||||
&self,
|
&self,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
cli_path: &PathBuf,
|
cli_path: &PathBuf,
|
||||||
) -> eyre::Result<(ConnectParams, Child)> {
|
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||||
let proc = self.start(config, cli_path)?;
|
let proc = self.start(config, cli_path)?;
|
||||||
let params = self.get_conn(proc)?;
|
let params = self.get_conn(proc).await?;
|
||||||
Ok(params)
|
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()];
|
let mut args: Vec<String> = vec!["session".into()];
|
||||||
if let Some(workspace) = &config.workdir_path {
|
if let Some(workspace) = &config.workdir_path {
|
||||||
let abs_path = canonicalize(workspace)?;
|
let abs_path = canonicalize(workspace)?;
|
||||||
@@ -55,7 +50,7 @@ impl InnerCliSession {
|
|||||||
args.extend(["--project".into(), abs_path.to_string_lossy().to_string()])
|
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
|
cli_path
|
||||||
.to_str()
|
.to_str()
|
||||||
.ok_or(eyre::anyhow!("could not get string from path"))?,
|
.ok_or(eyre::anyhow!("could not get string from path"))?,
|
||||||
@@ -71,10 +66,10 @@ impl InnerCliSession {
|
|||||||
return Ok(proc);
|
return Ok(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_conn(
|
async fn get_conn(
|
||||||
&self,
|
&self,
|
||||||
mut proc: std::process::Child,
|
mut proc: tokio::process::Child,
|
||||||
) -> eyre::Result<(ConnectParams, std::process::Child)> {
|
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||||
let stdout = proc
|
let stdout = proc
|
||||||
.stdout
|
.stdout
|
||||||
.take()
|
.take()
|
||||||
@@ -85,27 +80,29 @@ impl InnerCliSession {
|
|||||||
.take()
|
.take()
|
||||||
.ok_or(eyre::anyhow!("could not acquire stderr from child process"))?;
|
.ok_or(eyre::anyhow!("could not acquire stderr from child process"))?;
|
||||||
|
|
||||||
let (sender, receiver) = sync_channel(1);
|
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
tokio::spawn(async move {
|
||||||
let stdout_bufr = BufReader::new(stdout);
|
let mut stdout_bufr = tokio::io::BufReader::new(stdout).lines();
|
||||||
for line in stdout_bufr.lines() {
|
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||||
let out = line.unwrap();
|
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&line) {
|
||||||
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&out) {
|
sender.send(conn).await.unwrap();
|
||||||
sender.send(conn).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("dagger: {}", line);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
std::thread::spawn(|| {
|
tokio::spawn(async move {
|
||||||
let stderr_bufr = BufReader::new(stderr);
|
let mut stdout_bufr = tokio::io::BufReader::new(stderr).lines();
|
||||||
for line in stderr_bufr.lines() {
|
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||||
let out = line.unwrap();
|
println!("dagger: {}", line);
|
||||||
panic!("could not start dagger session: {}", out)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let conn = receiver.recv()?;
|
let conn = receiver.recv().await.ok_or(eyre::anyhow!(
|
||||||
|
"could not receive ok signal from dagger-engine"
|
||||||
|
))?;
|
||||||
|
|
||||||
Ok((conn, proc))
|
Ok((conn, proc))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
io::{copy, Read, Write},
|
io::{copy, Write},
|
||||||
os::unix::prelude::PermissionsExt,
|
os::unix::prelude::PermissionsExt,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
@@ -27,6 +27,7 @@ impl Platform {
|
|||||||
let normalize_arch = match arch.as_str() {
|
let normalize_arch = match arch.as_str() {
|
||||||
"x86_64" => "amd64",
|
"x86_64" => "amd64",
|
||||||
"aarch" => "arm64",
|
"aarch" => "arm64",
|
||||||
|
"aarch64" => "arm64",
|
||||||
arch => arch,
|
arch => arch,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ impl Downloader {
|
|||||||
Ok(path)
|
Ok(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_cli(&self) -> eyre::Result<PathBuf> {
|
pub async fn get_cli(&self) -> eyre::Result<PathBuf> {
|
||||||
let version = &self.version;
|
let version = &self.version;
|
||||||
let mut cli_bin_path = self.cache_dir()?;
|
let mut cli_bin_path = self.cache_dir()?;
|
||||||
cli_bin_path.push(format!("{CLI_BIN_PREFIX}{version}"));
|
cli_bin_path.push(format!("{CLI_BIN_PREFIX}{version}"));
|
||||||
@@ -130,6 +131,7 @@ impl Downloader {
|
|||||||
if !cli_bin_path.exists() {
|
if !cli_bin_path.exists() {
|
||||||
cli_bin_path = self
|
cli_bin_path = self
|
||||||
.download(cli_bin_path)
|
.download(cli_bin_path)
|
||||||
|
.await
|
||||||
.context("failed to download CLI from archive")?;
|
.context("failed to download CLI from archive")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +139,10 @@ impl Downloader {
|
|||||||
if let Ok(entry) = file {
|
if let Ok(entry) = file {
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
if path != cli_bin_path {
|
if path != cli_bin_path {
|
||||||
|
println!(
|
||||||
|
"deleting client: path: {:?} vs cli_bin_path: {:?}",
|
||||||
|
path, cli_bin_path
|
||||||
|
);
|
||||||
std::fs::remove_file(path)?;
|
std::fs::remove_file(path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,11 +151,11 @@ impl Downloader {
|
|||||||
Ok(cli_bin_path)
|
Ok(cli_bin_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn download(&self, path: PathBuf) -> eyre::Result<PathBuf> {
|
async fn download(&self, path: PathBuf) -> eyre::Result<PathBuf> {
|
||||||
let expected_checksum = self.expected_checksum()?;
|
let expected_checksum = self.expected_checksum().await?;
|
||||||
|
|
||||||
let mut bytes = vec![];
|
let mut bytes = vec![];
|
||||||
let actual_hash = self.extract_cli_archive(&mut bytes)?;
|
let actual_hash = self.extract_cli_archive(&mut bytes).await?;
|
||||||
|
|
||||||
if expected_checksum != actual_hash {
|
if expected_checksum != actual_hash {
|
||||||
eyre::bail!("downloaded CLI binary checksum doesn't match checksum from checksums.txt")
|
eyre::bail!("downloaded CLI binary checksum doesn't match checksum from checksums.txt")
|
||||||
@@ -165,15 +171,15 @@ impl Downloader {
|
|||||||
Ok(path)
|
Ok(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expected_checksum(&self) -> eyre::Result<String> {
|
async fn expected_checksum(&self) -> eyre::Result<String> {
|
||||||
let archive_url = &self.archive_url();
|
let archive_url = &self.archive_url();
|
||||||
let archive_path = PathBuf::from(&archive_url);
|
let archive_path = PathBuf::from(&archive_url);
|
||||||
let archive_name = archive_path
|
let archive_name = archive_path
|
||||||
.file_name()
|
.file_name()
|
||||||
.ok_or(eyre::anyhow!("could not get file_name from archive_url"))?;
|
.ok_or(eyre::anyhow!("could not get file_name from archive_url"))?;
|
||||||
let resp = reqwest::blocking::get(self.checksum_url())?;
|
let resp = reqwest::get(self.checksum_url()).await?;
|
||||||
let resp = resp.error_for_status()?;
|
let resp = resp.error_for_status()?;
|
||||||
for line in resp.text()?.lines() {
|
for line in resp.text().await?.lines() {
|
||||||
let mut content = line.split_whitespace();
|
let mut content = line.split_whitespace();
|
||||||
let checksum = content
|
let checksum = content
|
||||||
.next()
|
.next()
|
||||||
@@ -190,26 +196,20 @@ impl Downloader {
|
|||||||
eyre::bail!("could not find a matching version or binary in checksums.txt")
|
eyre::bail!("could not find a matching version or binary in checksums.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_cli_archive(&self, dest: &mut Vec<u8>) -> eyre::Result<String> {
|
pub async fn extract_cli_archive(&self, dest: &mut Vec<u8>) -> eyre::Result<String> {
|
||||||
let archive_url = self.archive_url();
|
let archive_url = self.archive_url();
|
||||||
let resp = reqwest::blocking::get(&archive_url)?;
|
let resp = reqwest::get(&archive_url).await?;
|
||||||
let mut resp = resp.error_for_status()?;
|
let resp = resp.error_for_status()?;
|
||||||
let mut bytes = vec![];
|
let bytes = resp.bytes().await?;
|
||||||
let lines = resp.read_to_end(&mut bytes)?;
|
|
||||||
if lines == 0 {
|
|
||||||
eyre::bail!("nothing was downloaded")
|
|
||||||
}
|
|
||||||
let mut hasher = sha2::Sha256::new();
|
let mut hasher = sha2::Sha256::new();
|
||||||
hasher.update(bytes.as_slice());
|
hasher.update(&bytes);
|
||||||
let res = hasher.finalize();
|
let res = hasher.finalize();
|
||||||
|
|
||||||
println!("{}", hex::encode(&res));
|
|
||||||
|
|
||||||
if archive_url.ends_with(".zip") {
|
if archive_url.ends_with(".zip") {
|
||||||
// TODO: Nothing for now
|
// TODO: Nothing for now
|
||||||
todo!()
|
todo!()
|
||||||
} else {
|
} else {
|
||||||
self.extract_from_tar(bytes.as_slice(), dest)?;
|
self.extract_from_tar(&bytes, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(hex::encode(res))
|
Ok(hex::encode(res))
|
||||||
@@ -223,8 +223,6 @@ impl Downloader {
|
|||||||
let mut entry = entry?;
|
let mut entry = entry?;
|
||||||
let path = entry.path()?;
|
let path = entry.path()?;
|
||||||
|
|
||||||
println!("path: {:?}", path);
|
|
||||||
|
|
||||||
if path.ends_with("dagger") {
|
if path.ends_with("dagger") {
|
||||||
copy(&mut entry, output)?;
|
copy(&mut entry, output)?;
|
||||||
|
|
||||||
@@ -240,9 +238,13 @@ impl Downloader {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::Downloader;
|
use super::Downloader;
|
||||||
|
|
||||||
#[test]
|
#[tokio::test]
|
||||||
fn download() {
|
async fn download() {
|
||||||
let cli_path = Downloader::new("0.3.10".into()).unwrap().get_cli().unwrap();
|
let cli_path = Downloader::new("0.3.10".into())
|
||||||
|
.unwrap()
|
||||||
|
.get_cli()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some("dagger-0.3.10"),
|
Some("dagger-0.3.10"),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use std::process::Child;
|
use crate::DAGGER_ENGINE_VERSION;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
|
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
|
||||||
};
|
};
|
||||||
@@ -11,38 +10,21 @@ impl Engine {
|
|||||||
Self {}
|
Self {}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.10".into())?.get_cli()?;
|
let cli = Downloader::new(DAGGER_ENGINE_VERSION.into())?
|
||||||
|
.get_cli()
|
||||||
|
.await?;
|
||||||
|
|
||||||
let cli_session = CliSession::new();
|
let cli_session = CliSession::new();
|
||||||
|
|
||||||
Ok(cli_session.connect(cfg, &cli)?)
|
Ok(cli_session.connect(cfg, &cli).await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub 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
|
// TODO: Add from existing session as well
|
||||||
self.from_cli(cfg)
|
self.from_cli(cfg).await
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use crate::{config::Config, connect_params::ConnectParams};
|
|
||||||
|
|
||||||
use super::Engine;
|
|
||||||
|
|
||||||
// TODO: these tests potentially have a race condition
|
|
||||||
#[test]
|
|
||||||
fn engine_can_start() {
|
|
||||||
let engine = Engine::new();
|
|
||||||
let params = engine.start(&Config::new(None, None, None, None)).unwrap();
|
|
||||||
|
|
||||||
assert_ne!(
|
|
||||||
params.0,
|
|
||||||
ConnectParams {
|
|
||||||
port: 123,
|
|
||||||
session_token: "123".into()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,9 @@ pub struct FullTypeFields {
|
|||||||
pub type_: Option<FullTypeFieldsType>,
|
pub type_: Option<FullTypeFieldsType>,
|
||||||
pub is_deprecated: Option<bool>,
|
pub is_deprecated: Option<bool>,
|
||||||
pub deprecation_reason: Option<String>,
|
pub deprecation_reason: Option<String>,
|
||||||
|
|
||||||
|
#[serde(skip)]
|
||||||
|
pub parent_type: Option<FullType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
@@ -238,6 +241,7 @@ pub struct SchemaTypes {
|
|||||||
pub full_type: FullType,
|
pub full_type: FullType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SchemaDirectivesArgs {
|
pub struct SchemaDirectivesArgs {
|
||||||
@@ -254,6 +258,7 @@ pub struct SchemaDirectives {
|
|||||||
pub args: Option<Vec<Option<SchemaDirectivesArgs>>>,
|
pub args: Option<Vec<Option<SchemaDirectivesArgs>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Schema {
|
pub struct Schema {
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
#![deny(warnings)]
|
||||||
|
|
||||||
|
pub const DAGGER_ENGINE_VERSION: &'static str = "0.4.0";
|
||||||
|
|
||||||
pub mod cli_session;
|
pub mod cli_session;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod connect_params;
|
pub mod connect_params;
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
use crate::introspection::IntrospectionResponse;
|
use crate::introspection::IntrospectionResponse;
|
||||||
use crate::{config::Config, engine::Engine, session::Session};
|
use crate::{config::Config, engine::Engine, session::Session};
|
||||||
|
|
||||||
pub fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
pub async fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
||||||
let cfg = Config::new(None, None, None, None);
|
let cfg = Config::new(None, None, None, None);
|
||||||
|
|
||||||
//TODO: Implement context for proc
|
//TODO: Implement context for proc
|
||||||
let (conn, _proc) = Engine::new().start(&cfg)?;
|
let (conn, _proc) = Engine::new().start(&cfg).await?;
|
||||||
let session = Session::new();
|
let session = Session::new();
|
||||||
let req_builder = session.start(&cfg, &conn)?;
|
let req_builder = session.start(&cfg, &conn)?;
|
||||||
let schema = session.schema(req_builder)?;
|
let schema = session.schema(req_builder).await?;
|
||||||
|
|
||||||
Ok(schema)
|
Ok(schema)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::get_schema;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_get_schema() {
|
|
||||||
let _ = get_schema().unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use graphql_client::GraphQLQuery;
|
use graphql_client::GraphQLQuery;
|
||||||
use reqwest::{
|
use reqwest::{
|
||||||
blocking::{Client, RequestBuilder},
|
|
||||||
header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE},
|
header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE},
|
||||||
|
Client, RequestBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{config::Config, connect_params::ConnectParams, introspection::IntrospectionResponse};
|
use crate::{config::Config, connect_params::ConnectParams, introspection::IntrospectionResponse};
|
||||||
@@ -37,14 +37,14 @@ impl Session {
|
|||||||
Ok(req_builder)
|
Ok(req_builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn schema(&self, req_builder: RequestBuilder) -> eyre::Result<IntrospectionResponse> {
|
pub async fn schema(&self, req_builder: RequestBuilder) -> eyre::Result<IntrospectionResponse> {
|
||||||
let request_body: graphql_client::QueryBody<()> = graphql_client::QueryBody {
|
let request_body: graphql_client::QueryBody<()> = graphql_client::QueryBody {
|
||||||
variables: (),
|
variables: (),
|
||||||
query: introspection_query::QUERY,
|
query: introspection_query::QUERY,
|
||||||
operation_name: introspection_query::OPERATION_NAME,
|
operation_name: introspection_query::OPERATION_NAME,
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = req_builder.json(&request_body).send()?;
|
let res = req_builder.json(&request_body).send().await?;
|
||||||
|
|
||||||
if res.status().is_success() {
|
if res.status().is_success() {
|
||||||
// do nothing
|
// do nothing
|
||||||
@@ -52,7 +52,7 @@ impl Session {
|
|||||||
return Err(eyre::anyhow!("server error!"));
|
return Err(eyre::anyhow!("server error!"));
|
||||||
} else {
|
} else {
|
||||||
let status = res.status();
|
let status = res.status();
|
||||||
let error_message = match res.text() {
|
let error_message = match res.text().await {
|
||||||
Ok(msg) => match serde_json::from_str::<serde_json::Value>(&msg) {
|
Ok(msg) => match serde_json::from_str::<serde_json::Value>(&msg) {
|
||||||
Ok(json) => {
|
Ok(json) => {
|
||||||
format!("HTTP {}\n{}", status, serde_json::to_string_pretty(&json)?)
|
format!("HTTP {}\n{}", status, serde_json::to_string_pretty(&json)?)
|
||||||
@@ -64,7 +64,7 @@ impl Session {
|
|||||||
return Err(eyre::anyhow!(error_message));
|
return Err(eyre::anyhow!(error_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
let json: IntrospectionResponse = res.json()?;
|
let json: IntrospectionResponse = res.json().await?;
|
||||||
|
|
||||||
Ok(json)
|
Ok(json)
|
||||||
}
|
}
|
||||||
|
|||||||
685
crates/dagger-sdk/CHANGELOG.md
Normal file
@@ -0,0 +1,685 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
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.18 (2023-03-14)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-2c04387c3dd4cfd097a8f142570c58bc756c8ab7/> fix serialization of enum args for graphql
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 1 commit 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**
|
||||||
|
- fix serialization of enum args for graphql ([`2c04387`](https://github.com/kjuulh/dagger-rs/commit/2c04387c3dd4cfd097a8f142570c58bc756c8ab7))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.17 (2023-03-13)
|
||||||
|
|
||||||
|
<csr-id-f67928155f02076cbb41abd4010523879ff3caf1/>
|
||||||
|
<csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/>
|
||||||
|
<csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/>
|
||||||
|
<csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/>
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute
|
||||||
|
- <csr-id-5593fce2e16e0aa97a2e6843f15d3bb1121048f5/> remove unused imports
|
||||||
|
- <csr-id-c025d1742482d701946c292dcf104421d3cade8e/> add support for String as well
|
||||||
|
- <csr-id-d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3/> add public tuple field and into func
|
||||||
|
- <csr-id-44fa0240f8197f49fdf942b5c3d89079b59195d1/> update rust crate futures to 0.3.27
|
||||||
|
|
||||||
|
### Other
|
||||||
|
|
||||||
|
- <csr-id-f67928155f02076cbb41abd4010523879ff3caf1/> initial issue
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- <csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/> remove export and instead use exitcode
|
||||||
|
- <csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/> move issues to actual tests and refactor
|
||||||
|
- <csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/> move issues to another folder
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 10 commits contributed to the release over the course of 2 calendar days.
|
||||||
|
- 2 days passed between releases.
|
||||||
|
- 9 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**
|
||||||
|
- Release dagger-sdk v0.2.17 ([`a8e6dde`](https://github.com/kjuulh/dagger-rs/commit/a8e6dde615029d9a94d159ed84b5373121cd201f))
|
||||||
|
- make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007))
|
||||||
|
- remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5))
|
||||||
|
- remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086))
|
||||||
|
- move issues to actual tests and refactor ([`9ba0139`](https://github.com/kjuulh/dagger-rs/commit/9ba01396cb44ee02cf7a16008e3f0bdae9f78754))
|
||||||
|
- add support for String as well ([`c025d17`](https://github.com/kjuulh/dagger-rs/commit/c025d1742482d701946c292dcf104421d3cade8e))
|
||||||
|
- move issues to another folder ([`e9e35ed`](https://github.com/kjuulh/dagger-rs/commit/e9e35edb1cb67eee8cc033212aba3b1888def78f))
|
||||||
|
- add public tuple field and into func ([`d7317e5`](https://github.com/kjuulh/dagger-rs/commit/d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3))
|
||||||
|
- initial issue ([`f679281`](https://github.com/kjuulh/dagger-rs/commit/f67928155f02076cbb41abd4010523879ff3caf1))
|
||||||
|
- update rust crate futures to 0.3.27 ([`44fa024`](https://github.com/kjuulh/dagger-rs/commit/44fa0240f8197f49fdf942b5c3d89079b59195d1))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.16 (2023-03-10)
|
||||||
|
|
||||||
|
<csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/> fix tasks
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- <csr-id-13b7805e7e6fcf47e0a1318adcc25b4ab773a3c9/> fix missing await in connect
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-7133bfae9508bc5977548e373c49342a1248d6e4/> with dagger-engine v.0.4.0
|
||||||
|
- <csr-id-4381af029521c2cbac9325278d261db79a994657/> add tests to sdk
|
||||||
|
- <csr-id-5f9b3a19c0ab6988bc335b020052074f3f101305/> set internal warnings as errors
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-ecca036bc644fee93fbcb69bf6da9f29169e473e/> fix builder pattern to actually work with default values
|
||||||
|
In previous versions the builder pattern required all values to be set.
|
||||||
|
This has not been fixed, so that default values are allowed.
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 7 commits contributed to the release over the course of 13 calendar days.
|
||||||
|
- 13 days passed between releases.
|
||||||
|
- 6 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**
|
||||||
|
- Release dagger-core v0.2.8, dagger-sdk v0.2.16 ([`f390eac`](https://github.com/kjuulh/dagger-rs/commit/f390eac29f1d041d18d2207a5aa0a8d993aab68c))
|
||||||
|
- fix tasks ([`e642778`](https://github.com/kjuulh/dagger-rs/commit/e642778d9028726dfb07217814e15ad1dd3b83f2))
|
||||||
|
- with dagger-engine v.0.4.0 ([`7133bfa`](https://github.com/kjuulh/dagger-rs/commit/7133bfae9508bc5977548e373c49342a1248d6e4))
|
||||||
|
- fix missing await in connect ([`13b7805`](https://github.com/kjuulh/dagger-rs/commit/13b7805e7e6fcf47e0a1318adcc25b4ab773a3c9))
|
||||||
|
- add tests to sdk ([`4381af0`](https://github.com/kjuulh/dagger-rs/commit/4381af029521c2cbac9325278d261db79a994657))
|
||||||
|
- set internal warnings as errors ([`5f9b3a1`](https://github.com/kjuulh/dagger-rs/commit/5f9b3a19c0ab6988bc335b020052074f3f101305))
|
||||||
|
- fix builder pattern to actually work with default values ([`ecca036`](https://github.com/kjuulh/dagger-rs/commit/ecca036bc644fee93fbcb69bf6da9f29169e473e))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.15 (2023-02-24)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f/> update to dagger-v0.3.13
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-e578b0e371e13bc30ada793b7cd6ebe75ba83a07/> set deserialize on enums as well
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 3 commits contributed to the release.
|
||||||
|
- 2 days passed between releases.
|
||||||
|
- 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**
|
||||||
|
- Release dagger-core v0.2.7, dagger-sdk v0.2.15 ([`6a9a560`](https://github.com/kjuulh/dagger-rs/commit/6a9a560cdca097abf23371d44599a2f1b726ae7f))
|
||||||
|
- set deserialize on enums as well ([`e578b0e`](https://github.com/kjuulh/dagger-rs/commit/e578b0e371e13bc30ada793b7cd6ebe75ba83a07))
|
||||||
|
- update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.14 (2023-02-22)
|
||||||
|
|
||||||
|
<csr-id-e331ca003546f4ebe00f33b65c3b45c6b0586514/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-e331ca003546f4ebe00f33b65c3b45c6b0586514/> fix whitespace
|
||||||
|
|
||||||
|
### 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-sdk v0.2.14 ([`88b055c`](https://github.com/kjuulh/dagger-rs/commit/88b055cb47d3d474e2c37d8fa8259df5faad9da5))
|
||||||
|
- fix whitespace ([`e331ca0`](https://github.com/kjuulh/dagger-rs/commit/e331ca003546f4ebe00f33b65c3b45c6b0586514))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.13 (2023-02-22)
|
||||||
|
|
||||||
|
<csr-id-7c3654d276bb5f66e692a210cb60cdf46b19e226/>
|
||||||
|
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-7c3654d276bb5f66e692a210cb60cdf46b19e226/> ran clippy
|
||||||
|
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c/> with clone
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 7 commits contributed to the release over the course of 2 calendar days.
|
||||||
|
- 2 days passed between releases.
|
||||||
|
- 4 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**
|
||||||
|
- Release dagger-codegen v0.2.8, dagger-sdk v0.2.13 ([`456f483`](https://github.com/kjuulh/dagger-rs/commit/456f48389b5514d7f743a600a7732fb02dd87418))
|
||||||
|
- ran clippy ([`7c3654d`](https://github.com/kjuulh/dagger-rs/commit/7c3654d276bb5f66e692a210cb60cdf46b19e226))
|
||||||
|
- with clone ([`266ad32`](https://github.com/kjuulh/dagger-rs/commit/266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c))
|
||||||
|
- Release dagger-core v0.2.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||||
|
- 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.12 (2023-02-20)
|
||||||
|
|
||||||
|
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||||
|
|
||||||
|
### Chore
|
||||||
|
|
||||||
|
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||||
|
|
||||||
|
## v0.2.11 (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>
|
||||||
|
|
||||||
|
## v0.2.10 (2023-02-20)
|
||||||
|
|
||||||
|
Alignment release
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-b100285312df522218bfd4bc00bbf41b857a81bf/> changelog
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 8 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-sdk v0.2.10 ([`5cb9729`](https://github.com/kjuulh/dagger-rs/commit/5cb97296b61677fb37e4bdb8519d30a484f93621))
|
||||||
|
- changelog ([`b100285`](https://github.com/kjuulh/dagger-rs/commit/b100285312df522218bfd4bc00bbf41b857a81bf))
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10 ([`8ed0647`](https://github.com/kjuulh/dagger-rs/commit/8ed06476e56f3290a419d2a67e7f25da575c63ad))
|
||||||
|
- update changelog ([`09aa658`](https://github.com/kjuulh/dagger-rs/commit/09aa658b6fb3c1e9a2de668c4a69bbe5be13202f))
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10 ([`b436f27`](https://github.com/kjuulh/dagger-rs/commit/b436f27a535f085bb8a4e66c7c4b3df461e74c21))
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10, dagger-rs v0.2.10 ([`577a293`](https://github.com/kjuulh/dagger-rs/commit/577a293c6777b9305a4f5fc7c3abee4aff4d74b5))
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10, dagger-rs v0.2.10 ([`76bb1fc`](https://github.com/kjuulh/dagger-rs/commit/76bb1fcedd03bd2d3b1e0f841f10325e4a85e108))
|
||||||
|
- Release dagger-rs v0.2.10 ([`dc3487b`](https://github.com/kjuulh/dagger-rs/commit/dc3487b840beb9543699f72d4282147e4ebc72f2))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.10
|
||||||
|
|
||||||
|
([`577a293`](https://github.com/kjuulh/dagger-rs/commit/577a293c6777b9305a4f5fc7c3abee4aff4d74b5))
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10, dagger-rs
|
||||||
|
|
||||||
|
## v0.2.10
|
||||||
|
|
||||||
|
([`76bb1fc`](https://github.com/kjuulh/dagger-rs/commit/76bb1fcedd03bd2d3b1e0f841f10325e4a85e108))
|
||||||
|
- Release dagger-rs v0.2.10
|
||||||
|
([`dc3487b`](https://github.com/kjuulh/dagger-rs/commit/dc3487b840beb9543699f72d4282147e4ebc72f2))
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.10
|
||||||
|
|
||||||
|
([`577a293`](https://github.com/kjuulh/dagger-rs/commit/577a293c6777b9305a4f5fc7c3abee4aff4d74b5))
|
||||||
|
|
||||||
|
- Adjusting changelogs prior to release of dagger-sdk v0.2.10, dagger-rs
|
||||||
|
|
||||||
|
## v0.2.10
|
||||||
|
|
||||||
|
([`76bb1fc`](https://github.com/kjuulh/dagger-rs/commit/76bb1fcedd03bd2d3b1e0f841f10325e4a85e108))
|
||||||
|
|
||||||
|
- Release dagger-rs v0.2.10
|
||||||
|
([`dc3487b`](https://github.com/kjuulh/dagger-rs/commit/dc3487b840beb9543699f72d4282147e4ebc72f2))
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.9 (2023-02-20)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-75bc17e57db222492c6ffd2dfe80208d2bda75c9/> Fix async panic on blocking
|
||||||
|
#19 Replaced internal threads with tokio spawn functions
|
||||||
|
|
||||||
|
### 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.3, dagger-sdk v0.2.9, dagger-rs v0.2.10 ([`82de43a`](https://github.com/kjuulh/dagger-rs/commit/82de43aa91d6a5e09a247d1959137fdc36a40d35))
|
||||||
|
- Fix async panic on blocking #19 ([`75bc17e`](https://github.com/kjuulh/dagger-rs/commit/75bc17e57db222492c6ffd2dfe80208d2bda75c9))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.8 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4/> add documentation strings
|
||||||
|
|
||||||
|
### 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-sdk v0.2.8, dagger-codegen v0.2.5 ([`0499024`](https://github.com/kjuulh/dagger-rs/commit/04990247ba8e9d0555847f582fef14849dbedebf))
|
||||||
|
- add documentation strings ([`978ede6`](https://github.com/kjuulh/dagger-rs/commit/978ede68ae52f5b5150a2aa45b8d6e1fbbbee2f4))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.7 (2023-02-19)
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- <csr-id-93f40b356c48f14e910968516bed9487912095c1/> change to await syntax
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598/> Use async runtime instead
|
||||||
|
of blocking. Default to using async runtime instead of blocking. I.e.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn main() -> eyre::Result<()> {
|
||||||
|
// ...
|
||||||
|
|
||||||
|
client.container().from("rust").publish("somewhere")?;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
// to
|
||||||
|
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
// ...
|
||||||
|
|
||||||
|
client.container().from("rust").publish("somewhere").await?;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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**
|
||||||
|
- Release dagger-sdk v0.2.7 ([`a1887af`](https://github.com/kjuulh/dagger-rs/commit/a1887afc8b51f61491ba7f13c5e7a5b7619623c4))
|
||||||
|
- change to await syntax ([`93f40b3`](https://github.com/kjuulh/dagger-rs/commit/93f40b356c48f14e910968516bed9487912095c1))
|
||||||
|
- Use async runtime instead of blocking. ([`9be6f43`](https://github.com/kjuulh/dagger-rs/commit/9be6f435d9ea39f31a8906e55dbd3e8b1e5ec598))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.6 (2023-02-19)
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- <csr-id-04e70ce964b343e28b3dbd0c46d10ccda958ab8c/> fix readme
|
||||||
|
|
||||||
|
### 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-sdk v0.2.6 ([`c312bc5`](https://github.com/kjuulh/dagger-rs/commit/c312bc57ad3e5380b6a2a927f3bb758aa5344efd))
|
||||||
|
- fix readme ([`04e70ce`](https://github.com/kjuulh/dagger-rs/commit/04e70ce964b343e28b3dbd0c46d10ccda958ab8c))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.5 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-f29ff836cfd72d5e051ca6a71a230ba1e9933091/> without Some in _opts
|
||||||
|
functions Option has been removed as a wrapper around opts. This makes it much
|
||||||
|
more convenient to use
|
||||||
|
|
||||||
|
```rust
|
||||||
|
client.container_opts(Some(ContainerOpts{}))
|
||||||
|
// ->
|
||||||
|
client.container_opts(ContainerOpts{})
|
||||||
|
```
|
||||||
|
|
||||||
|
The same options are still available, either an empty object can be passed, or
|
||||||
|
a non _opts function can be used
|
||||||
|
- <csr-id-9762da895a164e30c5dc60e89a83e934ceae47ab/> with _opts methods Now all
|
||||||
|
opt values enter into a _opts function instead of the original. This avoids a
|
||||||
|
lot of verbosity for both None in the case opts are unwanted, and Some() if
|
||||||
|
they actually are.
|
||||||
|
|
||||||
|
They are used like so:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
client.container().from("...");
|
||||||
|
client.container_opts(Some(ContainerOpts{ ... }))
|
||||||
|
```
|
||||||
|
|
||||||
|
Some from opts will be removed in a future commit/pr
|
||||||
|
- <csr-id-94336d06378f035464e233b921dc3858070f582d/> move to &str instead of
|
||||||
|
String and introduce builder. This will make the api much easier to use, as we
|
||||||
|
can now rely on "" instead of "".into() for normal string values.
|
||||||
|
|
||||||
|
Introduced builder as well, which makes it much easier to use *Opts, as it can
|
||||||
|
handle the building of that, and get the benefits from String -> &str, as that
|
||||||
|
is currently not allowed for optional values
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-c627595fd2695e236924175d137c42f1480ccd6b/> cargo clippy
|
||||||
|
- <csr-id-02006d40fc2c0383e0412c15c36db9af7eda991f/> without phantom data
|
||||||
|
- <csr-id-6e2292cf11942fbd26a52fe4e0fc8471e6eb70a3/> dependencies
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 7 commits contributed to the release.
|
||||||
|
- 6 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**
|
||||||
|
- Release dagger-sdk v0.2.5, dagger-codegen v0.2.4 ([`f727318`](https://github.com/kjuulh/dagger-rs/commit/f72731807d8358fdb3d80432136b7a08bb7b1773))
|
||||||
|
- cargo clippy ([`c627595`](https://github.com/kjuulh/dagger-rs/commit/c627595fd2695e236924175d137c42f1480ccd6b))
|
||||||
|
- without Some in _opts functions ([`f29ff83`](https://github.com/kjuulh/dagger-rs/commit/f29ff836cfd72d5e051ca6a71a230ba1e9933091))
|
||||||
|
- with _opts methods ([`9762da8`](https://github.com/kjuulh/dagger-rs/commit/9762da895a164e30c5dc60e89a83e934ceae47ab))
|
||||||
|
- without phantom data ([`02006d4`](https://github.com/kjuulh/dagger-rs/commit/02006d40fc2c0383e0412c15c36db9af7eda991f))
|
||||||
|
- move to &str instead of String and introduce builder. ([`94336d0`](https://github.com/kjuulh/dagger-rs/commit/94336d06378f035464e233b921dc3858070f582d))
|
||||||
|
- dependencies ([`6e2292c`](https://github.com/kjuulh/dagger-rs/commit/6e2292cf11942fbd26a52fe4e0fc8471e6eb70a3))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.4 (2023-02-19)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-7d04ab1240e497e7804fed23a378d28c78f50a0a/> readme dagger-rs ->
|
||||||
|
dagger-sdk
|
||||||
|
|
||||||
|
### 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-sdk v0.2.4 ([`cc81124`](https://github.com/kjuulh/dagger-rs/commit/cc81124f899f44f80c1ee7d1e23a7e02d8cc4b7c))
|
||||||
|
- readme dagger-rs -> dagger-sdk ([`7d04ab1`](https://github.com/kjuulh/dagger-rs/commit/7d04ab1240e497e7804fed23a378d28c78f50a0a))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.3 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-19ed6c267f779b72430422c463ceed553f6fc618/> re-export through lib.rs
|
||||||
|
this means that you can now use dagger_sdk::connect() instead of
|
||||||
|
dagger_sdk::client::connect();
|
||||||
|
- <csr-id-de063eae858eb3335d2558a57ee6a88689635200/> with return result instead
|
||||||
|
of unwrap
|
||||||
|
- <csr-id-5d667369900a47d3a6015cd3814c240bc5c54436/> remove unnecessary option
|
||||||
|
returns
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 4 commits contributed to the release.
|
||||||
|
- 3 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**
|
||||||
|
- Release dagger-sdk v0.2.3, dagger-codegen v0.2.3, dagger-rs v0.2.9 ([`9235030`](https://github.com/kjuulh/dagger-rs/commit/92350306b3f0da40b4fc6dcaffcd90b891e83f70))
|
||||||
|
- re-export through lib.rs ([`19ed6c2`](https://github.com/kjuulh/dagger-rs/commit/19ed6c267f779b72430422c463ceed553f6fc618))
|
||||||
|
- with return result instead of unwrap ([`de063ea`](https://github.com/kjuulh/dagger-rs/commit/de063eae858eb3335d2558a57ee6a88689635200))
|
||||||
|
- remove unnecessary option returns ([`5d66736`](https://github.com/kjuulh/dagger-rs/commit/5d667369900a47d3a6015cd3814c240bc5c54436))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.2 (2023-02-19)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- <csr-id-6e5f4074329ab0462445b31d4153f8497c483438/> update to dagger v0.3.12
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-10bc6f3846b65cc82c2fb343d8cfe921784bef1b/> fixed fmt errors
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **Uncategorized**
|
||||||
|
- Release dagger-sdk v0.2.2 ([`e921ba1`](https://github.com/kjuulh/dagger-rs/commit/e921ba13638987ccf5beaa48c4be9be5fd879bd0))
|
||||||
|
- Release dagger-core v0.2.2, dagger-codegen v0.2.2, dagger-rs v0.2.8 ([`1638f15`](https://github.com/kjuulh/dagger-rs/commit/1638f15fba9d16512e8452f87b908d6dce417cd9))
|
||||||
|
- fixed fmt errors ([`10bc6f3`](https://github.com/kjuulh/dagger-rs/commit/10bc6f3846b65cc82c2fb343d8cfe921784bef1b))
|
||||||
|
- update to dagger v0.3.12 ([`6e5f407`](https://github.com/kjuulh/dagger-rs/commit/6e5f4074329ab0462445b31d4153f8497c483438))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## v0.2.1 (2023-02-18)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- <csr-id-789b0e69c8c53d0e86d9cec89ab5345507aad514/> update all dependencies
|
||||||
|
|
||||||
|
### Commit Statistics
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
- 40 commits contributed to the release over the course of 20 calendar days.
|
||||||
|
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
|
||||||
|
- 2 unique issues were worked on: [#5](https://github.com/kjuulh/dagger-rs/issues/5), [#6](https://github.com/kjuulh/dagger-rs/issues/6)
|
||||||
|
|
||||||
|
### Commit Details
|
||||||
|
|
||||||
|
<csr-read-only-do-not-edit/>
|
||||||
|
|
||||||
|
<details><summary>view details</summary>
|
||||||
|
|
||||||
|
* **[#5](https://github.com/kjuulh/dagger-rs/issues/5)**
|
||||||
|
- update all dependencies ([`789b0e6`](https://github.com/kjuulh/dagger-rs/commit/789b0e69c8c53d0e86d9cec89ab5345507aad514))
|
||||||
|
* **[#6](https://github.com/kjuulh/dagger-rs/issues/6)**
|
||||||
|
- feature/add impl ([`4a4c03f`](https://github.com/kjuulh/dagger-rs/commit/4a4c03f3c2ee7f6268c65976715e70767b4ea78d))
|
||||||
|
* **Uncategorized**
|
||||||
|
- Release dagger-sdk v0.2.1 ([`aa0c397`](https://github.com/kjuulh/dagger-rs/commit/aa0c397b15566840eb59ca6186c083f631cc460b))
|
||||||
|
- add dagger-sdk changelog ([`11a5247`](https://github.com/kjuulh/dagger-rs/commit/11a5247933736bc6a4c5300c29599c88597fefb7))
|
||||||
|
- Release dagger-rs v0.2.7, dagger-sdk v0.2.1 ([`20c7118`](https://github.com/kjuulh/dagger-rs/commit/20c71189f6d5d978286ee16f8e958c6045756d80))
|
||||||
|
- Adjusting changelogs prior to release of dagger-core v0.2.1, dagger-codegen v0.2.1, dagger-rs v0.2.1 ([`f4a20fd`](https://github.com/kjuulh/dagger-rs/commit/f4a20fda79063b29829cc899793775ba8cb17214))
|
||||||
|
- with actual versions ([`7153c24`](https://github.com/kjuulh/dagger-rs/commit/7153c24f0105a05f170efd10ef2535d83ce0c87e))
|
||||||
|
- with publish ([`989d5bc`](https://github.com/kjuulh/dagger-rs/commit/989d5bc26036d46a199d939b5cbbe72aff2f8fb1))
|
||||||
|
- with repo ([`e5383b5`](https://github.com/kjuulh/dagger-rs/commit/e5383b51f3b290a87b729929c377e93bda3873e0))
|
||||||
|
- with wildcard version ([`533b9df`](https://github.com/kjuulh/dagger-rs/commit/533b9dfef0165c514127a8437d08daf52adf5739))
|
||||||
|
- cargo version 0.2.0 ([`bec62de`](https://github.com/kjuulh/dagger-rs/commit/bec62de62ff5638428174e232a36eee3ddd0f5ef))
|
||||||
|
- bump version ([`36b0ecd`](https://github.com/kjuulh/dagger-rs/commit/36b0ecdabf4c220cffb2d0660fb6480387e3249a))
|
||||||
|
- document usage ([`578c2a6`](https://github.com/kjuulh/dagger-rs/commit/578c2a68830eb40da888823a8770af4a764ed4c7))
|
||||||
|
- fix all clippy ([`6be8482`](https://github.com/kjuulh/dagger-rs/commit/6be8482b461e098384bbf1371ed7d67b259197fa))
|
||||||
|
- add with dockerfile ([`0cbd179`](https://github.com/kjuulh/dagger-rs/commit/0cbd1790b0b4030c68f0a0dd619325da26f14f60))
|
||||||
|
- with caching ([`728840c`](https://github.com/kjuulh/dagger-rs/commit/728840ca8e48b8bec66da4e5fa677bfa60d1d147))
|
||||||
|
- add more quickstart ([`59e2572`](https://github.com/kjuulh/dagger-rs/commit/59e2572173872c8091a0613a387a01e0cccc51bf))
|
||||||
|
- build the application ([`d894def`](https://github.com/kjuulh/dagger-rs/commit/d894def70c85ff2fc567bf614e3be6f4134965e2))
|
||||||
|
- add test-the-application ([`cb9a4dd`](https://github.com/kjuulh/dagger-rs/commit/cb9a4dd84fc13ef03ca3ad539646e95c3c047676))
|
||||||
|
- with println ([`d1726a0`](https://github.com/kjuulh/dagger-rs/commit/d1726a052a6dc4e57f364864446cab3cbda7e0bf))
|
||||||
|
- unpack response ([`3b5b59b`](https://github.com/kjuulh/dagger-rs/commit/3b5b59ba1c20cc68218dc5c0af18ff7a78f6953d))
|
||||||
|
- tested full flow initially ([`7a008be`](https://github.com/kjuulh/dagger-rs/commit/7a008be59e5ca183809e5840cdfae1d87665aa20))
|
||||||
|
- move code to dagger-core ([`ec0d0b2`](https://github.com/kjuulh/dagger-rs/commit/ec0d0b22e646c97acb3ce93f3afb3ddb8590e68f))
|
||||||
|
- with selection impl default ([`9f0021b`](https://github.com/kjuulh/dagger-rs/commit/9f0021b7086046c80b3f455f205149e03eb72da2))
|
||||||
|
- fix warnings ([`2b49f9c`](https://github.com/kjuulh/dagger-rs/commit/2b49f9c19098d96df2bb735253710774b0831c94))
|
||||||
|
- fix test ([`03366b7`](https://github.com/kjuulh/dagger-rs/commit/03366b7c5b3cce5ec42b5c7655843170236c56a1))
|
||||||
|
- test marshaller ([`c5dfceb`](https://github.com/kjuulh/dagger-rs/commit/c5dfcebaad9c255b10ba8c6e4d4dba00821c8941))
|
||||||
|
- test marshaller ([`c4ec6f0`](https://github.com/kjuulh/dagger-rs/commit/c4ec6f0c976ce0af2e05e818731b5e2bed7f0522))
|
||||||
|
- implement sort by name and type ([`d9b51c1`](https://github.com/kjuulh/dagger-rs/commit/d9b51c1ac90c00fb3af24332b6140e1201bc9be7))
|
||||||
|
- fix optional types for real ([`26069a8`](https://github.com/kjuulh/dagger-rs/commit/26069a82a69ec7265216c8ddaceb37228dd0fb81))
|
||||||
|
- fix description ([`f4581ba`](https://github.com/kjuulh/dagger-rs/commit/f4581ba4cd1693a906eaf6c58054398ceae3bfac))
|
||||||
|
- with proper optional types ([`f4a812a`](https://github.com/kjuulh/dagger-rs/commit/f4a812a7d24e9e09cb4e3cbde56ee0b3ac774b62))
|
||||||
|
- set proper option type ([`8549cfc`](https://github.com/kjuulh/dagger-rs/commit/8549cfc3a7d9f831febaeadc22db36604e465ea8))
|
||||||
|
- add fields ([`496a687`](https://github.com/kjuulh/dagger-rs/commit/496a687bc34f7c58cc86df60c183be741b0b8a9c))
|
||||||
|
- add input_fields ([`d2cddff`](https://github.com/kjuulh/dagger-rs/commit/d2cddff365c636feceb3f20a73df812fcab11a19))
|
||||||
|
- with objects ([`5fef514`](https://github.com/kjuulh/dagger-rs/commit/5fef5148010f384d0158361d64b8e17d357d4819))
|
||||||
|
- with enum ([`2a1f7c3`](https://github.com/kjuulh/dagger-rs/commit/2a1f7c3f2666f1f4caebf7c22707709741c2cfad))
|
||||||
|
- with codegen output ([`0bf6b0e`](https://github.com/kjuulh/dagger-rs/commit/0bf6b0e91ecc31c1f6b51338234137eb185810a0))
|
||||||
|
- split out codegen parts ([`3263f1d`](https://github.com/kjuulh/dagger-rs/commit/3263f1d589aee78065401c666533cb0cbadd06ce))
|
||||||
|
- add dagger-sdk ([`9dccb83`](https://github.com/kjuulh/dagger-rs/commit/9dccb83d94a720dd58deffe9f3e5aaea784336f3))
|
||||||
|
</details>
|
||||||
|
|
||||||
@@ -1,22 +1,28 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.1.0"
|
version = "0.2.18"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license-file = "LICENSE.MIT"
|
license-file = "LICENSE.MIT"
|
||||||
description = "A dagger sdk for rust, written in rust"
|
description = "A dagger sdk for rust, written in rust"
|
||||||
|
repository = "https://github.com/kjuulh/dagger-rs"
|
||||||
|
publish = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.21.0"
|
dagger-core = { path = "../dagger-core", version = "^0.2.8" }
|
||||||
dagger-core = { path = "../dagger-core" }
|
|
||||||
eyre = "0.6.8"
|
|
||||||
futures = "0.3.26"
|
|
||||||
|
|
||||||
genco = "0.17.3"
|
base64 = "0.21.0"
|
||||||
|
eyre = "0.6.8"
|
||||||
|
futures = "0.3.27"
|
||||||
gql_client = "1.0.7"
|
gql_client = "1.0.7"
|
||||||
pretty_assertions = "1.3.0"
|
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
serde_json = "1.0.92"
|
serde_json = { version = "1.0.93", features = ["raw_value"] }
|
||||||
tokio = { version = "1.25.0", features = ["full"] }
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
|
derive_builder = "0.12.0"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
pretty_assertions = "1.3.0"
|
||||||
|
rand = "0.8.5"
|
||||||
|
genco = "0.17.3"
|
||||||
|
|||||||
@@ -1,15 +1,48 @@
|
|||||||
# dagger-rs
|
# dagger-sdk
|
||||||
|
|
||||||
A dagger sdk written in rust for rust.
|
A dagger sdk written in rust for rust.
|
||||||
|
|
||||||
## Disclaimer
|
## Examples
|
||||||
|
|
||||||
Work in progress. This is not ready for usage yet
|
See [examples](./examples/)
|
||||||
|
|
||||||
### Status
|
Run them like so
|
||||||
|
|
||||||
- [x] dagger cli downloader
|
```bash
|
||||||
- [x] dagger network session
|
cargo run --example first-pipeline
|
||||||
- [ ] graphql rust codegen (User API)
|
```
|
||||||
- [ ] fix build / release cycle
|
|
||||||
- [ ] general api stabilisation
|
The examples match the folder name in each directory in examples
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Simply install like:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo add dagger-sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```rust
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
let client = dagger_sdk::connect().await?;
|
||||||
|
|
||||||
|
let version = client
|
||||||
|
.container()
|
||||||
|
.from("golang:1.19")
|
||||||
|
.with_exec(vec!["go", "version"])
|
||||||
|
.stdout().await?;
|
||||||
|
|
||||||
|
println!("Hello from Dagger and {}", version.trim());
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And run it like a normal application:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
|||||||
25
crates/dagger-sdk/examples/build-the-application/app/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
build-*
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# React Build
|
||||||
|
|
||||||
|
This is based on the [Getting Started guide for Nodejs](https://docs.dagger.io/sdk/nodejs/783645/get-started#step-5-test-against-multiple-nodejs-versions)
|
||||||
|
|
||||||
|
A simple react app is created with `create-react-app` which is built and tested by `build.js` or `build.ts`.
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
`npm install`
|
||||||
|
|
||||||
|
and then:
|
||||||
|
|
||||||
|
`node --loader ts-node/esm ./build.ts`
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
`node ./build.js`
|
||||||
29700
crates/dagger-sdk/examples/build-the-application/app/package-lock.json
generated
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "react-build",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
|
"@testing-library/react": "^13.4.0",
|
||||||
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"@types/jest": "^27.5.2",
|
||||||
|
"@types/node": "^16.18.6",
|
||||||
|
"@types/react": "^18.0.26",
|
||||||
|
"@types/react-dom": "^18.0.9",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"react-scripts": "5.0.1",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"typescript": "^4.9.3",
|
||||||
|
"web-vitals": "^2.1.4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"devDependencies": {
|
||||||
|
"@dagger.io/dagger": "^0.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
height: 40vmin;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
.App-logo {
|
||||||
|
animation: App-logo-spin infinite 20s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #282c34;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: calc(10px + 2vmin);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-link {
|
||||||
|
color: #61dafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes App-logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { render, screen } from '@testing-library/react';
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
test('renders learn react link', () => {
|
||||||
|
render(<App />);
|
||||||
|
const linkElement = screen.getByText(/learn react/i);
|
||||||
|
expect(linkElement).toBeInTheDocument();
|
||||||
|
});
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import logo from './logo.svg';
|
||||||
|
import './App.css';
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<div className="App">
|
||||||
|
<header className="App-header">
|
||||||
|
<img src={logo} className="App-logo" alt="logo" />
|
||||||
|
<p>
|
||||||
|
Edit <code>src/App.tsx</code> and save to reload.
|
||||||
|
</p>
|
||||||
|
<a
|
||||||
|
className="App-link"
|
||||||
|
href="https://reactjs.org"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Learn React
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import './index.css';
|
||||||
|
import App from './App';
|
||||||
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
|
||||||
|
const root = ReactDOM.createRoot(
|
||||||
|
document.getElementById('root') as HTMLElement
|
||||||
|
);
|
||||||
|
root.render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>
|
||||||
|
);
|
||||||
|
|
||||||
|
// If you want to start measuring performance in your app, pass a function
|
||||||
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
|
reportWebVitals();
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
1
crates/dagger-sdk/examples/build-the-application/app/src/react-app-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="react-scripts" />
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { ReportHandler } from 'web-vitals';
|
||||||
|
|
||||||
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||||
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||||
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
|
getCLS(onPerfEntry);
|
||||||
|
getFID(onPerfEntry);
|
||||||
|
getFCP(onPerfEntry);
|
||||||
|
getLCP(onPerfEntry);
|
||||||
|
getTTFB(onPerfEntry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reportWebVitals;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||||
|
// allows you to do things like:
|
||||||
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
|
import '@testing-library/jest-dom';
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
}
|
||||||
37
crates/dagger-sdk/examples/build-the-application/main.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
use dagger_sdk::HostDirectoryOpts;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
let client = dagger_sdk::connect().await?;
|
||||||
|
|
||||||
|
let host_source_dir = client.host().directory_opts(
|
||||||
|
"examples/build-the-application/app",
|
||||||
|
HostDirectoryOpts {
|
||||||
|
exclude: Some(vec!["node_modules".into(), "ci/".into()]),
|
||||||
|
include: None,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let source = client
|
||||||
|
.container()
|
||||||
|
.from("node:16")
|
||||||
|
.with_mounted_directory("/src", host_source_dir.id().await?);
|
||||||
|
|
||||||
|
let runner = source
|
||||||
|
.with_workdir("/src")
|
||||||
|
.with_exec(vec!["npm", "install"]);
|
||||||
|
|
||||||
|
let test = runner.with_exec(vec!["npm", "test", "--", "--watchAll=false"]);
|
||||||
|
|
||||||
|
let build_dir = test
|
||||||
|
.with_exec(vec!["npm", "run", "build"])
|
||||||
|
.directory("./build");
|
||||||
|
|
||||||
|
let _ = build_dir.export("./build");
|
||||||
|
|
||||||
|
let entries = build_dir.entries().await;
|
||||||
|
|
||||||
|
println!("build dir contents: \n {:?}", entries);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
25
crates/dagger-sdk/examples/caching/app/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
build-*
|
||||||
17
crates/dagger-sdk/examples/caching/app/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# React Build
|
||||||
|
|
||||||
|
This is based on the [Getting Started guide for Nodejs](https://docs.dagger.io/sdk/nodejs/783645/get-started#step-5-test-against-multiple-nodejs-versions)
|
||||||
|
|
||||||
|
A simple react app is created with `create-react-app` which is built and tested by `build.js` or `build.ts`.
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
`npm install`
|
||||||
|
|
||||||
|
and then:
|
||||||
|
|
||||||
|
`node --loader ts-node/esm ./build.ts`
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
`node ./build.js`
|
||||||
29700
crates/dagger-sdk/examples/caching/app/package-lock.json
generated
Normal file
48
crates/dagger-sdk/examples/caching/app/package.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "react-build",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
|
"@testing-library/react": "^13.4.0",
|
||||||
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"@types/jest": "^27.5.2",
|
||||||
|
"@types/node": "^16.18.6",
|
||||||
|
"@types/react": "^18.0.26",
|
||||||
|
"@types/react-dom": "^18.0.9",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"react-scripts": "5.0.1",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"typescript": "^4.9.3",
|
||||||
|
"web-vitals": "^2.1.4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"devDependencies": {
|
||||||
|
"@dagger.io/dagger": "^0.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
crates/dagger-sdk/examples/caching/app/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
43
crates/dagger-sdk/examples/caching/app/public/index.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
crates/dagger-sdk/examples/caching/app/public/logo192.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
crates/dagger-sdk/examples/caching/app/public/logo512.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
25
crates/dagger-sdk/examples/caching/app/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
3
crates/dagger-sdk/examples/caching/app/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
38
crates/dagger-sdk/examples/caching/app/src/App.css
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
height: 40vmin;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
.App-logo {
|
||||||
|
animation: App-logo-spin infinite 20s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #282c34;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: calc(10px + 2vmin);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-link {
|
||||||
|
color: #61dafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes App-logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
crates/dagger-sdk/examples/caching/app/src/App.test.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { render, screen } from '@testing-library/react';
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
test('renders learn react link', () => {
|
||||||
|
render(<App />);
|
||||||
|
const linkElement = screen.getByText(/learn react/i);
|
||||||
|
expect(linkElement).toBeInTheDocument();
|
||||||
|
});
|
||||||
26
crates/dagger-sdk/examples/caching/app/src/App.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import logo from './logo.svg';
|
||||||
|
import './App.css';
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<div className="App">
|
||||||
|
<header className="App-header">
|
||||||
|
<img src={logo} className="App-logo" alt="logo" />
|
||||||
|
<p>
|
||||||
|
Edit <code>src/App.tsx</code> and save to reload.
|
||||||
|
</p>
|
||||||
|
<a
|
||||||
|
className="App-link"
|
||||||
|
href="https://reactjs.org"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
Learn React
|
||||||
|
</a>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
13
crates/dagger-sdk/examples/caching/app/src/index.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
19
crates/dagger-sdk/examples/caching/app/src/index.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import './index.css';
|
||||||
|
import App from './App';
|
||||||
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
|
||||||
|
const root = ReactDOM.createRoot(
|
||||||
|
document.getElementById('root') as HTMLElement
|
||||||
|
);
|
||||||
|
root.render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>
|
||||||
|
);
|
||||||
|
|
||||||
|
// If you want to start measuring performance in your app, pass a function
|
||||||
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
|
reportWebVitals();
|
||||||
1
crates/dagger-sdk/examples/caching/app/src/logo.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
1
crates/dagger-sdk/examples/caching/app/src/react-app-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="react-scripts" />
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { ReportHandler } from 'web-vitals';
|
||||||
|
|
||||||
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||||
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||||
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
|
getCLS(onPerfEntry);
|
||||||
|
getFID(onPerfEntry);
|
||||||
|
getFCP(onPerfEntry);
|
||||||
|
getLCP(onPerfEntry);
|
||||||
|
getTTFB(onPerfEntry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reportWebVitals;
|
||||||
5
crates/dagger-sdk/examples/caching/app/src/setupTests.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||||
|
// allows you to do things like:
|
||||||
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
|
import '@testing-library/jest-dom';
|
||||||
26
crates/dagger-sdk/examples/caching/app/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
}
|
||||||
44
crates/dagger-sdk/examples/caching/main.rs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
use rand::Rng;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> eyre::Result<()> {
|
||||||
|
let client = dagger_sdk::connect().await?;
|
||||||
|
|
||||||
|
let host_source_dir = client.host().directory_opts(
|
||||||
|
"./examples/caching/app",
|
||||||
|
dagger_sdk::HostDirectoryOptsBuilder::default()
|
||||||
|
.exclude(vec!["node_modules", "ci/"])
|
||||||
|
.build()?,
|
||||||
|
);
|
||||||
|
|
||||||
|
let node_cache = client.cache_volume("node").id().await?;
|
||||||
|
|
||||||
|
let source = client
|
||||||
|
.container()
|
||||||
|
.from("node:16")
|
||||||
|
.with_mounted_directory("/src", host_source_dir.id().await?)
|
||||||
|
.with_mounted_cache("/src/node_modules", node_cache);
|
||||||
|
|
||||||
|
let runner = source
|
||||||
|
.with_workdir("/src")
|
||||||
|
.with_exec(vec!["npm", "install"]);
|
||||||
|
|
||||||
|
let test = runner.with_exec(vec!["npm", "test", "--", "--watchAll=false"]);
|
||||||
|
|
||||||
|
let build_dir = test
|
||||||
|
.with_exec(vec!["npm", "run", "build"])
|
||||||
|
.directory("./build");
|
||||||
|
|
||||||
|
let mut rng = rand::thread_rng();
|
||||||
|
|
||||||
|
let ref_ = client
|
||||||
|
.container()
|
||||||
|
.from("nginx")
|
||||||
|
.with_directory("/usr/share/nginx/html", build_dir.id().await?)
|
||||||
|
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("published image to: {}", ref_);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
25
crates/dagger-sdk/examples/existing-dockerfile/app/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
build-*
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
FROM node:16 as builder
|
||||||
|
|
||||||
|
COPY . /src
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
RUN npm test -- --watchAll=false
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx
|
||||||
|
|
||||||
|
COPY --from=builder /src/build /usr/share/nginx/html
|
||||||