Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make package.metadata.cargo-compete.config optional #112

Merged
merged 1 commit into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [Unreleased]

### Changed

- Made `package.metadata.cargo-compete.config` optional.

```diff
[package.metadata.cargo-compete]
-config = "../compete.toml"
```

## [0.7.1] - 2021-01-21Z

### Changed
Expand Down
8 changes: 1 addition & 7 deletions README-ja.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cargo-compete
#jcargo-compete

[![CI](https://github.com/qryxip/cargo-compete/workflows/CI/badge.svg)](https://github.com/qryxip/cargo-compete/actions?workflow=CI)
[![codecov](https://codecov.io/gh/qryxip/cargo-compete/branch/master/graph/badge.svg)](https://codecov.io/gh/qryxip/cargo-compete/branch/master)
Expand Down Expand Up @@ -331,9 +331,6 @@ version = "0.1.0"
authors = ["Ryo Yamashita <qryxip@gmail.com>"]
edition = "2018"

[package.metadata.cargo-compete]
config = "../compete.toml"

[package.metadata.cargo-compete.bin]
a = { name = "practice-a", problem = "https://atcoder.jp/contests/practice/tasks/practice_1" }
b = { name = "practice-b", problem = "https://atcoder.jp/contests/practice/tasks/practice_2" }
Expand Down Expand Up @@ -398,9 +395,6 @@ version = "0.0.0"
edition = "2018"
publish = false

[package.metadata.cargo-compete]
config = "./compete.toml"

[package.metadata.cargo-compete.bin]
aplusb = { name = "aplusb", problem = "https://judge.yosupo.jp/problem/aplusb" }
```
Expand Down
21 changes: 1 addition & 20 deletions src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ use crate::{
oj_api,
shell::{ColorChoice, Shell},
};
use anyhow::{anyhow, bail, Context as _};
use anyhow::{bail, Context as _};
use heck::KebabCase as _;
use itertools::Itertools as _;
use liquid::object;
use snowchains_core::web::{PlatformKind, ProblemsInContest, YukicoderRetrieveTestCasesTargets};
use std::{
collections::BTreeMap,
iter,
path::{Path, PathBuf},
};
use structopt::StructOpt;
Expand Down Expand Up @@ -373,8 +372,6 @@ fn create_new_package(
problems: &BTreeMap<&str, &Url>,
shell: &mut Shell,
) -> anyhow::Result<(PathBuf, Vec<PathBuf>)> {
let cargo_compete_config_dir = cargo_compete_config_path.with_file_name("");

let manifest_dir = cargo_compete_config.new.path().render(&object!({
"contest": group.contest(),
"package_name": group.package_name(),
Expand Down Expand Up @@ -490,22 +487,6 @@ fn create_new_package(
set_implicit_table_if_none(&mut manifest["package"]["metadata"]["cargo-compete"]);
set_implicit_table_if_none(&mut manifest["package"]["metadata"]["cargo-compete"]["bin"]);

manifest["package"]["metadata"]["cargo-compete"]["config"] = toml_edit::value({
if let Ok(rel_manifest_dir) = manifest_dir.strip_prefix(&cargo_compete_config_dir) {
rel_manifest_dir
.iter()
.map(|_| "..")
.chain(iter::once("compete.toml"))
.join("/")
} else {
manifest_dir
.clone()
.into_os_string()
.into_string()
.map_err(|s| anyhow!("invalid utf-8 path: {:?}", s))?
}
});

for (key, val) in package_metadata_cargo_compete_bin.as_table().iter() {
manifest["package"]["metadata"]["cargo-compete"]["bin"][key] = val.clone();
}
Expand Down
3 changes: 1 addition & 2 deletions src/commands/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ pub(crate) fn run(opt: OptCompeteOpen, ctx: crate::Context<'_>) -> anyhow::Resul
let metadata = crate::project::cargo_metadata(&manifest_path, cwd)?;
let member = metadata.query_for_member(package.as_deref())?;
let package_metadata = member.read_package_metadata(shell)?;
let cargo_compete_config =
crate::config::load_from_rel_path(&member.manifest_path, &package_metadata.config, shell)?;
let cargo_compete_config = crate::config::load_for_package(&member, shell)?;

let mut urls = vec![];
let mut file_paths = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/commands/retrieve_submission_summaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) fn run(
let metadata = crate::project::cargo_metadata(&manifest_path, cwd)?;
let member = metadata.query_for_member(package.as_deref())?;
let package_metadata = member.read_package_metadata(shell)?;
crate::config::load_from_rel_path(&member.manifest_path, &package_metadata.config, shell)?;
crate::config::load_for_package(&member, shell)?;

let mut atcoder_targets = indexset!();

Expand Down
3 changes: 1 addition & 2 deletions src/commands/retrieve_testcases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ pub(crate) fn run(opt: OptCompeteRetrieveTestcases, ctx: crate::Context<'_>) ->
let metadata = crate::project::cargo_metadata(&manifest_path, cwd)?;
let member = metadata.query_for_member(package.as_deref())?;
let package_metadata = member.read_package_metadata(shell)?;
let cargo_compete_config =
crate::config::load_from_rel_path(&member.manifest_path, &package_metadata.config, shell)?;
let cargo_compete_config = crate::config::load_for_package(&member, shell)?;

let mut urls = vec![];
let mut file_paths = vec![];
Expand Down
3 changes: 1 addition & 2 deletions src/commands/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ pub(crate) fn run(opt: OptCompeteSubmit, ctx: crate::Context<'_>) -> anyhow::Res
let metadata = crate::project::cargo_metadata(&manifest_path, &cwd)?;
let member = metadata.query_for_member(package.as_deref())?;
let package_metadata = member.read_package_metadata(shell)?;
let cargo_compete_config =
crate::config::load_from_rel_path(&member.manifest_path, &package_metadata.config, shell)?;
let cargo_compete_config = crate::config::load_for_package(&member, shell)?;

let (bin, package_metadata_bin) = if let Some(src) = src {
let src = cwd.join(src.strip_prefix(".").unwrap_or(&src));
Expand Down
3 changes: 1 addition & 2 deletions src/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ pub(crate) fn run(opt: OptCompeteTest, ctx: crate::Context<'_>) -> anyhow::Resul
let metadata = crate::project::cargo_metadata(&manifest_path, &cwd)?;
let member = metadata.query_for_member(package.as_deref())?;
let package_metadata = member.read_package_metadata(shell)?;
let cargo_compete_config =
crate::config::load_from_rel_path(&member.manifest_path, &package_metadata.config, shell)?;
let cargo_compete_config = crate::config::load_for_package(&member, shell)?;

let (bin, bin_alias, problem_url) = if let Some(src) = src {
let src = cwd.join(src.strip_prefix(".").unwrap_or(&src));
Expand Down
26 changes: 21 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::shell::Shell;
use crate::{project::PackageExt as _, shell::Shell};
use anyhow::Context as _;
use derivative::Derivative;
use heck::KebabCase as _;
use indexmap::indexset;
use krates::cm;
use liquid::object;
use serde::{de::Error as _, Deserialize, Deserializer};
use snowchains_core::web::PlatformKind;
Expand Down Expand Up @@ -77,12 +78,27 @@ pub(crate) fn load(
Ok(config)
}

pub(crate) fn load_from_rel_path(
manifest_path: &Path,
rel_path: impl AsRef<Path>,
pub(crate) fn load_for_package(
package: &cm::Package,
shell: &mut Shell,
) -> anyhow::Result<CargoCompeteConfig> {
load(manifest_path.with_file_name("").join(rel_path), shell)
let manifest_dir = package.manifest_path.with_file_name("");
let path = if let Some(config) = package.read_package_metadata(shell)?.config {
manifest_dir.join(config)
} else {
manifest_dir
.ancestors()
.map(|p| p.join("compete.toml"))
.find(|p| p.exists())
.with_context(|| {
format!(
"could not find `compete.toml` in `{}` or any parent directory. first, create \
one with `cargo compete init`",
manifest_dir.display(),
)
})?
};
load(path, shell)
}

#[derive(Deserialize, Derivative)]
Expand Down
2 changes: 1 addition & 1 deletion src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use url::Url;
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub(crate) struct PackageMetadataCargoCompete {
pub(crate) config: PathBuf,
pub(crate) config: Option<PathBuf>,
pub(crate) bin: IndexMap<String, PackageMetadataCargoCompeteBin>,
}

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/new__atcoder_abc003_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: tree
"config.toml": "[cargo-new]\nname = \"\"\nemail = \"\"\n"
},
"abc003": {
"Cargo.toml": "[package]\nname = \"abc003\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"abc003-a\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_1\" }\nb = { name = \"abc003-b\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_2\" }\nc = { name = \"abc003-c\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_3\" }\nd = { name = \"abc003-d\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_4\" }\n\n[[bin]]\nname = \"abc003-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"abc003-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"abc003-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"abc003-d\"\npath = \"src/bin/d.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"abc003\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"abc003-a\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_1\" }\nb = { name = \"abc003-b\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_2\" }\nc = { name = \"abc003-c\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_3\" }\nd = { name = \"abc003-d\", problem = \"https://atcoder.jp/contests/abc003/tasks/abc003_4\" }\n\n[[bin]]\nname = \"abc003-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"abc003-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"abc003-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"abc003-d\"\npath = \"src/bin/d.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "fn main() {\n todo!();\n}\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/new__atcoder_abc007_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: tree
"config.toml": "[cargo-new]\nname = \"\"\nemail = \"\"\n"
},
"abc007": {
"Cargo.toml": "[package]\nname = \"abc007\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"abc007-a\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_1\" }\nb = { name = \"abc007-b\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_2\" }\nc = { name = \"abc007-c\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_3\" }\nd = { name = \"abc007-d\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_4\" }\n\n[[bin]]\nname = \"abc007-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"abc007-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"abc007-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"abc007-d\"\npath = \"src/bin/d.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"abc007\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"abc007-a\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_1\" }\nb = { name = \"abc007-b\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_2\" }\nc = { name = \"abc007-c\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_3\" }\nd = { name = \"abc007-d\", problem = \"https://atcoder.jp/contests/abc007/tasks/abc007_4\" }\n\n[[bin]]\nname = \"abc007-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"abc007-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"abc007-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"abc007-d\"\npath = \"src/bin/d.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "fn main() {\n todo!();\n}\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/new__atcoder_agc047_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: tree
"config.toml": "[cargo-new]\nname = \"\"\nemail = \"\"\n"
},
"agc047": {
"Cargo.toml": "[package]\nname = \"agc047\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"agc047-a\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_a\" }\nb = { name = \"agc047-b\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_b\" }\nc = { name = \"agc047-c\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_c\" }\nd = { name = \"agc047-d\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_d\" }\ne = { name = \"agc047-e\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_e\" }\nf = { name = \"agc047-f\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_f\" }\n\n[[bin]]\nname = \"agc047-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"agc047-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"agc047-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"agc047-d\"\npath = \"src/bin/d.rs\"\n\n[[bin]]\nname = \"agc047-e\"\npath = \"src/bin/e.rs\"\n\n[[bin]]\nname = \"agc047-f\"\npath = \"src/bin/f.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"agc047\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"agc047-a\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_a\" }\nb = { name = \"agc047-b\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_b\" }\nc = { name = \"agc047-c\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_c\" }\nd = { name = \"agc047-d\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_d\" }\ne = { name = \"agc047-e\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_e\" }\nf = { name = \"agc047-f\", problem = \"https://atcoder.jp/contests/agc047/tasks/agc047_f\" }\n\n[[bin]]\nname = \"agc047-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"agc047-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"agc047-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"agc047-d\"\npath = \"src/bin/d.rs\"\n\n[[bin]]\nname = \"agc047-e\"\npath = \"src/bin/e.rs\"\n\n[[bin]]\nname = \"agc047-f\"\npath = \"src/bin/f.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "fn main() {\n todo!();\n}\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/new__atcoder_practice_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ expression: tree
},
"compete.toml": "test-suite = \"{{ manifest_dir }}/testcases/{{ bin_alias | kebabcase }}.yml\"\n\n[new]\nplatform = \"atcoder\"\npath = \"./{{ package_name }}\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nproconio = \"=0.3.6\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n",
"practice": {
"Cargo.toml": "[package]\nname = \"practice\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"practice-a\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_1\" }\nb = { name = \"practice-b\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_2\" }\n\n[[bin]]\nname = \"practice-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"practice-b\"\npath = \"src/bin/b.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"practice\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"practice-a\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_1\" }\nb = { name = \"practice-b\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_2\" }\n\n[[bin]]\nname = \"practice-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"practice-b\"\npath = \"src/bin/b.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "fn main() {\n todo!();\n}\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/new__yukicoder_contest_100_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ expression: tree
},
"compete.toml": "test-suite = \"{{ manifest_dir }}/testcases/{{ bin_alias | kebabcase }}.yml\"\n\n[new]\nplatform = \"yukicoder\"\npath = \"./{{ package_name }}\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nproconio = \"=0.3.6\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n",
"contest100": {
"Cargo.toml": "[package]\nname = \"contest100\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"contest100-a\", problem = \"https://yukicoder.me/problems/no/191\" }\nb = { name = \"contest100-b\", problem = \"https://yukicoder.me/problems/no/192\" }\nc = { name = \"contest100-c\", problem = \"https://yukicoder.me/problems/no/193\" }\nd = { name = \"contest100-d\", problem = \"https://yukicoder.me/problems/no/194\" }\ne = { name = \"contest100-e\", problem = \"https://yukicoder.me/problems/no/195\" }\nf = { name = \"contest100-f\", problem = \"https://yukicoder.me/problems/no/196\" }\n\n[[bin]]\nname = \"contest100-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"contest100-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"contest100-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"contest100-d\"\npath = \"src/bin/d.rs\"\n\n[[bin]]\nname = \"contest100-e\"\npath = \"src/bin/e.rs\"\n\n[[bin]]\nname = \"contest100-f\"\npath = \"src/bin/f.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"contest100\"\nversion = \"0.1.0\"\nauthors = [\"\"]\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"contest100-a\", problem = \"https://yukicoder.me/problems/no/191\" }\nb = { name = \"contest100-b\", problem = \"https://yukicoder.me/problems/no/192\" }\nc = { name = \"contest100-c\", problem = \"https://yukicoder.me/problems/no/193\" }\nd = { name = \"contest100-d\", problem = \"https://yukicoder.me/problems/no/194\" }\ne = { name = \"contest100-e\", problem = \"https://yukicoder.me/problems/no/195\" }\nf = { name = \"contest100-f\", problem = \"https://yukicoder.me/problems/no/196\" }\n\n[[bin]]\nname = \"contest100-a\"\npath = \"src/bin/a.rs\"\n\n[[bin]]\nname = \"contest100-b\"\npath = \"src/bin/b.rs\"\n\n[[bin]]\nname = \"contest100-c\"\npath = \"src/bin/c.rs\"\n\n[[bin]]\nname = \"contest100-d\"\npath = \"src/bin/d.rs\"\n\n[[bin]]\nname = \"contest100-e\"\npath = \"src/bin/e.rs\"\n\n[[bin]]\nname = \"contest100-f\"\npath = \"src/bin/f.rs\"\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "fn main() {\n todo!();\n}\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/test__atcoder_practice_a_file_tree.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ expression: tree
"compete.toml": "test-suite = \"{{ manifest_dir }}/testcases/{{ bin_alias | kebabcase }}.yml\"\n\n[new]\nplatform = \"atcoder\"\npath = \"./{{ package_name }}\"\n\n[new.template.dependencies]\nkind = \"inline\"\ncontent = '''\nproconio = \"=0.3.6\"\n'''\n\n[new.template.src]\nkind = \"inline\"\ncontent = '''\nfn main() {\n todo!();\n}\n'''\n",
"practice": {
"Cargo.lock": "..",
"Cargo.toml": "[package]\nname = \"problems\"\nversion = \"0.1.0\"\nedition = \"2018\"\n\n[package.metadata.cargo-compete]\nconfig = \"../compete.toml\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"practice-a\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_1\" }\n\n[[bin]]\nname = \"practice-a\"\npath = \"src/bin/a.rs\"\n\n[dependencies]\nproconio = \"=0.3.6\"\n",
"Cargo.toml": "[package]\nname = \"problems\"\nversion = \"0.1.0\"\nedition = \"2018\"\n\n[package.metadata.cargo-compete.bin]\na = { name = \"practice-a\", problem = \"https://atcoder.jp/contests/practice/tasks/practice_1\" }\n\n[[bin]]\nname = \"practice-a\"\npath = \"src/bin/a.rs\"\n\n[dependencies]\nproconio = \"=0.3.6\"\n",
"src": {
"bin": {
"a.rs": "use proconio::input;\n\nfn main() {\n input! {\n a: u32,\n b: u32,\n c: u32,\n s: String,\n }\n\n println!(\"{} {}\", a + b + c, s);\n}\n"
Expand Down
3 changes: 0 additions & 3 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ name = "problems"
version = "0.1.0"
edition = "2018"

[package.metadata.cargo-compete]
config = "../compete.toml"

[package.metadata.cargo-compete.bin]
{problem} = {{ name = "{contest}-{problem}", problem = "{url}" }}

Expand Down