cpeditor is cross-platform Qt based IDE specially designed for competitive programmers. It helps automating steps like compiling, running, submitting and debugging (in future) code written in C++, Python and Java. It executes a compiler process to compile the user code, upon successful compilation it runs the produced binary by providing input to stdin (called testcases) and monitor for output (on stdout), which it compares against expected output and then gives verdict whether code is logically correct or not. It repeats this process for number of testcases provided.
There are other stuff like code formatting, language server etc.
In order to function properly, it needs classic confinement. Here are some of the reasons for which it should not be sandboxed.
- Application needs to execute binaries inside
/usr/bin
, which isnt possible in sanboxed apps. - If we only used few binaries, I could have packaged them all in the snap but we use too many of binaries to function. Here is a list of them
c++
(gcc/clang),python2/3
,openjdk/jre
(other variants that user can use),clang-format/clangd
yapf/autopep
and the list goes on and things will be added as development proceeds. - Uses
/tmp
directory to create intermediate binaries and unsaved sources, which can be examined by user in a debugger (since we dont support debugger in IDE as of now).
Here is the snapcraft.yaml
name: cpeditor
base: core20
grade: stable
confinement: classic
adopt-info: cpeditor
package-repositories:
- type: apt
formats: [deb, deb-src]
components: [main]
suites: [focal]
key-id: C65D51784EDC19A871DBDBB710C56D0DE9977759
url: http://ppa.launchpad.net/beineri/opt-qt-5.15.2-focal/ubuntu
apps:
cpeditor:
common-id: cpeditor.desktop
command: usr/bin/cpeditor
plugs:
- home
- opengl
- network
- network-bind
- pulseaudio
parts:
cpeditor:
parse-info:
- usr/share/metainfo/cpeditor.appdata.xml
plugin: cmake
build-packages:
- build-essential
- qt515base
- qt515tools
- libgl1-mesa-dev
stage-packages:
- qt515base
source: https://github.com/cpeditor/cpeditor/releases/download/6.7.2/cpeditor.tar.xz
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
override-prime: |
snapcraftctl prime
sed -i 's|Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/512x512/apps/cpeditor.png|g' $SNAPCRAFT_PRIME/usr/share/applications/cpeditor.desktop
We use latest Qt version 5.15.2 with plan to move to Qt 6.0 once a ppa is available. I could not find any other way to get latest Qt, but hope someone can help improve it further.
Application: https://github.com/cpeditor/cpeditor