Skip to content

Commit 17957f1

Browse files
committed
move tmc-langs-abstraction inside tmc-langs-framework
1 parent 362fd97 commit 17957f1

File tree

13 files changed

+41
-57
lines changed

13 files changed

+41
-57
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[workspace]
22
members =[
3-
"tmc-langs-abstraction",
43
"tmc-langs-cli",
54
"tmc-langs-core",
65
"tmc-langs-csharp",

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ Documentation and binaries for the supported targets are built and deployed to G
4848

4949
## Included projects
5050

51-
### tmc-langs-abstraction
52-
53-
A library containing some common types.
54-
5551
### tmc-langs-cli
5652

5753
A binary CLI interface for TMC-langs for IDEs.

tmc-langs-abstraction/Cargo.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

tmc-langs-abstraction/src/lib.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

tmc-langs-csharp/src/plugin.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ pub use policy::CSharpStudentFilePolicy;
66
use crate::{CSTestResult, CSharpError};
77

88
use tmc_langs_framework::{
9-
domain::{ExerciseDesc, RunResult, RunStatus, TestDesc, TestResult},
10-
plugin::{Language, Strategy, ValidationResult},
9+
domain::{
10+
ExerciseDesc, RunResult, RunStatus, Strategy, TestDesc, TestResult, ValidationResult,
11+
},
12+
plugin::Language,
1113
CommandWithTimeout, LanguagePlugin, OutputWithTimeout, TmcError,
1214
};
1315

tmc-langs-framework/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ authors = ["Daniel Martinez <daniel.x.martinez@helsinki.fi>"]
55
edition = "2018"
66

77
[dependencies]
8-
tmc-langs-abstraction = { path = "../tmc-langs-abstraction" }
98
regex = "1"
109
lazy_static = "1"
1110
log = "0.4"

tmc-langs-framework/src/domain.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,30 @@ pub enum IntOrString {
209209
String(String),
210210
}
211211

212+
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
213+
#[serde(rename_all = "UPPERCASE")]
214+
pub enum Strategy {
215+
Fail,
216+
Warn,
217+
Disabled,
218+
}
219+
220+
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
221+
#[serde(rename_all = "camelCase")]
222+
pub struct ValidationError {
223+
pub column: usize,
224+
pub line: usize,
225+
pub message: String,
226+
pub source_name: String,
227+
}
228+
229+
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
230+
#[serde(rename_all = "camelCase")]
231+
pub struct ValidationResult {
232+
pub strategy: Strategy,
233+
pub validation_errors: Option<HashMap<PathBuf, Vec<ValidationError>>>,
234+
}
235+
212236
#[cfg(test)]
213237
mod test {
214238
use super::*;

tmc-langs-framework/src/plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Contains LanguagePlugin.
22
33
pub use isolang::Language;
4-
pub use tmc_langs_abstraction::{Strategy, ValidationError, ValidationResult};
54

65
use super::domain::{
76
ExerciseDesc, ExercisePackagingConfiguration, RunResult, RunStatus, TestResult, TmcProjectYml,
7+
ValidationResult,
88
};
99
use super::io::{submission_processing, zip};
1010
use super::policy::StudentFilePolicy;

tmc-langs-java/src/ant.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::path::{Path, PathBuf};
1313
use std::process::{Command, Stdio};
1414
use std::time::Duration;
1515
use tmc_langs_framework::{
16-
domain::{ExerciseDesc, RunResult},
17-
plugin::{Language, LanguagePlugin, ValidationResult},
16+
domain::{ExerciseDesc, RunResult, ValidationResult},
17+
plugin::{Language, LanguagePlugin},
1818
TmcError,
1919
};
2020
use walkdir::WalkDir;
@@ -297,7 +297,7 @@ impl JavaPlugin for AntPlugin {
297297
mod test {
298298
use super::*;
299299
use tempfile::{tempdir, TempDir};
300-
use tmc_langs_framework::plugin::Strategy;
300+
use tmc_langs_framework::domain::Strategy;
301301

302302
fn init() {
303303
let _ = env_logger::builder().is_test(true).try_init();

tmc-langs-java/src/maven.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use std::process::{Command, Stdio};
1515
use std::time::Duration;
1616
use tar::Archive;
1717
use tmc_langs_framework::{
18-
domain::{ExerciseDesc, RunResult},
19-
plugin::{Language, LanguagePlugin, ValidationResult},
18+
domain::{ExerciseDesc, RunResult, ValidationResult},
19+
plugin::{Language, LanguagePlugin},
2020
TmcError,
2121
};
2222

@@ -274,7 +274,7 @@ mod test {
274274
use super::super::{TestCase, TestCaseStatus};
275275
use super::*;
276276
use tempfile::{tempdir, TempDir};
277-
use tmc_langs_framework::plugin::Strategy;
277+
use tmc_langs_framework::domain::Strategy;
278278
use walkdir::WalkDir;
279279

280280
#[cfg(windows)]

tmc-langs-java/src/plugin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::fs::{self, File};
99
use std::path::{Path, PathBuf};
1010
use std::process::Command;
1111
use tmc_langs_framework::{
12-
domain::{ExerciseDesc, RunResult, RunStatus, TestDesc, TestResult},
13-
plugin::{Language, LanguagePlugin, ValidationResult},
12+
domain::{ExerciseDesc, RunResult, RunStatus, TestDesc, TestResult, ValidationResult},
13+
plugin::{Language, LanguagePlugin},
1414
};
1515
use walkdir::WalkDir;
1616

tmc-langs-util/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ authors = ["Daniel Martinez <daniel.x.martinez@helsinki.fi>"]
55
edition = "2018"
66

77
[dependencies]
8-
tmc-langs-abstraction = { path = "../tmc-langs-abstraction" }
98
tmc-langs-csharp = { path = "../tmc-langs-csharp" }
109
tmc-langs-framework = { path = "../tmc-langs-framework" }
1110
tmc-langs-java = { path = "../tmc-langs-java" }

tmc-langs-util/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
33
pub mod task_executor;
44

5-
pub use tmc_langs_abstraction::{Strategy, ValidationResult};
65
pub use tmc_langs_framework::{
7-
domain::{ExerciseDesc, ExercisePackagingConfiguration, RunResult, RunStatus},
6+
domain::{
7+
ExerciseDesc, ExercisePackagingConfiguration, RunResult, RunStatus, Strategy,
8+
ValidationResult,
9+
},
810
plugin::Language,
911
TmcError,
1012
};

0 commit comments

Comments
 (0)