Skip to content
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

Release 2.0 #11

Merged
merged 26 commits into from Feb 19, 2017
Merged

Release 2.0 #11

merged 26 commits into from Feb 19, 2017

Conversation

tkohout
Copy link
Member

@tkohout tkohout commented Jan 29, 2017

  • Updated Swinject to 2.0
  • Migrated to new swinject
  • Resolved Mistaking too many initialiser arguments for a tuple #2 Added warnings when
    • fails to resolve service with optional dependencies
    • fails to resolve service with implicitly unwrapped dependencies
    • fails to resolve service with more than maximum supported number of dependencies
    • trying to register service with same type of dynamic arguments
  • Added assert tests Testing asserts #6
  • Added swift package manager Swift PM support? #9

.travis.yml Outdated
- env: JOB="POD_LINT"
script:
- pod lib lint
- env: JOB="XCODE" DEST="OS=8.4,name=iPhone 5" SCHEME="SwinjectAutoregistration-iOS" SDK="iphonesimulator" ACTION="test"
Copy link
Member

Choose a reason for hiding this comment

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

Changing the device to iPhone 5s looks ok to fix the error on Travis with Nimble.
https://travis-ci.org/Swinject/SwinjectAutoregistration/jobs/196326139

DEST="OS=8.4,name=iPhone 5s" 

@yoichitgy
Copy link
Member

It looks good to run Carthage command with --use-submodules option to add dependencies as git submodules not to commit files of Swinject, Quick and Nimble to this repository. It's easier to review a pull request without those library files.

@tkohout, using the option is ok for you?

@jakubvano
Copy link
Member

jakubvano commented Feb 1, 2017

👍 Good job guys on 2.0 release!

@yoichitgy Is there a benefit of having carthage dependencies included as submodules and subprojects as opposed to just linked frameworks (not pushed in repo)? I suspect that when you have both Swinject and SwinjectAutoregistration in project Cartfile, this causes carthage effectively build Swinject twice (once as a carthage dependency, once as a subproject in SwinjectAutoregistration), and also might be causing Swinject#184.

@yoichitgy
Copy link
Member

Thanks @jakubvano for pointing out the issue👍👍👍 It looks good not to commit submodules.

Or maybe users should add only SwinjectAutoregistration to Cartfile to install both SwinjectAutoregistration and Swinject??? For example, installation guide of ReactiveCocoa tells to add only ReactiveCocoa to Cartfile to install with ReactiveSwift. Are you familiar with this idea?

I'm going to try some experiments.

@jakubvano
Copy link
Member

I get what you mean, but this approach would not cover the case when you use more than one Swinject extension (e.g. SwinjectAutoregistration and SwinjectStoryboard).

@yoichitgy
Copy link
Member

I agree. My approach doesn't fit in the case using more than a Swinject extension. I'm going to have some experiment as @jakubvano said.

@yoichitgy
Copy link
Member

yoichitgy commented Feb 11, 2017

I started adding depending projects to a project because of this issue:
Swinject/Swinject#40

For example, Quick and Nimble were added as projects, not prebuilt frameworks. In the same way, I added Swinject project to SwinjectStoryboard and SwinjectPropertyLoader.

The original issue looked already resolved, so we have no reasons to add depending projects. As @jakubvano told, we can just add frameworks built by Carthage, and depending projects can be removed from the repository.

@yoichitgy
Copy link
Member

I made the migration to prebuilt frameworks in the following branch. I think it should be in another pull request, so that I'm going to just review this current pull request.
https://github.com/Swinject/SwinjectAutoregistration/tree/migrate-to-prebuilt-frameworks

Copy link
Member

@yoichitgy yoichitgy left a comment

Choose a reason for hiding this comment

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

As my review, I added a comment about warnings to CheckResolved.swift.

Also I found unit test it("throws assertion when same type arguments are passed") failed only in case of tvOS target.

let unresolved = ( [a] as [Any?] ).filter { $0 == nil }
if unresolved.count > 0 {
let warningsMessage = warnings(forInitializer: initializer).map { "\($0.message)\n" }.joined()
fatalError("SwinjectAutoregistration: Resolution failed.\n\(warningsMessage)Unresolved service: \(unresolvedService(a)!)\nInitializer: (\(A.self)) -> \(Service.self)")
Copy link
Member

Choose a reason for hiding this comment

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

If this is just a warning message, shouldn't this be print or NSLog? The other warnings in this file are the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well the warnings describe what caused that the service was unresolved: Something like:

⚠ Autoregistration of implicitly unwrapped optional dependency (DependencyA)! is not supported. Use regular `register` method. 

And if i would just print them before the fatalError they might have been overlooked

Copy link
Member Author

Choose a reason for hiding this comment

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

The tvOS throw assertion fail is fixed

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for fixing the tvOS issue!

[nits] This is just a tiny thing, but if warningMessage is used for fatalError naming the parameter errorMessage sounds less misunderstandable. Maybe related parameter names also sound good with "error"😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I refactored the code to address your notes.

Copy link
Member

@yoichitgy yoichitgy left a comment

Choose a reason for hiding this comment

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

Thank you for accepting my feedback😃🐶☀️

@yoichitgy yoichitgy merged commit 2cbec03 into master Feb 19, 2017
@yoichitgy yoichitgy deleted the release2.0 branch February 19, 2017 05:06
@yoichitgy
Copy link
Member

I think we can release v2.0.0 now.

My changes to migrate to prebuilt frameworks can be released as v2.1 or v2.0.1 because the changes are not considered as breaking changes.
https://github.com/Swinject/SwinjectAutoregistration/tree/migrate-to-prebuilt-frameworks

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.

Mistaking too many initialiser arguments for a tuple
4 participants