Skip to content

Commit c98ba67

Browse files
committed
feat: update xcode permission by command - test
1 parent 093a67b commit c98ba67

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

Command/XcodeCommand.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class ParamsXcodebuild:
55

66
def __init__(self) -> None:
77
self.__path_workspace = ""
8+
self.__path_project = ""
89
self.__scheme = "AgoraExample"
910
self.__configuration = "Development"
1011
self.__destination="generic/platform=iOS"
@@ -15,6 +16,10 @@ def __init__(self) -> None:
1516
@property
1617
def get_workspace(self):
1718
return self.__path_workspace
19+
20+
@property
21+
def get_project(self):
22+
return self.__path_project
1823

1924
@property
2025
def get_scheme(self):
@@ -45,6 +50,10 @@ def get_provisioning_profile_specifier(self):
4550
def workspace(self,val):
4651
self.__path_workspace = Path(val)
4752

53+
@get_project.setter
54+
def project(self,val):
55+
self.__path_project = Path(val)
56+
4857
@get_scheme.setter
4958
def scheme(self,val):
5059
self.__scheme = val
@@ -73,13 +82,13 @@ def provisioning_profile_specifier(self,val):
7382
class XcodeCommand:
7483
def __init__(self) -> None:
7584
pass
76-
77-
def XcodeBuild(self,params:ParamsXcodebuild):
78-
79-
path_workspace = params.get_workspace
85+
path_project = params.get_project
8086
scheme = params.get_scheme
8187
configuration = params.get_configuration
8288
destination = params.get_destination
89+
90+
# ... existing ...
91+
8392
sdk = params.get_sdk
8493

8594
codesign_identity = params.get_codesign_identity
@@ -92,6 +101,16 @@ def XcodeBuild(self,params:ParamsXcodebuild):
92101
# -workspace "/Users/admin/Documents/Agora-Unreal-SDK-CPP-Example/AgoraExample_IOS.xcworkspace"
93102
# -scheme 'AgoraExample' -configuration "Development" -destination generic/platform=iOS -sdk iphoneos
94103

104+
target_param = ""
105+
if str(path_workspace) != "" and str(path_workspace) != ".":
106+
target_param = r" -workspace " + '"' + str(path_workspace) + '"'
107+
elif str(path_project) != "" and str(path_project) != ".":
108+
target_param = r" -project " + '"' + str(path_project) + '"'
109+
110+
command = (
111+
r"/usr/bin/xcrun xcodebuild build " +
112+
target_param-destination generic/platform=iOS -sdk iphoneos
113+
95114
command = (
96115
r"/usr/bin/xcrun xcodebuild build "
97116
r" -workspace " + '"' + str(path_workspace) + '"' +

Platform/IOS.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,26 @@ def PostPackaged_UseLegencyXcodeProject(self):
305305

306306
params = ParamsXcodebuild()
307307

308-
# Legacy UE4 Workspace Logic
309-
# Check for _IOS.xcworkspace first (Created by GenIOSProject, specific for iOS)
310-
name_workspace_ios = uproject_name + "_IOS.xcworkspace"
311-
path_workspace_ios = path_project_root / name_workspace_ios
308+
# Legacy UE4 Workspace/Project Logic
312309

313-
name_workspace_root = uproject_name + ".xcworkspace"
314-
path_workspace_root = path_project_root / name_workspace_root
310+
# 1. Attempt using Project file in Intermediate/ProjectFilesIOS (Created by GenIOSProject)
311+
# This is the most reliable way to target the specific iOS project configuration
312+
path_ios_xcodeproj = path_project_root / "Intermediate" / "ProjectFilesIOS" / (uproject_name + ".xcodeproj")
315313

316-
if path_workspace_ios.exists():
314+
path_workspace_ios = path_project_root / (uproject_name + "_IOS.xcworkspace")
315+
path_workspace_root = path_project_root / (uproject_name + ".xcworkspace")
316+
317+
if path_ios_xcodeproj.exists():
318+
PrintLog(f"Found iOS specific project: {path_ios_xcodeproj}")
319+
params.project = path_ios_xcodeproj
320+
elif path_workspace_ios.exists():
317321
PrintLog(f"Found iOS specific workspace: {path_workspace_ios}")
318322
params.workspace = path_workspace_ios
319323
elif path_workspace_root.exists():
320324
PrintLog(f"Found standard workspace: {path_workspace_root}")
321325
params.workspace = path_workspace_root
322326
else:
323-
PrintLog(f"Cannot find workspace in root path {path_workspace_root}")
327+
PrintErr(f"Cannot find valid Project or Workspace in root path {path_project_root}")
324328

325329
params.scheme = uproject_name
326330

0 commit comments

Comments
 (0)