unity-jar-resolver icon indicating copy to clipboard operation
unity-jar-resolver copied to clipboard

Resource bundles not linked when adding pod dependency to UnityFramework target

Open santoshbagadi opened this issue 4 years ago • 18 comments

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.

santoshbagadi avatar Mar 06 '20 02:03 santoshbagadi

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.

stewartmiles avatar Mar 06 '20 16:03 stewartmiles

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.

santoshbagadi avatar Mar 09 '20 19:03 santoshbagadi

@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

stewartmiles avatar Mar 09 '20 22:03 stewartmiles

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.

santoshbagadi avatar Mar 09 '20 22:03 santoshbagadi

@santoshbagadi yeah no probs.

stewartmiles avatar Mar 09 '20 22:03 stewartmiles

@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.

santoshbagadi avatar Mar 10 '20 01:03 santoshbagadi

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

stewartmiles avatar Mar 10 '20 16:03 stewartmiles

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.

stewartmiles avatar Mar 10 '20 16:03 stewartmiles

Yeah, definitely. I'll update the PR accordingly

santoshbagadi avatar Mar 10 '20 17:03 santoshbagadi

Updated the PR with the necessary changes.

santoshbagadi avatar Mar 11 '20 03:03 santoshbagadi

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

santoshbagadi avatar Mar 12 '20 18:03 santoshbagadi

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.

stewartmiles avatar Mar 12 '20 18:03 stewartmiles

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

rdominic avatar Mar 26 '20 14:03 rdominic

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.

stewartmiles avatar Mar 26 '20 17:03 stewartmiles

@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.

santoshbagadi avatar Mar 27 '20 05:03 santoshbagadi

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

stewartmiles avatar Mar 27 '20 16:03 stewartmiles

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.

chkuang-g avatar Mar 27 '20 17:03 chkuang-g

@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.

santoshbagadi avatar Apr 14 '20 21:04 santoshbagadi