Skip to content

Commit bc5a3ee

Browse files
committed
Update buildbot to use XCframework build script.
1 parent b98939b commit bc5a3ee

File tree

1 file changed

+158
-122
lines changed

1 file changed

+158
-122
lines changed

master/custom/factories.py

Lines changed: 158 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ class _IOSSimulatorBuild(UnixBuild):
10321032
build)
10331033
* It invokes `make testios` as a test target
10341034
"""
1035+
10351036
buildersuffix = ".iOS-simulator"
10361037
ios_min_version = "" # use the default from the configure file
10371038
factory_tags = ["iOS"]
@@ -1045,146 +1046,181 @@ def __init__(self, source, **kwargs):
10451046
super().__init__(source, **kwargs)
10461047

10471048
def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
1048-
out_of_tree_dir = "build_oot"
1049-
oot_dir_path = os.path.join("build", out_of_tree_dir)
1050-
oot_build_path = os.path.join(oot_dir_path, "build")
1051-
oot_host_path = os.path.join(oot_dir_path, "host")
1052-
1053-
# Create out of tree directory for "build", the platform we are
1054-
# currently running on
1055-
self.addStep(
1056-
ShellCommand(
1057-
name="mkdir build out-of-tree directory",
1058-
description="Create build out-of-tree directory",
1059-
command=["mkdir", "-p", oot_build_path],
1060-
warnOnFailure=True,
1049+
if branch in {"3.13", "3.14"}:
1050+
out_of_tree_dir = "build_oot"
1051+
oot_dir_path = os.path.join("build", out_of_tree_dir)
1052+
oot_build_path = os.path.join(oot_dir_path, "build")
1053+
oot_host_path = os.path.join(oot_dir_path, "host")
1054+
1055+
# Create out of tree directory for "build", the platform we are
1056+
# currently running on
1057+
self.addStep(
1058+
ShellCommand(
1059+
name="mkdir build out-of-tree directory",
1060+
description="Create build out-of-tree directory",
1061+
command=["mkdir", "-p", oot_build_path],
1062+
warnOnFailure=True,
1063+
)
10611064
)
1062-
)
1063-
# Create directory for "host", the platform we want to compile *for*
1064-
self.addStep(
1065-
ShellCommand(
1066-
name="mkdir host out-of-tree directory",
1067-
description="Create host out-of-tree directory",
1068-
command=["mkdir", "-p", oot_host_path],
1069-
warnOnFailure=True,
1065+
# Create directory for "host", the platform we want to compile *for*
1066+
self.addStep(
1067+
ShellCommand(
1068+
name="mkdir host out-of-tree directory",
1069+
description="Create host out-of-tree directory",
1070+
command=["mkdir", "-p", oot_host_path],
1071+
warnOnFailure=True,
1072+
)
10701073
)
1071-
)
10721074

1073-
# First, we build the "build" Python, which we need to cross compile
1074-
# the "host" Python
1075-
self.addStep(
1076-
Configure(
1077-
name="Configure build Python",
1078-
command=["../../configure"],
1079-
workdir=oot_build_path
1075+
# First, we build the "build" Python, which we need to cross compile
1076+
# the "host" Python
1077+
self.addStep(
1078+
Configure(
1079+
name="Configure build Python",
1080+
command=["../../configure"],
1081+
workdir=oot_build_path,
1082+
)
10801083
)
1081-
)
1082-
if parallel:
1083-
compile = ["make", parallel]
1084-
else:
1085-
compile = ["make"]
1084+
if parallel:
1085+
compile = ["make", parallel]
1086+
else:
1087+
compile = ["make"]
10861088

1087-
self.addStep(
1088-
Compile(
1089-
name="Compile build Python",
1090-
command=compile,
1091-
workdir=oot_build_path
1089+
self.addStep(
1090+
Compile(
1091+
name="Compile build Python", command=compile, workdir=oot_build_path
1092+
)
10921093
)
1093-
)
10941094

1095-
# Ensure the host path is isolated from Homebrew et al, but includes
1096-
# the host helper binaries. Also add the configuration paths for
1097-
# library dependencies.
1098-
support_path = f"/Users/buildbot/support/iphonesimulator.{self.arch}"
1099-
compile_environ = dict(self.compile_environ)
1100-
compile_environ.update({
1101-
"PATH": os.pathsep.join([
1102-
# This is intentionally a relative path. Buildbot doesn't expose
1103-
# the absolute working directory where the build is running as
1104-
# something that can be expanded into an environment variable.
1105-
"../../iOS/Resources/bin",
1106-
"/usr/bin",
1107-
"/bin",
1108-
"/usr/sbin",
1109-
"/sbin",
1110-
"/Library/Apple/usr/bin",
1111-
]),
1112-
"LIBLZMA_CFLAGS": f"-I{support_path}/xz/include",
1113-
"LIBLZMA_LIBS": f"-L{support_path}/xz/lib -llzma",
1114-
"BZIP2_CFLAGS": f"-I{support_path}/bzip2/include",
1115-
"BZIP2_LIBS": f"-L{support_path}/bzip2/lib -lbz2",
1116-
"LIBFFI_CFLAGS": f"-I{support_path}/libffi/include",
1117-
"LIBFFI_LIBS": f"-L{support_path}/libffi/lib -lffi",
1118-
})
1095+
# Ensure the host path is isolated from Homebrew et al, but includes
1096+
# the host helper binaries. Also add the configuration paths for
1097+
# library dependencies.
1098+
support_path = f"/Users/buildbot/support/iphonesimulator.{self.arch}"
1099+
compile_environ = dict(self.compile_environ)
1100+
compile_environ.update(
1101+
{
1102+
"PATH": os.pathsep.join(
1103+
[
1104+
# This is intentionally a relative path. Buildbot doesn't expose
1105+
# the absolute working directory where the build is running as
1106+
# something that can be expanded into an environment variable.
1107+
"../../iOS/Resources/bin",
1108+
"/usr/bin",
1109+
"/bin",
1110+
"/usr/sbin",
1111+
"/sbin",
1112+
"/Library/Apple/usr/bin",
1113+
]
1114+
),
1115+
"LIBLZMA_CFLAGS": f"-I{support_path}/xz/include",
1116+
"LIBLZMA_LIBS": f"-L{support_path}/xz/lib -llzma",
1117+
"BZIP2_CFLAGS": f"-I{support_path}/bzip2/include",
1118+
"BZIP2_LIBS": f"-L{support_path}/bzip2/lib -lbz2",
1119+
"LIBFFI_CFLAGS": f"-I{support_path}/libffi/include",
1120+
"LIBFFI_LIBS": f"-L{support_path}/libffi/lib -lffi",
1121+
}
1122+
)
11191123

1120-
# Now that we have a "build" architecture Python, we can use that
1121-
# to build a "host" (also known as the target we are cross compiling)
1122-
# Take a copy so that the class-level definition isn't tainted
1123-
configure_cmd = list(self.host_configure_cmd)
1124-
configure_cmd += self.configureFlags
1125-
configure_cmd += self.extra_configure_flags
1126-
configure_cmd += [
1127-
f"--with-openssl={support_path}/openssl",
1128-
f"--build={self.arch}-apple-darwin",
1129-
f"--host={self.host}",
1130-
"--with-build-python=../build/python.exe",
1131-
"--enable-framework"
1132-
]
1124+
# Now that we have a "build" architecture Python, we can use that
1125+
# to build a "host" (also known as the target we are cross compiling)
1126+
# Take a copy so that the class-level definition isn't tainted
1127+
configure_cmd = list(self.host_configure_cmd)
1128+
configure_cmd += self.configureFlags
1129+
configure_cmd += self.extra_configure_flags
1130+
configure_cmd += [
1131+
f"--with-openssl={support_path}/openssl",
1132+
f"--build={self.arch}-apple-darwin",
1133+
f"--host={self.host}",
1134+
"--with-build-python=../build/python.exe",
1135+
"--enable-framework",
1136+
]
11331137

1134-
self.addStep(
1135-
Configure(
1136-
name="Configure host Python",
1137-
command=configure_cmd,
1138-
env=compile_environ,
1139-
workdir=oot_host_path
1138+
self.addStep(
1139+
Configure(
1140+
name="Configure host Python",
1141+
command=configure_cmd,
1142+
env=compile_environ,
1143+
workdir=oot_host_path,
1144+
)
11401145
)
1141-
)
11421146

1143-
if parallel:
1144-
compile = ["make", parallel, self.makeTarget]
1145-
install = ["make", parallel, "install"]
1146-
else:
1147-
compile = ["make", self.makeTarget]
1148-
install = ["make", "install"]
1147+
if parallel:
1148+
compile = ["make", parallel, self.makeTarget]
1149+
install = ["make", parallel, "install"]
1150+
else:
1151+
compile = ["make", self.makeTarget]
1152+
install = ["make", "install"]
11491153

1150-
self.addStep(
1151-
Compile(
1152-
name="Compile host Python",
1153-
command=compile,
1154-
env=compile_environ,
1155-
workdir=oot_host_path,
1154+
self.addStep(
1155+
Compile(
1156+
name="Compile host Python",
1157+
command=compile,
1158+
env=compile_environ,
1159+
workdir=oot_host_path,
1160+
)
11561161
)
1157-
)
1158-
self.addStep(
1159-
Compile(
1160-
name="Install host Python",
1161-
command=install,
1162-
env=compile_environ,
1163-
workdir=oot_host_path,
1162+
self.addStep(
1163+
Compile(
1164+
name="Install host Python",
1165+
command=install,
1166+
env=compile_environ,
1167+
workdir=oot_host_path,
1168+
)
11641169
)
1165-
)
1166-
self.addStep(
1167-
Test(
1168-
command=["make", "testios"],
1169-
timeout=step_timeout(self.test_timeout),
1170-
usePTY=test_with_PTY,
1171-
env=self.test_environ,
1172-
workdir=oot_host_path,
1170+
self.addStep(
1171+
Test(
1172+
command=["make", "testios"],
1173+
timeout=step_timeout(self.test_timeout),
1174+
usePTY=test_with_PTY,
1175+
env=self.test_environ,
1176+
workdir=oot_host_path,
1177+
)
11731178
)
1174-
)
11751179

1176-
self.addStep(
1177-
Clean(
1178-
name="Clean build Python",
1179-
workdir=oot_build_path,
1180+
self.addStep(
1181+
Clean(
1182+
name="Clean build Python",
1183+
workdir=oot_build_path,
1184+
)
11801185
)
1181-
)
1182-
self.addStep(
1183-
Clean(
1184-
name="Clean host Python",
1185-
workdir=oot_host_path,
1186+
self.addStep(
1187+
Clean(
1188+
name="Clean host Python",
1189+
workdir=oot_host_path,
1190+
)
1191+
)
1192+
else: # Builds of Python 3.15+
1193+
self.addSteps(
1194+
[
1195+
Compile(
1196+
name="Configure and compile build Python",
1197+
command=["python3", "Platforms/Apple", "build", "iOS", "build"],
1198+
),
1199+
Compile(
1200+
name="Configure and compile host Pythons",
1201+
command=["python3", "Platforms/Apple", "build", "iOS", "hosts"],
1202+
),
1203+
Compile(
1204+
name="Package XCframework",
1205+
command=["python3", "Platforms/Apple", "package", "iOS"],
1206+
),
1207+
Test(
1208+
name="Run test suite",
1209+
command=[
1210+
"python3",
1211+
"Platforms/Apple",
1212+
"iOS",
1213+
"test",
1214+
"--slow-ci",
1215+
],
1216+
timeout=step_timeout(self.test_timeout),
1217+
),
1218+
Clean(
1219+
name="Clean the builds",
1220+
command=["python3", "Platforms/Apple", "clean", "iOS"],
1221+
),
1222+
]
11861223
)
1187-
)
11881224

11891225

11901226
class IOSARM64SimulatorBuild(_IOSSimulatorBuild):

0 commit comments

Comments
 (0)