<commit_before>cmake_minimum_required(VERSION 2.8.10)

project(shiny-server)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

if ("$ENV{BUILD_NUMBER}" STREQUAL "")
  set(BUILD_NUMBER "0")
else()
  set(BUILD_NUMBER $ENV{BUILD_NUMBER})
endif()

# Extract the shiny-server version number from package.json
execute_process(COMMAND sed -n "s/\\s*\"version\": \"\\(.*\\)\",\\s*/\\1/p"
                INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package.json"
                OUTPUT_VARIABLE NPM_PACKAGE_VERSION
                OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse major, minor, and patch values from NPM_PACKAGE_VERSION
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\1" CPACK_PACKAGE_VERSION_MAJOR ${NPM_PACKAGE_VERSION})
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\2" CPACK_PACKAGE_VERSION_MINOR ${NPM_PACKAGE_VERSION})
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\3" CPACK_PACKAGE_VERSION_PATCH ${NPM_PACKAGE_VERSION})

set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${BUILD_NUMBER}")

execute_process(COMMAND git describe --tags --dirty
                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/GIT_VERSION")
execute_process(COMMAND echo "${CPACK_PACKAGE_VERSION}"
                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/VERSION")

add_subdirectory(src)
add_subdirectory(external/node)

install(DIRECTORY assets
                  samples
                  bin
                  build
                  config
                  ext
                  lib
                  manual.test
                  node_modules
                  R
                  templates
                  test
                  tools
        USE_SOURCE_PERMISSIONS DESTINATION shiny-server)

install(FILES binding.gyp
              config.html
              COPYING
              NEWS
              package.json
              README.md
              "${CMAKE_CURRENT_BINARY_DIR}/VERSION"
              "${CMAKE_CURRENT_BINARY_DIR}/GIT_VERSION"
        DESTINATION shiny-server)

set(CPACK_PACKAGE_NAME "shiny-server")
set(CPACK_PACKAGE_DESCRIPTION "Shiny Server")
set(CPACK_PACKAGE_VENDOR "RStudio, Inc.")<commit_msg>Install NOTICE file.<commit_after>cmake_minimum_required(VERSION 2.8.10)

project(shiny-server)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

if ("$ENV{BUILD_NUMBER}" STREQUAL "")
  set(BUILD_NUMBER "0")
else()
  set(BUILD_NUMBER $ENV{BUILD_NUMBER})
endif()

# Extract the shiny-server version number from package.json
execute_process(COMMAND sed -n "s/\\s*\"version\": \"\\(.*\\)\",\\s*/\\1/p"
                INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package.json"
                OUTPUT_VARIABLE NPM_PACKAGE_VERSION
                OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse major, minor, and patch values from NPM_PACKAGE_VERSION
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\1" CPACK_PACKAGE_VERSION_MAJOR ${NPM_PACKAGE_VERSION})
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\2" CPACK_PACKAGE_VERSION_MINOR ${NPM_PACKAGE_VERSION})
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)"
       "\\3" CPACK_PACKAGE_VERSION_PATCH ${NPM_PACKAGE_VERSION})

set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${BUILD_NUMBER}")

execute_process(COMMAND git describe --tags --dirty
                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/GIT_VERSION")
execute_process(COMMAND echo "${CPACK_PACKAGE_VERSION}"
                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/VERSION")

add_subdirectory(src)
add_subdirectory(external/node)

install(DIRECTORY assets
                  samples
                  bin
                  build
                  config
                  ext
                  lib
                  manual.test
                  node_modules
                  R
                  templates
                  test
                  tools
        USE_SOURCE_PERMISSIONS DESTINATION shiny-server)

# Render and rename NOTICE.md
execute_process(COMMAND cat 
                INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/NOTICE.md
                OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/NOTICE)

install(FILES binding.gyp
              config.html
              COPYING
              NEWS
              package.json
              README.md
              "${CMAKE_CURRENT_BINARY_DIR}/NOTICE"
              "${CMAKE_CURRENT_BINARY_DIR}/VERSION"
              "${CMAKE_CURRENT_BINARY_DIR}/GIT_VERSION"
        DESTINATION shiny-server)

set(CPACK_PACKAGE_NAME "shiny-server")
set(CPACK_PACKAGE_DESCRIPTION "Shiny Server")
set(CPACK_PACKAGE_VENDOR "RStudio, Inc.")
{'fraction_non_alphanumeric': 0.11991177060356928, 'fraction_numerical': 0.010828153198315621, 'mean_word_length': 2.5250883392226147, 'pattern_counts': {'":': 2, '<': 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': '6148805', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1575, 'n_words': 238}