Deduplicate Cargo package fields across workspace

Also deduplicate version numbers in CMakeLists.txt.
This commit is contained in:
Oliver Hamlet
2025-07-31 22:08:46 +01:00
parent 724f6eaa15
commit 4acc64247e
8 changed files with 29 additions and 35 deletions
+8 -3
View File
@@ -1,8 +1,8 @@
[package]
name = "libloot"
version = "0.27.0"
edition = "2024"
license = "GPL-3.0-or-later"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
crc32fast = "1.5.0"
@@ -30,6 +30,11 @@ workspace = true
[workspace]
members = ["cpp", "ffi-errors", "nodejs", "parameterized-test", "python"]
[workspace.package]
version = "0.27.0"
edition = "2024"
license = "GPL-3.0-or-later"
[profile.release]
debug = "limited"
lto = "thin"
+5 -7
View File
@@ -5,7 +5,7 @@ endif()
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(libloot)
project(libloot VERSION "0.27.0")
include(ExternalProject)
include(FetchContent)
include(CMakeDependentOption)
@@ -253,11 +253,9 @@ endif()
add_library(libloot::loot ALIAS loot)
if(LIBLOOT_BUILD_SHARED)
set(LIBLOOT_VERSION "0.27.0")
set_property(TARGET loot PROPERTY VERSION ${LIBLOOT_VERSION})
set_property(TARGET loot PROPERTY SOVERSION 0)
set_property(TARGET loot PROPERTY INTERFACE_libloot_MAJOR_VERSION 0)
set_property(TARGET loot PROPERTY VERSION ${libloot_VERSION})
set_property(TARGET loot PROPERTY SOVERSION ${libloot_VERSION_MAJOR})
set_property(TARGET loot PROPERTY INTERFACE_libloot_MAJOR_VERSION ${libloot_VERSION_MAJOR})
set_property(TARGET loot APPEND PROPERTY COMPATIBLE_INTERFACE_STRING libloot_MAJOR_VERSION)
configure_package_config_file(
@@ -268,7 +266,7 @@ if(LIBLOOT_BUILD_SHARED)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/liblootConfigVersion.cmake"
VERSION "${LIBLOOT_VERSION}"
VERSION "${libloot_VERSION}"
COMPATIBILITY AnyNewerVersion
)
+3 -3
View File
@@ -1,8 +1,8 @@
[package]
name = "libloot-cpp"
version = "0.27.0"
edition = "2024"
license = "GPL-3.0-or-later"
version.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
cxx = { version = "1.0", features = ["c++17"] }
+3 -3
View File
@@ -1,8 +1,8 @@
[package]
name = "libloot-ffi-errors"
version = "0.27.0"
edition = "2024"
license = "GPL-3.0-or-later"
version.workspace = true
edition.workspace = true
license.workspace = true
[lints]
workspace = true
+3 -3
View File
@@ -1,8 +1,8 @@
[package]
edition = "2021"
name = "libloot-nodejs"
version = "0.27.0"
license = "GPL-3.0-or-later"
version.workspace = true
edition = "2021"
license.workspace = true
[lib]
crate-type = ["cdylib"]
+2 -2
View File
@@ -1,7 +1,7 @@
[package]
name = "parameterized-test"
version = "0.27.0"
edition = "2024"
version.workspace = true
edition.workspace = true
license = "MIT"
[dependencies]
+3 -3
View File
@@ -1,8 +1,8 @@
[package]
name = "libloot-python"
version = "0.27.0"
edition = "2024"
license = "GPL-3.0-or-later"
version.workspace = true
edition.workspace = true
license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
+2 -11
View File
@@ -31,11 +31,7 @@ def update_resource_file(path, version):
replace_in_file(path, 'Version", "\\d+\\.\\d+\\.\\d+"', 'Version", "{}"'.format(version))
def update_cmakelists(path, version):
version_parts = version.split('.')
replace_in_file(path, 'set\\(LIBLOOT_VERSION "\\d+\\.\\d+\\.\\d+"\\)', 'set(LIBLOOT_VERSION "{}")'.format(version))
replace_in_file(path, 'TARGET loot PROPERTY SOVERSION \\d+', 'TARGET loot PROPERTY SOVERSION {}'.format(version_parts[0]))
replace_in_file(path, 'INTERFACE_libloot_MAJOR_VERSION \\d+', 'INTERFACE_libloot_MAJOR_VERSION {}'.format(version_parts[0]))
replace_in_file(path, 'project\\(libloot VERSION "\\d+\\.\\d+\\.\\d+"\\)', 'project(libloot VERSION "{}")'.format(version))
def update_cargo_toml(path, version):
replace_in_file(path, '^version = "\\d+\\.\\d+\\.\\d+"$', 'version = "{}"'.format(version))
@@ -60,14 +56,9 @@ if __name__ == "__main__":
update_cmakelists(os.path.join('cpp', 'CMakeLists.txt'), arguments.version[0])
update_cargo_toml('Cargo.toml', arguments.version[0])
update_cargo_toml(os.path.join('cpp', 'Cargo.toml'), arguments.version[0])
update_cargo_toml(os.path.join('ffi-errors', 'Cargo.toml'), arguments.version[0])
update_cargo_toml(os.path.join('nodejs', 'Cargo.toml'), arguments.version[0])
update_cargo_toml(os.path.join('parameterized-test', 'Cargo.toml'), arguments.version[0])
update_cargo_toml(os.path.join('python', 'Cargo.toml'), arguments.version[0])
# update_cargo_toml also works for pyproject.toml
update_cargo_toml(os.path.join('cpp', 'docs', 'pyproject.toml'), arguments.version[0])
update_cargo_toml(os.path.join('docs', 'pyproject.toml'), arguments.version[0])
update_package_json(os.path.join('nodejs', 'package.json'), arguments.version[0])
update_package_json(os.path.join('nodejs', 'npm', 'linux-x64-gnu', 'package.json'), arguments.version[0])