From 552b19dbceda8982858e4678eabc98429f8b04d1 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 5 Jul 2023 07:11:52 +0100 Subject: [PATCH 1/5] Add double cmake to tests --- .github/workflows/ubuntu-2004.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ubuntu-2004.yml b/.github/workflows/ubuntu-2004.yml index 512b740..ad871e1 100644 --- a/.github/workflows/ubuntu-2004.yml +++ b/.github/workflows/ubuntu-2004.yml @@ -56,6 +56,14 @@ jobs: - name: cmake configure run: nice -n 10 cmake -DCMAKE_BUILD_TYPE=Release .. working-directory: Chaste/build + + - name: remove cellml + run: rm -rf ApPredict/src/cellml + working-directory: Chaste/projects + + - name: cmake configure again + run: nice -n 10 cmake -DCMAKE_BUILD_TYPE=Release .. + working-directory: Chaste/build - name: build core libraries run: nice -n 10 cmake --build . --parallel ${NPROC} --target chaste_core From 5d3a350dca242a896c8cfa287d0404d54ba413b2 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 5 Jul 2023 13:42:41 +0000 Subject: [PATCH 2/5] Switch from FetchContent to Download --- CMakeLists.txt | 57 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f128769..3c8c6ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,36 +42,35 @@ # # Note that the order in which components are specified does not matter. -include(FetchContent) -message (STATUS "Downloading ApPredict cellml files to ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml") -Set(FETCHCONTENT_UPDATES_DISCONNECTED ON) -FetchContent_Declare(CellML_repo_appredict - GIT_REPOSITORY https://github.com/Chaste/cellml.git - GIT_TAG e394aba8a7ca50f72ee212e21431045eae8b5ca4 - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml) -FetchContent_MakeAvailable(CellML_repo_appredict) +set(ApPredict_CELLML_TAG e394aba8a7ca50f72ee212e21431045eae8b5ca4) +set(ApPredict_CELLML_URL "https://github.com/Chaste/cellml/blob/${ApPredict_CELLML_TAG}/cellml") +set(ApPredict_CELLML_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/cellml") +set(ApPredict_CELLML_FILES + davies_isap_2012.cellml + decker_2009.cellml + faber_rudy_2000.cellml + grandi_pasqualini_bers_2010_ss.cellml + hund_rudy_2004.cellml + livshitz_rudy_2007.cellml + mahajan_shiferaw_2008.cellml + ohara_rudy_2011_endo.cellml + ohara_rudy_cipa_v1_2017.cellml + paci_hyttinen_aaltosetala_severi_ventricularVersion.cellml + priebe_beuckelmann_1998.cellml + shannon_wang_puglisi_weber_bers_2004.cellml + ten_tusscher_model_2006_epi.cellml +) -# remove .git folder to prevent accidentally checking in deletion of cellml files -file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml/.git) - -# remove cellml files that are not required -file(GLOB cellml_files ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml/cellml/*.cellml) -foreach(cellml_file ${cellml_files}) - if (NOT ${cellml_file} MATCHES davies_isap_2012.cellml - AND NOT ${cellml_file} MATCHES decker_2009.cellml - AND NOT ${cellml_file} MATCHES faber_rudy_2000.cellml - AND NOT ${cellml_file} MATCHES grandi_pasqualini_bers_2010_ss.cellml - AND NOT ${cellml_file} MATCHES hund_rudy_2004.cellml - AND NOT ${cellml_file} MATCHES livshitz_rudy_2007.cellml - AND NOT ${cellml_file} MATCHES mahajan_shiferaw_2008.cellml - AND NOT ${cellml_file} MATCHES ohara_rudy_2011_endo.cellml - AND NOT ${cellml_file} MATCHES ohara_rudy_cipa_v1_2017.cellml - AND NOT ${cellml_file} MATCHES paci_hyttinen_aaltosetala_severi_ventricularVersion.cellml - AND NOT ${cellml_file} MATCHES priebe_beuckelmann_1998.cellml - AND NOT ${cellml_file} MATCHES shannon_wang_puglisi_weber_bers_2004.cellml - AND NOT ${cellml_file} MATCHES ten_tusscher_model_2006_epi.cellml) - file(REMOVE ${cellml_file}) - endif() +message (STATUS "Downloading ApPredict cellml files to ${ApPredict_CELLML_SRC}") +foreach(cellml_file ${ApPredict_CELLML_FILES}) + if (NOT EXISTS "${ApPredict_CELLML_SRC}/${cellml_file}") + file(DOWNLOAD + "${ApPredict_CELLML_URL}/cellml/${cellml_file}" + "${ApPredict_CELLML_SRC}/${cellml_file}" + TIMEOUT 5 + TLS_VERIFY ON + ) + endif () endforeach() # Here we just depend on core components (nothing application-specific). From 8a1c2d3a56ec77452ac2257382d1bc107123a68a Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 5 Jul 2023 13:50:12 +0000 Subject: [PATCH 3/5] Change src/cellml/cellml to src/cellml --- src/extra_models/README | 2 +- test/TestApPredict.hpp | 2 +- test/TestApPredictLong.hpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/extra_models/README b/src/extra_models/README index 1769df6..bc613b2 100644 --- a/src/extra_models/README +++ b/src/extra_models/README @@ -3,7 +3,7 @@ Users can put additional cellml models in this directory. Once the project is built these will be available as pre-compiled models and can be used with --model . -Please note: The additional cellml file cannot have the same name as one of the pre-included cellml files in src/cellml/cellml +Please note: The additional cellml file cannot have the same name as one of the pre-included cellml files in src/cellml as these would generate model code with conflicting names. In case you receive a compile error with regards to duplicate definitions, we suggest renaming the additional cellml files to avoid conflicts. diff --git a/test/TestApPredict.hpp b/test/TestApPredict.hpp index 33ed8d3..ac027dc 100644 --- a/test/TestApPredict.hpp +++ b/test/TestApPredict.hpp @@ -112,7 +112,7 @@ class TestApPredict : public CxxTest::TestSuite "No model matches this index: 99999"); } { - CommandLineArgumentsMocker wrapper("--cellml projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long"); + CommandLineArgumentsMocker wrapper("--cellml projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long"); ApPredictMethods methods; TS_ASSERT_EQUALS(Warnings::Instance()->GetNextWarningMessage(), "Argument --cellml is deprecated: use --model instead."); diff --git a/test/TestApPredictLong.hpp b/test/TestApPredictLong.hpp index aec169e..d383927 100644 --- a/test/TestApPredictLong.hpp +++ b/test/TestApPredictLong.hpp @@ -64,12 +64,12 @@ class TestApPredictLong : public CxxTest::TestSuite // loop over hardcoded and dynamically loaded. // try both --model --cellml and --cellml and try both relative and absolute paths - FileFinder cellm_file("projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml", RelativeTo::CWD); + FileFinder cellm_file("projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml", RelativeTo::CWD); std::vector model_args = { "--model 2", "--model ten_tusscher_model_2006_epi", - "--model projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml", + "--model projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml", "--model " + cellm_file.GetAbsolutePath(), - "--cellml projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml"}; + "--cellml projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml"}; for (unsigned i = 0; i < model_args.size(); i++) { CommandLineArgumentsMocker wrapper(model_args[i] + " --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long"); From ae28c99b7a66bbc350da3bd33cd5462c68243996 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 5 Jul 2023 13:52:33 +0000 Subject: [PATCH 4/5] Update FetchContent in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 756f50b..0d79233 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,6 @@ so that all the file paths can be picked up correctly (replacing ``` From e2d03e383e7639959f467e9376b378d20d8f281d Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Wed, 5 Jul 2023 15:04:31 +0000 Subject: [PATCH 5/5] Verify CellML downloads --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c8c6ec..4b4ea75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ # Note that the order in which components are specified does not matter. set(ApPredict_CELLML_TAG e394aba8a7ca50f72ee212e21431045eae8b5ca4) -set(ApPredict_CELLML_URL "https://github.com/Chaste/cellml/blob/${ApPredict_CELLML_TAG}/cellml") +set(ApPredict_CELLML_URL "https://raw.githubusercontent.com/Chaste/cellml/${ApPredict_CELLML_TAG}/cellml") set(ApPredict_CELLML_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/cellml") set(ApPredict_CELLML_FILES davies_isap_2012.cellml @@ -65,11 +65,17 @@ message (STATUS "Downloading ApPredict cellml files to ${ApPredict_CELLML_SRC}") foreach(cellml_file ${ApPredict_CELLML_FILES}) if (NOT EXISTS "${ApPredict_CELLML_SRC}/${cellml_file}") file(DOWNLOAD - "${ApPredict_CELLML_URL}/cellml/${cellml_file}" + "${ApPredict_CELLML_URL}/${cellml_file}" "${ApPredict_CELLML_SRC}/${cellml_file}" - TIMEOUT 5 + TIMEOUT 10 TLS_VERIFY ON + STATUS dl_status ) + list (GET dl_status 0 dl_status_code) + if (NOT dl_status_code EQUAL 0) + file(REMOVE "${ApPredict_CELLML_SRC}/${cellml_file}") # remove stub + message (WARNING "Could not download ${cellml_file}") + endif () endif () endforeach()