Xcodeproj icon indicating copy to clipboard operation
Xcodeproj copied to clipboard

Add method to duplicate existing target

Open mgrebenets opened this issue 11 years ago • 13 comments

Hi all.

It would be great to have duplicate method on PBXNativeTarget.

This would be handy when dealing with automated test, e.g. Calabash for iOS. Test team could pick up latest app from the repo, locate main app target and duplicate it into many other targets, for Calabash, MonkeyTalk, RevealApp or any other test-related stuff the developers shouldn't care about.

For example calabash-ios setup does this job, but it' snot using Xcodeproj.

The way I intend to use it is to get the latest app code first, then duplicate main target into a bunch of test-specific targets, then update Podfile to add custom frameworks and pods to newly created targets. And all that with a couple of cli commands, so it can be used on CI server as well.

mgrebenets avatar Jun 10 '13 14:06 mgrebenets

I can see some valid use cases for this, @mgrebenets if you are interested in this feature, will you submit a patch?

fabiopelosin avatar Oct 05 '13 13:10 fabiopelosin

Is there still demand for this?

fabiopelosin avatar Jul 22 '14 14:07 fabiopelosin

I am still using calabash-ios setup script. I wouldn't say there's real demand for it. Would be a "nice to have" feature.

mgrebenets avatar Jul 24 '14 03:07 mgrebenets

Hello, this would be really great. There is a demand to publish many different apps from a single code base.

DmitryPR avatar Aug 14 '14 10:08 DmitryPR

I am also interested on this. Any work around for now? what operations would need to be performed? maybe create a new target, then go through all properties of original target and assign them in the new one? Not sure if that will reference UDIDs that are target-only...

angelolloqui avatar Sep 24 '14 08:09 angelolloqui

Without verifying what Xcode actually does, some ideas are:

  • Create a new target
  • Duplicate the build settings from the previous target a set them
  • Duplicate each build phase (including each build file) and add it to the new target

fabiopelosin avatar Sep 25 '14 09:09 fabiopelosin

Hi! I am also interested in the duplication of targets. I'm currently looking into doing it manually with xcodeproj but having it do the hard work would be nice and probably safer.

carlosefonseca avatar Nov 19 '14 22:11 carlosefonseca

Here's a +1. I also have a use case of multiple targets from the same code base. It's not a huge time savings but would be nice to automate the effects of "command-D" (Duplicate) in Xcode.

owurman avatar Feb 24 '16 23:02 owurman

For what it's worth, I would love to have this too.

vittoriom avatar Mar 10 '16 12:03 vittoriom

Found this Gist courtesy of @ratazzi, might help people looking for this feature:

https://gist.github.com/ratazzi/f6d9217654d6605450a0

eggsy84 avatar Mar 27 '17 20:03 eggsy84

@fabiopelosin Of course, there are demand for this. It is a bothersome and recurrent task. Would save a lot of time for everybody if we have it. On top of that, this task is difficult to do correctly.

neofly avatar Jan 24 '18 17:01 neofly

Without verifying what Xcode actually does, some ideas are:

* Create a new target

* Duplicate the build settings from the previous target a set them

* Duplicate each build phase (including each build file) and add it to the new target

Would help a lot.

chuckSaldana avatar May 09 '19 21:05 chuckSaldana

@chuckSaldana PRs are welcomed :)

Given that this issue is 6 years old, it's not likely to be added unless someone who has a use for it takes the time to contribute the feature

amorde avatar May 10 '19 00:05 amorde