googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.22k stars 339 forks source link

Resource bundles not linked when adding pod dependency to UnityFramework target #333

Open santoshbagadi opened 4 years ago

santoshbagadi commented 4 years ago

Please fill in the following fields:

Unity editor version: 2019.3.3f Play Services Resolver version: 1.2.136 (1.2.129+) Features in Play Services Resolver in use (Android Resolver, iOS Resolver, VersionHandler, etc.): iOS Resolver Plugins SDK in use (Firebase, Admob, Facebook, etc.): AppLovin MAX Unity Plugin Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac Platform you are targeting (iOS, Android, and/or desktop): iOS Scripting Runtime (Mono, and/or IL2CPP): Mono

Please describe the issue here:

Starting from 2019.3+ Unity has added a new target (UnityFramework) to the exported project and JAR Resolver (starting 1.2.129, Related Issue: https://github.com/googlesamples/unity-jar-resolver/issues/282) always adds the dependencies to this target. This has an unintended side effect of the resource bundles not being linked to the main target. Cocoapods is correctly adding these bundles to the UnityFramework but they are not being linked to the main target.

Adding the pod dependency directly to the Unity-iPhone target fixes this issue, but currently there is no way to specify the target to which the framework needs to be added to JAR Resolver.

Please answer the following, if applicable:

What's the issue repro rate? (eg 100%, 1/5 etc) 100%

It would be great if you could provide the ability to specify the desired target in the Dependencies file under the iosPod tag.

stewartmiles commented 4 years ago

Yeah, sounds like a good idea to expose the Cocoapod target in the Dependencies file. We're happy to take pull requests. The Pod class is populated in IOSXmlDependencies .Read and the Podfile is generated in GenPodfile.

santoshbagadi commented 4 years ago

Cool, I've been trying to set up my environment to get this project running but I'm having some trouble. Is there a writeup on how to setup this project and any suggestions on an IDE to use.

stewartmiles commented 4 years ago

@santoshbagadi I just hack in emacs for source editing TBH, other folks use Mono Develop, Visual Studio for source editing.

The build doesn't really work through an IDE though, you need to build following these instructions: https://github.com/googlesamples/unity-jar-resolver#building-from-source

santoshbagadi commented 4 years ago

Ohk, thanks! I started editing using Sublime, but wanted to double check that I was not missing something and/or making it harder on myself by not using an IDE.

stewartmiles commented 4 years ago

@santoshbagadi yeah no probs.

santoshbagadi commented 4 years ago

@stewartmiles I noticed that when reading an existing PodFile, right now the resolver is only getting pods within Unity-iPhone target. But they should be read from UnityFramework target as well right? Just wanted to make sure it is a legit bug. If so, I can add a fix in my PR.

stewartmiles commented 4 years ago

@santoshbagadi that does sound like a bug, nice catch.

stewartmiles commented 4 years ago

I guess part of the fun here is regenerating the podfile to make sure pods are added to the correct target they were parsed from.

santoshbagadi commented 4 years ago

Yeah, definitely. I'll update the PR accordingly

santoshbagadi commented 4 years ago

Updated the PR with the necessary changes.

santoshbagadi commented 4 years ago

Thanks for merging the PR @stewartmiles ! Just wanted to check if you could provide any timeline on when these changes would be released.

stewartmiles commented 4 years ago

We have a load of other stuff staged internally that needs to be finalized so I'm hoping we can push an update next week.

rdominic commented 4 years ago

Hey @stewartmiles - I see the changes were reverted, I assume this will reappear in another release?

stewartmiles commented 4 years ago

If someone wants to have another try at the pull request that doesn't cause a regression we're happy to try it out again. At the moment though this is pretty low priority for us at it doesn't really affect any of our plugins.

santoshbagadi commented 4 years ago

@stewartmiles , I can try and give it another try if you would be able to provide me more information as to what the exact regression that this change is causing.

stewartmiles commented 4 years ago

@chkuang-g you found the regression could you write up the details?

chkuang-g commented 4 years ago

As described in https://github.com/googlesamples/unity-jar-resolver/commit/df59a8232b602a1368b73b2a2a4794caada1a7a1

  1. GetXcodeTargetGuids() throws exception due to "Unity-iPhone" target being deprecated. https://github.com/googlesamples/unity-jar-resolver/blob/master/source/IOSResolver/src/IOSResolver.cs#L1686
  2. Generating "Unity-iPhone" target in Podfile with no pod by default. This is causing Firebase testapps failed with iOS build. Ex. Remote Config When a package ships Dependencies.xml with no custom target, "Unity-iPhone" target with no pod related to it in Podfile can cause issue.
santoshbagadi commented 4 years ago

@chkuang-g Thanks for the details!

  1. That line already exists and should only run on 2019_3 or newer (multiple targets enabled). So I don't see how that could be an issue.
  2. Actually, just having an empty Unity-iPhone target in the Podfile is fixing this issue of not being able to link the resource bundles. I don't exactly know why that is the case, seems like a weird interaction between multiple targets and CocoaPods. So, I feel like this should be the intended behavior.