diff --git a/.github/workflows/check_version_h.yml b/.github/workflows/check_version_h.yml new file mode 100644 index 0000000000..ab23ecf9ed --- /dev/null +++ b/.github/workflows/check_version_h.yml @@ -0,0 +1,29 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +name: confirm version.h stay in sync + +on: + workflow_call: + +permissions: + contents: read + +jobs: + confirm_version: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: cmake execute to generate version.h + run: cmake -B build_version -S . + + - name: confirm version.h + run: | + if [ -z "$(git status --porcelain | grep version.h)" ]; then + echo "version.h is in sync" + else + echo "version.h is not in sync" + exit 1 + fi diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index 119c8b2d05..0709f5fd46 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -74,6 +74,12 @@ permissions: contents: read jobs: + check_version_h: + permissions: + contents: read + actions: write + uses: ./.github/workflows/check_version_h.yml + build_llvm_libraries_on_ubuntu_2204: permissions: contents: read diff --git a/CMakeLists.txt b/CMakeLists.txt index a637c3643c..6362d0e56e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,7 @@ if (WAMR_BUILD_STATIC) target_link_libraries(iwasm_static PRIVATE ntdll) endif() + set_version_info (iwasm_static) install (TARGETS iwasm_static ARCHIVE DESTINATION lib) endif () @@ -196,6 +197,7 @@ if (WAMR_BUILD_SHARED) target_link_libraries(iwasm_shared PRIVATE ntdll) endif() + set_version_info (iwasm_shared) install (TARGETS iwasm_shared LIBRARY DESTINATION lib) endif () @@ -204,4 +206,5 @@ install (FILES ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h + ${WAMR_ROOT_DIR}/core/version.h DESTINATION include) diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake index 6a30bfb7b7..e77800ba4d 100644 --- a/build-scripts/config_common.cmake +++ b/build-scripts/config_common.cmake @@ -131,6 +131,9 @@ else () unset (LLVM_AVAILABLE_LIBS) endif () +# Version +include (${WAMR_ROOT_DIR}/build-scripts/version.cmake) + # Sanitizers if (NOT DEFINED WAMR_BUILD_SANITIZER) diff --git a/build-scripts/version.cmake b/build-scripts/version.cmake new file mode 100644 index 0000000000..04c4e1ccb0 --- /dev/null +++ b/build-scripts/version.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +if(NOT WAMR_ROOT_DIR) + # if from wamr-compiler + set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) +endif() + +set(WAMR_VERSION_MAJOR 2) +set(WAMR_VERSION_MINOR 2) +set(WAMR_VERSION_PATCH 0) + +message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}") + +# Configure the version header file +configure_file( + ${WAMR_ROOT_DIR}/core/version.h.in + ${WAMR_ROOT_DIR}/core/version.h +) + +# Set the library version and SOVERSION +function(set_version_info target) + set_target_properties(${target} + PROPERTIES + VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH} + SOVERSION ${WAMR_VERSION_MAJOR} +) +endfunction() diff --git a/core/version.h b/core/version.h index 4fe37e2d76..d1becac61f 100644 --- a/core/version.h +++ b/core/version.h @@ -3,9 +3,22 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + #ifndef _WAMR_VERSION_H_ #define _WAMR_VERSION_H_ + +/* clang-format off */ #define WAMR_VERSION_MAJOR 2 #define WAMR_VERSION_MINOR 2 #define WAMR_VERSION_PATCH 0 +/* clang-format on */ + #endif diff --git a/core/version.h.in b/core/version.h.in new file mode 100644 index 0000000000..e28df65ce4 --- /dev/null +++ b/core/version.h.in @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + +#ifndef _WAMR_VERSION_H_ +#define _WAMR_VERSION_H_ + +/* clang-format off */ +#define WAMR_VERSION_MAJOR @WAMR_VERSION_MAJOR@ +#define WAMR_VERSION_MINOR @WAMR_VERSION_MINOR@ +#define WAMR_VERSION_PATCH @WAMR_VERSION_PATCH@ +/* clang-format on */ + +#endif diff --git a/doc/semantic_version.md b/doc/semantic_version.md deleted file mode 100644 index 9fdd65d605..0000000000 --- a/doc/semantic_version.md +++ /dev/null @@ -1,21 +0,0 @@ -# WAMR uses semantic versioning - -WAMR uses the _semantic versioning_ to replace the current _date versioning_ system. - -There are three parts in the new version string: - -- _major_. Any incompatible modification, on both ABI and APIs, will lead an increment - in the value of _major_. APIs includes: `wasm_export.h`, `wasm_c_api.h`, - _sections in AOT files_, and so on. -- _minor_. It represents new features. It includes not just MVP or POST-MVP features - but also WASI features and WAMR private ones. -- _patch_. It represents patches. - -## Legacy versions - -All legacy versions(tags) will keep their current status. No existing release names -and links will be changed. - -## Reference - -- [Semantic Versioning 2.0.0](https://semver.org/) diff --git a/doc/stability_release.md b/doc/stability_release.md new file mode 100644 index 0000000000..78e034a3df --- /dev/null +++ b/doc/stability_release.md @@ -0,0 +1,33 @@ +# Semantic Versioning + +WAMR has adopted [semantic versioning](https://semver.org/) to replace the former *date versioning system*. The new version string consists of three parts: + +- *major*: Any change that is not compatible with previous versions, affecting either the ABI or APIs, will result in an increase in the major version number. APIs include: wasm_export.h, wasm_c_api.h, sections in AOT files, among others. +- *minor*: This number increases with the addition of new features. This encompasses not only MVP (Minimum Viable Product) or POST-MVP features but also WebAssembly System Interface (WASI) features and WAMR-specific features. +- *patch*: This number is incremented for patches. + +## Legacy releases + +All previous versions (tags) will retain their current status. There will be no changes to existing release names and links. + +# Release Process + +WAMR has been deployed across various devices. A frequent release cycle would strain customers' testing resources and add extra deployment work. Two factors can trigger a new WAMR release: + +- Community requests, particularly following the integration of significant and new features. +- Security vulnerabilities and critical bug fixes that ensure correctness. + +Patch releases will be made only to address security vulnerabilities and critical issues related to default behavior in prior releases. + +Once a release decision has been made: + +- Create a PR that: + 1. Modifies *build-scripts/version.cmake*. + 2. Executes cmake configuration to update the version. + 3. Updates *RELEASE_NOTES.md*. +- A checklist of the PR includes + - [ ] *build-scripts/version.cmake* + - [ ] *core/version.h* + - [ ] *RELEASE_NOTES.md* +- Once the PR is merged, create a new tag. +- Initiate the release process by triggering *the binary release processes* in *Actions*. diff --git a/product-mini/platforms/android/CMakeLists.txt b/product-mini/platforms/android/CMakeLists.txt index 5c05259176..19bc1b11e7 100644 --- a/product-mini/platforms/android/CMakeLists.txt +++ b/product-mini/platforms/android/CMakeLists.txt @@ -107,6 +107,8 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") @@ -135,6 +137,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/cosmopolitan/CMakeLists.txt b/product-mini/platforms/cosmopolitan/CMakeLists.txt index 8533ea68ce..7676ea6fb8 100644 --- a/product-mini/platforms/cosmopolitan/CMakeLists.txt +++ b/product-mini/platforms/cosmopolitan/CMakeLists.txt @@ -132,6 +132,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (vmlib) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -160,6 +161,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) install (TARGETS iwasm DESTINATION bin) @@ -168,6 +171,8 @@ target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN add_library (libiwasm STATIC ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/darwin/CMakeLists.txt b/product-mini/platforms/darwin/CMakeLists.txt index 12ed8052fe..1f955a10b7 100644 --- a/product-mini/platforms/darwin/CMakeLists.txt +++ b/product-mini/platforms/darwin/CMakeLists.txt @@ -116,11 +116,14 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) @@ -131,5 +134,7 @@ install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) +set_version_info (libiwasm) + target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) diff --git a/product-mini/platforms/freebsd/CMakeLists.txt b/product-mini/platforms/freebsd/CMakeLists.txt index dd1bbc41a5..5640a384a0 100644 --- a/product-mini/platforms/freebsd/CMakeLists.txt +++ b/product-mini/platforms/freebsd/CMakeLists.txt @@ -113,17 +113,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/ios/CMakeLists.txt b/product-mini/platforms/ios/CMakeLists.txt index ea5a4f4b9d..ca54aa1556 100644 --- a/product-mini/platforms/ios/CMakeLists.txt +++ b/product-mini/platforms/ios/CMakeLists.txt @@ -139,6 +139,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/linux-sgx/CMakeLists.txt b/product-mini/platforms/linux-sgx/CMakeLists.txt index 20b3fdfac1..927e6f4592 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists.txt @@ -107,6 +107,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt index aa3de6dacb..a29dbd69c1 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt @@ -78,6 +78,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux/CMakeLists.txt b/product-mini/platforms/linux/CMakeLists.txt index 321c4a955b..527d18035f 100644 --- a/product-mini/platforms/linux/CMakeLists.txt +++ b/product-mini/platforms/linux/CMakeLists.txt @@ -142,6 +142,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (vmlib) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -170,6 +171,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(iwasm @@ -185,6 +188,8 @@ install (TARGETS iwasm DESTINATION bin) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/riot/CMakeLists.txt b/product-mini/platforms/riot/CMakeLists.txt index 0032832627..c32a0b9777 100644 --- a/product-mini/platforms/riot/CMakeLists.txt +++ b/product-mini/platforms/riot/CMakeLists.txt @@ -62,3 +62,5 @@ include_directories(SYSTEM ${RIOT_INCLUDES_LIST}) # executable linking is done by RIOT build system add_library( wamr ${WAMR_RUNTIME_LIB_SOURCE}) + +set_version_info (wamr) diff --git a/product-mini/platforms/vxworks/CMakeLists.txt b/product-mini/platforms/vxworks/CMakeLists.txt index 0dc5d96999..dd03cb356f 100644 --- a/product-mini/platforms/vxworks/CMakeLists.txt +++ b/product-mini/platforms/vxworks/CMakeLists.txt @@ -78,17 +78,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/windows/CMakeLists.txt b/product-mini/platforms/windows/CMakeLists.txt index 40e925b16a..ff438ee8c1 100644 --- a/product-mini/platforms/windows/CMakeLists.txt +++ b/product-mini/platforms/windows/CMakeLists.txt @@ -106,6 +106,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info(vmlib) #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") if (NOT MINGW) @@ -134,6 +135,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) @@ -144,6 +147,8 @@ endif () add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm) diff --git a/wamr-compiler/CMakeLists.txt b/wamr-compiler/CMakeLists.txt index bc56f40308..73b1522489 100644 --- a/wamr-compiler/CMakeLists.txt +++ b/wamr-compiler/CMakeLists.txt @@ -284,6 +284,7 @@ include (${IWASM_DIR}/common/gc/iwasm_gc.cmake) include (${IWASM_DIR}/interpreter/iwasm_interp.cmake) include (${IWASM_DIR}/aot/iwasm_aot.cmake) include (${IWASM_DIR}/compilation/iwasm_compl.cmake) +include (${PROJECT_SOURCE_DIR}/../build-scripts/version.cmake) if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) include (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake) @@ -375,6 +376,7 @@ add_library (aotclib ${IWASM_COMPL_SOURCE}) add_executable (wamrc main.c) check_pie_supported() set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (wamrc) if (LLVM_LINK_LLVM_DYLIB) set(WAMRC_LINK_LLVM_LIBS LLVM)