Skip to content
Snippets Groups Projects
Commit b7349664 authored by Lars Bilke's avatar Lars Bilke Committed by Lars Bilke
Browse files

[CMake] Contentful import is skipped on web-target when not all

requirements were met.
parent 1b52476c
No related branches found
No related tags found
No related merge requests found
if(NOT NPM OR NOT PIP OR NOT PYTHON_EXECUTABLE) if(NOT NPM)
return() return()
endif() endif()
...@@ -10,16 +10,25 @@ endif() ...@@ -10,16 +10,25 @@ endif()
add_custom_target(web-install add_custom_target(web-install
COMMAND ${PACKAGE_MANAGER} COMMAND ${PACKAGE_MANAGER}
COMMAND ${PIP} install -r requirements.txt
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web
BYPRODUCTS ${CMAKE_SOURCE_DIR}/web/node_modules BYPRODUCTS ${CMAKE_SOURCE_DIR}/web/node_modules
) )
add_custom_target(web-import if(PIP AND PYTHON_EXECUTABLE AND
COMMAND ${PYTHON_EXECUTABLE} import.py (EXISTS ${CMAKE_SOURCE_DIR}/web/import/secret.py OR
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web/import DEFINED ENV{CONTENTFUL_ACCESS_TOKEN}))
DEPENDS web-install
) add_custom_target(web-import
COMMAND ${PIP} install -r ../requirements.txt
COMMAND ${PYTHON_EXECUTABLE} import.py
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web/import
DEPENDS web-install
)
set(IMPORT_TARGET web-import)
else()
message(STATUS "[web] Skipping import from Contentful!")
endif()
if(DEFINED OGS_WEB_BASE_URL) if(DEFINED OGS_WEB_BASE_URL)
set(HUGO_ARGS --baseURL ${OGS_WEB_BASE_URL}) set(HUGO_ARGS --baseURL ${OGS_WEB_BASE_URL})
...@@ -32,7 +41,7 @@ endif() ...@@ -32,7 +41,7 @@ endif()
add_custom_target(web add_custom_target(web
COMMAND ${NPM} run build -- ${HUGO_ARGS} COMMAND ${NPM} run build -- ${HUGO_ARGS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/web
DEPENDS web-install web-import DEPENDS web-install ${IMPORT_TARGET}
) )
add_custom_target(web-clean add_custom_target(web-clean
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment