Commits

James Dumay  committed f644d69 Merge

merge in workspace and scheme feature

  • Participants
  • Parent commits 4075d1d, dbcccc5

Comments (0)

Files changed (5)

File src/main/java/com/atlassian/bamboo/plugins/xcode/build/XCodeConfigurator.java

     public static final String SDK = "label";
     public static final String CLEAN = "clean";
     public static final String PROJECT = "projectname";
+    public static final String WORKSPACE = "workspacename";
+    public static final String SCHEME = "schemename";
     public static final String WORKING_SUB_DIR = "workingSubDirectory";
     public static final String ENVIRONMENT = "environmentVariables";
     public static final String OCUNIT = "ocunit";
             .add(ALL_TARGETS)
             .add(CONFIGURATION)
             .add(PROJECT)
+            .add(WORKSPACE)
+            .add(SCHEME)
             .add(SDK)
             .add(CLEAN)
             .add(WORKING_SUB_DIR)
                 errorCollection.addError(APP_PATH, textProvider.getText("xcode.app_path.error"));
             }
         }
+
+        if (StringUtils.isNotEmpty(params.getString(WORKSPACE)) && StringUtils.isEmpty(params.getString(SCHEME)))
+        {
+            errorCollection.addError(SCHEME, textProvider.getText("xcode.scheme.error"));
+        }
+        
     }
 
     @NotNull

File src/main/java/com/atlassian/bamboo/plugins/xcode/build/XCodeTaskType.java

         {
             final ConfigurationMap configurationMap = taskContext.getConfigurationMap();
             final String project = configurationMap.get(XCodeConfigurator.PROJECT);
+            final String workspace = configurationMap.get(XCodeConfigurator.WORKSPACE);
+            final String scheme = configurationMap.get(XCodeConfigurator.SCHEME);
             final boolean shouldClean = configurationMap.getAsBoolean(XCodeConfigurator.CLEAN);
             final File workingDirectory = taskContext.getWorkingDirectory();
             if (shouldClean)
                     arguments.add(project);
                 }
 
+                if (StringUtils.isNotEmpty(workspace))
+                {
+                    arguments.add("-workspace");
+                    arguments.add(workspace);
+                }
+
+                if (StringUtils.isNotEmpty(scheme))
+                {
+                    arguments.add("-scheme");
+                    arguments.add(scheme);
+                }
+
                 arguments.add(XCodeBuild.XCODEBUILD_ARG_CLEAN);
 
                 resultBuilder.checkReturnCode(processService.executeProcess(taskContext, new ExternalProcessBuilder()
                 arguments.add(project);
             }
 
-            if (buildAllTargets)
+            if (StringUtils.isNotEmpty(workspace))
             {
-                arguments.add("-alltargets");
+                arguments.add("-workspace");
+                arguments.add(workspace);
             }
-            else if (StringUtils.isNotEmpty(target))
+
+            if (StringUtils.isNotEmpty(scheme))
             {
-                arguments.add("-target");
-                arguments.add(target);
+                arguments.add("-scheme");
+                arguments.add(scheme);
+            }
+
+            if (StringUtils.isEmpty(scheme))
+            {
+                if (buildAllTargets)
+                {
+                    arguments.add("-alltargets");
+                }
+                else if (StringUtils.isNotEmpty(target))
+                {
+                    arguments.add("-target");
+                    arguments.add(target);
+                }
             }
 
             if (StringUtils.isNotEmpty(configuration))

File src/main/resources/com/atlassian/bamboo/plugins/xcode/build/editXcodeTask.ftl

 
 [@ww.checkbox labelKey="xcode.clean" name="clean"/]
 [@ww.textfield labelKey='xcode.project' name='projectname' cssClass="long-field"/]
+[@ww.textfield labelKey='xcode.workspace' name='workspacename' cssClass="long-field"/]
+[@ww.textfield labelKey='xcode.scheme' name='schemename' cssClass="long-field"/]
 
 [@ww.checkbox labelKey="xcode.buildall" name="alltargets"/]
 [@ui.bambooSection dependsOn='alltargets']

File src/main/resources/com/atlassian/bamboo/plugins/xcode/build/viewXcodeTask.ftl

 [@ww.label labelKey='xcode.sdk' name='label' /]
 [@ww.label labelKey='xcode.project' name='projectname' hideOnNull='true' /]
+[@ww.label labelKey='xcode.workspace' name='workspacename' hideOnNull='true' /]
+[@ww.label labelKey='xcode.scheme' name='schemename' hideOnNull='true' /]
 
 [#if alltargets == 'true']
     [@ww.label labelKey="xcode.target" value='This Task will build all targets' /]

File src/main/resources/i18n.properties

 xcode.project = Project
 xcode.project.description = Name of the Xcode Project to build
 
+xcode.workspace = Workspace
+xcode.workspace.description = Name of the Xcode Workspace to build. First ensure that you share the workspace within Xcode otherwise the build may fail with an error.
+
+xcode.scheme = Scheme
+xcode.scheme.description = Name of the Xcode Scheme to build. Required when using a workspace.
+xcode.scheme.error = If you specify a Workspace then you must also specify a Scheme. 
+
 xcode.buildall = Build all Targets?
 xcode.buildall.description = Do you want to build all targets in the Xcode project?