coronalabs / corona

Solar2D Game Engine main repository (ex Corona SDK)
https://solar2d.com/
MIT License
2.5k stars 269 forks source link

[Mac]: Solar2D periodically installs plugins - can we control when this takes place? #479

Closed solares closed 1 year ago

solares commented 1 year ago

Describe the bug About once a day, when Solar2D starts up it takes about 10 seconds to check all plugins. Can we stop this default behaviour, and only check plugins when we ask it to?

If we use this https://github.com/coronalabs/corona/pull/427 then will it prevent this happening, or will it still check?

Target platform and where build was made:

To Reproduce Start up Solar2D simulator. See log something like below

Oct 10 09:27:31.039: Platform: iPad / x86_64 / 12.6.0 / Apple M1 Max / 2.1 Metal - 76.3 / 2022.3680 / en-US | US | en_US | en
Oct 10 09:27:31.049: Collecting plugins {"continueOnError":true,"extractLocation":"/Users/m/Library/Application Support/Corona/Simulator/Plugins","customCollectorsDir":"/Users/m/Solar2DPlugins/Collectors","ignoreMissingMarker":"IgnoreMissing","pluginLocators":[<Collector: Custom URL Locator>,<Collector: Local File System Versionized>,<Collector: Local File System Per Platform>,<Collector: Local File System Per Platform Versionized>,<Collector: Solar2d Marketplace Directory>,<Collector: Solar2d Marketplace Resources>,<Collector: Solar2D Free Directory>,<Collector: Missing Marker>],"destinationDirectory":"/Users/m/Library/Application Support/Corona/Simulator/Plugins","plugins":{"plugin.gameanalytics_v2":{"supportedPlatforms":{"mac-sim":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-mac.tar.gz"},"iphone-sim":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-iphone-sim.tar.gz"},"iphone":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-iphone.tar.gz"},"macos":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-mac.tar.gz"},"linux-sim":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-linux.tar.gz"},"win32":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-win.tar.gz"},"win32-sim":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-win.tar.gz"},"linux":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-linux.tar.gz"},"android":{"url":"https://www.solar2dplugins.com/download/gameanalytics/studycat/6762dc3285f9f1588d098771118e3e1dc74c5606-android.tar.gz"}},"publisherId":"com.gameanalytics"},"plugin.pasteboard":{"publisherId":"com.coronalabs"},"plugin.utf8":{"publisherId":"com.coronalabs"},"plugin.microphone":{"publisherId":"com.studycat.microphone"},"CoronaProvider.native.popup.quickLook":{"publisherId":"com.coronalabs"},"CoronaProvider.native.popup.activity":{"supportedPlatforms":{"iphone":true,"mac-sim":true},"publisherId":"com.coronalabs"},"plugin.androidPreview":{"marketplaceId":"ki39t1","publisherId":"tech.scotth"},"plugin.CoronaSplashControl":{"publisherId":"com.coronalabs"},"plugin.amazon.iap":{"supportedPlatforms":{"android-kindle":true,"mac-sim":true},"publisherId":"com.coronalabs"},"plugin.onDemandResources":{"publisherId":"com.coronalabs"},"plugin.reviewPopUp":{"marketplaceId":"btx1xj","publisherId":"tech.scotth"},"plugin.pagecurl":{"publisherId":"com.xibalbastudios"},"plugin.zip":{"publisherId":"com.coronalabs"},"CoronaProvider.native.popup.social":{"publisherId":"com.coronalabs"},"plugin.universalLinks":{"marketplaceId":"btx1xj","publisherId":"tech.scotth"},"plugin.orientation":{"publisherId":"com.studycat.orientation"},"plugin.notifications":{"publisherId":"com.coronalabs"},"plugin.google.iap.billing":{"publisherId":"com.coronalabs"}},"pluginStorage":"/Users/m/Solar2DPlugins","pluginPlatform":"mac-sim","build":"3680"}
Oct 10 09:27:33.892: Located plugin.gameanalytics_v2 with locator Custom URL Locator
Oct 10 09:27:38.612: Solar2D Directory: cache hit plugin.pasteboard
Oct 10 09:27:38.613: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.pasteboard/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.pasteboard"
Oct 10 09:27:38.634: Located plugin.pasteboard with locator Solar2D Free Directory
Oct 10 09:27:38.635: Solar2D Directory: cache hit plugin.utf8
Oct 10 09:27:38.635: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.utf8/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.utf8"
Oct 10 09:27:38.649: Located plugin.utf8 with locator Solar2D Free Directory
Oct 10 09:27:38.649: Local lookup determined that plugin plugin.microphone is not supported by the platform lua
Oct 10 09:27:38.649: Located plugin.microphone with locator Local File System Per Platform
Oct 10 09:27:38.650: Solar2D Directory: cache hit CoronaProvider.native.popup.quickLook
Oct 10 09:27:38.650: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/CoronaProvider.native.popup.quickLook/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.quickLook"
Oct 10 09:27:38.663: Located CoronaProvider.native.popup.quickLook with locator Solar2D Free Directory
Oct 10 09:27:38.664: Solar2D Directory: cache hit CoronaProvider.native.popup.activity
Oct 10 09:27:38.664: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/CoronaProvider.native.popup.activity/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.activity"
Oct 10 09:27:38.675: Located CoronaProvider.native.popup.activity with locator Solar2D Free Directory
Oct 10 09:27:40.542: Solar2D Marketplace Directory: cache hit plugin.androidPreview
Oct 10 09:27:40.543: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2DMarketplaceDirectory/solar2dmarketplace/tech.scotth/plugin.androidPreview/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.androidPreview"
Oct 10 09:27:40.569: Located plugin.androidPreview with locator Solar2d Marketplace Directory
Oct 10 09:27:40.570: Solar2D Directory: cache hit plugin.CoronaSplashControl
Oct 10 09:27:40.571: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.CoronaSplashControl/lua/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.CoronaSplashControl"
Oct 10 09:27:40.585: Located plugin.CoronaSplashControl with locator Solar2D Free Directory
Oct 10 09:27:40.586: Solar2D Directory: cache hit plugin.amazon.iap
Oct 10 09:27:40.586: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.amazon.iap/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.amazon.iap"
Oct 10 09:27:40.599: Located plugin.amazon.iap with locator Solar2D Free Directory
Oct 10 09:27:40.600: Solar2D Directory: cache hit plugin.onDemandResources
Oct 10 09:27:40.600: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.onDemandResources/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.onDemandResources"
Oct 10 09:27:40.612: Located plugin.onDemandResources with locator Solar2D Free Directory
Oct 10 09:27:40.613: Solar2D Marketplace Directory: cache hit plugin.reviewPopUp
Oct 10 09:27:40.613: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2DMarketplaceDirectory/solar2dmarketplace/tech.scotth/plugin.reviewPopUp/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.reviewPopUp"
Oct 10 09:27:40.623: Located plugin.reviewPopUp with locator Solar2d Marketplace Directory
Oct 10 09:27:40.624: Solar2D Directory: cache hit plugin.pagecurl
Oct 10 09:27:40.624: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/solar2d/com.xibalbastudios/plugin.pagecurl/lua/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.pagecurl"
Oct 10 09:27:40.634: Located plugin.pagecurl with locator Solar2D Free Directory
Oct 10 09:27:40.636: Solar2D Directory: cache hit plugin.zip
Oct 10 09:27:40.636: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.zip/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.zip"
Oct 10 09:27:40.646: Located plugin.zip with locator Solar2D Free Directory
Oct 10 09:27:40.646: Solar2D Directory: cache hit CoronaProvider.native.popup.social
Oct 10 09:27:40.647: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/CoronaProvider.native.popup.social/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.social"
Oct 10 09:27:40.658: Located CoronaProvider.native.popup.social with locator Solar2D Free Directory
Oct 10 09:27:40.659: Solar2D Marketplace Directory: cache hit plugin.universalLinks
Oct 10 09:27:40.659: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2DMarketplaceDirectory/solar2dmarketplace/tech.scotth/plugin.universalLinks/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.universalLinks"
Oct 10 09:27:40.669: Located plugin.universalLinks with locator Solar2d Marketplace Directory
Oct 10 09:27:40.669: Local lookup determined that plugin plugin.orientation is not supported by the platform lua
Oct 10 09:27:40.670: Located plugin.orientation with locator Local File System Per Platform
Oct 10 09:27:40.670: Solar2D Directory: cache hit plugin.notifications
Oct 10 09:27:40.670: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.notifications/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.notifications"
Oct 10 09:27:40.679: Located plugin.notifications with locator Solar2D Free Directory
Oct 10 09:27:40.679: Solar2D Directory: cache hit plugin.google.iap.billing
Oct 10 09:27:40.679: Running command    /bin/cp "/Users/m/Solar2DPlugins/Caches/Solar2Directory/coronalabs/com.coronalabs/plugin.google.iap.billing/mac-sim/data.tgz" "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.google.iap.billing"
Oct 10 09:27:40.690: Located plugin.google.iap.billing with locator Solar2D Free Directory
Oct 10 09:27:40.690: Collecting plugin dependencies
Oct 10 09:27:40.691: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.gameanalytics_v2/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.701: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.pasteboard/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.710: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.universalLinks/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.721: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.quickLook/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.731: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.activity/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.740: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.androidPreview/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.749: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.CoronaSplashControl/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.758: Running command    rmdir "/Users/m/Library/Application Support/Corona/Simulator/Plugins/lua_51/plugin"
Oct 10 09:27:40.766: Running command    rmdir "/Users/m/Library/Application Support/Corona/Simulator/Plugins/lua_51"
Oct 10 09:27:40.774: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.amazon.iap/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.784: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.onDemandResources/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.795: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.reviewPopUp/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.804: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.pagecurl/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.815: Running command    rmdir "/Users/m/Library/Application Support/Corona/Simulator/Plugins/lua_51/plugin/pagecurl"
Oct 10 09:27:40.825: Running command    rmdir "/Users/m/Library/Application Support/Corona/Simulator/Plugins/lua_51/plugin"
Oct 10 09:27:40.833: Running command    rmdir "/Users/m/Library/Application Support/Corona/Simulator/Plugins/lua_51"
Oct 10 09:27:40.841: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.zip/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.853: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.google.iap.billing/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.864: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.notifications/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.874: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.orientation/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.884: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/plugin.utf8/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
Oct 10 09:27:40.894: Running command    /usr/bin/tar -xzf "/Users/m/Library/Application Support/Corona/Simulator/Plugins/CoronaProvider.native.popup.social/data.tgz" -C "/Users/m/Library/Application Support/Corona/Simulator/Plugins"
XeduR commented 1 year ago

There are several different ways of approaching this, some of which would be relatively trivial.

The plugin fetch occurs in: platform/resources/shell.lua. The "once a day" thing you're referring to occurs here:

https://github.com/coronalabs/corona/blob/2ed91b2b5f7568cd19ce045fc32cee8b66849777/platform/resources/shell.lua#L372-L380

Forcing a plugin version won't have any impact on this as plugins of particular versions can receive bug fixes, etc. However, adding a general property to build.settings to "not check for plugin updates" would be relatively trivial to implement. Adding plugin specific properties to control the updates for each individual plugin probably wouldn't be much of a stretch either.

I think we could take one extra step here as well and consider adding some minor UI to inform the user that the plugin is in fact fetching plugin updates. I'm a fairly experienced user and I only realised the lag spikes on launch were caused by plugins being fetched like 2 years ago.

I could take a look at this issue around Thursday or Friday next week.

solares commented 1 year ago

Thanks @XeduR

Maybe we can add one more option to each plugin definition (See https://github.com/coronalabs/corona/issues/426)

    ["CoronaProvider.native.popup.quickLook"] = { 
          publisherId = "com.coronalabs", 
          version = "^1.2.5", 
          autoUpdate = false 
     }

I suppose autoUpdate=true should be the default, so no change of behaviour for current users.

Or we could have a global setting in build.settings, autoUpdatePlugins=false to set the default for all plugins.

Shchvova commented 1 year ago

I think I’ll just make maxAge customizable. This would be easy fix for the issue. Syntax for disabling auto-update for me seem quite ambiguous. May be it would be easier to deal with the issue with a setting?

XeduR commented 1 year ago

Making the maxAge customisable was my idea as well for the general approach as well. I figured it'd be quick to assign values like:

1) not defined in build.settings or value is not a number -> default to 24h 2) value is set to less than or equal to 0 -> disable the fetching entirely 3) any value above 0 -> overwrite the default 24h value

Shchvova commented 1 year ago

This should be fixed by #480. To customize the timer, run a command:

defaults write com.coronalabs.Corona_Simulator SimPluginCacheMaxAge  -int 0

0 or less - disables timer. To restore - delete the preference:

defaults delete com.coronalabs.Corona_Simulator SimPluginCacheMaxAge

On windows:

reg ADD "HKEY_CURRENT_USER\Software\Ansca Corona\Corona Simulator\Preferences" /f /v SimPluginCacheMaxAge /d 5
rem And to delete:
reg DELETE "HKEY_CURRENT_USER\Software\Ansca Corona\Corona Simulator\Preferences" /f /v SimPluginCacheMaxAge
solares commented 1 year ago

Thanks @Shchvova and @XeduR. Much obliged.