Skip to content

Commit

Permalink
0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Heliozoa committed Nov 7, 2022
1 parent 62f5765 commit 953f3af
Show file tree
Hide file tree
Showing 27 changed files with 159 additions and 65 deletions.
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ cargo test
```

## Building and testing with Docker

Build the binary in Docker and copy it to the current directory (this can be useful to create a binary linked with an older glibc):

```bash
export DOCKER_BUILDKIT=1
docker build . -f docker/Dockerfile -t tmc-langs-rust
docker run --rm -v $PWD:/build/out tmc-langs-rust bash -c "cargo build && cp /build/target/debug/tmc-langs-cli /build/out/"
docker run --rm -v "$PWD":/build/out tmc-langs-rust bash -c "cargo build && cp /build/target/debug/tmc-langs-cli /build/out/"
```

Run tests in Docker:

```bash
export DOCKER_BUILDKIT=1
docker build . -f docker/Dockerfile -t tmc-langs-rust
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.27.0"
authors = [
"University of Helsinki <[email protected]>",
"Daniel Martinez <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion crates/bindings/tmc-langs-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-node"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Bindings to the tmc-langs library for Node"
Expand Down
14 changes: 14 additions & 0 deletions crates/bindings/tmc-langs-node/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ macro_rules! parse_args {
parse_arg!($cx, $ty8, 8),
);
};
($cx: ident, $id0: ident : $ty0: path, $id1: ident : $ty1: path, $id2: ident : $ty2: path, $id3: ident : $ty3: path, $id4: ident : $ty4: path, $id5: ident : $ty5: path, $id6: ident : $ty6: path, $id7: ident : $ty7: path, $id8: ident : $ty8: path, $id9: ident : $ty9: path) => {
let ($id0, $id1, $id2, $id3, $id4, $id5, $id6, $id7, $id8, $id9) = (
parse_arg!($cx, $ty0, 0),
parse_arg!($cx, $ty1, 1),
parse_arg!($cx, $ty2, 2),
parse_arg!($cx, $ty3, 3),
parse_arg!($cx, $ty4, 4),
parse_arg!($cx, $ty5, 5),
parse_arg!($cx, $ty6, 6),
parse_arg!($cx, $ty7, 7),
parse_arg!($cx, $ty8, 8),
parse_arg!($cx, $ty9, 9),
);
};
}

pub fn convert_err<E: Error>(cx: &mut FunctionContext, e: E) -> Throw {
Expand Down
10 changes: 8 additions & 2 deletions crates/bindings/tmc-langs-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use std::{
use thiserror::Error;
use tmc_langs::{
file_util, ClientError, Compression, Credentials, DownloadOrUpdateCourseExercisesResult,
FeedbackAnswer, LangsError, Language, NewSubmission, SubmissionFinished, TmcClient, TmcConfig,
FeedbackAnswer, LangsError, Language, NewSubmission, PrepareSubmission, SubmissionFinished,
TmcClient, TmcConfig,
};

#[derive(Debug, Error)]
Expand Down Expand Up @@ -185,6 +186,7 @@ fn prepare_submission(mut cx: FunctionContext) -> JsResult<JsValue> {
stub_compression: Compression,
submission_path: PathBuf,
submission_compression: Compression,
extract_submission_naively: bool,
tmc_param: Vec<(String, Vec<String>)>,
top_level_dir_name: Option<String>
);
Expand All @@ -210,7 +212,11 @@ fn prepare_submission(mut cx: FunctionContext) -> JsResult<JsValue> {
};

let res = tmc_langs::prepare_submission(
(&submission_path, submission_compression),
PrepareSubmission {
archive: &submission_path,
compression: submission_compression,
extract_naively: extract_submission_naively,
},
&output_path,
top_level_dir_name,
tmc_params,
Expand Down
2 changes: 1 addition & 1 deletion crates/helpers/tmc-server-mock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-server-mock"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/csharp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-csharp"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/java/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-java"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/make/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-make"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/notests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-notests"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/python3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-python3"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/plugins/r/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-r"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/tmc-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-client"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/tmc-langs-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-cli"
version = "0.26.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "CLI client for TMC"
Expand Down
3 changes: 3 additions & 0 deletions crates/tmc-langs-cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ pub enum Command {
/// Compression algorithm used for the submission.
#[clap(long, default_value_t = Compression::Zip)]
submission_compression: Compression,
/// If set, the submission is extracted without trying to find a project directory inside it. This can be useful if the submission is minimal and doesn't contain enough files to detect the project.
#[clap(long)]
extract_submission_naively: bool,
/// A key-value pair in the form key=value to be written into .tmcparams. If multiple pairs with the same key are given, the values are collected into an array.
#[clap(long)]
tmc_param: Vec<String>,
Expand Down
13 changes: 10 additions & 3 deletions crates/tmc-langs-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ pub fn run() {
result: OutputResult::Error,
data: None,
}));
print_output(&output, false).expect("this should never fail");
let pretty = std::env::args().find(|arg| arg == "--pretty").is_some();
print_output(&output, pretty).expect("this should never fail");

quit::with_code(1);
}
Expand All @@ -89,7 +90,8 @@ fn run_inner() -> Result<(), ()> {
trace: causes,
}),
}));
print_output(&error_output, false).expect("failed to print output");
let pretty = std::env::args().find(|arg| arg == "--pretty").is_some();
print_output(&error_output, pretty).expect("failed to print output");
return Err(());
}
};
Expand Down Expand Up @@ -383,6 +385,7 @@ fn run_app(matches: Opt) -> Result<()> {
stub_compression,
submission_path,
submission_compression,
extract_submission_naively,
tmc_param,
top_level_dir_name,
} => {
Expand Down Expand Up @@ -418,7 +421,11 @@ fn run_app(matches: Opt) -> Result<()> {
}

tmc_langs::prepare_submission(
(&submission_path, submission_compression),
tmc_langs::PrepareSubmission {
archive: &submission_path,
compression: submission_compression,
extract_naively: extract_submission_naively,
},
&output_path,
top_level_dir_name,
tmc_params,
Expand Down
2 changes: 1 addition & 1 deletion crates/tmc-langs-framework/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tmc-langs-framework"
version = "0.1.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
Loading

0 comments on commit 953f3af

Please sign in to comment.