Compare commits
116 Commits
master
...
dev/git-se
Author | SHA1 | Date |
---|---|---|
![]() |
f63536c5ce | 5 years ago |
![]() |
cfefa37387 | 5 years ago |
![]() |
37bbbcfcbf | 5 years ago |
![]() |
c2a3a68123 | 5 years ago |
![]() |
6a4e4fb834 | 5 years ago |
![]() |
0fbe1c827d | 5 years ago |
![]() |
8bf2c18c50 | 5 years ago |
![]() |
9e60050cee | 5 years ago |
![]() |
087289db8e | 5 years ago |
![]() |
940a8beb80 | 5 years ago |
![]() |
577c3454c1 | 5 years ago |
![]() |
616652ab78 | 5 years ago |
![]() |
9784aa54bf | 5 years ago |
![]() |
6fb59802a0 | 5 years ago |
![]() |
224b7cce7d | 5 years ago |
![]() |
3a6acdb835 | 5 years ago |
![]() |
63f0c13aa7 | 5 years ago |
![]() |
17ee626618 | 5 years ago |
![]() |
5836e024ff | 5 years ago |
![]() |
e0f132af91 | 5 years ago |
![]() |
0d34ffd379 | 5 years ago |
![]() |
9ed3749e7f | 5 years ago |
![]() |
a1d0d45c6a | 5 years ago |
![]() |
44ba96bd8b | 5 years ago |
![]() |
f0da33f66e | 5 years ago |
![]() |
c214dac2d0 | 5 years ago |
![]() |
6faada8d79 | 5 years ago |
![]() |
91c010edbe | 5 years ago |
![]() |
bbd6f0d600 | 5 years ago |
![]() |
43c16a1238 | 5 years ago |
![]() |
13b2acd365 | 5 years ago |
![]() |
3f21fd73e7 | 5 years ago |
![]() |
fb4f5371aa | 5 years ago |
![]() |
ebb5aeeb07 | 5 years ago |
![]() |
c443cb149b | 5 years ago |
![]() |
0ace5fb84b | 5 years ago |
![]() |
cbe0dbc692 | 5 years ago |
![]() |
6f718f4e70 | 5 years ago |
![]() |
d7040b2ced | 5 years ago |
![]() |
c82fa1db32 | 5 years ago |
![]() |
f4f400adcf | 5 years ago |
![]() |
d62ff479fe | 5 years ago |
![]() |
062a72633e | 5 years ago |
![]() |
56e53dc1c5 | 5 years ago |
![]() |
fe4f2fafe1 | 5 years ago |
![]() |
3ff8cec015 | 5 years ago |
![]() |
78e42a76ad | 5 years ago |
![]() |
8d85986b01 | 5 years ago |
![]() |
deed95f3b9 | 5 years ago |
![]() |
5acb292393 | 5 years ago |
![]() |
3b58957c87 | 5 years ago |
![]() |
6d4d33f109 | 5 years ago |
![]() |
a3a1f55602 | 5 years ago |
![]() |
0260e0e33f | 5 years ago |
![]() |
f691aaea78 | 5 years ago |
![]() |
12c302fa3b | 5 years ago |
![]() |
0f3f24ffa2 | 5 years ago |
![]() |
5cec77a499 | 5 years ago |
![]() |
e9750a36ac | 5 years ago |
![]() |
e59041ebe7 | 5 years ago |
![]() |
94815bb1b9 | 5 years ago |
![]() |
1bb818869f | 5 years ago |
![]() |
368dd7e7d4 | 5 years ago |
![]() |
c7dd63df65 | 5 years ago |
![]() |
be83a8c283 | 5 years ago |
![]() |
85a392fdcf | 5 years ago |
![]() |
c6838692f7 | 5 years ago |
![]() |
e7a31d7a2c | 5 years ago |
![]() |
d0d9e1f18d | 5 years ago |
![]() |
7cf0eaf2f1 | 5 years ago |
![]() |
9a848af892 | 5 years ago |
![]() |
645943a449 | 5 years ago |
![]() |
71b9d19c3f | 5 years ago |
![]() |
d519c96441 | 5 years ago |
![]() |
7836188bc9 | 5 years ago |
![]() |
28be8e933f | 5 years ago |
![]() |
4244f0ff91 | 5 years ago |
![]() |
b956fe2b47 | 5 years ago |
![]() |
b804e0b5bd | 5 years ago |
![]() |
e592d33808 | 5 years ago |
![]() |
12fe135a4b | 5 years ago |
![]() |
9857ea356e | 5 years ago |
![]() |
8e8c85a114 | 5 years ago |
![]() |
3755265902 | 5 years ago |
![]() |
ebecea3ff3 | 5 years ago |
![]() |
f7f0be7709 | 5 years ago |
![]() |
f578877096 | 5 years ago |
![]() |
6f7a4b8b4a | 5 years ago |
![]() |
ec6378db10 | 5 years ago |
![]() |
4e8752fd73 | 5 years ago |
![]() |
f150526715 | 5 years ago |
![]() |
9cd3b1dd22 | 5 years ago |
![]() |
f8cb1a58ff | 5 years ago |
![]() |
b4adcab8c2 | 5 years ago |
![]() |
6b13bb1e85 | 5 years ago |
![]() |
9938aa7dc1 | 5 years ago |
![]() |
96bacaab8e | 5 years ago |
![]() |
fe644a1896 | 5 years ago |
![]() |
4c387da9a8 | 5 years ago |
![]() |
e1229ec79d | 5 years ago |
![]() |
a6199453d0 | 5 years ago |
![]() |
2147e9a6fc | 5 years ago |
![]() |
e00d24da8a | 5 years ago |
![]() |
30999e9062 | 5 years ago |
![]() |
7c9f6af470 | 5 years ago |
![]() |
dd2355678f | 5 years ago |
![]() |
393cd975ef | 5 years ago |
![]() |
d0ab37557e | 5 years ago |
![]() |
42b792b434 | 5 years ago |
![]() |
0a65cd14c5 | 5 years ago |
![]() |
5fae0c9894 | 5 years ago |
![]() |
9a3d1f8556 | 5 years ago |
![]() |
e108116d52 | 5 years ago |
![]() |
cf28e93a3f | 5 years ago |
![]() |
ada06a1323 | 5 years ago |
![]() |
6231b73ad2 | 5 years ago |
266 changed files with 2 additions and 34080 deletions
@ -1,10 +0,0 @@
|
||||
*.swp |
||||
/node_modules |
||||
/.npm-updated |
||||
/.bower-updated |
||||
*.vscode |
||||
/out |
||||
*.heapsnapshot |
||||
etc/config/*.local.properties |
||||
/nbproject |
||||
/package-lock.json |
@ -1,3 +0,0 @@
|
||||
/.name |
||||
/workspace.xml |
||||
/xtextAutoBuilderState.xml |
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectCodeStyleSettingsManager"> |
||||
<option name="PER_PROJECT_SETTINGS"> |
||||
<value> |
||||
<MarkdownNavigatorCodeStyleSettings> |
||||
<option name="RIGHT_MARGIN" value="72" /> |
||||
</MarkdownNavigatorCodeStyleSettings> |
||||
<codeStyleSettings language="Jade"> |
||||
<indentOptions> |
||||
<option name="INDENT_SIZE" value="2" /> |
||||
<option name="TAB_SIZE" value="2" /> |
||||
</indentOptions> |
||||
</codeStyleSettings> |
||||
</value> |
||||
</option> |
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> |
||||
</component> |
||||
</project> |
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="WEB_MODULE" version="4"> |
||||
<component name="NewModuleRootManager" inherit-compiler-output="false"> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/out" /> |
||||
</content> |
||||
<orderEntry type="inheritedJdk" /> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
</component> |
||||
</module> |
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="CompilerConfiguration"> |
||||
<resourceExtensions /> |
||||
<wildcardResourcePatterns> |
||||
<entry name="!?*.java" /> |
||||
<entry name="!?*.form" /> |
||||
<entry name="!?*.class" /> |
||||
<entry name="!?*.groovy" /> |
||||
<entry name="!?*.scala" /> |
||||
<entry name="!?*.flex" /> |
||||
<entry name="!?*.kt" /> |
||||
<entry name="!?*.clj" /> |
||||
<entry name="!?*.aj" /> |
||||
</wildcardResourcePatterns> |
||||
<annotationProcessing> |
||||
<profile default="true" name="Default" enabled="false"> |
||||
<processorPath useClasspath="true" /> |
||||
</profile> |
||||
</annotationProcessing> |
||||
</component> |
||||
</project> |
@ -1,3 +0,0 @@
|
||||
<component name="CopyrightManager"> |
||||
<settings default="" /> |
||||
</component> |
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="PublishConfigData" serverName="Compiler Explorer" /> |
||||
</project> |
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false"> |
||||
<file url="PROJECT" charset="UTF-8" /> |
||||
</component> |
||||
</project> |
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="JavaScriptLibraryMappings"> |
||||
<file url="file://$PROJECT_DIR$" libraries="{compiler-explorer/node_modules}" /> |
||||
<includedPredefinedLibrary name="Node.js Core" /> |
||||
</component> |
||||
</project> |
@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="JSHintConfiguration" version="2.9.4" use-config-file="true" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/.jshintrc"> |
||||
<option asi="false" /> |
||||
<option bitwise="true" /> |
||||
<option boss="false" /> |
||||
<option browser="true" /> |
||||
<option browserify="false" /> |
||||
<option camelcase="false" /> |
||||
<option couch="false" /> |
||||
<option curly="true" /> |
||||
<option debug="false" /> |
||||
<option devel="false" /> |
||||
<option dojo="false" /> |
||||
<option elision="false" /> |
||||
<option enforceall="false" /> |
||||
<option eqeqeq="true" /> |
||||
<option eqnull="false" /> |
||||
<option es3="false" /> |
||||
<option es5="false" /> |
||||
<option esnext="false" /> |
||||
<option evil="false" /> |
||||
<option expr="false" /> |
||||
<option forin="true" /> |
||||
<option freeze="false" /> |
||||
<option funcscope="false" /> |
||||
<option futurehostile="false" /> |
||||
<option gcl="false" /> |
||||
<option globalstrict="false" /> |
||||
<option immed="false" /> |
||||
<option iterator="false" /> |
||||
<option jasmine="false" /> |
||||
<option jquery="false" /> |
||||
<option lastsemic="false" /> |
||||
<option latedef="false" /> |
||||
<option laxbreak="false" /> |
||||
<option laxcomma="false" /> |
||||
<option loopfunc="false" /> |
||||
<option maxerr="50" /> |
||||
<option mocha="false" /> |
||||
<option module="false" /> |
||||
<option mootools="false" /> |
||||
<option moz="false" /> |
||||
<option multistr="false" /> |
||||
<option newcap="false" /> |
||||
<option noarg="true" /> |
||||
<option nocomma="false" /> |
||||
<option node="false" /> |
||||
<option noempty="true" /> |
||||
<option nomen="false" /> |
||||
<option nonbsp="false" /> |
||||
<option nonew="true" /> |
||||
<option nonstandard="false" /> |
||||
<option notypeof="false" /> |
||||
<option noyield="false" /> |
||||
<option onevar="false" /> |
||||
<option passfail="false" /> |
||||
<option phantom="false" /> |
||||
<option plusplus="false" /> |
||||
<option proto="false" /> |
||||
<option prototypejs="false" /> |
||||
<option qunit="false" /> |
||||
<option quotmark="false" /> |
||||
<option rhino="false" /> |
||||
<option scripturl="false" /> |
||||
<option shadow="false" /> |
||||
<option shelljs="false" /> |
||||
<option singleGroups="false" /> |
||||
<option smarttabs="false" /> |
||||
<option strict="true" /> |
||||
<option sub="false" /> |
||||
<option supernew="false" /> |
||||
<option trailing="false" /> |
||||
<option typed="false" /> |
||||
<option undef="true" /> |
||||
<option unused="false" /> |
||||
<option validthis="false" /> |
||||
<option varstmt="false" /> |
||||
<option white="false" /> |
||||
<option withstmt="false" /> |
||||
<option worker="false" /> |
||||
<option wsh="false" /> |
||||
<option yui="false" /> |
||||
</component> |
||||
</project> |
@ -1,21 +0,0 @@
|
||||
<component name="libraryTable"> |
||||
<library name="Cargo <rustfilt>"> |
||||
<CLASSES> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.18" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.2.8" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.3.9" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/utf8-ranges-0.1.3" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread_local-0.2.7" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-0.1.80" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.3" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.5.3" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.2" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread-id-2.0.0" /> |
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11" /> |
||||
</CLASSES> |
||||
<JAVADOC /> |
||||
<SOURCES /> |
||||
</library> |
||||
</component> |
@ -1,16 +0,0 @@
|
||||
<component name="libraryTable"> |
||||
<library name="Rust <rustfilt>"> |
||||
<CLASSES> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcollections" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liblibc/src" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libpanic_unwind" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/librustc_unicode" /> |
||||
<root url="file://$USER_HOME$/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest" /> |
||||
</CLASSES> |
||||
<JAVADOC /> |
||||
<SOURCES /> |
||||
</library> |
||||
</component> |
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="JavaScriptSettings"> |
||||
<option name="languageLevel" value="ES6" /> |
||||
</component> |
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="Python 2.7.12+ (/usr/bin/python2.7)" project-jdk-type="Python SDK" /> |
||||
<component name="RustProjectSettings"> |
||||
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" /> |
||||
</component> |
||||
</project> |
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectModuleManager"> |
||||
<modules> |
||||
<module fileurl="file://$PROJECT_DIR$/.idea/compiler-explorer.iml" filepath="$PROJECT_DIR$/.idea/compiler-explorer.iml" /> |
||||
<module fileurl="file://$PROJECT_DIR$/rust/rustfilt.iml" filepath="$PROJECT_DIR$/rust/rustfilt.iml" /> |
||||
</modules> |
||||
</component> |
||||
</project> |
@ -1,5 +0,0 @@
|
||||
<component name="DependencyValidationManager"> |
||||
<state> |
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" /> |
||||
</state> |
||||
</component> |
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="VcsDirectoryMappings"> |
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
||||
</component> |
||||
</project> |
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectTasksOptions" suppressed-tasks="Less" /> |
||||
</project> |
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="WebResourcesPaths"> |
||||
<contentEntries> |
||||
<entry url="file://$PROJECT_DIR$"> |
||||
<entryData> |
||||
<resourceRoots> |
||||
<path value="file://$PROJECT_DIR$/static" /> |
||||
</resourceRoots> |
||||
</entryData> |
||||
</entry> |
||||
</contentEntries> |
||||
</component> |
||||
</project> |
@ -1,28 +0,0 @@
|
||||
# Lines starting with '#' are comments. |
||||
# Each line is a file pattern followed by one or more owners. |
||||
|
||||
# These owners will be the default owners for everything in the repo. |
||||
* @mattgodbolt |
||||
|
||||
# rabsrincon |
||||
static/conformance-view.js @RabsRincon |
||||
static/cppp-mode.js @RabsRincon |
||||
static/themes.js @RabsRincon |
||||
lib/asm-docs.js @RabsRincon |
||||
lib/asm-docs-api.js @RabsRincon |
||||
views/sitemap.pug @RabsRincon |
||||
|
||||
|
||||
# jaredwy |
||||
static/opt-view.js @jaredwy |
||||
lib/compilers/argument-parsers.js @jaredwy |
||||
|
||||
# tartanllama |
||||
static/ast-view.js @TartanLlama |
||||
static/haskell-mode.js @TartanLlama |
||||
lib/compilers/haskell.js @TartanLlama |
||||
views/example.hs @TartanLlama |
||||
|
||||
# cppchedy |
||||
static/cfg-view.js @cppchedy |
||||
lib/cfg.js @cppchedy |
@ -1,46 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct |
||||
|
||||
## Our Pledge |
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. |
||||
|
||||
## Our Standards |
||||
|
||||
Examples of behavior that contributes to creating a positive environment include: |
||||
|
||||
* Using welcoming and inclusive language |
||||
* Being respectful of differing viewpoints and experiences |
||||
* Gracefully accepting constructive criticism |
||||
* Focusing on what is best for the community |
||||
* Showing empathy towards other community members |
||||
|
||||
Examples of unacceptable behavior by participants include: |
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances |
||||
* Trolling, insulting/derogatory comments, and personal or political attacks |
||||
* Public or private harassment |
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission |
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting |
||||
|
||||
## Our Responsibilities |
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. |
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. |
||||
|
||||
## Scope |
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. |
||||
|
||||
## Enforcement |
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project owner at matt@godbolt.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. |
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. |
||||
|
||||
## Attribution |
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] |
||||
|
||||
[homepage]: http://contributor-covenant.org |
||||
[version]: http://contributor-covenant.org/version/1/4/ |
@ -1,23 +0,0 @@
|
||||
Copyright (c) 2012-2017, Matt Godbolt |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, |
||||
this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
POSSIBILITY OF SUCH DAMAGE. |
@ -1,108 +0,0 @@
|
||||
ifneq "" "$(NODE_DIR)" |
||||
NPM:=$(NODE_DIR)/bin/npm
|
||||
NODE:=$(NODE_DIR)/bin/node
|
||||
default: run |
||||
else |
||||
ifeq "" "$(shell which npm)" |
||||
default: |
||||
@echo "Please install node.js"
|
||||
@echo "Visit http://nodejs.org/ for more details"
|
||||
@echo "On Ubuntu/Debian try: sudo apt-get install nodejs npm"
|
||||
exit 1
|
||||
else |
||||
NPM:= $(shell which npm)
|
||||
NODE:= $(shell which node || which nodejs)
|
||||
default: run |
||||
endif |
||||
endif |
||||
|
||||
.PHONY: clean run test run-amazon c-preload optional-haskell-support optional-d-support optional-rust-support |
||||
.PHONY: dist lint prereqs node_modules bower_modules |
||||
prereqs: optional-haskell-support optional-d-support optional-rust-support node_modules c-preload bower_modules |
||||
|
||||
GDC?=gdc
|
||||
DMD?=dmd
|
||||
LDC?=ldc2
|
||||
ifneq "" "$(shell which $(GDC) 2>/dev/null || which $(DMD) 2>/dev/null || which $(LDC) 2>/dev/null)" |
||||
optional-d-support: |
||||
$(MAKE) -C d
|
||||
else |
||||
optional-d-support: |
||||
@echo "D language support disabled"
|
||||
endif |
||||
|
||||
GHC?=ghc
|
||||
ifneq "" "$(shell which $(GHC))" |
||||
optional-haskell-support: |
||||
$(MAKE) -C haskell
|
||||
else |
||||
optional-haskell-support: |
||||
@echo "Haskell language support disabled"
|
||||
endif |
||||
|
||||
ifneq "" "$(shell which cargo)" |
||||
optional-rust-support: |
||||
cd rust && cargo build --release
|
||||
else |
||||
optional-rust-support: |
||||
@echo "Rust language support disabled"
|
||||
endif |
||||
|
||||
|
||||
NODE_MODULES=.npm-updated
|
||||
$(NODE_MODULES): package.json |
||||
$(NPM) install
|
||||
@touch $@
|
||||
|
||||
BOWER_MODULES=.bower-updated
|
||||
$(BOWER_MODULES): bower.json $(NODE_MODULES) |
||||
if ! test -f "${BOWER_MODULES}"; then rm -rf static/ext; fi
|
||||
$(NODE) ./node_modules/bower/bin/bower install
|
||||
@touch $@
|
||||
# Workaround for lack of versioned monaco-editor in bower
|
||||
rm -rf static/ext/monaco-editor
|
||||
cp -r node_modules/monaco-editor static/ext/
|
||||
|
||||
lint: $(NODE_MODULES) |
||||
$(NODE) ./node_modules/.bin/jshint app.js $(shell find lib static -name '*.js' -not -path 'static/ext/*' -not -path static/analytics.js)
|
||||
|
||||
LANG:=C++
|
||||
|
||||
node_modules: $(NODE_MODULES) |
||||
bower_modules: $(BOWER_MODULES) |
||||
|
||||
test: $(NODE_MODULES) lint |
||||
$(MAKE) -C c-preload test
|
||||
@echo Tests pass
|
||||
|
||||
clean: |
||||
rm -rf bower_modules node_modules .npm-updated .bower-updated out static/ext
|
||||
$(MAKE) -C d clean
|
||||
$(MAKE) -C c-preload clean
|
||||
|
||||
run: prereqs |
||||
$(NODE) ./node_modules/.bin/supervisor -w app.js,lib,etc/config -e 'js|node|properties' --exec $(NODE) $(NODE_ARGS) -- ./app.js --language $(LANG) $(EXTRA_ARGS)
|
||||
|
||||
HASH := $(shell git rev-parse HEAD)
|
||||
dist: prereqs |
||||
rm -rf out/dist
|
||||
$(NODE) ./node_modules/requirejs/bin/r.js -o app.build.js
|
||||
# Move all assets to a versioned directory
|
||||
mkdir -p out/dist/v/$(HASH)
|
||||
mv out/dist/main.js* out/dist/v/$(HASH)/
|
||||
mv out/dist/explorer.css out/dist/v/$(HASH)/
|
||||
mv out/dist/assets/ out/dist/v/$(HASH)/
|
||||
mv out/dist/themes/ out/dist/v/$(HASH)/
|
||||
# copy any external references into the directory too
|
||||
cp -r $(shell pwd)/out/dist/ext out/dist/v/$(HASH)/ext
|
||||
# uglify requirejs itself
|
||||
$(NODE) ./node_modules/.bin/uglifyjs out/dist/v/$(HASH)/ext/requirejs/require.js \
|
||||
-c \
|
||||
--output out/dist/v/$(HASH)/ext/requirejs/require.js \
|
||||
--source-map out/dist/v/$(HASH)/ext/requirejs/require.js.map \
|
||||
--source-map-url require.js.map \
|
||||
--source-map-root //v/$(HASH)/ext/requirejs \
|
||||
--prefix 6
|
||||
|
||||
c-preload: |
||||
$(MAKE) -C c-preload
|
@ -1,135 +0,0 @@
|
||||
[](https://travis-ci.org/mattgodbolt/compiler-explorer) |
||||
[](https://www.codewake.com/p/compiler-explorer) |
||||
|
||||
Compiler Explorer |
||||
------------ |
||||
|
||||
Compiler Explorer is an interactive compiler. The left-hand pane shows editable C/C++/Rust/Go/D/Haskell/Swift code. The right, the |
||||
assembly output of having compiled the code with a given compiler and settings. Multiple compilers are supported, and |
||||
the UI layout is configurable (the [Golden Layout](https://www.golden-layout.com/) library is used for this). |
||||
There is also an ispc compiler for a C variant with extensions for SPMD. |
||||
|
||||
Try out one of the demo sites: [C++][cpp], [Rust][rust], [D][d], [Go][go], [Haskell][haskell], [Swif][swift], [ispc][ispc]. |
||||
|
||||
[cpp]: https://gcc.godbolt.org/ "Compiler Explorer for C++" |
||||
[rust]: https://rust.godbolt.org/ "Compiler Explorer for Rust" |
||||
[d]: https://d.godbolt.org/ "Compiler Explorer for D" |
||||
[go]: https://go.godbolt.org/ "Compiler Explorer for Go" |
||||
[ispc]: https://ispc.godbolt.org/ "Compiler Explorer for ispc" |
||||
[haskell]: https://haskell.godbolt.org/ "Compiler Explorer for Haskell" |
||||
[swift]: https://swift.godbolt.org/ "Compiler Explorer for Swift" |
||||
|
||||
You can support this [this project on Patreon](https://patreon.com/mattgodbolt). |
||||
|
||||
### Developing or running a local instance |
||||
|
||||
Compiler Explorer is written in node.js. |
||||
|
||||
Assuming you have npm and node installed, simply running `make` ought to get you up and running with an Explorer |
||||
running on port 10240 on your local machine: http://localhost:10240/ |
||||
|
||||
The `Makefile` will automatically install all the third party libraries needed to run; using `npm` to install server-side |
||||
components and `bower` to install all the client-facing libraries. |
||||
|
||||
If you want to point it at your own GCC or similar binaries, either edit the `etc/config/compiler-explorer.defaults.properties` or else make a new one with the name |
||||
`compiler-explorer.local.properties`. `*.local.properties` files have the highest priority when loading properties. |
||||
|
||||
The config system leaves a lot to be desired, I'm working on porting [CCS](https://github.com/hellige/ccs-cpp) to javascript and then something more rational can be used. |
||||
|
||||
Feel free to raise an issue on [github](https://github.com/mattgodbolt/compiler-explorer/issues) or |
||||
[email me directly](mailto:matt@godbolt.org) for more help. |
||||
|
||||
There's now a [Road map](Roadmap.md) that gives a little insight into future plans for Compiler Explorer. |
||||
|
||||
### Credits |
||||
|
||||
Compiler Explorer is maintained by [Matt Godbolt](http://xania.org), [Rubén Rincón](https://github.com/RabsRincon) and [Simon Brand](https://blog.tartanllama.xyz/). |
||||
Multiple compiler and difference view initially implemented by [Gabriel Devillers](https://github.com/voxelf), |
||||
while working for [Kalray](http://www.kalrayinc.com/). Clang optview output by [Jared Wyles](https://github.com/jaredwy). |
||||
|
||||
### RESTful API |
||||
|
||||
There's a simple restful API that can be used to do compiles to asm and to list compilers. In general |
||||
all handlers live in `/api/*` endpoints, and will accept JSON or text in POSTs, and will return text responses |
||||
or JSON responses depending on the request's `Accept` header. |
||||
|
||||
At a later date there may be some form of rate-limiting: currently requests will be queued and dealt with |
||||
exactly like interactive requests on the main site. Authentication might be required at some point in the |
||||
future (for the main Compiler Explorer site anyway). |
||||
|
||||
The following endpoints are defined: |
||||
|
||||
#### `GET /api/compilers` - return a list of compilers |
||||
|
||||
Returns a list of compilers. In text form, there's a simple formatting of the ID of the compiler and its |
||||
description. In JSON, all the information is returned as an array of compilers, with the `id` key being the |
||||
primary identifier of each compiler. |
||||
|
||||
#### `POST /api/compiler/<compiler-id>/compile` - perform a compilation |
||||
|
||||
To specify a compilation request as a JSON document, post it as the appropriate type and send an object of |
||||
the form: `{'source': 'source to compile', 'options': {userOptions': 'compiler flags', 'compilerOptions':{}, filters': {'filter': true}}}`. |
||||
The filters are an JSON object with true/false. If not supplied, defaults are used. If supplied, the |
||||
filters are used as-is. The `compilerOptions` is used to pass extra arguments to the back end, and is probably |
||||
not useful for most REST users. |
||||
|
||||
A text compilation request has the source as the body of the post, and uses query parameters to pass the |
||||
options and filters. Filters are supplied as a comma-separated string. Use the query parameter `filters=XX` |
||||
to set the filters directly, else `addFilters=XX` to add a filter to defaults, or `removeFilters` to remove from defaults. Compiler parameters should be passed as `options=-O2` and default to empty. |
||||
|
||||
Filters include `binary`, `labels`, `intel`, `comments` and `directives` and correspond to the UI buttons on |
||||
the HTML version. |
||||
|
||||
The text request is designed for simplicity for command-line clients like `curl`: |
||||
|
||||
```bash |
||||
$ curl 'https://gcc.godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary 'int foo() { return 1; }' |
||||
# Compilation provided by Compiler Explorer at gcc.godbolt.org |
||||
foo(): |
||||
push rbp |
||||
mov rbp, rsp |
||||
mov eax, 1 |
||||
pop rbp |
||||
ret |
||||
``` |
||||
|
||||
If JSON is present in the request's `Accept` header, the compilation results are of the form: |
||||
|
||||
Optional values are marked with a '**' |
||||
|
||||
``` |
||||
{ |
||||
"code": 0 if successful, else compiler return code, |
||||
"stdout": [ |
||||
{ |
||||
"text": Output, |
||||
** "tag": { |
||||
"line": Source line, |
||||
"text": Parsed error for that line |
||||
} |
||||
}, |
||||
... |
||||
], |
||||
"stderr": (format is similar to that of stdout), |
||||
"asm": [ |
||||
{ |
||||
"text": Assembly text, |
||||
"source": {file: null for user input, else path, line: number} or null if none |
||||
}, |
||||
... |
||||
], |
||||
"okToCache": true if output could be locally cached else false, |
||||
** "optOutput" : { |
||||
"displayString" : String displayed in output, |
||||
"Pass" : [ Missed | Passed | Analysis ] (Specifies the type of optimisation output), |
||||
"Name" : Name of the output (mostly represents the reason for the output), |
||||
"DebugLoc" : { |
||||
"File": Name of file, |
||||
"Line": Line number, |
||||
"Column": Column number in line |
||||
}, |
||||
"Function": Name of function for which optimisation output is provided, |
||||
"Args": Array of objects representing the arguments that the optimiser used when trying to optimise |
||||
} |
||||
} |
||||
``` |
@ -1,76 +0,0 @@
|
||||
# Compiler Explorer Road Map |
||||
|
||||
CE was started in 2012 to serve my needs at [my company](http:/drw.com) in terms of showing how |
||||
C++ constructs translated to assembly code. It started out as a `tmux` session with `vi` running in one |
||||
pane and `watch gcc -S foo.cc -o -` running in the other. Since those days, it's now a public website |
||||
serving the C++, Rust, Go and D communities and performs around 20,000 compilations per day. |
||||
|
||||
This document is an attempt to capture thoughts on the future direction of Compiler Explorer. |
||||
|
||||
## Areas to improve |
||||
|
||||
### Mobile client support |
||||
|
||||
CE's UI doesn't work well with mobile clients. The editor doesn't work well on many mobile clients, and the |
||||
layout doesn't lend itself well to small screens. |
||||
|
||||
Ideas for improving mobile support include automatically folding up all the panes into a single tab upon |
||||
detection of a mobile client. This would require a bunch of fixes in the |
||||
underlying [UI library](http://golden-layout.com) as this doesn't properly work with mobile and tabs. |
||||
|
||||
Perhaps a read-only simplified view would work better: the main reason one brings up the CE website is to |
||||
look at tweeted links rather than author content. |
||||
|
||||
### UI improvements |
||||
|
||||
The UI has a number of things that need improving: |
||||
|
||||
- [X] Multiple editor windows |
||||
- [X] Saving and restoring from browser-local storage |
||||
- [ ] Handling the loss of data if one has a work-in-progress CE window open and then clicks another CE link. |
||||
|
||||
### Diff view |
||||
|
||||
A frequently requested feature that arrived with the inclusion of the [Monaco](https://microsoft.github.io/monaco-editor/) editor. |
||||
|
||||
### Execution support |
||||
|
||||
Another big ticket item is to allow executing of the user's code. This is fraught with security issues, and |
||||
brings up a number of UI and API considerations. Compiling code every time to execute with different params |
||||
seems wasteful, so caching seems good; but in a multi-instance setup a shared cache woudl be needed. Perhaps |
||||
a backend system that caches the executables (and makes them downloadable; at least for some compilers where |
||||
license allows), and stores the binaries in ephemeral, shared storage. This same backend system could also |
||||
be used to store code, and could be part of a whole new way of sending and sharing code (if made permanent |
||||
storage). |
||||
|
||||
### Support more compilers |
||||
|
||||
Most of the open tickets are to do with adding new compilers, or fixing issues with existing compilers. |
||||
Continuing to add more compilers and make it easier for others to submit PRs to add new compilers is |
||||
very important. |
||||
|
||||
## Tensions |
||||
|
||||
There's an inherent tension between the standalone, run-it-yourself version of CE and the scalable, AWS-backed |
||||
CE instance. Care must be taken to keep the standalone version usable, not least as the majority of CE's |
||||
development is done on a laptop during a commute (with little or no internet access). |
||||
|
||||
## Priorities |
||||
|
||||
Above all, the priority is to keep the main CE site up, stable and dependable. After that, features are |
||||
added honestly in the order that is most useful and interesting to the primary developer (Matt Godbolt). |
||||
|
||||
## Non-goals |
||||
CE will remain ad-free, open-source and non-commercial. There's no plans at all to add "freemium" content. |
||||
|
||||
## 2017 goals |
||||
|
||||
With all this in mind, the tentative goals for 2017 are: |
||||
|
||||
- [X] Move to the Monaco editor |
||||
- [X] Implement diff view |
||||
- [ ] Come up with a decent secure solution for code execution |
||||
- [ ] Design an API that can handle remote code execution and download needs |
||||
- [ ] Implement remote execution UIs |
||||
|
||||
These goals will be refined as time ticks on. |
@ -1,19 +0,0 @@
|
||||
({ |
||||
appDir: "static", |
||||
baseUrl: ".", |
||||
dir: "out/dist", |
||||
generateSourceMaps: true, |
||||
preserveLicenseComments: false, |
||||
optimize: "uglify2", |
||||
removeCombined: true, |
||||
useStrict: true, |
||||
mainConfigFile: "static/main.js", |
||||
skipDirOptimize: true, |
||||
optimizeCss: "standard", |
||||
paths: { "vs": "empty:" }, |
||||
modules: [ |
||||
{ |
||||
name: "main" |
||||
} |
||||
] |
||||
}) |
@ -1,647 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Copyright (c) 2012-2017, Matt Godbolt
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Initialise options and properties. Don't load any handlers here; they
|
||||
// may need an initialised properties library.
|
||||
var nopt = require('nopt'), |
||||
os = require('os'), |
||||
props = require('./lib/properties'), |
||||
child_process = require('child_process'), |
||||
path = require('path'), |
||||
fs = require('fs-extra'), |
||||
http = require('http'), |
||||
https = require('https'), |
||||
url = require('url'), |
||||
Promise = require('promise'), |
||||
_ = require('underscore-node'), |
||||
utils = require('./lib/utils'), |
||||
express = require('express'), |
||||
logger = require('./lib/logger').logger; |
||||
|
||||
// Parse arguments from command line 'node ./app.js args...'
|
||||
var opts = nopt({ |
||||
'env': [String, Array], |
||||
'rootDir': [String], |
||||
'language': [String], |
||||
'host': [String], |
||||
'port': [Number], |
||||
'propDebug': [Boolean], |
||||
'debug': [Boolean], |
||||
'static': [String], |
||||
'archivedVersions': [String], |
||||
'noRemoteFetch': [Boolean], |
||||
'tmpDir': [String] |
||||
}); |
||||
|
||||
if (opts.debug) logger.level = 'debug'; |
||||
|
||||
// AP: Detect if we're running under Windows Subsystem for Linux. Temporary modification
|
||||
// of process.env is allowed: https://nodejs.org/api/process.html#process_process_env
|
||||
if (child_process.execSync('uname -a').toString().indexOf('Microsoft') > -1) |
||||
process.env.wsl = true; |
||||
|
||||
// AP: Allow setting of tmpDir (used in lib/base-compiler.js & lib/exec.js) through
|
||||
// opts. WSL requires a tmpDir as it can't see Linux volumes so set default to c:\tmp.
|
||||
if (opts.tmpDir) |
||||
process.env.tmpDir = opts.tmpDir; |
||||
else if (process.env.wsl) |
||||
process.env.tmpDir = "/mnt/c/tmp"; |
||||
|
||||
|
||||
// Set default values for omitted arguments
|
||||
var rootDir = opts.rootDir || './etc'; |
||||
var language = opts.language || "C++"; |
||||
var env = opts.env || ['dev']; |
||||
var hostname = opts.host; |
||||
var port = opts.port || 10240; |
||||
var staticDir = opts.static || 'static'; |
||||
var archivedVersions = opts.archivedVersions; |
||||
var gitReleaseName = child_process.execSync('git rev-parse HEAD').toString().trim(); |
||||
var versionedRootPrefix = ""; |
||||
// Don't treat @ in paths as remote adresses
|
||||
var fetchCompilersFromRemote = !opts.noRemoteFetch; |
||||
if (opts.static && fs.existsSync(opts.static + '/v/' + gitReleaseName)) |
||||
versionedRootPrefix = "v/" + gitReleaseName + "/"; |
||||
|
||||
var propHierarchy = _.flatten([ |
||||
'defaults', |
||||
env, |
||||
language, |
||||
_.map(env, function (e) { |
||||
return e + '.' + process.platform; |
||||
}), |
||||
process.platform, |
||||
os.hostname(), |
||||
'local']); |
||||
logger.info("properties hierarchy: " + propHierarchy.join(', ')); |
||||
|
||||
// Propagate debug mode if need be
|
||||
if (opts.propDebug) props.setDebug(true); |
||||
|
||||
// *All* files in config dir are parsed
|
||||
props.initialize(rootDir + '/config', propHierarchy); |
||||
|
||||
// Now load up our libraries.
|
||||
var CompileHandler = require('./lib/compile-handler').CompileHandler, |
||||
aws = require('./lib/aws'), |
||||
asm_doc_api = require('./lib/asm-docs-api'); |
||||
|
||||
// Instantiate a function to access records concerning "compiler-explorer"
|
||||
// in hidden object props.properties
|
||||
var gccProps = props.propsFor("compiler-explorer"); |
||||
|
||||
// Instantiate a function to access records concerning the chosen language
|
||||
// in hidden object props.properties
|
||||
var compilerPropsFunc = props.propsFor(language.toLowerCase()); |
||||
|
||||
// If no option for the compiler ... use gcc's options (??)
|
||||
function compilerProps(property, defaultValue) { |
||||
// My kingdom for ccs... [see Matt's github page]
|
||||
var forCompiler = compilerPropsFunc(property, undefined); |
||||
if (forCompiler !== undefined) return forCompiler; |
||||
return gccProps(property, defaultValue); // gccProps comes from lib/compile-handler.js
|
||||
} |
||||
|
||||
var staticMaxAgeSecs = gccProps('staticMaxAgeSecs', 0); |
||||
|
||||
function staticHeaders(res) { |
||||
if (staticMaxAgeSecs) { |
||||
res.setHeader('Cache-Control', 'public, max-age=' + staticMaxAgeSecs + ', must-revalidate'); |
||||
} |
||||
} |
||||
|
||||
var awsProps = props.propsFor("aws"); |
||||
var awsPoller = null; |
||||
|
||||
function awsInstances() { |
||||
if (!awsPoller) awsPoller = new aws.InstanceFetcher(awsProps); |
||||
return awsPoller.getInstances(); |
||||
} |
||||
|
||||
// function to load internal binaries (i.e. lib/source/*.js)
|
||||
function loadSources() { |
||||
var sourcesDir = "lib/sources"; |
||||
return fs.readdirSync(sourcesDir) |
||||
.filter(function (file) { |
||||
return file.match(/.*\.js$/); |
||||
}) |
||||
.map(function (file) { |
||||
return require("./" + path.join(sourcesDir, file)); |
||||
}); |
||||
} |
||||
|
||||
// load effectively
|
||||
var fileSources = loadSources(); |
||||
var sourceToHandler = {}; |
||||
fileSources.forEach(function (source) { |
||||
sourceToHandler[source.urlpart] = source; |
||||
}); |
||||
|
||||
var clientOptionsHandler = new ClientOptionsHandler(fileSources); |
||||
var compileHandler = new CompileHandler(gccProps, compilerProps); |
||||
var apiHandler = new ApiHandler(compileHandler); |
||||
|
||||
// auxiliary function used in clientOptionsHandler
|
||||
function compareOn(key) { |
||||
return function (xObj, yObj) { |
||||
var x = xObj[key]; |
||||
var y = yObj[key]; |
||||
if (x < y) return -1; |
||||
if (x > y) return 1; |
||||
return 0; |
||||
}; |
||||
} |
||||
|
||||
// instantiate a function that generate javascript code,
|
||||
function ClientOptionsHandler(fileSources) { |
||||
var sources = fileSources.map(function (source) { |
||||
return {name: source.name, urlpart: source.urlpart}; |
||||
}); |
||||
// sort source file alphabetically
|
||||
sources = sources.sort(compareOn("name")); |
||||
var languages = _.compact(_.map(gccProps("languages", '').split(':'), function (thing) { |
||||
if (!thing) return null; |
||||
var splat = thing.split("="); |
||||
return {language: splat[0], url: splat[1]}; |
||||
})); |
||||
var supportsBinary = !!compilerProps("supportsBinary", true); |
||||
var supportsExecute = supportsBinary && !!compilerProps("supportsExecute", true); |
||||
var libs = {}; |
||||
|
||||
var baseLibs = compilerProps("libs"); |
||||
|
||||
if (baseLibs) { |
||||
_.each(baseLibs.split(':'), function (lib) { |
||||
libs[lib] = {name: compilerProps('libs.' + lib + '.name')}; |
||||
libs[lib].versions = {}; |
||||
var listedVersions = compilerProps("libs." + lib + '.versions'); |
||||
if (listedVersions) { |
||||
_.each(listedVersions.split(':'), function (version) { |
||||
libs[lib].versions[version] = {}; |
||||
libs[lib].versions[version].version = compilerProps("libs." + lib + '.versions.' + version + '.version'); |
||||
libs[lib].versions[version].path = []; |
||||
var listedIncludes = compilerProps("libs." + lib + '.versions.' + version + '.path'); |
||||
if (listedIncludes) { |
||||
_.each(listedIncludes.split(':'), function (path) { |
||||
libs[lib].versions[version].path.push(path); |
||||
}); |
||||
} else { |
||||
logger.warn("No paths found for " + lib + " version " + version); |
||||
} |
||||
}); |
||||
} else { |
||||
logger.warn("No versions found for " + lib + " library"); |
||||
} |
||||
}); |
||||
} |
||||
var options = { |
||||
googleAnalyticsAccount: gccProps('clientGoogleAnalyticsAccount', 'UA-55180-6'), |
||||
googleAnalyticsEnabled: gccProps('clientGoogleAnalyticsEnabled', false), |
||||
sharingEnabled: gccProps('clientSharingEnabled', true), |
||||
githubEnabled: gccProps('clientGitHubRibbonEnabled', true), |
||||
gapiKey: gccProps('googleApiKey', ''), |
||||
googleShortLinkRewrite: gccProps('googleShortLinkRewrite', '').split('|'), |
||||
defaultSource: gccProps('defaultSource', ''), |
||||
language: language, |
||||
compilers: [], |
||||
libs: libs, |
||||
sourceExtension: compilerProps('compileFilename').split('.', 2)[1], |
||||
defaultCompiler: compilerProps('defaultCompiler', ''), |
||||
compileOptions: compilerProps('defaultOptions', ''), |
||||
supportsBinary: supportsBinary, |
||||
supportsExecute: supportsExecute, |
||||
languages: languages, |
||||
sources: sources, |
||||
raven: gccProps('ravenUrl', ''), |
||||
release: gitReleaseName, |
||||
environment: env, |
||||
localStoragePrefix: gccProps('localStoragePrefix'), |
||||
cvCompilerCountMax: gccProps('cvCompilerCountMax', 6), |
||||
defaultFontScale: gccProps('defaultFontScale', 1.0) |
||||
}; |
||||
this.setCompilers = function (compilers) { |
||||
options.compilers = compilers; |
||||
}; |
||||
this.setCompilers([]); |
||||
this.handler = function getClientOptions(req, res) { |
||||
res.set('Content-Type', 'application/json'); |
||||
staticHeaders(res); |
||||
res.end(JSON.stringify(options)); |
||||
}; |
||||
this.get = function () { |
||||
return options; |
||||
}; |
||||
} |
||||
|
||||
// function used to enable loading and saving source code from web interface
|
||||
function getSource(req, res, next) { |
||||
var bits = req.url.split("/"); |
||||
var handler = sourceToHandler[bits[1]]; |
||||
if (!handler) { |
||||
next(); |
||||
return; |
||||
} |
||||
var action = bits[2]; |
||||
if (action === "list") action = handler.list; |
||||
else if (action === "load") action = handler.load; |
||||
else if (action === "save") action = handler.save; |
||||
else action = null; |
||||
if (action === null) { |
||||
next(); |
||||
return; |
||||
} |
||||
action.apply(handler, bits.slice(3).concat(function (err, response) { |
||||
staticHeaders |