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

[Suggestion] Facilitate the installation using CocoaPods #129

Closed
fjtrujy opened this issue Apr 10, 2019 · 8 comments
Closed

[Suggestion] Facilitate the installation using CocoaPods #129

fjtrujy opened this issue Apr 10, 2019 · 8 comments

Comments

@fjtrujy
Copy link

fjtrujy commented Apr 10, 2019

Hello,
First of all, I would like to thank you for this amazing project.
This thread is just to ask your opinion about this idea.

When we want to make use of the InjectionIII, following the instructions we need to put in the AppDelegate:

#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#endif

As you know, usually devs work within team, so we have several guys working under the same Project/repository.

Having in mind that the path of the bundle(s) are inside of the InjectionIII.app, if we want to add these lines in the repository, it forces to rest of the guys to have the InjectionIII.app exactly in the same folder/path.
This is quite unflexible, my idea is to have these bundles in a separate pod, it obviously will require as well the use of the InjectionII.app, but won't matter where it is physically locatted.

On the other hand, I think that it also will help to have several versions of the bundles installed in different projects, and to have the dependency of the bundles at the repository level and not at the OS level.

In general, I would like to do the next steps to use your amazing tool in my projects.

  1. Add in the Podfile
    pod InjectionIII

  2. Add in the AppDelegate

#if DEBUG
import "InjectionIII"
#endif

and then in the applicationDidFinishLaunching

#if DEBUG
InjectionIII.iOSBundle()
InjectionIII.tvOSBundle()
InjectionIII.macOSBundle()
#endif
  1. Finally, just run the InjectionII app

In this way, we can fully separate the bundle that we load in the iOS/tvOS/macOS project to the InjectionIII.app

What do you think about this idea?
I'm more than happy to collaborate.

Thanks in advance

PS: You can take a look at how Fabrichttps://docs.fabric.io/apple/fabric/overview.html does it.
It has from one side libraries added in the project using CocoaPods, and then finally an additional Betahttps://docs.fabric.io/apple/beta/overview.html that performs as an Xcode plugin.

@fjtrujy fjtrujy changed the title [Suggestion] Facilitate the installation using with CocoaPods [Suggestion] Facilitate the installation using CocoaPods Apr 10, 2019
@johnno1962
Copy link
Owner

Hi there, It’s a good suggestion that I’m sure many would agree with. Ideally the code in the Pod would work out the architecture and injectionBundle name from the Swift version. If you want to have a go creating a pod and publishing it we can publicise it.

@fjtrujy
Copy link
Author

fjtrujy commented Apr 10, 2019

Perfect!
I will keep this thread open to track my advances.

Thanks

@fjtrujy
Copy link
Author

fjtrujy commented Apr 18, 2019

Hello @johnno1962 ,
Do you know why are you compiling the bundles using Debug configuration? Or maybe you are compiling them using a different way?

I'm speaking about the latest build phase that is executed in the InjectionIII target in the Project

SYMROOT=/tmp/Injection
export PLATFORM_DIR_OS=$DEVELOPER_DIR/Platforms/iPhoneSimulator.platform &&
"$DEVELOPER_BIN_DIR"/xcodebuild SYMROOT=$SYMROOT PRODUCT_NAME=iOSInjection LD_RUNPATH_SEARCH_PATHS="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator $PLATFORM_DIR_OS/Developer/Library/Frameworks @loader_path/Frameworks" -arch x86_64 -sdk iphonesimulator -config Debug -target InjectionBundle &&
/Applications/Xcode101.app/Contents/Developer/usr/bin/xcodebuild SYMROOT=/tmp/Injection10 PRODUCT_NAME=iOSInjection10 LD_RUNPATH_SEARCH_PATHS="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator $PLATFORM_DIR_OS/Developer/Library/Frameworks @loader_path/Frameworks" -arch x86_64 -sdk iphonesimulator -config Debug -target InjectionBundle &&
rsync -au $SYMROOT/Debug-iphonesimulator/iOSInjection.bundle /tmp/Injection10/Debug-iphonesimulator/iOSInjection10.bundle "$CODESIGNING_FOLDER_PATH/Contents/Resources" &&
export PLATFORM_DIR_OS=$DEVELOPER_DIR/Platforms/AppleTVSimulator.platform &&
"$DEVELOPER_BIN_DIR"/xcodebuild SYMROOT=$SYMROOT PRODUCT_NAME=tvOSInjection LD_RUNPATH_SEARCH_PATHS="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator $PLATFORM_DIR_OS/Developer/Library/Frameworks @loader_path/Frameworks" -arch x86_64 -sdk appletvsimulator -config Debug -target InjectionBundle &&
/Applications/Xcode101.app/Contents/Developer/usr/bin/xcodebuild SYMROOT=/tmp/Injection10 PRODUCT_NAME=tvOSInjection10 LD_RUNPATH_SEARCH_PATHS="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator $PLATFORM_DIR_OS/Developer/Library/Frameworks @loader_path/Frameworks" -arch x86_64 -sdk appletvsimulator -config Debug -target InjectionBundle &&
rsync -au $SYMROOT/Debug-appletvsimulator/tvOSInjection.bundle /tmp/Injection10/Debug-appletvsimulator/tvOSInjection10.bundle "$CODESIGNING_FOLDER_PATH/Contents/Resources" &&
export PLATFORM_DIR_OS=$DEVELOPER_DIR/Platforms/MacOS.platform &&
/Applications/Xcode101.app/Contents/Developer/usr/bin/xcodebuild SYMROOT=/tmp/Injection10 PRODUCT_NAME=macOSInjection10 LD_RUNPATH_SEARCH_PATHS="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator $PLATFORM_DIR_OS/Developer/Library/Frameworks @loader_path/Frameworks" -arch x86_64 -config Debug -target InjectionBundle &&
rsync -au /tmp/Injection10/Debug/macOSInjection10.bundle "$CODESIGNING_FOLDER_PATH/Contents/Resources" &&
find $CODESIGNING_FOLDER_PATH/Contents/Resources/*.bundle -name '*.h' -delete

Finally, you are always choosing the arch x86_64, does it mean that can just be executed in simulators? is this for a specific reason?

Thanks

@johnno1962
Copy link
Owner

johnno1962 commented Apr 19, 2019

I think you'll find it difficult putting all of the injectionBundle inside the pod. What I was thinking of was just a snippet of code to load the injection bundle from the app bundle taking into account the OS, swift compiler version etc. There is no particular reason Debug configuration is used. arch x86_64 is required for the simulator.

@fjtrujy
Copy link
Author

fjtrujy commented Apr 19, 2019

Hello @johnno1962 ,
Is not too difficult at all, the main problem that I'm suffering right now is the mixing Swift and Objective-C under the same pod.

The bundle is composed of just 7 different files (classes).
Right now I'm migrating to swift the SimpleSocket.mm, I will try to split it in several PR to make easier the review.

Finally another question, any particular reason why did you implement your own Socket?

Thanks.

@johnno1962
Copy link
Owner

johnno1962 commented Apr 19, 2019

Hi @fjtrujy, not sure I'd be happy if you tried to put all the InjectionBundle into a pod. It would create problems distributing and i'm sure you'll find it difficult (Xprobe?). Injection has it's own socket layer as it's a little unusual in that the clients app connects to the macOS app which then pushes to the client app which is an unusual paradigm. It's written in Objective-C as socket programming in Swift is more difficult than it needs to be.

@fjtrujy
Copy link
Author

fjtrujy commented Apr 22, 2019

Hello @johnno1962 ,

I have finished most part of the work, at the end is not going to be needed to rewrite any class to swift.
I'm going to create the PR ASAP.

However, I think that there are a lot of things in the project that could be improved, this is a separate topic but I would like to discuss with you as well.
For now, I have just changed the minimum things as possible.

Thanks

@fjtrujy
Copy link
Author

fjtrujy commented Apr 22, 2019

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

No branches or pull requests

2 participants