43 changed files with 1203 additions and 174 deletions
-
4.gitignore
-
296.travis.yml
-
1CHANGELOG.md
-
18README.md
-
2resources/3rdparty/CMakeLists.txt
-
4resources/3rdparty/carl/CMakeLists.txt
-
1src/CMakeLists.txt
-
40src/storm-cli-utilities/CMakeLists.txt
-
32src/storm-cli-utilities/cli.cpp
-
0src/storm-cli-utilities/cli.h
-
2src/storm-dft-cli/CMakeLists.txt
-
4src/storm-dft-cli/storm-dyftee.cpp
-
2src/storm-dft/modelchecker/dft/DFTModelChecker.cpp
-
8src/storm-dft/storage/dft/OrderDFTElementsById.cpp
-
2src/storm-gspn-cli/CMakeLists.txt
-
4src/storm-gspn-cli/storm-gspn.cpp
-
43src/storm-pars-cli/storm-pars.cpp
-
13src/storm-pars/transformer/SparseParametricModelSimplifier.cpp
-
2src/storm-pgcl-cli/CMakeLists.txt
-
2src/storm-pgcl-cli/storm-pgcl.cpp
-
2src/storm/CMakeLists.txt
-
26src/storm/adapters/Smt2ExpressionAdapter.h
-
2src/storm/analysis/GraphConditions.h
-
29src/storm/api/builder.h
-
8src/storm/builder/BuilderOptions.cpp
-
59src/storm/builder/BuilderOptions.h
-
27src/storm/solver/SmtlibSmtSolver.cpp
-
8src/storm/solver/SmtlibSmtSolver.h
-
4src/storm/storage/expressions/Variable.h
-
2src/storm/storm.cpp
-
164travis/build-helper.sh
-
71travis/build.sh
-
16travis/dockerfiles/Dockerfile.debian-9
-
8travis/dockerfiles/Dockerfile.storm
-
17travis/dockerfiles/Dockerfile.ubuntu-16.10
-
9travis/dockerfiles/build_carl.sh
-
9travis/dockerfiles/build_docker.sh
-
9travis/dockerfiles/build_storm.sh
-
123travis/generate_travis.py
-
11travis/install_linux.sh
-
73travis/install_osx.sh
-
4travis/mtime_cache/globs.txt
-
178travis/mtime_cache/mtime_cache.rb
@ -0,0 +1,296 @@ |
|||||
|
# This file was inspired from https://github.com/google/fruit |
||||
|
|
||||
|
# |
||||
|
# General config |
||||
|
# |
||||
|
branches: |
||||
|
only: |
||||
|
- master |
||||
|
- stable |
||||
|
dist: trusty |
||||
|
language: cpp |
||||
|
|
||||
|
# Enable caching |
||||
|
cache: |
||||
|
timeout: 1000 |
||||
|
directories: |
||||
|
- build |
||||
|
- travis/mtime_cache |
||||
|
|
||||
|
# Enable docker support |
||||
|
services: |
||||
|
- docker |
||||
|
sudo: required |
||||
|
|
||||
|
notifications: |
||||
|
email: |
||||
|
on_failure: always |
||||
|
on_success: change |
||||
|
recipients: |
||||
|
secure: "Q9CW/PtyWkZwExDrfFFb9n1STGYsRfI6awv1bZHcGwfrDvhpXoMCuF8CwviIfilm7fFJJEoKizTtdRpY0HrOnY/8KY111xrtcFYosxdndv7xbESodIxQOUoIEFCO0mCNHwWYisoi3dAA7H3Yn661EsxluwHjzX5vY0xSbw0n229hlsFz092HwGLSU33zHl7eXpQk+BOFmBTRGlOq9obtDZ17zbHz1oXFZntHK/JDUIYP0b0uq8NvE2jM6CIVdcuSwmIkOhZJoO2L3Py3rBbPci+L2PSK4Smv2UjCPF8KusnOaFIyDB3LcNM9Jqq5ssJMrK/KaO6BiuYrOZXYWZ7KEg3Y/naC8HjOH1dzty+P7oW46sb9F03pTsufqD4R7wcK+9wROTztO6aJPDG/IPH7EWgrBTxqlOkVRwi2eYuQouZpZUW6EMClKbMHMIxCH2S8aOk/r1w2cNwmPEcunnP0nl413x/ByHr4fTPFykPj8pQxIsllYjpdWBRQfDOauKWGzk6LcrFW0qpWP+/aJ2vYu/IoZQMG5lMHbp6Y1Lg09pYm7Q983v3b7D+JvXhOXMyGq91HyPahA2wwKoG1GA4uoZ2I95/IFYNiKkelDd3WTBoFLNF9YFoEJNdCywm1fO2WY4WkyEFBuQcgDA+YpFMJJMxjTbivYk9jvHk2gji//2w=" |
||||
|
|
||||
|
# |
||||
|
# Configurations |
||||
|
# |
||||
|
jobs: |
||||
|
include: |
||||
|
|
||||
|
### |
||||
|
# Stage: Build (1st run) |
||||
|
### |
||||
|
|
||||
|
# osx |
||||
|
- stage: Build (1st run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- rm -rf build |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build1 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (1st run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- rm -rf build |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build1 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
# ubuntu-16.10 |
||||
|
- stage: Build (1st run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- rm -rf build |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build1 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (1st run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- rm -rf build |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build1 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
|
||||
|
### |
||||
|
# Stage: Build (2nd run) |
||||
|
### |
||||
|
|
||||
|
# osx |
||||
|
- stage: Build (2nd run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build2 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (2nd run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build2 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
# ubuntu-16.10 |
||||
|
- stage: Build (2nd run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build2 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (2nd run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build2 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
|
||||
|
### |
||||
|
# Stage: Build (3rd run) |
||||
|
### |
||||
|
|
||||
|
# osx |
||||
|
- stage: Build (3rd run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build3 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (3rd run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build3 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
# ubuntu-16.10 |
||||
|
- stage: Build (3rd run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build3 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (3rd run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build3 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
|
||||
|
### |
||||
|
# Stage: Build (4th run) |
||||
|
### |
||||
|
|
||||
|
# osx |
||||
|
- stage: Build (4th run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build4 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (4th run) |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh Build4 |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
# ubuntu-16.10 |
||||
|
- stage: Build (4th run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build4 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Build (4th run) |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh Build4 |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
|
||||
|
### |
||||
|
# Stage: Test all |
||||
|
### |
||||
|
|
||||
|
# osx |
||||
|
- stage: Test all |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh TestAll |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Test all |
||||
|
os: osx |
||||
|
compiler: clang |
||||
|
env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ |
||||
|
install: |
||||
|
- travis/install_osx.sh |
||||
|
script: |
||||
|
- travis/build.sh TestAll |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
# ubuntu-16.10 |
||||
|
- stage: Test all |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh TestAll |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
- stage: Test all |
||||
|
os: linux |
||||
|
compiler: gcc |
||||
|
env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 |
||||
|
install: |
||||
|
- travis/install_linux.sh |
||||
|
script: |
||||
|
- travis/build.sh TestAll |
||||
|
before_cache: |
||||
|
- docker cp storm:/storm/. . |
||||
|
after_failure: |
||||
|
- find build -iname '*err*.log' -type f -print -exec cat {} \; |
||||
|
|
@ -0,0 +1,40 @@ |
|||||
|
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-cli-utilities/*.h ${PROJECT_SOURCE_DIR}/src/storm-cli-utilities/*.cpp) |
||||
|
|
||||
|
register_source_groups_from_filestructure("${ALL_FILES}" storm-cli-utilities) |
||||
|
|
||||
|
|
||||
|
|
||||
|
file(GLOB_RECURSE STORM_CLI_UTIL_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-cli-utilities/*.cpp) |
||||
|
file(GLOB_RECURSE STORM_CLI_UTIL_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-cli-utilities/*.h) |
||||
|
|
||||
|
|
||||
|
# Create storm-pars. |
||||
|
add_library(storm-cli-utilities SHARED ${STORM_CLI_UTIL_SOURCES} ${STORM_CLI_UTIL_HEADERS}) |
||||
|
|
||||
|
# Remove define symbol for shared libstorm. |
||||
|
set_target_properties(storm-cli-utilities PROPERTIES DEFINE_SYMBOL "") |
||||
|
#add_dependencies(storm resources) |
||||
|
list(APPEND STORM_TARGETS storm-cli-utilities) |
||||
|
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) |
||||
|
|
||||
|
target_link_libraries(storm-cli-utilities PUBLIC storm) |
||||
|
|
||||
|
# Install storm headers to include directory. |
||||
|
foreach(HEADER ${STORM_CLI_UTIL_HEADERS}) |
||||
|
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER}) |
||||
|
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH}) |
||||
|
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH}) |
||||
|
add_custom_command( |
||||
|
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY} |
||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME} |
||||
|
DEPENDS ${HEADER} |
||||
|
) |
||||
|
list(APPEND STORM_CLI_UTIL_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}") |
||||
|
endforeach() |
||||
|
add_custom_target(copy_storm_cli_util_headers DEPENDS ${STORM_CLI_UTIL_OUTPUT_HEADERS} ${STORM_CLI_UTIL_HEADERS}) |
||||
|
add_dependencies(storm-cli-utilities copy_storm_pars_headers) |
||||
|
|
||||
|
# installation |
||||
|
install(TARGETS storm-cli-utilities RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL) |
||||
|
|
@ -1,5 +1,5 @@ |
|||||
add_executable(storm-pgcl-cli ${PROJECT_SOURCE_DIR}/src/storm-pgcl-cli/storm-pgcl.cpp) |
add_executable(storm-pgcl-cli ${PROJECT_SOURCE_DIR}/src/storm-pgcl-cli/storm-pgcl.cpp) |
||||
target_link_libraries(storm-pgcl-cli storm-pgcl) |
|
||||
|
target_link_libraries(storm-pgcl-cli storm-pgcl storm-cli-utilities) |
||||
set_target_properties(storm-pgcl-cli PROPERTIES OUTPUT_NAME "storm-pgcl") |
set_target_properties(storm-pgcl-cli PROPERTIES OUTPUT_NAME "storm-pgcl") |
||||
|
|
||||
# installation |
# installation |
@ -0,0 +1,164 @@ |
|||||
|
#!/bin/bash |
||||
|
# Inspired by https://github.com/google/fruit |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
# Helper for travis folding |
||||
|
travis_fold() { |
||||
|
local action=$1 |
||||
|
local name=$2 |
||||
|
echo -en "travis_fold:${action}:${name}\r" |
||||
|
} |
||||
|
|
||||
|
# Helper for distinguishing between different runs |
||||
|
run() { |
||||
|
case "$1" in |
||||
|
Build1 | Build2 | Build3 | Build4) |
||||
|
if [[ "$1" == "Build1" ]] |
||||
|
then |
||||
|
# CMake |
||||
|
travis_fold start cmake |
||||
|
mkdir build |
||||
|
cd build |
||||
|
cmake .. "${CMAKE_ARGS[@]}" |
||||
|
echo |
||||
|
if [ -f "CMakeFiles/CMakeError.log" ] |
||||
|
then |
||||
|
echo "Content of CMakeFiles/CMakeError.log:" |
||||
|
cat CMakeFiles/CMakeError.log |
||||
|
fi |
||||
|
echo |
||||
|
cd .. |
||||
|
travis_fold end cmake |
||||
|
fi |
||||
|
|
||||
|
# Make |
||||
|
travis_fold start make |
||||
|
cd build |
||||
|
make -j$N_JOBS |
||||
|
travis_fold end make |
||||
|
# Set skip-file |
||||
|
if [[ "$1" != "Build4" ]] |
||||
|
then |
||||
|
touch skip.txt |
||||
|
else |
||||
|
rm -rf skip.txt |
||||
|
fi |
||||
|
;; |
||||
|
|
||||
|
TestAll) |
||||
|
# Test all |
||||
|
travis_fold start test_all |
||||
|
cd build |
||||
|
ctest test --output-on-failure |
||||
|
travis_fold end test_all |
||||
|
;; |
||||
|
|
||||
|
*) |
||||
|
echo "Unrecognized value of run: $1" |
||||
|
exit 1 |
||||
|
esac |
||||
|
} |
||||
|
|
||||
|
|
||||
|
# This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's |
||||
|
# ignored). |
||||
|
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" |
||||
|
|
||||
|
case $COMPILER in |
||||
|
gcc-4.8) |
||||
|
export CC=gcc-4.8 |
||||
|
export CXX=g++-4.8 |
||||
|
;; |
||||
|
|
||||
|
gcc-4.9) |
||||
|
export CC=gcc-4.9 |
||||
|
export CXX=g++-4.9 |
||||
|
;; |
||||
|
|
||||
|
gcc-5) |
||||
|
export CC=gcc-5 |
||||
|
export CXX=g++-5 |
||||
|
;; |
||||
|
|
||||
|
gcc-6) |
||||
|
export CC=gcc-6 |
||||
|
export CXX=g++-6 |
||||
|
;; |
||||
|
|
||||
|
gcc-default) |
||||
|
export CC=gcc |
||||
|
export CXX=g++ |
||||
|
;; |
||||
|
|
||||
|
clang-3.5) |
||||
|
export CC=clang-3.5 |
||||
|
export CXX=clang++-3.5 |
||||
|
;; |
||||
|
|
||||
|
clang-3.6) |
||||
|
export CC=clang-3.6 |
||||
|
export CXX=clang++-3.6 |
||||
|
;; |
||||
|
|
||||
|
clang-3.7) |
||||
|
export CC=clang-3.7 |
||||
|
export CXX=clang++-3.7 |
||||
|
;; |
||||
|
|
||||
|
clang-3.8) |
||||
|
export CC=clang-3.8 |
||||
|
export CXX=clang++-3.8 |
||||
|
;; |
||||
|
|
||||
|
clang-3.9) |
||||
|
export CC=clang-3.9 |
||||
|
export CXX=clang++-3.9 |
||||
|
;; |
||||
|
|
||||
|
clang-4.0) |
||||
|
case "$OS" in |
||||
|
linux) |
||||
|
export CC=clang-4.0 |
||||
|
export CXX=clang++-4.0 |
||||
|
;; |
||||
|
osx) |
||||
|
export CC=/usr/local/opt/llvm/bin/clang-4.0 |
||||
|
export CXX=/usr/local/opt/llvm/bin/clang++ |
||||
|
;; |
||||
|
*) echo "Error: unexpected OS: $OS"; exit 1 ;; |
||||
|
esac |
||||
|
;; |
||||
|
|
||||
|
clang-default) |
||||
|
export CC=clang |
||||
|
export CXX=clang++ |
||||
|
;; |
||||
|
|
||||
|
*) |
||||
|
echo "Unrecognized value of COMPILER: $COMPILER" |
||||
|
exit 1 |
||||
|
esac |
||||
|
|
||||
|
# Build |
||||
|
echo CXX version: $($CXX --version) |
||||
|
echo C++ Standard library location: $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1) |
||||
|
echo Normalized C++ Standard library location: $(readlink -f $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)) |
||||
|
|
||||
|
case "$CONFIG" in |
||||
|
DefaultDebug) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;; |
||||
|
DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;; |
||||
|
*) echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;; |
||||
|
esac |
||||
|
|
||||
|
# Restore timestamps of files |
||||
|
travis_fold start mtime |
||||
|
if [[ "$1" == "Build1" ]] |
||||
|
then |
||||
|
# Remove old mtime cache |
||||
|
rm -rf travis/mtime_cache/cache.json |
||||
|
fi |
||||
|
ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json |
||||
|
travis_fold end mtime |
||||
|
|
||||
|
run "$1" |
@ -0,0 +1,71 @@ |
|||||
|
#!/bin/bash -x |
||||
|
# Inspired by https://github.com/google/fruit |
||||
|
|
||||
|
N_JOBS=2 |
||||
|
TIMEOUT_MAC=1600 |
||||
|
TIMEOUT_LINUX=2300 |
||||
|
|
||||
|
OS=$TRAVIS_OS_NAME |
||||
|
|
||||
|
EXITCODE=42 |
||||
|
|
||||
|
# Skip this run? |
||||
|
if [ -f build/skip.txt ] |
||||
|
then |
||||
|
# Remove flag s.t. tests will be executed |
||||
|
if [[ "$1" == "Build4" ]] |
||||
|
then |
||||
|
rm build/skip.txt |
||||
|
fi |
||||
|
exit 0 |
||||
|
fi |
||||
|
|
||||
|
case $OS in |
||||
|
linux) |
||||
|
# Execute docker image on Linux |
||||
|
# Stop previous session |
||||
|
docker rm -f storm &>/dev/null |
||||
|
# Run container |
||||
|
set -e |
||||
|
docker run -d -it --name storm --privileged mvolk/storm-basesystem:$LINUX |
||||
|
# Copy local content into container |
||||
|
docker exec storm mkdir storm |
||||
|
docker cp . storm:/storm |
||||
|
set +e |
||||
|
|
||||
|
# Execute main process |
||||
|
timeout $TIMEOUT_LINUX docker exec storm bash -c " |
||||
|
export CONFIG=$CONFIG; |
||||
|
export COMPILER=$COMPILER; |
||||
|
export N_JOBS=$N_JOBS; |
||||
|
export STLARG=; |
||||
|
export OS=$OS; |
||||
|
cd storm; |
||||
|
travis/build-helper.sh $1" |
||||
|
EXITCODE=$? |
||||
|
;; |
||||
|
|
||||
|
osx) |
||||
|
# Mac OSX |
||||
|
STLARG="-stdlib=libc++" |
||||
|
export CONFIG=$CONFIG |
||||
|
export COMPILER |
||||
|
export N_JOBS |
||||
|
export STLARG |
||||
|
export OS |
||||
|
gtimeout $TIMEOUT_MAC travis/build-helper.sh "$1" |
||||
|
EXITCODE=$? |
||||
|
;; |
||||
|
|
||||
|
*) |
||||
|
# Unknown OS |
||||
|
echo "Unsupported OS: $OS" |
||||
|
exit 1 |
||||
|
esac |
||||
|
|
||||
|
if [[ $EXITCODE == 124 ]] && [[ "$1" == Build* ]] && [[ "$1" != "Build4" ]] |
||||
|
then |
||||
|
exit 0 |
||||
|
else |
||||
|
exit $EXITCODE |
||||
|
fi |
@ -0,0 +1,16 @@ |
|||||
|
FROM debian:9 |
||||
|
MAINTAINER Matthias Volk <matthias.volk@cs.rwth-aachen.de> |
||||
|
|
||||
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends \ |
||||
|
build-essential \ |
||||
|
ruby \ |
||||
|
git \ |
||||
|
cmake \ |
||||
|
libboost-all-dev \ |
||||
|
libcln-dev \ |
||||
|
libeigen3-dev \ |
||||
|
libgmp-dev \ |
||||
|
libginac-dev \ |
||||
|
automake \ |
||||
|
libglpk-dev \ |
||||
|
libz3-dev |
@ -0,0 +1,8 @@ |
|||||
|
FROM mvolk/storm-basesystem:ubuntu-16.10 |
||||
|
MAINTAINER Matthias Volk <matthias.volk@cs.rwth-aachen.de> |
||||
|
|
||||
|
COPY build_carl.sh /opt |
||||
|
RUN cd opt && ./build_carl.sh |
||||
|
|
||||
|
COPY build_storm.sh /opt |
||||
|
RUN cd opt && ./build_storm.sh |
@ -0,0 +1,17 @@ |
|||||
|
FROM ubuntu:16.10 |
||||
|
MAINTAINER Matthias Volk <matthias.volk@cs.rwth-aachen.de> |
||||
|
|
||||
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends \ |
||||
|
build-essential \ |
||||
|
ruby \ |
||||
|
git \ |
||||
|
cmake \ |
||||
|
libboost-all-dev \ |
||||
|
libcln-dev \ |
||||
|
libeigen3-dev \ |
||||
|
libgmp-dev \ |
||||
|
libginac-dev \ |
||||
|
automake \ |
||||
|
libglpk-dev \ |
||||
|
libhwloc-dev \ |
||||
|
libz3-dev |
@ -0,0 +1,9 @@ |
|||||
|
#!/bin/bash |
||||
|
echo "Building Carl..." |
||||
|
git clone https://github.com/smtrat/carl.git |
||||
|
cd carl |
||||
|
mkdir build |
||||
|
cd build |
||||
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON |
||||
|
make lib_carl -j2 |
||||
|
echo "Building Carl finished" |
@ -0,0 +1,9 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# Build Ubuntu 16.10 "Yakkety Yak" |
||||
|
docker build -t mvolk/storm-basesystem:ubuntu-16.10 -f Dockerfile.ubuntu-16.10 . |
||||
|
docker push mvolk/storm-basesystem:ubuntu-16.10 |
||||
|
|
||||
|
# Build Debian 9 "Stretch" |
||||
|
docker build -t mvolk/storm-basesystem:debian-9 -f Dockerfile.debian-9 . |
||||
|
docker push mvolk/storm-basesystem:debian-9 |
@ -0,0 +1,9 @@ |
|||||
|
#!/bin/bash |
||||
|
echo "Building Storm..." |
||||
|
git clone https://github.com/moves-rwth/storm.git |
||||
|
cd storm |
||||
|
mkdir build |
||||
|
cd build |
||||
|
cmake .. -DCMAKE_BUILD_TYPE=Release |
||||
|
make storm storm-dft storm-pars -j1 |
||||
|
echo "Building Storm finished" |
@ -0,0 +1,123 @@ |
|||||
|
|
||||
|
# Configuration for Linux |
||||
|
configs_linux = [ |
||||
|
# OS, compiler |
||||
|
("ubuntu-16.10", "gcc", "-6"), |
||||
|
#("debian-9", "gcc", "-6"), |
||||
|
] |
||||
|
|
||||
|
# Configurations for Mac |
||||
|
configs_mac = [ |
||||
|
# OS, compiler |
||||
|
("osx", "clang", "-4.0"), |
||||
|
] |
||||
|
|
||||
|
# Build types |
||||
|
build_types = [ |
||||
|
"DefaultDebug", |
||||
|
"DefaultRelease", |
||||
|
] |
||||
|
|
||||
|
# Stages in travis |
||||
|
stages = [ |
||||
|
("Build (1st run)", "Build1"), |
||||
|
("Build (2nd run)", "Build2"), |
||||
|
("Build (3rd run)", "Build3"), |
||||
|
("Build (4th run)", "Build4"), |
||||
|
("Test all", "TestAll"), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
if __name__ == "__main__": |
||||
|
s = "" |
||||
|
# Initial config |
||||
|
s += "# This file was inspired from https://github.com/google/fruit\n" |
||||
|
s += "\n" |
||||
|
s += "#\n" |
||||
|
s += "# General config\n" |
||||
|
s += "#\n" |
||||
|
s += "branches:\n" |
||||
|
s += " only:\n" |
||||
|
s += " - master\n" |
||||
|
s += " - stable\n" |
||||
|
s += "dist: trusty\n" |
||||
|
s += "language: cpp\n" |
||||
|
s += "\n" |
||||
|
s += "# Enable caching\n" |
||||
|
s += "cache:\n" |
||||
|
s += " timeout: 1000\n" |
||||
|
s += " directories:\n" |
||||
|
s += " - build\n" |
||||
|
s += " - travis/mtime_cache\n" |
||||
|
s += "\n" |
||||
|
s += "# Enable docker support\n" |
||||
|
s += "services:\n" |
||||
|
s += "- docker\n" |
||||
|
s += "sudo: required\n" |
||||
|
s += "\n" |
||||
|
|
||||
|
s += "notifications:\n" |
||||
|
s += " email:\n" |
||||
|
s += " on_failure: always\n" |
||||
|
s += " on_success: change\n" |
||||
|
s += " recipients:\n" |
||||
|
s += ' secure: "Q9CW/PtyWkZwExDrfFFb9n1STGYsRfI6awv1bZHcGwfrDvhpXoMCuF8CwviIfilm7fFJJEoKizTtdRpY0HrOnY/8KY111xrtcFYosxdndv7xbESodIxQOUoIEFCO0mCNHwWYisoi3dAA7H3Yn661EsxluwHjzX5vY0xSbw0n229hlsFz092HwGLSU33zHl7eXpQk+BOFmBTRGlOq9obtDZ17zbHz1oXFZntHK/JDUIYP0b0uq8NvE2jM6CIVdcuSwmIkOhZJoO2L3Py3rBbPci+L2PSK4Smv2UjCPF8KusnOaFIyDB3LcNM9Jqq5ssJMrK/KaO6BiuYrOZXYWZ7KEg3Y/naC8HjOH1dzty+P7oW46sb9F03pTsufqD4R7wcK+9wROTztO6aJPDG/IPH7EWgrBTxqlOkVRwi2eYuQouZpZUW6EMClKbMHMIxCH2S8aOk/r1w2cNwmPEcunnP0nl413x/ByHr4fTPFykPj8pQxIsllYjpdWBRQfDOauKWGzk6LcrFW0qpWP+/aJ2vYu/IoZQMG5lMHbp6Y1Lg09pYm7Q983v3b7D+JvXhOXMyGq91HyPahA2wwKoG1GA4uoZ2I95/IFYNiKkelDd3WTBoFLNF9YFoEJNdCywm1fO2WY4WkyEFBuQcgDA+YpFMJJMxjTbivYk9jvHk2gji//2w="\n' |
||||
|
s += "\n" |
||||
|
s += "#\n" |
||||
|
s += "# Configurations\n" |
||||
|
s += "#\n" |
||||
|
s += "jobs:\n" |
||||
|
s += " include:\n" |
||||
|
|
||||
|
# Generate all configurations |
||||
|
for stage in stages: |
||||
|
s += "\n" |
||||
|
s += " ###\n" |
||||
|
s += " # Stage: {}\n".format(stage[0]) |
||||
|
s += " ###\n" |
||||
|
s += "\n" |
||||
|
# Mac OS X |
||||
|
for config in configs_mac: |
||||
|
osx = config[0] |
||||
|
compiler = "{}{}".format(config[1], config[2]) |
||||
|
s += " # {}\n".format(osx) |
||||
|
buildConfig = "" |
||||
|
for build in build_types: |
||||
|
buildConfig += " - stage: {}\n".format(stage[0]) |
||||
|
buildConfig += " os: osx\n" |
||||
|
buildConfig += " compiler: {}\n".format(config[1]) |
||||
|
buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler) |
||||
|
buildConfig += " install:\n" |
||||
|
if stage[1] == "Build1": |
||||
|
buildConfig += " - rm -rf build\n" |
||||
|
buildConfig += " - travis/install_osx.sh\n" |
||||
|
buildConfig += " script:\n" |
||||
|
buildConfig += " - travis/build.sh {}\n".format(stage[1]) |
||||
|
buildConfig += " after_failure:\n" |
||||
|
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n" |
||||
|
s += buildConfig |
||||
|
|
||||
|
# Linux via Docker |
||||
|
for config in configs_linux: |
||||
|
linux = config[0] |
||||
|
compiler = "{}{}".format(config[1], config[2]) |
||||
|
s += " # {}\n".format(linux) |
||||
|
buildConfig = "" |
||||
|
for build in build_types: |
||||
|
buildConfig += " - stage: {}\n".format(stage[0]) |
||||
|
buildConfig += " os: linux\n" |
||||
|
buildConfig += " compiler: {}\n".format(config[1]) |
||||
|
buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler) |
||||
|
buildConfig += " install:\n" |
||||
|
if stage[1] == "Build1": |
||||
|
buildConfig += " - rm -rf build\n" |
||||
|
buildConfig += " - travis/install_linux.sh\n" |
||||
|
buildConfig += " script:\n" |
||||
|
buildConfig += " - travis/build.sh {}\n".format(stage[1]) |
||||
|
buildConfig += " before_cache:\n" |
||||
|
buildConfig += " - docker cp storm:/storm/. .\n" |
||||
|
buildConfig += " after_failure:\n" |
||||
|
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n" |
||||
|
s += buildConfig |
||||
|
|
||||
|
print(s) |
@ -0,0 +1,11 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
# Skip this run? |
||||
|
if [ -f build/skip.txt ] |
||||
|
then |
||||
|
exit 0 |
||||
|
fi |
||||
|
|
||||
|
sudo apt-get install -qq -y docker |
@ -0,0 +1,73 @@ |
|||||
|
#!/bin/bash |
||||
|
# Script installing dependencies |
||||
|
# Inspired by https://github.com/google/fruit |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
# Helper for travis folding |
||||
|
travis_fold() { |
||||
|
local action=$1 |
||||
|
local name=$2 |
||||
|
echo -en "travis_fold:${action}:${name}\r" |
||||
|
} |
||||
|
|
||||
|
# Helper for installing packages via homebrew |
||||
|
install_brew_package() { |
||||
|
if brew list -1 | grep -q "^$1\$"; then |
||||
|
# Package is installed, upgrade if needed |
||||
|
brew outdated "$1" || brew upgrade "$@" |
||||
|
else |
||||
|
# Package not installed yet, install. |
||||
|
# If there are conflicts, try overwriting the files (these are in /usr/local anyway so it should be ok). |
||||
|
brew install "$@" || brew link --overwrite gcc49 |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# Skip this run? |
||||
|
if [ -f build/skip.txt ] |
||||
|
then |
||||
|
exit 0 |
||||
|
fi |
||||
|
|
||||
|
# Update packages |
||||
|
travis_fold start brew_update |
||||
|
brew update |
||||
|
travis_fold end brew_update |
||||
|
|
||||
|
travis_fold start brew_install_util |
||||
|
# For md5sum |
||||
|
install_brew_package md5sha1sum |
||||
|
# For `timeout' |
||||
|
install_brew_package coreutils |
||||
|
|
||||
|
which cmake &>/dev/null || install_brew_package cmake |
||||
|
|
||||
|
# Install compiler |
||||
|
case "${COMPILER}" in |
||||
|
gcc-4.8) install_brew_package gcc@4.8 ;; |
||||
|
gcc-4.9) install_brew_package gcc@4.9 ;; |
||||
|
gcc-5) install_brew_package gcc@5 ;; |
||||
|
gcc-6) install_brew_package gcc@6 ;; |
||||
|
clang-default) ;; |
||||
|
clang-3.7) install_brew_package llvm@3.7 --with-clang --with-libcxx;; |
||||
|
clang-3.8) install_brew_package llvm@3.8 --with-clang --with-libcxx;; |
||||
|
clang-3.9) install_brew_package llvm@3.9 --with-clang --with-libcxx;; |
||||
|
clang-4.0) install_brew_package llvm --with-clang --with-libcxx;; |
||||
|
*) echo "Compiler not supported: ${COMPILER}. See travis/install_osx.sh"; exit 1 ;; |
||||
|
esac |
||||
|
travis_fold end brew_install_util |
||||
|
|
||||
|
|
||||
|
# Install dependencies |
||||
|
travis_fold start brew_install_dependencies |
||||
|
install_brew_package gmp --c++11 |
||||
|
install_brew_package cln |
||||
|
install_brew_package ginac |
||||
|
install_brew_package doxygen |
||||
|
install_brew_package boost --c++11 |
||||
|
install_brew_package z3 # optional |
||||
|
brew tap homebrew/science |
||||
|
install_brew_package homebrew/science/glpk |
||||
|
install_brew_package homebrew/science/hwloc |
||||
|
install_brew_package eigen |
||||
|
travis_fold end brew_install_dependencies |
@ -0,0 +1,4 @@ |
|||||
|
src/**/*.{%{cpp}} |
||||
|
src/**/CMakeLists.txt |
||||
|
resources/3rdparty/**/*.{%{cpp}} |
||||
|
resources/3rdparty/eigen-3.3-beta1/StormEigen/* |
@ -0,0 +1,178 @@ |
|||||
|
#!/usr/bin/env ruby |
||||
|
|
||||
|
# |
||||
|
# mtime_cache |
||||
|
# Copyright (c) 2016 Borislav Stanimirov |
||||
|
# |
||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
|
# of this software and associated documentation files (the "Software"), to |
||||
|
# deal in the Software without restriction, including without limitation the |
||||
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
||||
|
# sell copies of the Software, and to permit persons to whom the Software is |
||||
|
# furnished to do so, subject to the following conditions: |
||||
|
# |
||||
|
# The above copyright notice and this permission notice shall be included in |
||||
|
# all copies or substantial portions of the Software. |
||||
|
# |
||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
||||
|
# IN THE SOFTWARE. |
||||
|
# |
||||
|
|
||||
|
require 'digest/md5' |
||||
|
require 'json' |
||||
|
require 'fileutils' |
||||
|
|
||||
|
VERSION = "1.0.2" |
||||
|
|
||||
|
VERSION_TEXT = "mtime_cache v#{VERSION}" |
||||
|
|
||||
|
USAGE = <<ENDUSAGE |
||||
|
|
||||
|
Usage: |
||||
|
mtime_cache [<globs>] [-g globfile] [-d] [-q|V] [-c cache] |
||||
|
ENDUSAGE |
||||
|
|
||||
|
HELP = <<ENDHELP |
||||
|
|
||||
|
Traverse through globbed files, making a json cache based on their mtime. |
||||
|
If a cache exists, changes the mtime of existing unchanged (based on MD5 |
||||
|
hash) files to the one in the cache. |
||||
|
|
||||
|
Options: |
||||
|
|
||||
|
globs Ruby-compatible glob strings (ex some/path/**/*.java) |
||||
|
A extension pattern is allowd in the form %{pattern} |
||||
|
(ex some/path/*.{%{pattern1},%{pattern2}}) |
||||
|
The globs support the following patterns: |
||||
|
%{cpp} - common C++ extensions |
||||
|
|
||||
|
-g, --globfile A file with list of globs to perform (one per line) |
||||
|
|
||||
|
-?, -h, --help Show this help message. |
||||
|
-v, --version Show the version number (#{VERSION}) |
||||
|
-q, --quiet Don't log anything to stdout |
||||
|
-V, --verbose Show extra logging |
||||
|
-d, --dryrun Don't change any files on the filesystem |
||||
|
-c, --cache Specify the cache file for input and output. |
||||
|
[Default is .mtime_cache.json] |
||||
|
|
||||
|
ENDHELP |
||||
|
|
||||
|
param_arg = nil |
||||
|
ARGS = { :cache => '.mtime_cache.json', :globs => [] } |
||||
|
|
||||
|
ARGV.each do |arg| |
||||
|
case arg |
||||
|
when '-g', '--globfile' then param_arg = :globfile |
||||
|
when '-h', '-?', '--help' then ARGS[:help] = true |
||||
|
when '-v', '--version' then ARGS[:ver] = true |
||||
|
when '-q', '--quiet' then ARGS[:quiet] = true |
||||
|
when '-V', '--verbose' then ARGS[:verbose] = true |
||||
|
when '-d', '--dryrun' then ARGS[:dry] = true |
||||
|
when '-c', '--cache' then param_arg = :cache |
||||
|
else |
||||
|
if param_arg |
||||
|
ARGS[param_arg] = arg |
||||
|
param_arg = nil |
||||
|
else |
||||
|
ARGS[:globs] << arg |
||||
|
end |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
def log(text, level = 0) |
||||
|
return if ARGS[:quiet] |
||||
|
return if level > 0 && !ARGS[:verbose] |
||||
|
puts text |
||||
|
end |
||||
|
|
||||
|
if ARGS[:ver] || ARGS[:help] |
||||
|
log VERSION_TEXT |
||||
|
exit if ARGS[:ver] |
||||
|
log USAGE |
||||
|
log HELP |
||||
|
exit |
||||
|
end |
||||
|
|
||||
|
if ARGS[:globs].empty? && !ARGS[:globfile] |
||||
|
log 'Error: Missing globs' |
||||
|
log USAGE |
||||
|
exit 1 |
||||
|
end |
||||
|
|
||||
|
EXTENSION_PATTERNS = { |
||||
|
:cpp => "c,cc,cpp,cxx,h,hpp,hxx,inl,ipp,inc,ixx" |
||||
|
} |
||||
|
|
||||
|
cache_file = ARGS[:cache] |
||||
|
|
||||
|
cache = {} |
||||
|
|
||||
|
if File.file?(cache_file) |
||||
|
log "Found #{cache_file}" |
||||
|
cache = JSON.parse(File.read(cache_file)) |
||||
|
log "Read #{cache.length} entries" |
||||
|
else |
||||
|
log "#{cache_file} not found. A new one will be created" |
||||
|
end |
||||
|
|
||||
|
globs = ARGS[:globs].map { |g| g % EXTENSION_PATTERNS } |
||||
|
|
||||
|
globfile = ARGS[:globfile] |
||||
|
if globfile |
||||
|
File.open(globfile, 'r').each_line do |line| |
||||
|
line.strip! |
||||
|
next if line.empty? |
||||
|
globs << line % EXTENSION_PATTERNS |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
if globs.empty? |
||||
|
log 'Error: No globs in globfile' |
||||
|
log USAGE |
||||
|
exit 1 |
||||
|
end |
||||
|
|
||||
|
files = {} |
||||
|
num_changed = 0 |
||||
|
|
||||
|
globs.each do |glob| |
||||
|
Dir[glob].each do |file| |
||||
|
next if !File.file?(file) |
||||
|
|
||||
|
mtime = File.mtime(file).to_i |
||||
|
hash = Digest::MD5.hexdigest(File.read(file)) |
||||
|
|
||||
|
cached = cache[file] |
||||
|
|
||||
|
if cached && cached['hash'] == hash && cached['mtime'] < mtime |
||||
|
mtime = cached['mtime'] |
||||
|
|
||||
|
log "mtime_cache: changing mtime of #{file} to #{mtime}", 1 |
||||
|
|
||||
|
File.utime(File.atime(file), Time.at(mtime), file) if !ARGS[:dry] |
||||
|
num_changed += 1 |
||||
|
else |
||||
|
log "mtime_cache: NOT changing mtime of #{file}", 1 |
||||
|
end |
||||
|
|
||||
|
files[file] = { 'mtime' => mtime, 'hash' => hash } |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
log "Changed mtime of #{num_changed} of #{files.length} files" |
||||
|
log "Writing #{cache_file}" |
||||
|
|
||||
|
if !ARGS[:dry] |
||||
|
dirname = File.dirname(cache_file) |
||||
|
unless File.directory?(dirname) |
||||
|
FileUtils.mkdir_p(dirname) |
||||
|
end |
||||
|
File.open(cache_file, 'w').write(JSON.pretty_generate(files)) |
||||
|
end |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue