An application has the following logic:
- client => created *.cpp => sent to the server => cl.exe + *.cpp =
*.exe - client => created *.cs => sent to the server => csc.exe + *.cs =
*.exe - client => created *.pas => sent to the server => PascalCompiler +
*.pas = *.exe - etc.
The language – C#. I hear that MSBUILD can help me, but I don’t understand how to change compiler on server at runtime. Does anyone know of options other than Process class?
I’m trying to write an online system to test programs in programming contests. The programmer selects the compiler and sends the source code to the server for verification.
And I do not need to build the project, I just need to compile a single file.
1
It sounds like you are trying to automate a build process? A few more details of what you want to achieve would help.
MsBuild is Microsoft’s build tool, not sure if it will help you with Pascal. Other tools that will include NAnt.
Have a look at Continuous integration, and CC.Net (CruiseControl.Net) There are other tools as well.
I’m sort of guessing what you want a bit, so please add a few more details.
2
If all you have to compile is a single file, then why not simply require developers to adhere to a file suffix standard and drive the compiler choice from the file type? Just iterate through the directory, picking up every file in it and checking its suffix. If it’s a “known” suffix, then fire off the appropriate compile command in a separate thread. When your loop ends, wait on all the children before scanning again. You’ll need some way to move or flag files once they’ve been processed and a notification mechanism to inform the submitters whether their compile failed or not, but those are fairly trivial details.
2
You are on a right track.
I would suggest to start with your MSBuild and continues integration process. Dealing with continues integration takes time and resource. I would advice to think twice on the goal that you are planning to achieve.
I have compiled a list of good resources that hopefully will help you to understand the build process itself:
- Continues integration with MS Build and CruiseControl.Net
- Continuous Integration – Why use MSBuild?
- Continuous Integration and nightly build system for an ASP.Net application using MSBuild build scripts and Jenkins CI Server
- Redefine Your Build Process with Continuous Integration