Skip to content

Commit d122c21

Browse files
authored
Merge pull request #121 from feltech/98-versionedTraits
Update to new versioned trait schema
2 parents ff2d6a7 + fae7f8b commit d122c21

7 files changed

Lines changed: 1169 additions & 865 deletions

File tree

CMakeLists.txt

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,28 @@ endif ()
6565
# to the library structure later on will encounter issues caused by the
6666
# generative nature of the project.
6767
message("Generating Traits with openassetio-traitgen")
68+
69+
# Locate the openassetio-traitgen executable. This allows the user to
70+
# override which traitgen is used via CMake mechanisms, e.g.
71+
# CMAKE_PREFIX_PATH, or by directly setting
72+
# OPENASSETIO_TRAITGEN_EXECUTABLE.
73+
find_program(
74+
OPENASSETIO_TRAITGEN_EXECUTABLE
75+
NAMES openassetio-traitgen
76+
REQUIRED
77+
)
78+
message(STATUS "Found openassetio-traitgen at: ${OPENASSETIO_TRAITGEN_EXECUTABLE}")
79+
6880
# Mark the traits source as a configure dependency by copying it to the
6981
# binary dir, and use that file to run traitgen from.
7082
# This means if the source traits file is changed, configure will rerun.
7183
configure_file(${CMAKE_CURRENT_LIST_DIR}/traits.yml ${PROJECT_BINARY_DIR}/traits.yml)
72-
execute_process(COMMAND openassetio-traitgen ${PROJECT_BINARY_DIR}/traits.yml
73-
-o ${PROJECT_BINARY_DIR}/cpp -g cpp
74-
COMMAND_ERROR_IS_FATAL ANY
75-
COMMAND_ECHO STDERR)
84+
execute_process(
85+
COMMAND ${OPENASSETIO_TRAITGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/traits.yml
86+
-o ${PROJECT_BINARY_DIR}/cpp -g cpp
87+
COMMAND_ERROR_IS_FATAL ANY
88+
COMMAND_ECHO STDERR
89+
)
7690

7791
if (OPENASSETIO_MEDIACREATION_GENERATE_PYTHON)
7892
# Generate the python package by running traitgen.
@@ -87,10 +101,12 @@ if (OPENASSETIO_MEDIACREATION_GENERATE_PYTHON)
87101
# `pip install .` (and invoking setup.py), but that's not a
88102
# guarentee going forward, as additional elements of the python
89103
# package may be added to mediacreation.
90-
execute_process(COMMAND openassetio-traitgen ${PROJECT_BINARY_DIR}/traits.yml
104+
execute_process(
105+
COMMAND ${OPENASSETIO_TRAITGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/traits.yml
91106
-o ${PROJECT_BINARY_DIR}/python -g python
92107
COMMAND_ERROR_IS_FATAL ANY
93-
COMMAND_ECHO STDERR)
108+
COMMAND_ECHO STDERR
109+
)
94110
endif()
95111

96112
add_library(openassetio-mediacreation INTERFACE)

RELEASE_NOTES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Release Notes
22
=============
33

4+
v1.0.0-alpha.x
5+
---------------
6+
7+
### Breaking changes
8+
9+
- Update the traits YAML to be compatible with the new schema defined in
10+
`openassetio-traitgen` v1.0.0-alpha.13+, which adds versioning to
11+
traits and specifications.
12+
[#98](https://github.com/OpenAssetIO/OpenAssetIO-MediaCreation/issues/98)
13+
414
v1.0.0-alpha.12
515
---------------
616

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[build-system]
55
requires = [
66
"setuptools>=65.5.0",
7-
"openassetio-traitgen==1.0.0a12"
7+
"openassetio-traitgen>=1.0.0a13"
88
]
99
build-backend = "setuptools.build_meta"
1010

tests/cpp/test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ using namespace openassetio_mediacreation;
99

1010
int main() {
1111
auto traits = openassetio::trait::TraitsData::make();
12-
auto trait = traits::managementPolicy::ManagedTrait(traits);
12+
auto deprecated = traits::managementPolicy::ManagedTrait(traits);
13+
auto trait = traits::managementPolicy::ManagedTrait_v1(traits);
1314
trait.imbue();
1415
return 0;
1516
}

0 commit comments

Comments
 (0)