You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/08/31 21:27:25 UTC

ios commit: CB-11788 - Change create and build scripts to use .xcworkspace

Repository: cordova-ios
Updated Branches:
  refs/heads/master 2085ab927 -> 8aabb2c3d


CB-11788 - Change create and build scripts to use .xcworkspace

 This closes #247


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/8aabb2c3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/8aabb2c3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/8aabb2c3

Branch: refs/heads/master
Commit: 8aabb2c3d943048fd89ef313257b3cd90a90c053
Parents: 2085ab9
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Aug 31 11:46:49 2016 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Aug 31 14:23:54 2016 -0700

----------------------------------------------------------------------
 bin/lib/create.js                               | 11 ++-
 .../contents.xcworkspacedata                    |  7 ++
 .../xcschemes/__PROJECT_NAME__.xcscheme         | 91 ++++++++++++++++++++
 bin/templates/scripts/cordova/lib/build.js      | 14 +--
 4 files changed, 114 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8aabb2c3/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 7fa3ee7..276704e 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -112,9 +112,14 @@ function copyScripts(projectPath) {
 function copyTemplateFiles(project_path, project_name, project_template_dir, package_name) {
     var r = path.join(project_path, project_name);
 
-    shell.rm('-rf', path.join(project_path, project_name+'.xcodeproj'));
+    shell.rm('-rf', path.join(r+'.xcodeproj'));
     shell.cp('-rf', path.join(project_template_dir, '__TEMP__.xcodeproj'), project_path);
-    shell.mv('-f', path.join(project_path, '__TEMP__.xcodeproj'), path.join(project_path, project_name+'.xcodeproj'));
+    shell.mv('-f', path.join(project_path, '__TEMP__.xcodeproj'), path.join(r+'.xcodeproj'));
+
+    shell.rm('-rf', path.join(project_path, project_name+'.xcodeworkspace'));
+    shell.cp('-rf', path.join(project_template_dir, '__TEMP__.xcworkspace'), project_path);
+    shell.mv('-f', path.join(project_path, '__TEMP__.xcworkspace'), path.join(r+'.xcworkspace'));
+    shell.mv('-f', path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', '__PROJECT_NAME__.xcscheme'), path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', project_name+'.xcscheme'));
 
     shell.rm('-rf', r);
     shell.cp('-rf', path.join(project_template_dir, '__PROJECT_NAME__'), project_path);
@@ -137,6 +142,8 @@ function copyTemplateFiles(project_path, project_name, project_template_dir, pac
      */
     var project_name_esc = project_name.replace(/&/g, '\\&');
     shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r+'.xcodeproj', 'project.pbxproj'));
+    shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r+'.xcworkspace', 'contents.xcworkspacedata'));
+    shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', project_name +'.xcscheme'));
     shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'AppDelegate.h'));
     shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'AppDelegate.m'));
     shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'MainViewController.h'));

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8aabb2c3/bin/templates/project/__TEMP__.xcworkspace/contents.xcworkspacedata
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TEMP__.xcworkspace/contents.xcworkspacedata b/bin/templates/project/__TEMP__.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..a8b8bb4
--- /dev/null
+++ b/bin/templates/project/__TEMP__.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "group:__PROJECT_NAME__.xcodeproj">
+   </FileRef>
+</Workspace>

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8aabb2c3/bin/templates/project/__TEMP__.xcworkspace/xcshareddata/xcschemes/__PROJECT_NAME__.xcscheme
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TEMP__.xcworkspace/xcshareddata/xcschemes/__PROJECT_NAME__.xcscheme b/bin/templates/project/__TEMP__.xcworkspace/xcshareddata/xcschemes/__PROJECT_NAME__.xcscheme
new file mode 100644
index 0000000..e2f3cfe
--- /dev/null
+++ b/bin/templates/project/__TEMP__.xcworkspace/xcshareddata/xcschemes/__PROJECT_NAME__.xcscheme
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0730"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+               BuildableName = "__PROJECT_NAME__.app"
+               BlueprintName = "__PROJECT_NAME__"
+               ReferencedContainer = "container:__PROJECT_NAME__.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+            BuildableName = "__PROJECT_NAME__.app"
+            BlueprintName = "__PROJECT_NAME__"
+            ReferencedContainer = "container:__PROJECT_NAME__.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+            BuildableName = "__PROJECT_NAME__.app"
+            BlueprintName = "__PROJECT_NAME__"
+            ReferencedContainer = "container:__PROJECT_NAME__.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
+            BuildableName = "__PROJECT_NAME__.app"
+            BlueprintName = "__PROJECT_NAME__"
+            ReferencedContainer = "container:__PROJECT_NAME__.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/8aabb2c3/bin/templates/scripts/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/build.js b/bin/templates/scripts/cordova/lib/build.js
index c2d9b49..66eb4b2 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -81,7 +81,7 @@ module.exports.run = function (buildOpts) {
     }).then(function () {
         var configuration = buildOpts.release ? 'Release' : 'Debug';
 
-        events.emit('log','Building project: ' + path.join(projectPath, projectName + '.xcodeproj'));
+        events.emit('log','Building project: ' + path.join(projectPath, projectName + '.xcworkspace'));
         events.emit('log','\tConfiguration: ' + configuration);
         events.emit('log','\tPlatform: ' + (buildOpts.device ? 'device' : 'emulator'));
 
@@ -145,10 +145,10 @@ function getXcodeArgs(projectName, projectPath, configuration, isDevice) {
     if (isDevice) {
         xcodebuildArgs = [
             '-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
-            '-project', projectName + '.xcodeproj',
-            '-target', projectName,
+            '-workspace', projectName + '.xcworkspace',
+            '-scheme', projectName,
             '-configuration', configuration,
-            '-destination', 'platform=iOS',
+            '-destination', 'generic/platform=iOS',
             'build',
             'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'device'),
             'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')
@@ -156,11 +156,11 @@ function getXcodeArgs(projectName, projectPath, configuration, isDevice) {
     } else { // emulator
         xcodebuildArgs = [
             '-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
-            '-project', projectName + '.xcodeproj',
-            '-target', projectName ,
+            '-workspace', projectName + '.xcworkspace',
+            '-scheme', projectName ,
             '-configuration', configuration,
             '-sdk', 'iphonesimulator',
-            '-destination', 'platform=iOS Simulator',
+            '-destination', 'platform=iOS Simulator,name=iPhone 5s',
             'build',
             'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'emulator'),
             'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org