<commit_before>cmake_minimum_required(VERSION 2.8)

# This project doesn't require any of the standard compilers, hence the "NONE"
# argument.
project(Tangelo NONE)
set(TANGELO_VERSION 0.5-dev1)

mark_as_advanced(CMAKE_INSTALL_PREFIX)

# Extend cmake module path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Include utility functions.
include(tangelo)

# Cache variables.
#
# Whether to build Tangelo at all, and then if yes, whether to build the Python
# package.
#
# This option is marked as advanced, as it only applies in a particular set of
# circumstances that apply mainly to Tangelo developers.
set(BUILD_TANGELO ON CACHE BOOL "Build Tangelo")
mark_as_advanced(BUILD_TANGELO)
if(${BUILD_TANGELO})
    set(BUILD_TANGELO_PYTHON_PACKAGE ON CACHE BOOL "Generate a Python package for Tangelo")
    mark_as_advanced(CLEAR BUILD_TANGELO_PYTHON_PACKAGE)
    mark_as_advanced(CLEAR UglifyJS_EXECUTABLE)
else()
    mark_as_advanced(FORCE BUILD_TANGELO_PYTHON_PACKAGE)
    mark_as_advanced(FORCE UglifyJS_EXECUTABLE)
endif()

# Whether to build Sphinx documentation.
set(BUILD_DOCUMENTATION OFF CACHE BOOL "Generate documentation for project.")
if(${BUILD_DOCUMENTATION})
    mark_as_advanced(CLEAR Sphinx_EXECUTABLE)
else()
    mark_as_advanced(FORCE Sphinx_EXECUTABLE)
endif()

# Show/hide testing options depending on whether testing is enabled.
if(${BUILD_TESTING})
    set(JS_STYLE_TESTS ON CACHE BOOL "Generate style tests for JS source files (via JSLint).")
    mark_as_advanced(CLEAR JS_STYLE_TESTS)
    if(${JS_STYLE_TESTS})
        mark_as_advanced(CLEAR JSLint_EXECUTABLE)
    else()
        mark_as_advanced(FORCE JSLint_EXECUTABLE)
    endif()

    set(PY_STYLE_TESTS ON CACHE BOOL "Generate style tests for Python source files (via pep8).")
    mark_as_advanced(CLEAR PY_STYLE_TESTS)
    if(${PY_STYLE_TESTS})
        mark_as_advanced(CLEAR Pep8_EXECUTABLE)
    else()
        mark_as_advanced(FORCE Pep8_EXECUTABLE)
    endif()

    set(JS_UNIT_TESTS ON CACHE BOOL "Generate tangelo.js unit tests.")
    mark_as_advanced(CLEAR JS_UNIT_TESTS)

    set(PY_UNIT_TESTS ON CACHE BOOL "Generate tangelo Python module unit tests.")
    mark_as_advanced(CLEAR PY_STYLE_TESTS)

    set(WEB_CONTENT_TESTS ON CACHE BOOL "Generate tests for example web appplications.")
    mark_as_advanced(CLEAR WEB_CONTENT_TESTS)

    set(PY_COVERAGE_REPORT ON CACHE BOOL "Generate Python coverage report.")
    mark_as_advanced(CLEAR PY_COVERAGE_REPORT)

    set(TESTING_HOST localhost CACHE STRING "The host to run Tangelo on for the test suite.")
    mark_as_advanced(TESTING_HOST)

    set(TESTING_PORT 50047 CACHE STRING "The port number to run Tangelo for the test suite.")
    mark_as_advanced(CLEAR TESTING_PORT)

    if(${JS_UNIT_TESTS} OR ${WEB_CONTENT_TESTS})
        mark_as_advanced(CLEAR PhantomJS_EXECUTABLE)
    else()
        mark_as_advanced(FORCE PhantomJS_EXECUTABLE)
    endif()
else()
    mark_as_advanced(FORCE JS_STYLE_TESTS)
    mark_as_advanced(FORCE JSLint_EXECUTABLE)
    mark_as_advanced(FORCE PY_STYLE_TESTS)
    mark_as_advanced(FORCE Pep8_EXECUTABLE)
    mark_as_advanced(FORCE JS_UNIT_TESTS)
    mark_as_advanced(FORCE PhantomJS_EXECUTABLE)
    mark_as_advanced(FORCE PY_UNIT_TESTS)
    mark_as_advanced(FORCE WEB_CONTENT_TESTS)
    mark_as_advanced(FORCE PY_COVERAGE_REPORT)
    mark_as_advanced(FORCE TESTING_PORT)
endif()

# We will need the Python interpreter to build the package and run the tests.
find_package(PythonInterp 2.7 REQUIRED)

# Create a binary directory to hold various timestamps.
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/stamps)

# These files should be validated with JSLint.
set(JS_LINT_FILES
    ${CMAKE_SOURCE_DIR}/src/js/core/core.js
    ${CMAKE_SOURCE_DIR}/src/js/core/util.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/controlPanel.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/GoogleMapSVG.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/svgColorLegend.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/dendrogram.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/geodots.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/geonodelink.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/mapdots.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/nodelink.js
    ${CMAKE_SOURCE_DIR}/src/js/stream/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/stream/stream.js
    ${CMAKE_SOURCE_DIR}/src/js/vtkweb/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/vtkweb/vtkweb.js
    ${CMAKE_SOURCE_DIR}/src/js/widget/widget.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/index.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/landingPage.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/app-template/myapp.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/charitynet/charitynet.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/enron/enron.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/flickr/flickr.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/ner/ner.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/primes/primes.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/vegabuilder/vegabuilder.js
)

# These files should be uglified and concatenated.
set(JS_UGLIFY_FILES
    ${CMAKE_SOURCE_DIR}/src/js/core/core.js
    ${CMAKE_SOURCE_DIR}/src/js/core/util.js<commit_msg>Adding more complete list of JS style testing files<commit_after>cmake_minimum_required(VERSION 2.8)

# This project doesn't require any of the standard compilers, hence the "NONE"
# argument.
project(Tangelo NONE)
set(TANGELO_VERSION 0.5-dev1)

mark_as_advanced(CMAKE_INSTALL_PREFIX)

# Extend cmake module path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Include utility functions.
include(tangelo)

# Cache variables.
#
# Whether to build Tangelo at all, and then if yes, whether to build the Python
# package.
#
# This option is marked as advanced, as it only applies in a particular set of
# circumstances that apply mainly to Tangelo developers.
set(BUILD_TANGELO ON CACHE BOOL "Build Tangelo")
mark_as_advanced(BUILD_TANGELO)
if(${BUILD_TANGELO})
    set(BUILD_TANGELO_PYTHON_PACKAGE ON CACHE BOOL "Generate a Python package for Tangelo")
    mark_as_advanced(CLEAR BUILD_TANGELO_PYTHON_PACKAGE)
    mark_as_advanced(CLEAR UglifyJS_EXECUTABLE)
else()
    mark_as_advanced(FORCE BUILD_TANGELO_PYTHON_PACKAGE)
    mark_as_advanced(FORCE UglifyJS_EXECUTABLE)
endif()

# Whether to build Sphinx documentation.
set(BUILD_DOCUMENTATION OFF CACHE BOOL "Generate documentation for project.")
if(${BUILD_DOCUMENTATION})
    mark_as_advanced(CLEAR Sphinx_EXECUTABLE)
else()
    mark_as_advanced(FORCE Sphinx_EXECUTABLE)
endif()

# Show/hide testing options depending on whether testing is enabled.
if(${BUILD_TESTING})
    set(JS_STYLE_TESTS ON CACHE BOOL "Generate style tests for JS source files (via JSLint).")
    mark_as_advanced(CLEAR JS_STYLE_TESTS)
    if(${JS_STYLE_TESTS})
        mark_as_advanced(CLEAR JSLint_EXECUTABLE)
    else()
        mark_as_advanced(FORCE JSLint_EXECUTABLE)
    endif()

    set(PY_STYLE_TESTS ON CACHE BOOL "Generate style tests for Python source files (via pep8).")
    mark_as_advanced(CLEAR PY_STYLE_TESTS)
    if(${PY_STYLE_TESTS})
        mark_as_advanced(CLEAR Pep8_EXECUTABLE)
    else()
        mark_as_advanced(FORCE Pep8_EXECUTABLE)
    endif()

    set(JS_UNIT_TESTS ON CACHE BOOL "Generate tangelo.js unit tests.")
    mark_as_advanced(CLEAR JS_UNIT_TESTS)

    set(PY_UNIT_TESTS ON CACHE BOOL "Generate tangelo Python module unit tests.")
    mark_as_advanced(CLEAR PY_STYLE_TESTS)

    set(WEB_CONTENT_TESTS ON CACHE BOOL "Generate tests for example web appplications.")
    mark_as_advanced(CLEAR WEB_CONTENT_TESTS)

    set(PY_COVERAGE_REPORT ON CACHE BOOL "Generate Python coverage report.")
    mark_as_advanced(CLEAR PY_COVERAGE_REPORT)

    set(TESTING_HOST localhost CACHE STRING "The host to run Tangelo on for the test suite.")
    mark_as_advanced(TESTING_HOST)

    set(TESTING_PORT 50047 CACHE STRING "The port number to run Tangelo for the test suite.")
    mark_as_advanced(CLEAR TESTING_PORT)

    if(${JS_UNIT_TESTS} OR ${WEB_CONTENT_TESTS})
        mark_as_advanced(CLEAR PhantomJS_EXECUTABLE)
    else()
        mark_as_advanced(FORCE PhantomJS_EXECUTABLE)
    endif()
else()
    mark_as_advanced(FORCE JS_STYLE_TESTS)
    mark_as_advanced(FORCE JSLint_EXECUTABLE)
    mark_as_advanced(FORCE PY_STYLE_TESTS)
    mark_as_advanced(FORCE Pep8_EXECUTABLE)
    mark_as_advanced(FORCE JS_UNIT_TESTS)
    mark_as_advanced(FORCE PhantomJS_EXECUTABLE)
    mark_as_advanced(FORCE PY_UNIT_TESTS)
    mark_as_advanced(FORCE WEB_CONTENT_TESTS)
    mark_as_advanced(FORCE PY_COVERAGE_REPORT)
    mark_as_advanced(FORCE TESTING_PORT)
endif()

# We will need the Python interpreter to build the package and run the tests.
find_package(PythonInterp 2.7 REQUIRED)

# Create a binary directory to hold various timestamps.
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/stamps)

# These files should be validated with JSLint.
set(JS_LINT_FILES
    ${CMAKE_SOURCE_DIR}/src/js/core/core.js
    ${CMAKE_SOURCE_DIR}/src/js/core/util.js
    ${CMAKE_SOURCE_DIR}/src/js/data/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/data/tree.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/GoogleMapSVG.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/controlPanel.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/dendrogram.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/geodots.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/geonodelink.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/mapdots.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/nodelink.js
    ${CMAKE_SOURCE_DIR}/src/js/plugin/svgColorLegend.js
    ${CMAKE_SOURCE_DIR}/src/js/stream/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/stream/stream.js
    ${CMAKE_SOURCE_DIR}/src/js/vega/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/vega/geovis.js
    ${CMAKE_SOURCE_DIR}/src/js/vtkweb/_package.js
    ${CMAKE_SOURCE_DIR}/src/js/vtkweb/vtkweb.js
    ${CMAKE_SOURCE_DIR}/src/js/widget/widget.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/index.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/landingPage.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/app-template/myapp.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/charitynet/charitynet.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/dendrogram/dendrogram.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/enron/enron.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/flickr/flickr.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/geodots/geodots.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/geonodelink/geonodelink.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/mapdots/mapdots.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/ner/md5.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/ner/ner.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/primes/primes.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/vegabuilder/vegabuilder.js
    ${CMAKE_SOURCE_DIR}/tangelo/web/examples/vtkweb/index.js
    ${CMAKE_SOURCE_DIR}/testing/js-unit-tests/isBoolean.js
    ${CMAKE_SOURCE_DIR}/testing/js-unit-tests/isFunction.js
    ${CMAKE_SOURCE_DIR}/testing/js-unit-tests/tangelo-exists.js
    ${CMAKE_SOURCE_DIR}/testing/js/blanket.min.js
    ${CMAKE_SOURCE_DIR}/testing/js/jasmine-blanket.js
    ${CMAKE_SOURCE_DIR}/testing/phantomjs/blanket-test.js
    ${CMAKE_SOURCE_DIR}/testing/phantomjs/run-jasmine.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/200-ok.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/404-not-found.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/echo-service-no-args.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/echo-service.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/geodots-match.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/ner-service.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/rest-get.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/rest-implicit-get.js
    ${CMAKE_SOURCE_DIR}/testing/web-content-tests/rest-post.js
)

# These files should be uglified and concatenated.
set(JS_UGLIFY_FILES
    ${CMAKE_SOURCE_DIR}/src/js/core/core.js
    ${CMAKE_SOURCE_DIR}/src/js/core/util.js
{'fraction_non_alphanumeric': 0.09863659316613364, 'fraction_numerical': 0.0032822757111597373, 'mean_word_length': 4.816446402349486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3570664', 'n_tokens_mistral': 4655, 'n_tokens_neox': 4345, 'n_words': 729}