Skip to content

Commit faff9e0

Browse files
authored
git: Add option to customize pattern language repo and git hash with workflow call
1 parent a350046 commit faff9e0

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
repository_dispatch:
99
types: [run_tests]
1010
workflow_call:
11+
inputs:
12+
pattern_language_git_repo:
13+
type: string
14+
pattern_language_git_hash:
15+
type: string
1116

1217
jobs:
1318
tests:
@@ -63,6 +68,8 @@ jobs:
6368
-DIMHEX_PATTERNS_ENABLE_UNIT_TESTS=ON \
6469
-DLIBPL_ENABLE_TESTS=OFF \
6570
-DLIBPL_ENABLE_CLI=OFF \
71+
-DIMHEX_PATTERNS_LIBPL_GIT_REPO="${{ inputs.pattern_language_git_repo }}" \
72+
-DIMHEX_PATTERNS_LIBPL_GIT_HASH="${{ inputs.pattern_language_git_hash }}" \
6673
-G Ninja \
6774
..
6875
ninja unit_tests

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ endif()
1616
if(NOT TARGET libpl)
1717
include(FetchContent)
1818

19+
if (NOT DEFINED DIMHEX_PATTERNS_LIBPL_GIT_REPO OR DIMHEX_PATTERNS_LIBPL_GIT_REPO STREQUAL "")
20+
set(LIBPL_GIT_REPO "https://github.com/WerWolv/PatternLanguage")
21+
else()
22+
set(LIBPL_GIT_REPO ${DIMHEX_PATTERNS_LIBPL_GIT_REPO})
23+
endif()
24+
25+
if (NOT DEFINED IMHEX_PATTERNS_LIBPL_GIT_HASH OR IMHEX_PATTERNS_LIBPL_GIT_HASH STREQUAL "")
26+
set(LIBPL_GIT_TAG "master")
27+
else()
28+
set(LIBPL_GIT_TAG ${IMHEX_PATTERNS_LIBPL_GIT_HASH})
29+
endif()
30+
1931
FetchContent_Declare(
2032
pattern_language
21-
GIT_REPOSITORY https://github.com/WerWolv/PatternLanguage
22-
GIT_TAG master
33+
GIT_REPOSITORY ${LIBPL_GIT_REPO}
34+
GIT_TAG ${LIBPL_GIT_TAG}
2335
)
2436

2537
FetchContent_MakeAvailable(pattern_language)

0 commit comments

Comments
 (0)