From 4c91194611086916c833d61e28e2f5e689316e83 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 27 Jan 2024 19:10:41 +0100 Subject: [PATCH] build: various fixes - Consistently use the variable CMAKE_BUILD_TYPE to select build type. - Remove broken `doc_html` target. - Remove swap files created by oldtest when cleaning. - Only rerun `lintdoc` if any documentation files has changed. --- .github/scripts/build_universal_macos.sh | 4 ++-- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 8 ++++---- CMakeLists.txt | 2 ++ runtime/CMakeLists.txt | 11 ----------- scripts/genappimage.sh | 2 +- src/nvim/CMakeLists.txt | 7 ++++++- test/old/testdir/Makefile | 3 ++- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/scripts/build_universal_macos.sh b/.github/scripts/build_universal_macos.sh index 432a275d6d..49de6e2b96 100755 --- a/.github/scripts/build_universal_macos.sh +++ b/.github/scripts/build_universal_macos.sh @@ -3,13 +3,13 @@ MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -f1 -d.)" export MACOSX_DEPLOYMENT_TARGET cmake -S cmake.deps -B .deps -G Ninja \ - -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \ + -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ -D CMAKE_FIND_FRAMEWORK=NEVER cmake --build .deps cmake -B build -G Ninja \ - -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \ + -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ -D ENABLE_LIBINTL=OFF \ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1468d2547..5dd53150ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - - run: printf 'NVIM_BUILD_TYPE=Release\n' >> $GITHUB_ENV + - run: printf 'CMAKE_BUILD_TYPE=Release\n' >> $GITHUB_ENV - name: Build universal binary run: ./.github/scripts/build_universal_macos.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6452de9036..815e7554cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,11 +29,11 @@ jobs: - run: ./.github/scripts/install_deps.sh - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') run: | - echo 'NVIM_BUILD_TYPE=Release' >> $GITHUB_ENV + echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') run: | - echo 'NVIM_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV + echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV - name: appimage run: ./scripts/genappimage.sh ${APPIMAGE_TAG} @@ -69,9 +69,9 @@ jobs: - name: Install dependencies run: ./.github/scripts/install_deps.sh - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') - run: printf 'NVIM_BUILD_TYPE=Release\n' >> $GITHUB_ENV + run: printf 'CMAKE_BUILD_TYPE=Release\n' >> $GITHUB_ENV - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') - run: printf 'NVIM_BUILD_TYPE=RelWithDebInfo\n' >> $GITHUB_ENV + run: printf 'CMAKE_BUILD_TYPE=RelWithDebInfo\n' >> $GITHUB_ENV - name: Build universal binary run: ./.github/scripts/build_universal_macos.sh - uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 96e1b63ca8..e9c62ba4dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,8 @@ include(Util) set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack) set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches) +file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) + set_directory_properties(PROPERTIES EP_PREFIX "${DEPS_BUILD_DIR}") diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 0dbf646702..c171fab9e9 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -55,8 +55,6 @@ foreach(PACKAGE ${PACKAGES}) endif() endforeach() -file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) - set(BUILDDOCFILES) foreach(DF ${DOCFILES}) get_filename_component(F ${DF} NAME) @@ -75,15 +73,6 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}" ) -# TODO: This doesn't work. wait for "nvim -l" to land? -add_custom_target(doc_html - COMMAND $ - -V1 -es --clean -c "lua require('scripts.gen_help_html').gen('./build/runtime/doc', './build/doc_html', nil, 'todo_commit_id')" -c "0cq" - DEPENDS - ${GENERATED_HELP_TAGS} - WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc" -) - add_custom_target( nvim_runtime DEPENDS diff --git a/scripts/genappimage.sh b/scripts/genappimage.sh index 0ad5e803e4..e8aac42a9c 100755 --- a/scripts/genappimage.sh +++ b/scripts/genappimage.sh @@ -26,7 +26,7 @@ APP_DIR="$APP.AppDir" ######################################################################## # Build and install nvim into the AppImage -make CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}" +make CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" cmake --install build --prefix="$APP_BUILD_DIR/${APP_DIR}/usr" ######################################################################## diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 2e26e58c82..f393993894 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -954,9 +954,14 @@ add_custom_target(doc-vim DEPENDS ${VIMDOC_FILES}) add_custom_target(doc) add_dependencies(doc doc-vim doc-eval) -add_custom_target(lintdoc +set(lintdoc_touch ${TOUCHES_DIR}/lintdoc) +add_custom_command( + OUTPUT ${lintdoc_touch} + COMMAND ${CMAKE_COMMAND} -E touch ${lintdoc_touch} COMMAND ${CMAKE_COMMAND} -E env "VIMRUNTIME=${NVIM_RUNTIME_DIR}" $ --clean -l scripts/lintdoc.lua WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + DEPENDS ${DOCFILES} USES_TERMINAL) +add_custom_target(lintdoc DEPENDS ${lintdoc_touch}) add_dependencies(lintdoc nvim) diff --git a/test/old/testdir/Makefile b/test/old/testdir/Makefile index b5ca6a17b0..c55e060f5a 100644 --- a/test/old/testdir/Makefile +++ b/test/old/testdir/Makefile @@ -121,7 +121,8 @@ CLEAN_FILES := *.out \ .*.swo \ .gdbinit \ $(TMPDIR) \ - del + del \ + $(ROOT)/runtime/doc/.*.swp clean: $(RM) -rf $(CLEAN_FILES)