Skip to content

Move external dependencies to Dependencies group in Xcode project #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2016

Conversation

bhargavg
Copy link
Contributor

  • Create Dependencies group in project
  • Move all external dependencies from Source to Dependencies group
  • Differentiate source packages & modules from external dependencies
  • Rebase and resolve conflicts
  • Refactor code
  • Add test cases

@bhargavg bhargavg force-pushed the dependencies-pbxgroup branch 2 times, most recently from 0d6c64c to e7623f6 Compare March 11, 2016 23:22
let rootGroupReference = "_____RootGroup_"
let productsGroupReference = "______Products_"
let sourcesGroupReference = "_______Sources_"
let dependenciesGroupReference = "__Dependencies_"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not a requirement to have a _ prefix, so this diff can probably be less.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed and minimized the diff.

@bhargavg
Copy link
Contributor Author

@mxcl how are we planning to test the generated xcodeproj?

As @modocache mentioned in #174 (comment), are we going to build the targets to check whether everything is working? or do you have any thing in mind?

@mxcl
Copy link
Contributor

mxcl commented Mar 11, 2016

I'm not sure there is anything really good we can do for testing here (within a reasonable amount of development time), keeping in mind that Xcode itself tests for a great many configurations.

So I think what we will do is run an xcodebuild test for debug and release on a few Fixtures,

@bhargavg bhargavg force-pushed the dependencies-pbxgroup branch from 9c570f1 to d56f343 Compare March 12, 2016 08:46
@bhargavg bhargavg changed the title [WIP] Move external dependencies to Dependencies group in Xcode project Move external dependencies to Dependencies group in Xcode project Mar 12, 2016
@bhargavg
Copy link
Contributor Author

Squashed and rebased. Please review.

public var dependencies: [Package] = []
public let manifest: Manifest

public init(manifest: Manifest, url: String) {
public init(manifest: Manifest, url: String, isSourcePackage: Bool = false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rootPackage makes more sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're standardizing on the name “root package”.

Aside: I think there is a better name that can be found.

But we can correct this later.

@bhargavg bhargavg force-pushed the dependencies-pbxgroup branch from d56f343 to 5e10280 Compare March 12, 2016 10:41
@mxcl
Copy link
Contributor

mxcl commented Mar 13, 2016

I don't want the notion of isExternalDependency to be part of PackageType this violates the responsibility boundary for this module.

Modules do not know these details about themselves. Instead this information should be passed to Xcodeproj.generate().

@bhargavg
Copy link
Contributor Author

I felt this information, ie., whether it is external package or root package, would be useful not only during Xcode project generation, but also in other places in future. That's why I've added the properties isExternalDependency and isSourcePackage and set them during get() phase.

Without these properties, we have to filter through the list of packages based on path to identify whether it is root package or dependency package.

I can remove these properties and use package paths for root/dependency package identification, but I feel these properties are not violating the responsibility boundaries of these modules.

@mxcl
Copy link
Contributor

mxcl commented Mar 14, 2016

Without these properties, we have to filter through the list of packages based on path to identify whether it is root package or dependency package.

This would also be bad, I'm not suggesting we infer the information, I'm suggesting that this information be passed differently, specifically my idea is that a Set<Module> be returned from transmute() which contains the set of packages that are external and this set be passed to other modules that need it.

@mxcl
Copy link
Contributor

mxcl commented Mar 14, 2016

Alternatively, the Package could have a modules property. Intuitively I expect people expect this, though at this point we are only designing for ourselves.

Anyway, do which ever you like, if you have the time, otherwise I'll get around to amending this PR eventually.

@bhargavg
Copy link
Contributor Author

specifically my idea is that a Set<Module> be returned from transmute() which contains the set of packages that are external and this set be passed to other modules that need it.

Sorry, I didn't get you. Could you please explain?

As of now transmute() is returning modules (root + external + test) and Products, how can we make it to return a Set<Module> and be able to identify which modules are root modules and which ones are external?

@mxcl
Copy link
Contributor

mxcl commented Mar 17, 2016

public func transmute(packages: [Package], rootdir: String) throws -> ([Module], [Product]) {

to

public func transmute(packages: [Package], rootPackage: Package) throws -> ([Module], [Product], externalModules: Set<Module>) {

But this might not be the best way to do it, certainly it is ugly, but it will suffice for now until I get round to refactoring it.

@bhargavg bhargavg force-pushed the dependencies-pbxgroup branch from 5e10280 to 5cd0b68 Compare March 18, 2016 20:38
@bhargavg
Copy link
Contributor Author

@mxcl Made the changes as per your previous comment. Please review.

var set = Set<Module>()
var stack = packages.flatMap{ map[$0] ?? [] }
var modules = [Module]()
let depPackages = packages.filter{ $0.path != rootdir }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me a little uncomfortable with this, it seems fragile. We should explicitly pass in the root package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Refactored get() to return source package and dependency packages separately.

@mxcl
Copy link
Contributor

mxcl commented Mar 18, 2016

Great, better even than I suggested. Thanks.

@bhargavg
Copy link
Contributor Author

Could you please run CI on this?

@mxcl
Copy link
Contributor

mxcl commented Mar 22, 2016

@swift-ci Please test

@bhargavg
Copy link
Contributor Author

@mxcl, All the tests've passed. Could you please review and merge this?

@kostiakoval
Copy link
Contributor

@bhargavg Conflicts

@bhargavg bhargavg force-pushed the dependencies-pbxgroup branch from e3dafed to 9d56b9a Compare March 23, 2016 19:11
@bhargavg
Copy link
Contributor Author

Rebased and resolved the conflicts.

@mxcl
Copy link
Contributor

mxcl commented Mar 23, 2016

@swift-ci Please test

@bhargavg
Copy link
Contributor Author

All tests passed, Could someone please merge this.

@mxcl mxcl merged commit 2c588fd into swiftlang:master Mar 24, 2016
@mxcl
Copy link
Contributor

mxcl commented Mar 24, 2016

Sorry, I wanted to try it out on a few packages first. Looks good, code-wise and result-wise.

aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
[Xcode] Add an easy way to enable code signing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants