Skip to content

Commit eff5b9a

Browse files
vrasparedgchen1
andauthored
Remove training packages from onnxruntime-ios-packaging-pipeline (microsoft#25451)
### Description remove support for multiple package variants (`Full` and `Training`) in the Apple packaging pipeline, consolidating the codebase to only support the `Full` variant. The changes simplify the code by eliminating the `PackageVariant` enum, related logic, and configuration files for the `Training` variant. --------- Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
1 parent 55f4c2a commit eff5b9a

15 files changed

+28
-227
lines changed

tools/ci_build/build.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,8 +1668,6 @@ def run_ios_tests(args, source_dir, config, cwd):
16681668
dynamic_framework_dir,
16691669
"--framework_info_file",
16701670
framework_info_file,
1671-
"--variant",
1672-
"Full",
16731671
"--skip_macos_test",
16741672
],
16751673
cwd=cwd,
@@ -1683,8 +1681,6 @@ def run_ios_tests(args, source_dir, config, cwd):
16831681
static_framework_dir,
16841682
"--framework_info_file",
16851683
framework_info_file,
1686-
"--variant",
1687-
"Full",
16881684
"--skip_macos_test",
16891685
],
16901686
cwd=cwd,

tools/ci_build/github/apple/build_and_assemble_apple_pods.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import tempfile
1515

1616
from c.assemble_c_pod_package import assemble_c_pod_package
17-
from package_assembly_utils import PackageVariant, get_ort_version
17+
from package_assembly_utils import get_ort_version
1818

1919
from objectivec.assemble_objc_pod_package import assemble_objc_pod_package
2020

@@ -53,13 +53,6 @@ def parse_args():
5353
help="The version string of the pod. The same version is used for all pods.",
5454
)
5555

56-
parser.add_argument(
57-
"--variant",
58-
choices=PackageVariant.release_variant_names(),
59-
default=PackageVariant.Full.name,
60-
help="Pod package variant.",
61-
)
62-
6356
parser.add_argument("--test", action="store_true", help="Run tests on the framework and pod package files.")
6457
parser.add_argument(
6558
"--skip-build",
@@ -103,7 +96,6 @@ def main():
10396
staging_dir = args.staging_dir.resolve()
10497

10598
# build framework
106-
package_variant = PackageVariant[args.variant]
10799
framework_info_file = build_dir / "xcframework_info.json"
108100

109101
log.info("Building Apple framework.")
@@ -131,8 +123,6 @@ def main():
131123
str(framework_info_file),
132124
"--c_framework_dir",
133125
str(build_dir / "framework_out"),
134-
"--variant",
135-
package_variant.name,
136126
"--test_project_stage_dir", # use a specific directory so it's easier to debug
137127
str(build_dir / "test_apple_packages_staging"),
138128
]
@@ -153,7 +143,6 @@ def main():
153143
framework_info_file=framework_info_file,
154144
framework_dir=build_dir / "framework_out" / "onnxruntime.xcframework",
155145
public_headers_dir=build_dir / "framework_out" / "Headers",
156-
package_variant=package_variant,
157146
)
158147

159148
if args.test:
@@ -168,7 +157,6 @@ def main():
168157
staging_dir=objc_pod_staging_dir,
169158
pod_version=args.pod_version,
170159
framework_info_file=framework_info_file,
171-
package_variant=package_variant,
172160
)
173161

174162
if args.test:

tools/ci_build/github/apple/c/assemble_c_pod_package.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,18 @@
1313

1414

1515
from package_assembly_utils import ( # noqa: E402
16-
PackageVariant,
1716
copy_repo_relative_to_dir,
1817
gen_file_from_template,
1918
get_podspec_values,
2019
load_json_config,
2120
)
2221

2322

24-
def get_pod_config_file(package_variant: PackageVariant):
23+
def get_pod_config_file():
2524
"""
26-
Gets the pod configuration file path for the given package variant.
25+
Gets the pod configuration file path.
2726
"""
28-
if package_variant == PackageVariant.Full:
29-
return _script_dir / "onnxruntime-c.config.json"
30-
elif package_variant == PackageVariant.Training:
31-
return _script_dir / "onnxruntime-training-c.config.json"
32-
else:
33-
raise ValueError(f"Unhandled package variant: {package_variant}")
27+
return _script_dir / "onnxruntime-c.config.json"
3428

3529

3630
def assemble_c_pod_package(
@@ -39,7 +33,6 @@ def assemble_c_pod_package(
3933
framework_info_file: pathlib.Path,
4034
public_headers_dir: pathlib.Path,
4135
framework_dir: pathlib.Path,
42-
package_variant: PackageVariant,
4336
):
4437
"""
4538
Assembles the files for the C/C++ pod package in a staging directory.
@@ -49,7 +42,6 @@ def assemble_c_pod_package(
4942
:param framework_info_file Path to the framework_info.json or xcframework_info.json file containing additional values for the podspec.
5043
:param public_headers_dir Path to the public headers directory to include in the pod.
5144
:param framework_dir Path to the onnxruntime framework directory to include in the pod.
52-
:param package_variant The pod package variant.
5345
:return Tuple of (package name, path to the podspec file).
5446
"""
5547
staging_dir = staging_dir.resolve()
@@ -58,7 +50,7 @@ def assemble_c_pod_package(
5850
framework_dir = framework_dir.resolve(strict=True)
5951

6052
framework_info = load_json_config(framework_info_file)
61-
pod_config = load_json_config(get_pod_config_file(package_variant))
53+
pod_config = load_json_config(get_pod_config_file())
6254

6355
pod_name = pod_config["name"]
6456

@@ -130,9 +122,6 @@ def parse_args():
130122
required=True,
131123
help="Path to the onnxruntime framework directory to include in the pod.",
132124
)
133-
parser.add_argument(
134-
"--variant", choices=PackageVariant.all_variant_names(), required=True, help="Pod package variant."
135-
)
136125

137126
return parser.parse_args()
138127

@@ -146,7 +135,6 @@ def main():
146135
framework_info_file=args.framework_info_file,
147136
public_headers_dir=args.public_headers_dir,
148137
framework_dir=args.framework_dir,
149-
package_variant=PackageVariant[args.variant],
150138
)
151139

152140
return 0

tools/ci_build/github/apple/c/onnxruntime-training-c.config.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

tools/ci_build/github/apple/default_training_ios_framework_build_settings.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

tools/ci_build/github/apple/objectivec/assemble_objc_pod_package.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
from c.assemble_c_pod_package import get_pod_config_file as get_c_pod_config_file # noqa: E402
1515
from package_assembly_utils import ( # noqa: E402
16-
PackageVariant,
1716
copy_repo_relative_to_dir,
1817
filter_files,
1918
gen_file_from_template,
@@ -84,58 +83,47 @@
8483
}
8584

8685

87-
def get_pod_files(package_variant: PackageVariant):
86+
def get_pod_files():
8887
"""
89-
Gets the source and header files for the given package variant.
88+
Gets the source and header files.
9089
"""
91-
if package_variant == PackageVariant.Training:
92-
return all_objc_files
93-
else:
94-
# return files that are in pod_files but not in training_only_objc_files
95-
filtered_pod_files = {}
96-
for key, value in all_objc_files.items():
97-
filtered_pod_files[key] = filter_files(value, training_only_objc_files[key])
98-
return filtered_pod_files
90+
# return files that are in pod_files but not in training_only_objc_files
91+
filtered_pod_files = {}
92+
for key, value in all_objc_files.items():
93+
filtered_pod_files[key] = filter_files(value, training_only_objc_files[key])
94+
return filtered_pod_files
9995

10096

101-
def get_pod_config_file(package_variant: PackageVariant):
97+
def get_pod_config_file():
10298
"""
103-
Gets the pod configuration file path for the given package variant.
99+
Gets the pod configuration file path.
104100
"""
105-
if package_variant == PackageVariant.Full:
106-
return _script_dir / "onnxruntime-objc.config.json"
107-
elif package_variant == PackageVariant.Training:
108-
return _script_dir / "onnxruntime-training-objc.config.json"
109-
else:
110-
raise ValueError(f"Unhandled package variant: {package_variant}")
101+
return _script_dir / "onnxruntime-objc.config.json"
111102

112103

113-
def assemble_objc_pod_package(
114-
staging_dir: pathlib.Path, pod_version: str, framework_info_file: pathlib.Path, package_variant: PackageVariant
115-
):
104+
def assemble_objc_pod_package(staging_dir: pathlib.Path, pod_version: str, framework_info_file: pathlib.Path):
116105
"""
117106
Assembles the files for the Objective-C pod package in a staging directory.
118107
119108
:param staging_dir Path to the staging directory for the Objective-C pod files.
120109
:param pod_version Objective-C pod version.
121110
:param framework_info_file Path to the framework_info.json or xcframework_info.json file containing additional values for the podspec.
122-
:param package_variant The pod package variant.
123111
:return Tuple of (package name, path to the podspec file).
124112
"""
125113
staging_dir = staging_dir.resolve()
126114
framework_info_file = framework_info_file.resolve(strict=True)
127115

128116
framework_info = load_json_config(framework_info_file)
129-
pod_config = load_json_config(get_pod_config_file(package_variant))
130-
c_pod_config = load_json_config(get_c_pod_config_file(package_variant))
117+
pod_config = load_json_config(get_pod_config_file())
118+
c_pod_config = load_json_config(get_c_pod_config_file())
131119

132120
pod_name = pod_config["name"]
133121

134122
print(f"Assembling files in staging directory: {staging_dir}")
135123
if staging_dir.exists():
136124
print("Warning: staging directory already exists", file=sys.stderr)
137125

138-
pod_files = get_pod_files(package_variant)
126+
pod_files = get_pod_files()
139127

140128
# copy the necessary files to the staging directory
141129
copy_repo_relative_to_dir(
@@ -196,9 +184,6 @@ def parse_args():
196184
help="Path to the framework_info.json or xcframework_info.json file containing additional values for the podspec. "
197185
"This file should be generated by CMake in the build directory.",
198186
)
199-
parser.add_argument(
200-
"--variant", choices=PackageVariant.release_variant_names(), required=True, help="Pod package variant."
201-
)
202187

203188
return parser.parse_args()
204189

@@ -210,7 +195,6 @@ def main():
210195
staging_dir=args.staging_dir,
211196
pod_version=args.pod_version,
212197
framework_info_file=args.framework_info_file,
213-
package_variant=PackageVariant[args.variant],
214198
)
215199

216200
return 0

tools/ci_build/github/apple/objectivec/onnxruntime-training-objc.config.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

tools/ci_build/github/apple/package_assembly_utils.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
import enum
54
import json
65
import os
76
import pathlib
@@ -12,19 +11,6 @@
1211
repo_root = _script_dir.parents[3]
1312

1413

15-
class PackageVariant(enum.Enum):
16-
Full = 0 # full ORT build with all opsets, ops, and types
17-
Training = 1 # full ORT build with all opsets, ops, and types, plus training APIs
18-
19-
@classmethod
20-
def release_variant_names(cls):
21-
return [v.name for v in cls if v.value >= 0]
22-
23-
@classmethod
24-
def all_variant_names(cls):
25-
return [v.name for v in cls]
26-
27-
2814
_template_variable_pattern = re.compile(r"@(\w+)@") # match "@var@"
2915

3016

tools/ci_build/github/apple/test_apple_packages.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import tempfile
1414

1515
from c.assemble_c_pod_package import assemble_c_pod_package
16-
from package_assembly_utils import PackageVariant, gen_file_from_template, get_ort_version
16+
from package_assembly_utils import gen_file_from_template, get_ort_version
1717

1818
SCRIPT_PATH = pathlib.Path(__file__).resolve(strict=True)
1919
REPO_DIR = SCRIPT_PATH.parents[4]
@@ -81,7 +81,6 @@ def _test_apple_packages(args):
8181
framework_info_file=args.framework_info_file,
8282
public_headers_dir=public_headers_dir,
8383
framework_dir=framework_dir,
84-
package_variant=PackageVariant[args.variant],
8584
)
8685

8786
# move podspec out to target_proj_path first
@@ -239,13 +238,6 @@ def parse_args():
239238
"--c_framework_dir", type=pathlib.Path, required=True, help="Provide the parent directory for C/C++ framework"
240239
)
241240

242-
parser.add_argument(
243-
"--variant",
244-
choices=PackageVariant.all_variant_names(),
245-
required=True,
246-
help="Pod package variant.",
247-
)
248-
249241
parser.add_argument(
250242
"--test_project_stage_dir",
251243
type=pathlib.Path,

tools/ci_build/github/apple/test_minimal_training_ios_simulator_framework_build_settings.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)