You can use IntelliJ IDEA to develop and debug the ICPC Tools. Note that to work on the CDS, the Ultimate edition is required, since it uses Java EE.
To get started, first open the whole repository in IDEA.
Next, open File -> Project structure. Select a valid SDK under Project SDK. If none are available,
click Add SDK and add one. Also select a directory under Project compiler output to put compilation results.
Next, go to Modules on the same window. Remove the icpctools module (or how it is called, depends on
your directory name).
Now perform the following steps for the top level icpctools directory, and it should find all the modules:
Alternatively, if this doesn't work, perform the steps for each of the directories listed below.
- Click
+ - Click
Import Module - Select
Create module from existing sources. ClickNext. - Leave the checkbox selected on the source files screen. Click
Next. - On the Libraries page, deselect all libraries. Click
Next. - On the Modules page, click
Next. - On the second Libraries page, deselect all libraries. Click
Next. - On the second Modules page, click
Next. - On the Frameworks page, click
Finish. Note that for the CDS the page shows a different output. This is fine.
Do this for the following directories:
BalloonUtilityCDSCoachViewContestModelContestUtilPresAdminPresContestPresCoreProblemSetResolver
Now we need to add dependencies. Some modules need other modules and some modules need external JARs.
For each of the modules listed below, add the specified modules, directories and JARs. First, select the module,
then click the Dependencies tab. Click the + button. Select Module Dependency... to add a module dependency
and select JARs or Directories... to add a directory or JAR.
Add the dependencies listed below. If you need to add the SWT JAR for your platform, select the correct JAR in
SWTLauncher/lib based on your operating system.
Module dependencies might be added automatically when importing all the modules at once.
- For
BalloonUtilityadd:- Module
ContestModel - Module
PresCore - The SWT JAR for your platform
- The file 'svgSalamander-1.1.2.4.jar' from the 'ContestModel/lib' directory.
- Module
- For
CoachViewadd:- Module
ContestModel - Module
PresCore - The
libdirectory in theCoachViewdirectory
- Module
- For
CDSadd:- Module
ContestModel - The files
javax.servlet-api-4.0.1.jar,javax.servlet.jsp-api-2.3.3.jarandjavax.websocket-api-1.1.jarfrom theCDSdirectory.
- Module
- For
ContestModeladd:- The
libdirectory in the project root - The
testlibdirectory in the project root - The
libdirectory in theContestModeldirectory
- The
- For
ContestUtiladd:- Module
ContestModel
- Module
- For
PresCoreadd:- Module
ContestModel - The
libdirectory in thePresCoredirectory
- Module
- For
PresAdminadd:- Module
ContestModel - Module
PresCore - The SWT JAR for your platform
- Module
- For
PresContestadd:- Module
ContestModel - Module
PresCore - The
libdirectory in thePresContestdirectory - The file 'svgSalamander-1.1.2.4.jar' from the 'ContestModel/lib' directory.
- Module
- For
ProblemSetadd:- The
libdirectory in theProblemSetdirectory - The SWT JAR for your platform
- The
- For
Resolveradd:b- Module
ContestModel - Module
PresCore - Module
PresContest
- Module
Now select the Facets item on the left. At the bottom it will tell you that the Web Facet resources
are not included in an artifact. Click the Create Artifact button. Rename the artifact to CDS and
select an output directory for the artifact. We need this directory later. Keep clicking the Fix
button at the bottom until it goes away. Now expand WEB-INF, then classes. Click on classes and
click on the + button. Select Module Output and then select CDS. Click OK twice.
If you want to run the CDS from inside IntelliJ IDEA, download Openliberty from
this page. Make sure to pick the Web Profile 8 package.
Unpack the ZIP file and place it somewhere. In IntelliJ IDEA go to the prefenences and under
Build, Execution, Deployment select Application Servers. Click the + button and select
WebSphere Server as the type. As WebSphere Home select the wlp directory inside the unpacked
Openliberty archive. It should show the correct version. Click Ok to close the window.
Copy the CDS/config/wlp/cds directory to wlp/usr/servers inside the unpacked Openliberty archive.
Open the file server.xml and change the following on the line that contains <webApplication:
- Change
webApplicationtoapplication - Change the value inside the
locationtag to the artifact directory of the CDS you picked earlier - Change
contextRoottocontext-root - Add
type="war"
Also change </webApplication> to </application>.
If the server.xml or any files in this directory change in the repository, make sure to update them accordingly.
Now that we have set up all modules, we can finally add the build configurations. Setting up the CDS is the most cumbersome, but it is also the tool most other tools need, so it should be the first thing you set up.
Click the Run menu item and select Edit configurations.... Click + and select WebSphere Server
-> Local. Name it CDS and uncheck After launch if you do not want your browser to launch after the
CDS has started up. Use https://localhost:8443/ as URL. Select cds under WebSphere Server Settings ->
Server. On the Deployment tab click the + button and select Artifact.... The CDS artifact will
automatically be added. Make sure to check the Use contest context root checkbox and leave the context as /.
Click the Fix button at the bottom if it complains about JMX administration.
Now you can finally run and debug the CDS using the IntelliJ IDEA features. The CDS configuration can be found
in the wlp/usr/servers/cds directory inside the Openliberty directory, so you can edit the cdsConfig.xml and
other files there. You can use File -> New -> Module from existing sources and point to this directory to
open it inside IntelliJ IDEA.
The other tools are way easier to run. Configuring each of them is similar with only small differences. First, the general process will be explained and below that the specific settings for each tool will be shown.
In the Run menu, select Edit configurations.... Click the + button and select Application.
Give the application a logical name. Under Build and run click the first empty dropdown and select the module
you want to run. Click the Browse button inside the Main class input and select the correct class. If the tool
requires program arguments, enter them in the Program arguments input field.
When using macOS, click Modify options and select Add VM options. In the VM options field, type
-XstartOnFirstThread.
Click OK to add the tool.
- Balloon utility:
- Module:
BalloonUtility - Main class:
BalloonUtility
- Module:
- Coach view:
- Module:
CoachView - Main class:
CoachView - Program arguments:
https://localhost:8443/api/contests/<id> public publ1cwhere<id>is a configured contest ID
- Module:
- Floor generators:
- Module:
ContestUtil - Main class:
FloorGenerator<X>with<X>the floor generator you want to use
- Module:
- Presentation admin:
- Module:
PresAdmin - Main class:
Admin - Program arguments:
https://localhost:8443/ admin adm1n - Note that the presentation admin requires a presentation client ZIP file inside a
presentdirectory in the same directory as thecdsConfig.xmlfile
- Module:
- Presentation client:
- Module:
PresContest - Main class:
ClientLauncher - Program arguments:
https://localhost:8443/api/contests/<id> presentation presentat1on --display 1dwhere<id>is a configured contest ID. The-display 1dis to make the presentation client not be full screen
- Module:
- Problem set editor:
- Module:
ProblemSet - Main class:
ProblemSetEditor
- Module:
- Resolver:
- Module:
Resolver - Main class:
Resolver - Program arguments:
https://localhost:8443/api/contests/<id> presAdmin padm1n --display 1dwhere<id>is a configured contest ID. The-display 1dis to make the resolver not be full screen. Other useful options are--fast 0.15,--infoand--presenter
- Module:
- Awards utility:
- Module:
Resolver - Main class:
Awards
- Module: