Mercurial > xcodescriptingbridge
annotate ScriptingBridge_Xcode4_broken.lua @ 6:7a0e6eeedd92
Style fixes
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Mon, 08 Aug 2011 19:32:30 -0700 |
parents | fdcbf6da59ec |
children |
rev | line source |
---|---|
4
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
1 #!/Library/Frameworks/LuaCocoa.framework/Versions/Current/Tools/luacocoa |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
2 --[[ |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
3 Simple Scripting Bridge example using iTunes. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
4 Script will launch iTunes (if not already open), |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
5 Pause playback (if not already paused), |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
6 Start/resume playing, |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
7 and print out the name, artist, year of the current track. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
8 --]] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
9 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
10 LuaCocoa.import("ScriptingBridge") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
11 LuaCocoa.import("Foundation") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
12 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
13 function GetURLFromFileAndPath(file_name) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
14 local current_working_directory = NSFileManager:defaultManager():currentDirectoryPath() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
15 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
16 local file_string = NSString:stringWithUTF8String_(file_name):stringByExpandingTildeInPath():stringByStandardizingPath() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
17 if not file_string:isAbsolutePath() then |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
18 file_string = current_working_directory:stringByAppendingPathComponent_(file_string):stringByStandardizingPath() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
19 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
20 --print("file_string", file_string) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
21 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
22 local ns_url = NSURL:URLWithString_(file_string:stringByAddingPercentEscapesUsingEncoding_(NSUTF8StringEncoding)) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
23 --print("ns_url", ns_url) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
24 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
25 return ns_url |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
26 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
27 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
28 local xcode_application = SBApplication:applicationWithBundleIdentifier_("com.apple.dt.Xcode") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
29 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
30 if xcode_application ~= nil then |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
31 -- arg[0] is the script name |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
32 -- negative index values represent arguments that come before the script |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
33 -- we only want the arguments after the script name |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
34 -- so use a numeric for |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
35 local file_to_open = arg[1] or "MySampleProject.xcodeproj" |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
36 local url_to_open = GetURLFromFileAndPath(file_to_open) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
37 local xcode_document = xcode_application:open(url_to_open) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
38 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
39 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
40 --[[ |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
41 local all_documents = xcode_application:projects() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
42 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
43 print(all_documents, #all_documents) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
44 for i=1, #all_documents do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
45 local a_doc = all_documents[i] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
46 print("doc", a_doc) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
47 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
48 --]] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
49 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
50 -- I'm assuming that the document we just opened becomes the activeProjectDocument |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
51 --[[ Broken in Xcode 4 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
52 local active_project_document = xcode_application:activeProjectDocument() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
53 print("active_project", active_project_document ) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
54 print("active_project name", active_project_document:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
55 print("active_project path", active_project_document:path()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
56 --]] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
57 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
58 NSLog("workspace docs %@", xcode_application:workspaceDocuments()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
59 local workspace_documents = xcode_application:workspaceDocuments() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
60 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
61 for i=1, #workspace_documents do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
62 print("workspace_documents " .. workspace_documents[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
63 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
64 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
65 local active_workspace_document = xcode_application:activeWorkspaceDocument() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
66 print("active_workspace_document name", active_workspace_document:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
67 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
68 local active_workspace_document_projects = active_workspace_document:projects() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
69 local xcode_project = nil |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
70 for i=1, #active_workspace_document_projects do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
71 print("active_workspace_document_projects " .. active_workspace_document_projects[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
72 if tostring(active_workspace_document_projects[i]:name()) == "ratatouille" then |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
73 xcode_project = active_workspace_document_projects[i] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
74 print("xcode_project set", xcode_project) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
75 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
76 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
77 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
78 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
79 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
80 local xcode_project = active_project_document:project() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
81 -- print("xcode project, name ", xcode_project, xcode_project:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
82 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
83 local xcode_project_schemes = active_workspace_document:schemes() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
84 NSLog("schemes %@, %d", xcode_project_schemes, xcode_project_schemes:count()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
85 for i=1, #xcode_project_schemes do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
86 print("xcode_project_schemes " .. xcode_project_schemes[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
87 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
88 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
89 -- This could be a problem: activeSDK() is nil. Looks like an Apple bug. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
90 --print("activeSDK", xcode_project:activeSDK()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
91 -- I don't think we need to worry about setting the architexture since we build Universal (fat) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
92 --print("activeArchitecture", xcode_project:activeArchitecture()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
93 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
94 -- I'm unclear on buildConfigurations vs buildConfigurationTypes |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
95 -- I don't think we need to use buildConfigurations |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
96 --[[ |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
97 local array_of_build_configurations = xcode_project:buildConfigurations() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
98 for i=1, #array_of_build_configurations do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
99 print("buildConfigurations[:".. tostring(i) .. "]" .. array_of_build_configurations[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
100 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
101 --]] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
102 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
103 local array_of_build_configuration_types = xcode_project:buildConfigurationTypes() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
104 for i=1, #array_of_build_configuration_types do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
105 print("buildConfigurationType[".. tostring(i) .. "]" .. array_of_build_configuration_types[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
106 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
107 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
108 local array_of_executables = xcode_project:executables() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
109 for i=1, #array_of_executables do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
110 print("executables[".. tostring(i) .. "]" .. array_of_executables[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
111 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
112 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
113 local array_of_targets = xcode_project:targets() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
114 local active_target = xcode_project:activeTarget() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
115 for i=1, #array_of_targets do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
116 print("targets[".. tostring(i) .. "]" .. array_of_targets[i]:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
117 -- Watch out: __eq (==) always returns false for different types. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
118 local the_name = array_of_targets[i]:name() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
119 -- if the_name:isEqualToString_("rttplayer-all") then |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
120 if tostring(the_name) == "rttplayer-all" then |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
121 active_target = array_of_targets[i] |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
122 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
123 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
124 xcode_project:setActiveTarget_(active_target) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
125 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
126 local build_configuration_type = xcode_project:activeBuildConfigurationType() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
127 print("config type", xcode_project:activeBuildConfigurationType():name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
128 -- print("Bypass") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
129 ret_string = xcode_project:buildStaticAnalysis_transcript_using_(false, false, build_configuration_type) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
130 -- xcode_project:launch() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
131 print("Bypass2") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
132 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
133 active_workspace_document:buildStaticAnalysis_transcript_using_(false, false, build_configuration_type) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
134 -- active_workspace_document:debug() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
135 do |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
136 return |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
137 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
138 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
139 --print("config type", xcode_project:activeBuildConfigurationType():name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
140 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
141 -- You are not allowed to create a new instance of XcodeBuildConfigurationType |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
142 -- Instead, you must use an object returned from the system. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
143 -- It appears you cannot use copy or mutableCopy as they throw exceptions. |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
144 -- XcodeBuildConfigurationType = NSClassFromString("XcodeBuildConfigurationType") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
145 -- local build_configuration_type = XcodeBuildConfigurationType:alloc():init() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
146 -- copy and mutableCopy throw exceptions |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
147 local build_configuration_type = xcode_project:activeBuildConfigurationType() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
148 build_configuration_type:setName_("Release") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
149 xcode_project:setActiveBuildConfigurationType_(build_configuration_type) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
150 print("config type", xcode_project:activeBuildConfigurationType():name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
151 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
152 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
153 local active_executable = xcode_project:activeExecutable() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
154 print(active_executable, active_executable:name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
155 active_executable:setName_("rttplayer-all") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
156 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
157 print("ActiveTarget:", xcode_project:activeTarget():name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
158 print("ActiveExecutable:", xcode_project:activeExecutable():name()) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
159 ret_string = xcode_project:buildStaticAnalysis_transcript_using_(false, false, build_configuration_type) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
160 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
161 -- local build_configuration_type = |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
162 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
163 print(ret_string) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
164 print("launching...") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
165 -- Refetch the object just in case since we tried changing it |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
166 active_executable = xcode_project:activeExecutable() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
167 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
168 -- launch() doesn't seem to actually work. We must use debug() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
169 -- local ret_string = active_executable:launch() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
170 local ret_string = active_executable:debug() |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
171 print(ret_string) |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
172 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
173 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
174 else |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
175 print("Xcode not available") |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
176 end |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
177 |
fdcbf6da59ec
Added non-working Xcode 4 scripting bridge script as a reference.
Eric Wing <ewing@anscamobile.com>
parents:
diff
changeset
|
178 |