Skip to content

Commit 7da18cd

Browse files
Re-enable artifact generation on Windows. (#408)
* Makes the existing `optional=` tag able to take an OS name like "windows" or "linux" in order to control optionality in a system specific way. Progress on #36
1 parent 34d2d73 commit 7da18cd

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,4 @@ endif()
370370
# Finalization
371371
################################################################################
372372
therock_subproject_merge_compile_commands()
373-
if(NOT WIN32)
374-
# TODO(#36): Enable on Windows (base/artifact.toml includes rocm_smi_lib that is excluded on Windows)
375-
therock_create_dist()
376-
endif()
373+
therock_create_dist()

base/artifact.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44

55
# rocm_smi_lib
66
[components.dbg."base/rocm_smi_lib/stage"]
7+
optional = "windows"
78
[components.dev."base/rocm_smi_lib/stage"]
9+
optional = "windows"
810
[components.doc."base/rocm_smi_lib/stage"]
11+
optional = "windows"
912
[components.lib."base/rocm_smi_lib/stage"]
13+
optional = "windows"
1014
[components.run."base/rocm_smi_lib/stage"]
15+
optional = "windows"
1116
include = [
1217
"bin/**",
1318
"libexec/**",
@@ -30,11 +35,17 @@ include = "libexec/**"
3035

3136
# rocprofiler-register
3237
[components.dbg."base/rocprofiler-register/stage"]
38+
optional = "windows"
3339
[components.dev."base/rocprofiler-register/stage"]
40+
optional = "windows"
3441
[components.doc."base/rocprofiler-register/stage"]
42+
optional = "windows"
3543
[components.lib."base/rocprofiler-register/stage"]
44+
optional = "windows"
3645
[components.run."base/rocprofiler-register/stage"]
46+
optional = "windows"
3747
[components.test."base/rocprofiler-register/stage"]
48+
optional = "windows"
3849
include = [
3950
"share/rocprofiler-register/tests/**",
4051
]

build_tools/fileset_tool.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from typing import Callable
1717
import argparse
1818
from pathlib import Path
19+
import platform
1920
import sys
2021
import shutil
2122
import tarfile
@@ -25,6 +26,26 @@
2526
from _therock_utils.pattern_match import PatternMatcher
2627

2728

29+
def evaluate_optional(optional_value) -> bool:
30+
"""Returns true if the given value should be considered optional on this platform.
31+
32+
It can be either a str, list of str, or a truthy value. If a str/list, then it will
33+
return true if any of the strings match the case insensitive
34+
`platform.system()`.
35+
"""
36+
if optional_value is None:
37+
return False
38+
if isinstance(optional_value, str):
39+
optional_value = [optional_value]
40+
if isinstance(optional_value, list):
41+
system_name = platform.system().lower()
42+
for v in optional_value:
43+
if str(v).lower() == system_name:
44+
return True
45+
return False
46+
return bool(optional_value)
47+
48+
2849
class ComponentDefaults:
2950
"""Defaults for to apply to artifact merging by component name."""
3051

@@ -135,7 +156,11 @@ def do_artifact(args):
135156
matched, force inclusion, regardless of whether they match
136157
an exclude pattern.
137158
"optional": if true and the directory does not exist, it
138-
is not an error. Use for optionally built projects
159+
is not an error. Use for optionally built projects. This
160+
can also be either a string or array of strings, which
161+
are interpreted as a platform name. If the case-insensitive
162+
`platform.system()` equals one of them, then it is
163+
considered optional.
139164
140165
Most sections can typically be blank because by default they use
141166
component specific include/exclude patterns (see `COMPONENT_DEFAULTS` above)
@@ -164,7 +189,7 @@ def do_artifact(args):
164189
for basedir_relpath, basedir_record in component_record.items():
165190
use_default_patterns = basedir_record.get("default_patterns", True)
166191
basedir = args.root_dir / Path(basedir_relpath)
167-
optional = basedir_record.get("optional")
192+
optional = evaluate_optional(basedir_record.get("optional"))
168193
if optional and not basedir.exists():
169194
continue
170195
all_basedir_relpaths.append(basedir_relpath)

third-party/sysdeps/windows/artifact.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
[components.lib."third-party/sysdeps/windows/sqlite3/build/stage"]
44

55
# zlib
6-
[components.dev."third-party/sysdeps/linux/zlib/build/stage"]
7-
[components.lib."third-party/sysdeps/linux/zlib/build/stage"]
6+
[components.dev."third-party/sysdeps/windows/zlib/build/stage"]
7+
[components.lib."third-party/sysdeps/windows/zlib/build/stage"]

0 commit comments

Comments
 (0)