Skip to content

Commit c30f587

Browse files
committed
Add devcontainer with cargo-compete
1 parent 19635c1 commit c30f587

File tree

7 files changed

+743
-0
lines changed

7 files changed

+743
-0
lines changed

.cargo/config.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
target-dir = "target"

.devcontainer/.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TZ=Asia/Tokyo

.devcontainer/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM rust:1.68-buster
2+
3+
RUN cargo install cargo-compete && \
4+
rustup toolchain install 1.42.0

.devcontainer/devcontainer.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "${localWorkspaceFolderBasename}",
3+
4+
"build": { "dockerfile": "Dockerfile" },
5+
6+
"runArgs": ["--env-file", ".devcontainer/.env"]
7+
}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11+
12+
# Ignore environment variables file
13+
.env
14+
15+
# Ignore source code files
16+
/src/

compete.toml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Path to the test file (Liquid template)
2+
#
3+
# Variables:
4+
#
5+
# - `manifest_dir`: Package directory
6+
# - `contest`: Contest ID (e.g. "abc100")
7+
# - `bin_name`: Name of a `bin` target (e.g. "abc100-a")
8+
# - `bin_alias`: "Alias" for a `bin` target defined in `pacakge.metadata.cargo-compete` (e.g. "a")
9+
# - `problem`: Alias for `bin_alias` (deprecated)
10+
#
11+
# Additional filters:
12+
#
13+
# - `kebabcase`: Convert to kebab case (by using the `heck` crate)
14+
test-suite = "{{ manifest_dir }}/testcases/{{ bin_alias }}.yml"
15+
16+
# Open files with the command (`jq` command that outputs `string[] | string[][]`)
17+
#
18+
# VSCode:
19+
#open = '[["code", "-a", .manifest_dir], ["code"] + (.paths | map([.src, .test_suite]) | flatten)]'
20+
# Emacs:
21+
#open = '["emacsclient", "-n"] + (.paths | map([.src, .test_suite]) | flatten)'
22+
23+
[template]
24+
src = '''
25+
fn main() {
26+
todo!();
27+
}
28+
'''
29+
30+
[template.new]
31+
# `edition` for `Cargo.toml`.
32+
edition = "2018"
33+
# `profile` for `Cargo.toml`.
34+
#
35+
# By setting this, you can run tests with `opt-level=3` while enabling `debug-assertions` and `overflow-checks`.
36+
#profile = '''
37+
#[dev]
38+
#opt-level = 3
39+
#'''
40+
dependencies = '''
41+
num = "=0.2.1"
42+
num-bigint = "=0.2.6"
43+
num-complex = "=0.2.4"
44+
num-integer = "=0.1.42"
45+
num-iter = "=0.1.40"
46+
num-rational = "=0.2.4"
47+
num-traits = "=0.2.11"
48+
num-derive = "=0.3.0"
49+
ndarray = "=0.13.0"
50+
nalgebra = "=0.20.0"
51+
alga = "=0.9.3"
52+
libm = "=0.2.1"
53+
rand = { version = "=0.7.3", features = ["small_rng"] }
54+
getrandom = "=0.1.14"
55+
rand_chacha = "=0.2.2"
56+
rand_core = "=0.5.1"
57+
rand_hc = "=0.2.0"
58+
rand_pcg = "=0.2.1"
59+
rand_distr = "=0.2.2"
60+
petgraph = "=0.5.0"
61+
indexmap = "=1.3.2"
62+
regex = "=1.3.6"
63+
lazy_static = "=1.4.0"
64+
ordered-float = "=1.0.2"
65+
ascii = "=1.0.0"
66+
permutohedron = "=0.2.4"
67+
superslice = "=1.0.0"
68+
itertools = "=0.9.0"
69+
itertools-num = "=0.1.3"
70+
maplit = "=1.0.2"
71+
either = "=1.5.3"
72+
im-rc = "=14.3.0"
73+
fixedbitset = "=0.2.0"
74+
bitset-fixed = "=0.1.0"
75+
proconio = { version = "=0.3.6", features = ["derive"] }
76+
text_io = "=0.1.8"
77+
whiteread = "=0.5.0"
78+
rustc-hash = "=1.1.0"
79+
smallvec = "=1.2.0"
80+
'''
81+
dev-dependencies = '''
82+
#atcoder-202004-lock = { git = "https://github.com/qryxip/atcoder-202004-lock" }
83+
'''
84+
85+
[template.new.copy-files]
86+
"./template-cargo-lock.toml" = "Cargo.lock"
87+
88+
[new]
89+
kind = "cargo-compete"
90+
# Platform
91+
#
92+
# - atcoder
93+
# - codeforces
94+
# - yukicoder
95+
platform = "atcoder"
96+
# Path (Liquid template)
97+
#
98+
# Variables:
99+
#
100+
# - `contest`: Contest ID. **May be nil**
101+
# - `package_name`: Package name
102+
path = "./src/contest/{{ contest }}"
103+
104+
#[new]
105+
#kind = "oj-api"
106+
#url = "https://atcoder.jp/contests/{{ id }}"
107+
#path = "./{{ contest }}"
108+
109+
# for Library-Checker
110+
#[add]
111+
#url = "https://judge.yosupo.jp/problem/{{ args[0] }}"
112+
##is-contest = ["false"] # optional
113+
##target-kind = "bin" # ["bin", "example"]. default to "bin"
114+
#bin-name = '{{ args[0] }}'
115+
##bin-alias = '{{ args[0] }}' # optional
116+
##bin-src-path = './src/bin/{{ bin_alias }}.rs' # optional
117+
118+
# for yukicoder
119+
#[add]
120+
#url = '{% case args[0] %}{% when "contest" %}https://yukicoder.me/contests/{{ args[1] }}{% when "problem" %}https://yukicoder.me/problems/no/{{ args[1] }}{% endcase %}'
121+
#is-contest = ["bash", "-c", '[[ $(cut -d / -f 4) == "contests" ]]'] # optional
122+
##target-kind = "bin" # ["bin", "example"]. default to "bin"
123+
#bin-name = '{% assign segments = url | split: "/" %}{{ segments[5] }}'
124+
##bin-alias = '{% assign segments = url | split: "/" %}{{ segments[5] }}' # optional
125+
##bin-src-path = './src/bin/{{ bin_alias }}.rs' # optional
126+
127+
[test]
128+
# Toolchain for the test. (optional)
129+
toolchain = "1.42.0"
130+
# Profile for `cargo build`. ("dev" | "release")
131+
#
132+
# Defaults to `"dev"`.
133+
#profile = "dev"
134+
135+
#[submit.transpile]
136+
#kind = "command"
137+
#args = ["cargo", "equip", "--exclude-atcoder-crates", "--resolve-cfgs", "--remove", "docs", "--minify", "libs", "--rustfmt", "--check", "--bin", "{{ bin_name }}"]
138+
##language_id = ""

0 commit comments

Comments
 (0)