Skip to content

Commit 74bf2cf

Browse files
committed
Improve bindings
1 parent 7ecb3ec commit 74bf2cf

File tree

8 files changed

+83
-64
lines changed

8 files changed

+83
-64
lines changed

Cargo.lock

Lines changed: 61 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tmc-langs-util = { path = "crates/tmc-langs-util" }
3939
tmc-mooc-client = { path = "crates/tmc-mooc-client" }
4040
tmc-server-mock = { path = "crates/helpers/tmc-server-mock" }
4141
tmc-testmycode-client = { path = "crates/tmc-testmycode-client" }
42-
ts-rs = { git = "https://github.com/Heliozoa/ts-rs.git", rev = "d6cad971aca4aac40462279cbf96cc3bb3b7f30c" }
42+
ts-rs = { git = "https://github.com/Heliozoa/ts-rs.git", rev = "043c49c461543367d702e4db503f793f1ba801c2" }
4343

4444
# [patch.'https://github.com/Heliozoa/ts-rs.git']
4545
# ts-rs = { path = "../ts-rs/ts-rs" }

crates/tmc-langs-cli/bindings.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type OutputResult = "logged-in" | "logged-out" | "not-logged-in" | "error
1616

1717
export type ClientUpdateData = { "client-update-data-kind": "exercise-download", id: number, path: string, } | { "client-update-data-kind": "posted-submission" } & NewSubmission;
1818

19-
export interface StatusUpdate<T> { finished: boolean, message: string, "percent-done": number, time: bigint, data: T | null, }
19+
export interface StatusUpdate<T> { finished: boolean, message: string, "percent-done": number, time: number, data: T | null, }
2020

2121
export type NotificationKind = "warning" | "info";
2222

@@ -52,7 +52,7 @@ export interface TestResult { name: string, successful: boolean, points: Array<s
5252

5353
export interface TestDesc { name: string, points: Array<string>, }
5454

55-
export interface TmcProjectYml { extra_student_files: Array<string>, extra_exercise_files: Array<string>, force_update: Array<string>, tests_timeout_ms?: bigint, fail_on_valgrind_error?: boolean, minimum_python_version?: PythonVer, sandbox_image?: string, }
55+
export interface TmcProjectYml { extra_student_files: Array<string>, extra_exercise_files: Array<string>, force_update: Array<string>, tests_timeout_ms?: number, fail_on_valgrind_error?: boolean, minimum_python_version?: PythonVer, sandbox_image?: string, }
5656

5757
export interface UpdatedExercise { id: number, }
5858

crates/tmc-langs-cli/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{path::PathBuf, str::FromStr};
77
use tmc_langs::{
88
tmc::{
99
response::{
10-
CourseData, CourseDetails, CourseExercise, ExerciseDetails, NewSubmission,
10+
Course, CourseData, CourseDetails, CourseExercise, ExerciseDetails, NewSubmission,
1111
Organization, Review, Submission, SubmissionFeedbackResponse, SubmissionFinished,
1212
},
1313
UpdateResult,
@@ -347,7 +347,7 @@ pub enum TestMyCodeCommand {
347347
},
348348

349349
/// Lists courses
350-
#[clap(long_about = schema_leaked::<Vec<CourseData>>())]
350+
#[clap(long_about = schema_leaked::<Vec<Course>>())]
351351
GetCourses {
352352
/// Organization slug (e.g. mooc, hy).
353353
#[clap(long)]

crates/tmc-langs-cli/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ fn run_tmc(tmc: TestMyCode) -> Result<CliOutput> {
537537
let (mut client, mut credentials) =
538538
tmc_langs::init_testmycode_client_with_credentials(root_url, client_name, client_version)?;
539539

540-
match run_core_inner(tmc, &mut client, &mut credentials) {
540+
match run_tmc_inner(tmc, &mut client, &mut credentials) {
541541
Err(error) => {
542542
for cause in error.chain() {
543543
// check if the token was rejected and delete it if so
@@ -561,7 +561,7 @@ fn run_tmc(tmc: TestMyCode) -> Result<CliOutput> {
561561
}
562562
}
563563

564-
fn run_core_inner(
564+
fn run_tmc_inner(
565565
tmc: TestMyCode,
566566
client: &mut TestMyCodeClient,
567567
credentials: &mut Option<Credentials>,

crates/tmc-langs-framework/src/plugin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub trait LanguagePlugin {
5454
let timeout = Self::StudentFilePolicy::new(path)?
5555
.get_project_config()
5656
.tests_timeout_ms
57+
.map(Into::into)
5758
.map(Duration::from_millis);
5859
let result = self.run_tests_with_timeout(path, timeout)?;
5960

crates/tmc-langs-framework/src/tmc_project_yml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct TmcProjectYml {
3535
/// If set, tests are forcibly stopped after this duration.
3636
#[serde(default)]
3737
#[serde(skip_serializing_if = "Option::is_none")]
38-
pub tests_timeout_ms: Option<u64>,
38+
pub tests_timeout_ms: Option<u32>,
3939

4040
/// Marks the exercise as not containing any tests.
4141
#[serde(rename = "no-tests")]

0 commit comments

Comments
 (0)