From 81b3d1c6393a1d62ca3c56ffd3f7c38842d6b567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janis=20Daniel=20Da=CC=88hne?= <janis.daehne2@student.uni-halle.de> Date: Fri, 7 Jun 2019 16:56:09 +0200 Subject: [PATCH] - fixed issue #130 - added compiler options --- i18n/en.ts | 2 ++ i18n/i18nRoot.ts | 2 ++ .../helpers/tests/testSettingsView.tsx | 33 ++++++++++++++++++- src/components/loggerPanel/LoggerWrapper.tsx | 4 ++- .../changeCustomTestView.tsx | 2 ++ .../sites/doExerciseSite/doExerciseSite.tsx | 1 + .../viewTestDialog/viewTestView.tsx | 2 ++ .../changeTestDialog/changeTestView.tsx | 4 +++ .../exerciseSettingsPanelView.tsx | 4 +++ .../dialogs/changeTestView.tsx | 4 +++ src/helpers/convertersAndTransformers.ts | 19 +++++++++-- .../doExerciseSite/doExerciseCrudActions.ts | 2 ++ .../customProjectTestActions.ts | 11 +++++++ .../editCustomProjectCrudActions.ts | 4 ++- .../changeTestDialog/changeTestActions.ts | 11 ++++++- ...ditorExerciseDefaultTestSettingsActions.ts | 8 +++++ .../tutorViewSite/tutorViewSiteCrudActions.ts | 2 ++ ...setDoExerciseDefaultTestSettingsReducer.ts | 1 + ...hangeCustomProjectTestDialogActionTypes.ts | 1 + .../changeCustomProjectTestDialogReducer.ts | 1 + .../customProjectTestReducer.ts | 14 ++++++++ .../changeTestDialogActionTypes.ts | 1 + .../changeTestDialogReducer.ts | 1 + .../changeTestDialog/editorTestReducer.ts | 14 ++++++++ .../editorExerciseReducer.ts | 1 + .../editorExerciseSiteActionTypes.ts | 1 + .../exerciseEditorSiteReducer.ts | 1 + ...ditorExerciseDefaultTestSettingsReducer.ts | 12 +++++++ src/types/exerciseEditor.ts | 5 +++ 29 files changed, 161 insertions(+), 7 deletions(-) diff --git a/i18n/en.ts b/i18n/en.ts index 77346568..bd6afb6b 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 da3b9ba3..e0777d94 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 b6b7ede3..e2ca4136 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 813afed3..6dfbad39 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 7260c97c..fe2d0f18 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 45d78ee0..8d43505c 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 381f0840..86e346d7 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 af473aba..079aa6f8 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 860d2937..bf47b67e 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 aa212aa5..0eb6992e 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 5ea0fe82..ebcff878 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 134233c7..6cda5d9e 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 360a96d6..c63382fe 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 d17e3fdb..c63b4399 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 dc366b5a..7979302a 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 fea2c95a..9b100c74 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 71dafdfd..b698331e 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 1eb91add..8d8381eb 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 1c6f46e4..ef9c83dc 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 c20f748d..1b093089 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 b809755a..94878b29 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 3dd7dae7..1bc987a5 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 2082e958..69eadb18 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 c3a0835a..5a471e88 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 44cdd2bf..6e98937a 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 540236a9..e9cab96a 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 800eccb0..ebfa3efe 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 6d73a5ac..f430ce31 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 3fc0217a..468c3586 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 } /** -- GitLab