-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
twoliter: Remove
Release.toml
from build
- Loading branch information
Showing
16 changed files
with
100 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "test-variant" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
[workspace] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::{test::data_dir, variant::variant_version}; | ||
|
||
#[tokio::test] | ||
async fn test_variant_version() { | ||
assert_eq!( | ||
variant_version(&data_dir().join("variants"), "test-variant") | ||
.await | ||
.unwrap(), | ||
"0.1.0" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use crate::common::exec; | ||
use anyhow::{Context, Result}; | ||
use serde_json::Value; | ||
use std::path::Path; | ||
use tokio::process::Command; | ||
|
||
pub(crate) async fn variant_version<S>(variants_dir: &Path, variant: S) -> Result<String> | ||
where | ||
S: AsRef<str>, | ||
{ | ||
serde_json::from_str::<Value>( | ||
&exec( | ||
Command::new("cargo").args([ | ||
"metadata", | ||
"--manifest-path", | ||
&variants_dir | ||
.join(variant.as_ref()) | ||
.join("Cargo.toml") | ||
.display() | ||
.to_string(), | ||
"--no-deps", | ||
"--format-version", | ||
"1", | ||
]), | ||
true, | ||
) | ||
.await?, | ||
)? | ||
.as_object() | ||
.context("Unexpected output format from `cargo metadata`")? | ||
.get("packages") | ||
.and_then(Value::as_array) | ||
.context("`packages` is not an array")? | ||
.iter() | ||
.find(|value| { | ||
value | ||
.as_object() | ||
.map(|object| object.get("name") == Some(&Value::String(variant.as_ref().into()))) | ||
.unwrap_or_default() | ||
}) | ||
.and_then(Value::as_object) | ||
.and_then(|object| object.get("version")) | ||
.and_then(Value::as_str) | ||
.map(str::to_string) | ||
.context("Unable to get variant version from Cargo.toml metadata") | ||
} |