unity-jar-resolver
unity-jar-resolver copied to clipboard
[FR] Generate :podspec parameter in Podfile using iOSResolver XML?
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2019.4
- External Dependency Manager version: 1.2.165
- Source you installed EDM4U: .unitypackage (.unitypackage or Unity Package Manager)
- Features in External Dependency Manager in use: iOS Resolver (Android Resolver, iOS Resolver, VersionHandler, etc.)
- Plugins SDK in use: Firebase, Ironsource Mediation (Firebase, Admob, Facebook, etc.)
- Platform you are using the Unity editor on: Mac (Mac, Windows, or Linux)
[REQUIRED] Please describe the question here:
Hi, due to the need of using old AdMob version (v7.69), I am trying to modify a released Pod "IronSourceAdMobAdapter" so it can be compatible with a higher version of "IronSourceSDK". I have downloaded and edited "IronSourceAdMobAdapter.podspec.json" as below:
{
"name": "IronSourceAdMobAdapter",
"version": "4.3.19.4",
"summary": "AdMob Adapter",
"description": "Use this adapter to show AdMob ads",
"homepage": "http://www.is.com/",
"license": {
"type": "Commercial",
"text": "https://platform.ironsrc.com/partners/terms-and-conditions-new-user"
},
"authors": {
"IronSource": "http://www.is.com/contact/"
},
"source": {
"http": "https://raw.githubusercontent.com/ironsource-mobile/iOS-adapters/master/admob-adapter/4.3.19/ISAdMobAdapter4.3.19.zip"
},
"source_files": "ISAdMobAdapter/ISAdMobAdapter.framework/**/*.{h,m}",
"public_header_files": "ISAdMobAdapter/ISAdMobAdapter.framework/**/*.h",
"preserve_paths": "ISAdMobAdapter/ISAdMobAdapter.framework",
"platforms": {
"ios": "9.0"
},
"requires_arc": true,
"vendored_frameworks": "ISAdMobAdapter/ISAdMobAdapter.framework",
"dependencies": {
"IronSourceSDK": [
"= 7.1.6.1"
],
"Google-Mobile-Ads-SDK": [
"= 7.69.0"
]
}
}
Now it comes the tricky part. When I am trying to use "path" in Dependencies.xml , it didn't work as Cocoapods didn't try to get the "http" . However, when changing :path to :podspec in Podfile, it worked.
My question is, how do I generate the :podspec parameters using Dependencies.xml instead of having to edit Podfile manually? I tried as below but it didn't work.
<iosPods>
<iosPod name="IronSourceAdMobAdapter" podspec="./100/Data/Raw/IronSourceAdMobAdapter.podspec.json">
</iosPod>
</iosPods>
Thanks
I think what you are looking for is the sources tag, so it would look something like:
<iosPods>
<iosPod name="IronSourceAdMobAdapter">
<sources>
<source>"./100/Data/Raw/IronSourceAdMobAdapter.podspec.json"</source>
</sources>
</iosPod>
</iosPods>
For another example, see this sample: https://github.com/googlesamples/unity-jar-resolver/blob/30b4f9292db3bd11340883dd80872c9852ae70e3/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml#L82-L92
I'm not sure if that will work with a relative path, so you might need the full path. Please give it a try, and let us know if that solves the issue.
Thanks for the suggestion. I have tried using source tag . However, the result is not as expected:
The generated Podfile doesn't include :podspec option. It just leave the pod as empty, while adding some source at the top of the Podfile
source './100/Data/Raw/IronSourceAdMobAdapter.podspec.json'
...
pod 'IronSourceAdmobAdapter'
...
After doing pod install , pod doesn't understand the source
Unable to add a source with url `./100/Data/Raw/....
You can try adding it manually in `/Users/Admin/.cocoapods/repos` or via `pod repo add`
From my understanding, source is used to define a repo , not the podspec itself. To load a local podspec file, the Pod documentation says to use :podspec specifically for this scenario:
https://guides.cocoapods.org/syntax/podfile.html#pod
From a podspec outside a spec repository, for a library without podspec.
If a podspec is available from another source outside of the library’s repository. Consider, for instance, a podspec available via HTTP:
pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
Is there a way for me to set the :podspec parameter from iOSResolver XML ?
Thanks
Hi @camphongdinh
I actually tried you sample and path actually works. TL;DR; I think you might assume path is a relative path from the Assets folder but it is actually from the root of the project folder. See this doc. If 100/Data/Raw/IronSourceAdMobAdapter.podspec.json is under Assets folder, try to use path="Assets/100/Data/Raw/IronSourceAdMobAdapter.podspec.json" instead.
Here is my experiment that works:
- In an empty Unity project, I created
Assets/Editor/TestDependencies.xml<dependencies> <iosPods> <iosPods> <iosPod name="IronSourceAdMobAdapter" path="PodSpec/IronSourceAdMobAdapter.podspec.json"> </iosPod> </iosPods> </iosPods> </dependencies> - Then I created
PodSpec/IronSourceAdMobAdapter.podspec.jsonwith the content you gave in the original post. Note that this is relative path from the ROOT of the Unity project. - Build the project. It generated a
Podfilelike the following (I was using Unity 2017 BTW)
Also thetarget 'Unity-iPhone' do pod 'IronSourceAdMobAdapter', :path => '/Users/myusername/Workspace/Unity/EmptyProject/PodSpec/IronSourceAdMobAdapter.podspec.json' end use_frameworks!Podfile.lockis like the following:- IronSourceAdMobAdapter (4.3.19.4): - Google-Mobile-Ads-SDK (= 7.69.0) - IronSourceSDK (= 7.1.6.1)
Perhaps you can try to verify if your path is correct? Otherwise, could you post the content of your Podfile?
Hi @chkuang-g ,
Yes, the :path seems to work at first glance, and Podfile can generate Pods without errors. However, during testing, the IronSource Mediation didn't find the included AdMobAdapter. After looking around, I found that in the generated Pods.proj, those Pods that were used with :path is only empty Pods. You can open the .xcworkspace project to see the Pods.proj . It will look like this:
Pods.proj:
| -- Development Pods
| ------ IronSourceAdMobAdapter
| -------------
My assumption is that when using :path , Cocoapods assumes that all files of that Pod is included in the :path , so it doesn't download files from source -> http .
The ISAdmobAdapter.framework is actually inside the ISAdMobAdapter4.3.19.zip , in "source" -> "http":
...
"source": {
"http": "https://raw.githubusercontent.com/ironsource-mobile/iOS-adapters/master/admob-adapter/4.3.19/ISAdMobAdapter4.3.19.zip"
},
When trying with :podspec param, Cocoapods will fetch the podspec information from the IronSourceAdMobAdapter.podspec.json and print out these lines:
Fetching podspec for `IronSourceAdMobAdapter` from `/Volumes/Data/Users/Shared/...../Data/Raw/IronSourceAdMobAdapter.podspec.json`
This resulting a Pods.proj with complete structure:
Pods | -- Pods | ----- IronSourceAdMobAdapter | ---------- Frameworks | ---------------- ISAdMobAdapter.framework
This is the expected result . Without ISAdMobAdapter.framework , the generated Pod doesn't work.
Please let me know if you need further details. I will get more.
Thanks Phong
@camphongdinh
I see. Thanks for including extra details.
Seems like neither path and source would work for your case. EDM4U does not support podspec now but I think it should be pretty straightforward to add.
Basically:
- Add "podspec" here. ...and hey, that's it. That property should be automatically injected to Podfile here.
I will change this to FR. Feel free to send us a Pull Request and we can include this in the next release sooner. :)
@chkuang-g
Thank you for the fix!
In fact I am not quite familiar with Github Pull Request nor I have experience working with Github yet. Currently I am using the External Dependency Manager v1.2.165 , in which there is iOSResolver v1.2.165.dll . I guess I will be waiting for the next release of iOSResolver to use it then.
Thank you.
@chkuang-g
Hey I have made a Pull Request for this issue. I am unsure if all is fine though. Please verify it and let me know if changes are required then.
I would recommend you to build it locally by running the following command if you are using Mac.
./gradlew buildplugin
Make sure you setup UNITY_EXE in your environmental variable.
The build can be found under build/ folder.
You can test and use the local build in your project immediately and does not need to wait for the next release. :)
Thank you for the PR. I'll take a look in a bit.
@chkuang-g
Hi, I have tried to build locally on Windows and encounter this issue https://github.com/googlesamples/unity-jar-resolver/issues/423 . Seems like building the plugin on Windows is having bug at the moment.
My main workstation is Windows. It will take some time to get familiar with gradle on Mac. I will try to build it on Mac later then.
Thanks Phong
@chkuang-g
Hi, sorry for the late response. I am stuck in development recently. Here is a quick update on this.
I have tried to setup the build on Mac. After hitting ./gradlew buildplugin , there is one error I am not familiar with:
0:12:30.295 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
00:12:30.295 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command '/Applications/Unity/Hub/Editor/2018.4.26f1/Unity.app/Contents/Mono/bin/xbuild'.
00:12:30.300 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
00:12:30.300 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command '/Applications/Unity/Hub/Editor/2018.4.26f1/Unity.app/Contents/Mono/bin/xbuild''
00:12:30.300 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
00:12:30.423 [QUIET] [system.out] XBuild Engine Version 2.6.5.0
00:12:30.424 [QUIET] [system.out] Mono, Version 2.6.5.0
00:12:30.424 [QUIET] [system.out] Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2009.
00:12:30.797 [QUIET] [system.out]
00:12:30.802 [QUIET] [system.out] Build started 07/20/2021 00:12:30.
00:12:30.802 [QUIET] [system.out] __________________________________________________
00:12:30.803 [QUIET] [system.out] Project "/Users/Admin/Documents/GitHub/unity-jar-resolver/source/ExternalDependencyManager.sln" (VersionHandler target(s)):
00:12:30.803 [QUIET] [system.out]
00:12:30.820 [QUIET] [system.out] Target ValidateSolutionConfiguration:
00:12:30.837 [QUIET] [system.out]
00:12:30.838 [QUIET] [system.out] Target VersionHandler:
00:12:30.845 [QUIET] [system.out] Project "/Users/Admin/Documents/GitHub/unity-jar-resolver/source/VersionHandler/VersionHandler.csproj" (default target(s)):
00:12:30.846 [QUIET] [system.out]
00:12:30.846 [QUIET] [system.out] Target _ValidateEssentialProperties:
00:12:30.861 [QUIET] [system.out]
00:12:30.862 [QUIET] [system.out] Target PrepareForBuild:
00:12:30.867 [QUIET] [system.out]
00:12:30.867 [QUIET] [system.out] Target SplitProjectReferencesByExistent:
00:12:30.868 [QUIET] [system.out]
00:12:30.868 [QUIET] [system.out] Target ResolveProjectReferences:
00:12:30.868 [QUIET] [system.out]
00:12:30.869 [QUIET] [system.out] Target ResolveAssemblyReferences:
00:12:31.010 [QUIET] [system.out]
00:12:31.010 [QUIET] [system.out] Target CopyFilesMarkedCopyLocal:
00:12:31.014 [QUIET] [system.out]
00:12:31.014 [QUIET] [system.out] Target AssignTargetPaths:
00:12:31.015 [QUIET] [system.out]
00:12:31.015 [QUIET] [system.out] Target SplitResourcesByCulture:
00:12:31.018 [QUIET] [system.out]
00:12:31.018 [QUIET] [system.out] Target CreateManifestResourceNames:
00:12:31.018 [QUIET] [system.out]
00:12:31.019 [QUIET] [system.out] Target GenerateResources:
00:12:31.019 [QUIET] [system.out]
00:12:31.021 [QUIET] [system.out] Target GenerateSatelliteAssemblies:
00:12:31.021 [QUIET] [system.out]
00:12:31.029 [QUIET] [system.out] Target CoreCompile:
00:12:31.496 [QUIET] [system.out] Task "Csc" execution -- FAILED
00:12:31.496 [QUIET] [system.out] Done building target "CoreCompile" in project "/Users/Admin/Documents/GitHub/unity-jar-resolver/source/VersionHandler/VersionHandler.csproj".-- FAILED
00:12:31.496 [QUIET] [system.out]
00:12:31.496 [QUIET] [system.out] Target _GetCompileOutputsForClean:
00:12:31.497 [QUIET] [system.out]
00:12:31.497 [QUIET] [system.out] Target _RecordCleanFile:
00:12:31.500 [QUIET] [system.out]
00:12:31.502 [QUIET] [system.out] Task "MSBuild" execution -- FAILED
00:12:31.502 [QUIET] [system.out] Done building target "VersionHandler" in project "/Users/Admin/Documents/GitHub/unity-jar-resolver/source/ExternalDependencyManager.sln".-- FAILED
00:12:31.502 [QUIET] [system.out]
00:12:31.503 [QUIET] [system.out] Build FAILED.
I will look into it afterwards then. if you have any suggestions, please kindly let me know then.
Thanks Phong