diff --git a/i18n/en.ts b/i18n/en.ts index 77346568be36bc2572d1ee071298de130a067bb9..bd6afb6baedb8477314d542acbf722613f72ff3d 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -345,6 +345,8 @@ export const lang_en: LangObj = { "Compile timeout in ms" : "Compile timeout in ms", "Max. RAM in kb": "Max. RAM in kb", "Max disk space in kb": "Max disk space in kb", + "Compiler options" : "Compiler options", + "Options passed to the compiler, e.g. for java -Xlint. Multiple arguments must be separated by a whitespace." : "Options passed to the compiler, e.g. for java -Xlint. Multiple arguments must be separated by a whitespace.", "Files": "Files", "Run all tests": "Run all tests", "Runs all not passed tests. If all tests have passed then all tests are re-run. When at least one test fails then the next x tests are not executed.": "Runs all not passed tests. If all tests have passed then all tests are re-run. When at least one test fails then the next x tests are not executed.", diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts index da3b9ba3d64cb321ee5e81f10a2ea7256e80a09e..e0777d94978970a99a3f0664684de6c0614b1737 100644 --- a/i18n/i18nRoot.ts +++ b/i18n/i18nRoot.ts @@ -352,6 +352,8 @@ export interface LangObj { "Compile timeout in ms": string "Max. RAM in kb": string "Max disk space in kb": string + "Compiler options": string + "Options passed to the compiler, e.g. for java -Xlint. Multiple arguments must be separated by a whitespace.": string "Files": string "Run all tests": string "Runs all not passed tests. If all tests have passed then all tests are re-run. When at least one test fails then the next x tests are not executed.": string diff --git a/src/components/helpers/tests/testSettingsView.tsx b/src/components/helpers/tests/testSettingsView.tsx index b6b7ede3162d936831bc8564c2f1012a9221fbfc..e2ca41368516395721a6e8abbcdb41da7f42703c 100644 --- a/src/components/helpers/tests/testSettingsView.tsx +++ b/src/components/helpers/tests/testSettingsView.tsx @@ -23,6 +23,7 @@ export interface MyProps { readonly compileTimeoutInMs: number readonly memoryLimitInKb: number readonly maxDiskSpaceInKb: number + readonly compilerOptions: string /** * can be null for readonly @@ -42,6 +43,11 @@ export interface MyProps { * can be null for readonly */ readonly set_maxDiskSpaceInKb: ((val: number) => void) | null + + /** + * can be null for readonly + */ + readonly set_compilerOptions: ((val: string) => void) | null } const mapStateToProps = (rootState: RootState, props: MyProps) => { @@ -239,7 +245,7 @@ class TestSettingsView extends React.Component<Props & ButtonProps, any> { } { - areTestServerSettingsAvailable && isTimeoutOverwrittenByTestServerSetting && + areTestServerSettingsAvailable && isCompileTimeoutOverwrittenByTestServerSetting && <HelpPopup className="mar-left-half warning-colored" icon="exclamation triangle" defaultText={`${getI18n(this.props.langId, "This value is overwritten by the test-server setting compile timeout in ms (hardCompileTimeoutInMs) which is the max time the user program can compile" @@ -423,7 +429,32 @@ class TestSettingsView extends React.Component<Props & ButtonProps, any> { }} /> </Form.Field> + + <Form.Field> + + <div className="flexed-no-wrap"> + <label className="not-text-wrapping"> + { + getI18n(this.props.langId, 'Compiler options') + } + </label> + + <HelpPopup className="mar-left-half" defaultText={getI18n(this.props.langId, "Options passed to the compiler, e.g. for java -Xlint. Multiple arguments must be separated by a whitespace.")} /> + </div> + + <MaterialInput + disabled={!this.props.set_compilerOptions} + value={this.props.compilerOptions} + onChange={(e) => { + + if (!this.props.set_compilerOptions) return + + this.props.set_compilerOptions(e.currentTarget.value) + }} + /> + </Form.Field> </Form.Group> + </div> ) } diff --git a/src/components/loggerPanel/LoggerWrapper.tsx b/src/components/loggerPanel/LoggerWrapper.tsx index 813afed36adac26865c7813bfb7e3c75c37e9dba..6dfbad39a92a75d50d9f1f32bb984af3edc20e38 100644 --- a/src/components/loggerPanel/LoggerWrapper.tsx +++ b/src/components/loggerPanel/LoggerWrapper.tsx @@ -40,6 +40,8 @@ const collapsedStyle = { class LoggerWrapper extends React.Component<Props, any> { render(): JSX.Element { + //this should not affect page layout ... absolute + //TODO why is this placed in a wrapper?? it had something to do with the mounting of LoggerPanel... return ( <div> <LoggerPanel isCollapsed={!this.props.isLoggerPanelOpen} /> @@ -48,4 +50,4 @@ class LoggerWrapper extends React.Component<Props, any> { } } -export default connect(mapStateToProps, mapDispatchToProps)(LoggerWrapper) \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(LoggerWrapper) diff --git a/src/components/sites/doExerciseSite/customTestsPanel/dialog/customTestsDialog/changeCustomTestView.tsx b/src/components/sites/doExerciseSite/customTestsPanel/dialog/customTestsDialog/changeCustomTestView.tsx index 7260c97c9b14dfe097ac968f75d1103538733055..fe2d0f18f3ee8bb735231e3ad41a00495348fa64 100644 --- a/src/components/sites/doExerciseSite/customTestsPanel/dialog/customTestsDialog/changeCustomTestView.tsx +++ b/src/components/sites/doExerciseSite/customTestsPanel/dialog/customTestsDialog/changeCustomTestView.tsx @@ -494,11 +494,13 @@ class ChangeCustomTestView extends React.Component<Props, any> { memoryLimitInKb={this.props.defaultCustomTestSettings.memoryLimitInKb} maxDiskSpaceInKb={this.props.defaultCustomTestSettings.maxDiskSpaceInKb} compileTimeoutInMs={this.props.defaultCustomTestSettings.compileTimeoutInMs} + compilerOptions={this.props.defaultCustomTestSettings.compilerOptions} set_maxDiskSpaceInKb={null} set_memoryLimitInKb={null} set_timeoutInMs={null} set_compileTimeoutInMs={null} + set_compilerOptions={null} /> <h4 className="ui dividing header"> diff --git a/src/components/sites/doExerciseSite/doExerciseSite.tsx b/src/components/sites/doExerciseSite/doExerciseSite.tsx index 45d78ee0edeff29020e91a7a5e97fe3397054b9b..8d43505ce99bf04e7589dd05001ec36e8e62d259 100644 --- a/src/components/sites/doExerciseSite/doExerciseSite.tsx +++ b/src/components/sites/doExerciseSite/doExerciseSite.tsx @@ -556,6 +556,7 @@ class doExerciseSite extends React.Component<Props & RouteComponentProps<Matched : '' } + Logger.debug('[do exercise editor site]', `this.props.lastKnownEditorContent !== currentEditorContent: ${this.props.lastKnownEditorContent !== currentEditorContent}`) if (this.props.lastKnownEditorContent !== currentEditorContent) { //something changed... update auth token diff --git a/src/components/sites/doExerciseSite/testsPanel/viewTestDialog/viewTestView.tsx b/src/components/sites/doExerciseSite/testsPanel/viewTestDialog/viewTestView.tsx index 381f08404b573cb82c4fa0194fdb2315663ecb2f..86e346d73cb79bebbc40353142312d9d64ab0dc5 100644 --- a/src/components/sites/doExerciseSite/testsPanel/viewTestDialog/viewTestView.tsx +++ b/src/components/sites/doExerciseSite/testsPanel/viewTestDialog/viewTestView.tsx @@ -208,11 +208,13 @@ class viewTestView extends React.Component<Props, any> { memoryLimitInKb={this.props.test.testSettings.memoryLimitInKb} maxDiskSpaceInKb={this.props.test.testSettings.maxDiskSpaceInKb} compileTimeoutInMs={this.props.test.testSettings.compileTimeoutInMs} + compilerOptions={this.props.test.testSettings.compilerOptions} set_timeoutInMs={null} set_memoryLimitInKb={null} set_maxDiskSpaceInKb={null} set_compileTimeoutInMs={null} + set_compilerOptions={null} /> <h4 className="ui dividing header"> diff --git a/src/components/sites/editCustomProjectSite/dialogs/changeTestDialog/changeTestView.tsx b/src/components/sites/editCustomProjectSite/dialogs/changeTestDialog/changeTestView.tsx index af473aba3a8b20eed03a9702766c52b3063d49b8..079aa6f822e361912a6943816c7388e1542088ec 100644 --- a/src/components/sites/editCustomProjectSite/dialogs/changeTestDialog/changeTestView.tsx +++ b/src/components/sites/editCustomProjectSite/dialogs/changeTestDialog/changeTestView.tsx @@ -46,6 +46,7 @@ import { setEditorTest_maxDiskSpaceInKb, setEditorTest_memoryLimitInKb, setEditorTest_timeoutInMs, + setEditorTest_compilerOptions, setEditorTestContent, setTestTypeId, setWeight @@ -115,6 +116,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => bindActionCreators({ setEditorTest_timeoutInMs, setEditorTest_compileTimeoutInMs, setEditorTest_maxDiskSpaceInKb, + setEditorTest_compilerOptions, setSelectedTabIndex, setEditorTest_files, @@ -574,11 +576,13 @@ class ChangeTestView extends React.Component<Props, any> { memoryLimitInKb={this.props.test.testSettings.memoryLimitInKb} maxDiskSpaceInKb={this.props.test.testSettings.maxDiskSpaceInKb} compileTimeoutInMs={this.props.test.testSettings.compileTimeoutInMs} + compilerOptions={this.props.test.testSettings.compilerOptions} set_timeoutInMs={this.props.setEditorTest_timeoutInMs} set_memoryLimitInKb={this.props.setEditorTest_memoryLimitInKb} set_maxDiskSpaceInKb={this.props.setEditorTest_maxDiskSpaceInKb} set_compileTimeoutInMs={this.props.setEditorTest_compileTimeoutInMs} + set_compilerOptions={this.props.setEditorTest_compilerOptions} /> diff --git a/src/components/sites/exerciseEditorSite/exerciseSettingsPanel/exerciseSettingsPanelView.tsx b/src/components/sites/exerciseEditorSite/exerciseSettingsPanel/exerciseSettingsPanelView.tsx index 860d2937d5a46b67f2962381c2c1fa61810fa5b0..bf47b67e8b9c170d8293bef6157caf5d7560fdd3 100644 --- a/src/components/sites/exerciseEditorSite/exerciseSettingsPanel/exerciseSettingsPanelView.tsx +++ b/src/components/sites/exerciseEditorSite/exerciseSettingsPanel/exerciseSettingsPanelView.tsx @@ -20,6 +20,7 @@ import { } from "../../../../state/actions/exerciseEditorSite/subSets/editorExercisePropertiesAction"; import {CheckboxOnChangeEventData} from "../../../../types/reactEvents"; import { + setCompilerOptions, setCompileTimeoutInMs, setMaxDiskSpaceInKb, setMemoryLimitInKb, @@ -66,6 +67,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => bindActionCreators({ setMemoryLimitInKb, setMaxDiskSpaceInKb, setCompileTimeoutInMs, + setCompilerOptions, }, dispatch) @@ -177,11 +179,13 @@ class exerciseSettingsPanelView extends React.Component<Props, any> { memoryLimitInKb={this.props.defaultTestSettings.memoryLimitInKb} maxDiskSpaceInKb={this.props.defaultTestSettings.maxDiskSpaceInKb} compileTimeoutInMs={this.props.defaultTestSettings.compileTimeoutInMs} + compilerOptions={this.props.defaultTestSettings.compilerOptions} set_timeoutInMs={this.props.setTimeoutInMs} set_memoryLimitInKb={this.props.setMemoryLimitInKb} set_maxDiskSpaceInKb={this.props.setMaxDiskSpaceInKb} set_compileTimeoutInMs={this.props.setCompileTimeoutInMs} + set_compilerOptions={this.props.setCompilerOptions} /> <h4 className="ui dividing header"> diff --git a/src/components/sites/exerciseEditorSite/exerciseTestsPanel/dialogs/changeTestView.tsx b/src/components/sites/exerciseEditorSite/exerciseTestsPanel/dialogs/changeTestView.tsx index aa212aa5dbe3983877abbd36f723afba3e305a44..0eb6992e464b2174495ccd74f21a768681917585 100644 --- a/src/components/sites/exerciseEditorSite/exerciseTestsPanel/dialogs/changeTestView.tsx +++ b/src/components/sites/exerciseEditorSite/exerciseTestsPanel/dialogs/changeTestView.tsx @@ -15,6 +15,7 @@ import { setEditorTest_maxDiskSpaceInKb, setEditorTest_memoryLimitInKb, setEditorTest_timeoutInMs, + setEditorTest_compilerOptions, setEditorTestContent, setTestTypeId, setWeight @@ -111,6 +112,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => bindActionCreators({ setEditorTest_timeoutInMs, setEditorTest_maxDiskSpaceInKb, setEditorTest_compileTimeoutInMs, + setEditorTest_compilerOptions, setSelectedTabIndex, setEditorTest_files, @@ -570,11 +572,13 @@ class ChangeTestView extends React.Component<Props, any> { memoryLimitInKb={this.props.test.testSettings.memoryLimitInKb} maxDiskSpaceInKb={this.props.test.testSettings.maxDiskSpaceInKb} compileTimeoutInMs={this.props.test.testSettings.compileTimeoutInMs} + compilerOptions={this.props.test.testSettings.compilerOptions} set_timeoutInMs={this.props.setEditorTest_timeoutInMs} set_memoryLimitInKb={this.props.setEditorTest_memoryLimitInKb} set_maxDiskSpaceInKb={this.props.setEditorTest_maxDiskSpaceInKb} set_compileTimeoutInMs={this.props.setEditorTest_compileTimeoutInMs} + set_compilerOptions={this.props.setEditorTest_compilerOptions} /> <h4 className="ui dividing header"> diff --git a/src/helpers/convertersAndTransformers.ts b/src/helpers/convertersAndTransformers.ts index 5ea0fe82a852fe1d2845f3121df899fbcd669b6e..ebcff878cc07d26d1212933d97b1689140848c80 100644 --- a/src/helpers/convertersAndTransformers.ts +++ b/src/helpers/convertersAndTransformers.ts @@ -798,7 +798,7 @@ export function convertTestProtocol(protocol: ReadonlyArray<string>, } - //TODO some warning we should never get here... + //could be some debug output... return { type: TestProtocolType.unknown, @@ -835,11 +835,23 @@ export function convertTestProtocol(protocol: ReadonlyArray<string>, return protocolItemsFinished - } else if (testType.internalName === KnownInternalTestTypes.compileTest) { + } + else if (testType.internalName === KnownInternalTestTypes.compileTest) { //we only wanted to know if it's compiles or not... - //but there could be some debug lines... + //but there could be some debug lines or std error (e.g. from linters)... return protocol.map<TestProtocolItem>(line => { + + line = trimStart(line) //for some reason some lines start with whitespaces... + + if (startsWith(line, TestProtocol.errorPrefix)) { + return { + type: TestProtocolType.isError, + hasOutputMismatched: false, + content: line.substring(TestProtocol.errorPrefix.length), + } + } + return { type: TestProtocolType.unknown, hasOutputMismatched: false, @@ -923,6 +935,7 @@ export function convertTestProtocol(protocol: ReadonlyArray<string>, } } + //could be some debug output... return { type: TestProtocolType.unknown, diff --git a/src/state/actions/doExerciseSite/doExerciseCrudActions.ts b/src/state/actions/doExerciseSite/doExerciseCrudActions.ts index 134233c7313b51fdf846cc545f43eb223210cfb6..6cda5d9ee87df2444476f23d2c83659eb9326571 100644 --- a/src/state/actions/doExerciseSite/doExerciseCrudActions.ts +++ b/src/state/actions/doExerciseSite/doExerciseCrudActions.ts @@ -339,6 +339,7 @@ export function runCompileSingleFileDoExercise(runCompileSingleFileCommand: RunC timeoutInMs: -1, memoryLimitInKb: -1, compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: compileTestType.id } @@ -389,6 +390,7 @@ export function justRunProgramDoExerciseAsync(justRunProgramCommand: JustRunProg timeoutInMs: -1, memoryLimitInKb: -1, compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: -1 } diff --git a/src/state/actions/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestActions.ts b/src/state/actions/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestActions.ts index 360a96d6c48c43b9949a77a8cb24ff4279273538..c63382fe9303e71b0ef52dd05fd4a3d90203c8c9 100644 --- a/src/state/actions/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestActions.ts +++ b/src/state/actions/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestActions.ts @@ -11,6 +11,7 @@ import { SET_editorTest_maxDiskSpaceInKbAction, SET_editorTest_memoryLimitInKbAction, SET_editorTest_timeoutInMsAction, + SET_editorTest_compilerOptionsAction, SET_testIdAction, SET_testTypeIdAction, SET_weightAction @@ -34,6 +35,7 @@ export function setChangCustomProjectTest(test: CustomProjectTestFullBase): Mult dispatch(setEditorTest_memoryLimitInKb(test.testSettings.memoryLimitInKb)) dispatch(setEditorTest_timeoutInMs(test.testSettings.timeoutInMs)) dispatch(setEditorTest_maxDiskSpaceInKb(test.testSettings.maxDiskSpaceInKb)) + dispatch(setEditorTest_compilerOptions(test.testSettings.compilerOptions)) dispatch(setEditorTest_files(test.files)) } @@ -111,6 +113,15 @@ export function setEditorTest_maxDiskSpaceInKb(maxDiskSpaceInKb: number): SET_ed } } + +export function setEditorTest_compilerOptions(compilerOptions: string): SET_editorTest_compilerOptionsAction { + return { + type: ActionType.SET_editorTest_compilerOptions, + compilerOptions + } +} + + export function setEditorTest_files(files: ReadonlyArray<FilePreviewFromBackend>): SET_editorTest_filesAction { return { type: ActionType.SET_editorTest_files, diff --git a/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts b/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts index d17e3fdb9dfa43677913f8da276dab750a2494a1..c63b439972cbcd28bb9174dbb6b2cf64063f86e8 100644 --- a/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts +++ b/src/state/actions/editCustomProjectSite/editCustomProjectCrudActions.ts @@ -199,7 +199,8 @@ export function runCompileSingleFileCustomProjectAsync(runCompileSingleFileComma maxDiskSpaceInKb: -1, timeoutInMs: -1, memoryLimitInKb: -1, - compileTimeoutInMs: -1 + compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: compileTestType.id } @@ -254,6 +255,7 @@ export function justRunProgramCustomProjectAsync(justRunProgramCommand: JustRunP timeoutInMs: -1, memoryLimitInKb: -1, compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: -1 } diff --git a/src/state/actions/exerciseEditorSite/dialogs/changeTestDialog/changeTestActions.ts b/src/state/actions/exerciseEditorSite/dialogs/changeTestDialog/changeTestActions.ts index dc366b5af8911ad00715a5f69d9209bc513aa9ba..7979302a835b15ef4096fc0e431944151543fa6f 100644 --- a/src/state/actions/exerciseEditorSite/dialogs/changeTestDialog/changeTestActions.ts +++ b/src/state/actions/exerciseEditorSite/dialogs/changeTestDialog/changeTestActions.ts @@ -5,7 +5,7 @@ import {ActionType} from "../../../../reducers/exerciseEditorSite/dialogs/change import { SET_contentAction, SET_displayIndexAction, - SET_displayNameAction, + SET_displayNameAction, SET_editorTest_compilerOptionsAction, SET_editorTest_compileTimeoutInMsAction, SET_editorTest_filesAction, SET_editorTest_maxDiskSpaceInKbAction, @@ -35,6 +35,7 @@ export function setChangTest(test: ExerciseTestForBackend): MultiActions { dispatch(setEditorTest_memoryLimitInKb(test.testSettings.memoryLimitInKb)) dispatch(setEditorTest_timeoutInMs(test.testSettings.timeoutInMs)) dispatch(setEditorTest_maxDiskSpaceInKb(test.testSettings.maxDiskSpaceInKb)) + dispatch(setEditorTest_compilerOptions(test.testSettings.compilerOptions)) dispatch(setEditorTest_files(test.files)) } @@ -120,6 +121,14 @@ export function setEditorTest_maxDiskSpaceInKb(maxDiskSpaceInKb: number): SET_ed } } +export function setEditorTest_compilerOptions(compilerOptions: string): SET_editorTest_compilerOptionsAction { + return { + type: ActionType.SET_editorTest_compilerOptions, + compilerOptions + } +} + + export function setEditorTest_files(files: ReadonlyArray<FilePreviewFromBackend>): SET_editorTest_filesAction { return { type: ActionType.SET_editorTest_files, diff --git a/src/state/actions/exerciseEditorSite/subSets/editorExerciseDefaultTestSettingsActions.ts b/src/state/actions/exerciseEditorSite/subSets/editorExerciseDefaultTestSettingsActions.ts index fea2c95a50c9a8b3d02a02ba9661b961ef9595b3..9b100c747260e15c07f2d36033eac12317dfd986 100644 --- a/src/state/actions/exerciseEditorSite/subSets/editorExerciseDefaultTestSettingsActions.ts +++ b/src/state/actions/exerciseEditorSite/subSets/editorExerciseDefaultTestSettingsActions.ts @@ -3,6 +3,7 @@ */ import { + SET_compilerOptionsAction, SET_compileTimeoutInMsAction, SET_maxDiskSpaceInKbAction, SET_memoryLimitInKbAction, @@ -40,3 +41,10 @@ export function setMaxDiskSpaceInKb(maxDiskSpaceInKb: number): SET_maxDiskSpaceI maxDiskSpaceInKb } } + +export function setCompilerOptions(compilerOptions: string): SET_compilerOptionsAction { + return { + type: ActionType.SET_compilerOptions, + compilerOptions + } +} diff --git a/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts b/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts index 71dafdfd98aa46ae9f88718b88e8a6e01f866a5d..b698331e5b5aa52178fcab7a39630d97cf419fc2 100644 --- a/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts +++ b/src/state/actions/tutorViewSite/tutorViewSiteCrudActions.ts @@ -293,6 +293,7 @@ export function runCompileSingleFileTutorView(runCompileSingleFileCommand: RunCo timeoutInMs: -1, memoryLimitInKb: -1, compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: compileTestType.id } @@ -335,6 +336,7 @@ export function justRunProgramTutorViewAsync(justRunProgramCommand: JustRunProgr timeoutInMs: -1, memoryLimitInKb: -1, compileTimeoutInMs: -1, + compilerOptions: '', }, testTypeId: -1 } diff --git a/src/state/reducers/doExerciseSite/subSets/setDoExerciseDefaultTestSettingsReducer.ts b/src/state/reducers/doExerciseSite/subSets/setDoExerciseDefaultTestSettingsReducer.ts index 1eb91addbeaafc12d85ee29bc3440ec624ca398b..8d8381eb2b35528110875b7b7ca8f64ac7b0e6e5 100644 --- a/src/state/reducers/doExerciseSite/subSets/setDoExerciseDefaultTestSettingsReducer.ts +++ b/src/state/reducers/doExerciseSite/subSets/setDoExerciseDefaultTestSettingsReducer.ts @@ -15,6 +15,7 @@ export const initial: State = { memoryLimitInKb: 1000, maxDiskSpaceInKb: 1000, compileTimeoutInMs: 2000, + compilerOptions: '', } diff --git a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogActionTypes.ts b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogActionTypes.ts index 1c6f46e4b61a80978e7cbc5d06e01c6ab926bfa4..ef9c83dce0bc8051a09cdbee62d1d3233cb24821 100644 --- a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogActionTypes.ts +++ b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogActionTypes.ts @@ -32,6 +32,7 @@ export enum ActionType { SET_editorTest_timeoutInMs = 'changeCustomProjectTestDialogReducer_SET_editorTest_timeoutInMs', SET_editorTest_compileTimeoutInMs = 'changeCustomProjectTestDialogReducer_SET_editorTest_compileTimeoutInMs', SET_editorTest_maxDiskSpaceInKb = 'changeCustomProjectTestDialogReducer_SET_editorTest_maxDiskSpaceInKb', + SET_editorTest_compilerOptions = 'changeCustomProjectTestDialogReducer_SET_editorTest_compilerOptions', SET_isCreating = 'changeCustomProjectTestDialogReducer_SET_isCreating', diff --git a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogReducer.ts b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogReducer.ts index c20f748de70feba915b95360b6a01a5c83138138..1b093089a7777c08d900cbac280459a86a6a7bab 100644 --- a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogReducer.ts +++ b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/changeCustomProjectTestDialogReducer.ts @@ -102,6 +102,7 @@ export function reducer(state: State = initial(), action: AllActions): State { case ActionType.SET_editorTest_maxDiskSpaceInKb: case ActionType.SET_editorTest_timeoutInMs: case ActionType.SET_editorTest_compileTimeoutInMs: + case ActionType.SET_editorTest_compilerOptions: case ActionType.SET_editorTest_files: case EditCustomProjectSiteActionTypes.ATTACH_customProjectCustomTestAssetPreview_FULFILLED: case EditCustomProjectSiteActionTypes.DETACH_customProjectCustomTestAssetPreview_FULFILLED: diff --git a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestReducer.ts b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestReducer.ts index b809755a857d1a0561c12b74c67e3f2309efc670..94878b29b840c463e6caf0938ca402e227321c55 100644 --- a/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestReducer.ts +++ b/src/state/reducers/editCustomProjectSite/dialogs/changeCustomProjectTestDialog/customProjectTestReducer.ts @@ -30,6 +30,7 @@ export const initial: () => State = () => { timeoutInMs: 1000, maxDiskSpaceInKb: 1000, compileTimeoutInMs: 2000, + compilerOptions: '', }, } } @@ -96,6 +97,10 @@ export interface SET_editorTest_maxDiskSpaceInKbAction extends ActionBase { readonly maxDiskSpaceInKb: number } +export interface SET_editorTest_compilerOptionsAction extends ActionBase { + readonly type: ActionType.SET_editorTest_compilerOptions + readonly compilerOptions: string +} export interface SET_editorTest_filesAction extends ActionBase { readonly type: ActionType.SET_editorTest_files @@ -113,6 +118,7 @@ export type AllActions = | SET_editorTest_timeoutInMsAction | SET_editorTest_compileTimeoutInMsAction | SET_editorTest_maxDiskSpaceInKbAction + | SET_editorTest_compilerOptionsAction | SET_editorTest_filesAction | ATTACH_customProjectCustomTestAssetPreviewE_FULFILLEDAction @@ -194,6 +200,14 @@ export function reducer(state: State = initial(), action: AllActions): State { compileTimeoutInMs: action.compileTimeoutInMs } } + case ActionType.SET_editorTest_compilerOptions: + return { + ...state, + testSettings: { + ...state.testSettings, + compilerOptions: action.compilerOptions + } + } case ActionType.SET_editorTest_files: return { diff --git a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogActionTypes.ts b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogActionTypes.ts index 3dd7dae73cb30ad21e5cb648dc06d3964896856c..1bc987a549c2ea4c904672ac21d1db6b200af3fe 100644 --- a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogActionTypes.ts +++ b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogActionTypes.ts @@ -22,6 +22,7 @@ export enum ActionType { SET_editorTest_timeoutInMs = 'changeTestDialogReducer_SET_editorTest_timeoutInMs', SET_editorTest_compileTimeoutInMs = 'changeTestDialogReducer_SET_editorTest_compileTimeoutInMs', SET_editorTest_maxDiskSpaceInKb = 'changeTestDialogReducer_SET_editorTest_maxDiskSpaceInKb', + SET_editorTest_compilerOptions = 'changeTestDialogReducer_SET_editorTest_compilerOptions', SET_isCreating = 'changeTestDialogReducer_SET_isCreating', diff --git a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogReducer.ts b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogReducer.ts index 2082e95810e067741ad5117025572d83dd8c9c83..69eadb184808fecef15c72acaabc73f4441f2f9e 100644 --- a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogReducer.ts +++ b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/changeTestDialogReducer.ts @@ -88,6 +88,7 @@ export function reducer(state: State = initial(), action: AllActions): State { case ActionType.SET_editorTest_maxDiskSpaceInKb: case ActionType.SET_editorTest_timeoutInMs: case ActionType.SET_editorTest_compileTimeoutInMs: + case ActionType.SET_editorTest_compilerOptions: case ActionType.SET_editorTest_files: case EditorExerciseSiteActionTypes.ATTACH_testAsset_FULFILLED: case EditorExerciseSiteActionTypes.DETACH_testAsset_FULFILLED: diff --git a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/editorTestReducer.ts b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/editorTestReducer.ts index c3a0835acf7b2670308e843e747f1cd25acd478d..5a471e881cc11216ff3a9f086a83c8c233fdc821 100644 --- a/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/editorTestReducer.ts +++ b/src/state/reducers/exerciseEditorSite/dialogs/changeTestDialog/editorTestReducer.ts @@ -33,6 +33,7 @@ export const initial: () => State = () => { timeoutInMs: 1000, maxDiskSpaceInKb: 1000, compileTimeoutInMs: 2000, + compilerOptions: '', } } } @@ -105,6 +106,10 @@ export interface SET_editorTest_maxDiskSpaceInKbAction extends ActionBase { readonly maxDiskSpaceInKb: number } +export interface SET_editorTest_compilerOptionsAction extends ActionBase { + readonly type: ActionType.SET_editorTest_compilerOptions + readonly compilerOptions: string +} export interface SET_editorTest_filesAction extends ActionBase { readonly type: ActionType.SET_editorTest_files @@ -123,6 +128,7 @@ export type AllActions = | SET_editorTest_timeoutInMsAction | SET_editorTest_compileTimeoutInMsAction | SET_editorTest_maxDiskSpaceInKbAction + | SET_editorTest_compilerOptionsAction | SET_editorTest_filesAction | ATTACH_testAsset_FULFILLEDAction @@ -209,6 +215,14 @@ export function reducer(state: State = initial(), action: AllActions): State { compileTimeoutInMs: action.compileTimeoutInMs } } + case ActionType.SET_editorTest_compilerOptions: + return { + ...state, + testSettings: { + ...state.testSettings, + compilerOptions: action.compilerOptions + } + } case ActionType.SET_editorTest_files: return { diff --git a/src/state/reducers/exerciseEditorSite/editorExerciseReducer.ts b/src/state/reducers/exerciseEditorSite/editorExerciseReducer.ts index 44cdd2bf66650e053b39b6057049d015b33b3840..6e98937af93e93d74822fabcc123454df70a4317 100644 --- a/src/state/reducers/exerciseEditorSite/editorExerciseReducer.ts +++ b/src/state/reducers/exerciseEditorSite/editorExerciseReducer.ts @@ -151,6 +151,7 @@ export function reducer(state: State = initial(), action: AllActions): State { case ActionType.SET_compileTimeoutInMs: case ActionType.SET_memoryLimitInKb: case ActionType.SET_maxDiskSpaceInKb: + case ActionType.SET_compilerOptions: return { ...state, defaultTestSettings: setEditorExerciseDefaultTestSettingsReducer(state.defaultTestSettings, action), diff --git a/src/state/reducers/exerciseEditorSite/editorExerciseSiteActionTypes.ts b/src/state/reducers/exerciseEditorSite/editorExerciseSiteActionTypes.ts index 540236a99793ec4056b31c247c5fc0f4780a0606..e9cab96a92a7a9001a713dacc5b70152454bdd45 100644 --- a/src/state/reducers/exerciseEditorSite/editorExerciseSiteActionTypes.ts +++ b/src/state/reducers/exerciseEditorSite/editorExerciseSiteActionTypes.ts @@ -34,6 +34,7 @@ export enum ActionType { SET_compileTimeoutInMs = 'editorExerciseSiteReducer_SET_compileTimeoutInMs', SET_memoryLimitInKb = 'editorExerciseSiteReducer_SET_memoryLimitInKb', SET_maxDiskSpaceInKb = 'editorExerciseSiteReducer_SET_maxDiskSpaceInKb', + SET_compilerOptions = 'editorExerciseSiteReducer_SET_compilerOptions', //meta data SET_editorExerciseMetaDataId = 'editorExerciseSiteReducer_SET_editorExerciseMetaDataId', diff --git a/src/state/reducers/exerciseEditorSite/exerciseEditorSiteReducer.ts b/src/state/reducers/exerciseEditorSite/exerciseEditorSiteReducer.ts index 800eccb00bfa780908f8637580b20a9fbd788ea9..ebfa3efe3acf5667d4b0c6cf66021bfd969901a0 100644 --- a/src/state/reducers/exerciseEditorSite/exerciseEditorSiteReducer.ts +++ b/src/state/reducers/exerciseEditorSite/exerciseEditorSiteReducer.ts @@ -522,6 +522,7 @@ export function reducer(state: State = initial(), action: AllActions): State { case ActionType.SET_compileTimeoutInMs: case ActionType.SET_memoryLimitInKb: case ActionType.SET_maxDiskSpaceInKb: + case ActionType.SET_compilerOptions: case ActionType.SET_editorExerciseMetaDataId: case ActionType.SET_tagIds: case ActionType.SET_editorExerciseDescriptionId: diff --git a/src/state/reducers/exerciseEditorSite/subSets/setEditorExerciseDefaultTestSettingsReducer.ts b/src/state/reducers/exerciseEditorSite/subSets/setEditorExerciseDefaultTestSettingsReducer.ts index 6d73a5acb619010dd847ce2523f88ad041581408..f430ce315fade977e3b2a72d6bea080aa98e807f 100644 --- a/src/state/reducers/exerciseEditorSite/subSets/setEditorExerciseDefaultTestSettingsReducer.ts +++ b/src/state/reducers/exerciseEditorSite/subSets/setEditorExerciseDefaultTestSettingsReducer.ts @@ -17,6 +17,7 @@ export const initial: () => State = () => { memoryLimitInKb: 1000, maxDiskSpaceInKb: 1000, compileTimeoutInMs: 2000, + compilerOptions: '', } } @@ -46,6 +47,11 @@ export interface SET_maxDiskSpaceInKbAction extends ActionBase { readonly maxDiskSpaceInKb: number } +export interface SET_compilerOptionsAction extends ActionBase { + readonly type: ActionType.SET_compilerOptions + readonly compilerOptions: string +} + export type AllActions = SET_editorExerciseDefaultTestSettingsIdAction @@ -53,6 +59,7 @@ export type AllActions = | SET_compileTimeoutInMsAction | SET_memoryLimitInKbAction | SET_maxDiskSpaceInKbAction + | SET_compilerOptionsAction export function reducer(state: State = initial(), action: AllActions): State { @@ -85,6 +92,11 @@ export function reducer(state: State = initial(), action: AllActions): State { ...state, maxDiskSpaceInKb: action.maxDiskSpaceInKb } + case ActionType.SET_compilerOptions: + return { + ...state, + compilerOptions: action.compilerOptions + } default: diff --git a/src/types/exerciseEditor.ts b/src/types/exerciseEditor.ts index 3fc0217a6c8fa9d2217477307d0ee4144f7ce419..468c358683be673c68fcb42424d0d01d9f80ab78 100644 --- a/src/types/exerciseEditor.ts +++ b/src/types/exerciseEditor.ts @@ -388,6 +388,11 @@ export interface TestSettingsFullBase { * the max disk space to users program can write to */ readonly maxDiskSpaceInKb: number + + /** + * some compiler options .g. -Xlint options needs to be separated by whitespaces (like normal command args) + */ + readonly compilerOptions: string } /**