Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20489] iOS modules unable to write to product

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-03-03T00:51:16.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.2.1
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeEric Wieber
Created2016-03-01T09:00:37.000+0000
Updated2016-03-22T20:10:32.000+0000

Description

TIMOB-19694 fixed a bug where for iOS anything in a module's platform/iphone|ios folder was copied to build/iphone/build/Products/Debug-iphonesimulator/AppName.app where it should copy to build/iphone like Android and Windows do. Unfortunately this breaks Titanium and iOS modules that relied on the old behaviour, when you build using 5.2.0. This ticket requests to find a module-side solution for this "breaking fix". So far a project-side solution was suggested, by using a [project CLI plugin or (new) hook](https://gist.github.com/hansemannn/83840da6d7cd39ed6e1e) that copies the files over. However, modules should be self-contained and not rely on additional scripts to be added/written by the user. Probably, modules should be able to hook into the CLI as well. Then we could give an example of a module-based CLI hook that does what the < 5.2.0 CLI used to do. Known affected OSS modules: * https://github.com/Scringo/ScringoTitaniumModule/tree/master/ios/platform/iphone * https://github.com/an83/JoobMobile-Appcelerator-Module/tree/master/platform/iphone/Resources * https://github.com/ZeusFramework/ZeusbaseTi/tree/master/Modules/iphone/com.infinery.fv/1.0/platform/iphone * https://github.com/benbahrenburg/Ti.iSpeech/tree/master/iOS/platform/iphone * https://github.com/aaronksaunders/ios8documemtpicker/tree/master/iphone/platform/iphone * https://github.com/mdsb100/titanium-good-practices/tree/master/ShareSDKModuleDemo/ios/TestShareSDK/iphone/platform/iphone * https://github.com/hyperlab/TiMixpanel/tree/master/ios/platform/iphone * https://github.com/ryanpeng84/pageflip/tree/master/com.infinery.pageflip/1.0/platform/iphone * https://github.com/timanrebel/HockeyApp/tree/master/iphone/platform/iphone/HockeySDKResources.bundle * https://github.com/inthekloud/ITK.Instabug/tree/master/iphone/platform/iphone * https://github.com/dieskim/countly-sdk-appcelerator-titanium-ios/tree/master/iphone/platform/iphone/Countly.momd * https://github.com/The-Virtual-Forge/ti.S3FileTransferManager/tree/master/iphone/platform/iphone * https://github.com/hansemannn/Ti.GoogleMaps/tree/master/iphone/platform/ios/GoogleMaps.bundle * https://github.com/BOXOUT-THINKERS/TiOpenChat/tree/master/modules/iphone/com.leftlanelab.firebase/1.1.1/platform/iphone

Comments

  1. Chris Barber 2016-03-01

    This can't be solved with a CLI hook. This can only be fixed by fixing the iOS build. I propose we introduce a Resources directory to modules. Module developers can place bundles and other files in the Resources directory. There will not be a Resources/ios directory since the Resources directory would already be in the platform specific module project directory. This is a 1 line change to the iOS build. Then we need to add maybe 10 lines to the iOS module build. All module authors that use the platform/ios directory will need to update their modules and re-package them using whatever Titanium SDK includes this proposed fix. I think we can get by for now only doing this for iOS since supporting a Resources directory would be a new feature for Android, Windows, and Mobile Web.
  2. Ingo Muschenetz 2016-03-01

    This sounds like a good plan [~cng]. Let's confirm on a fix, and then shove it into 5.2.1 if possible (as it's a bug fix more than a feature add).
  3. Ingo Muschenetz 2016-03-01

    By "good plan" I was referring to your comment.
  4. Fokke Zandbergen 2016-03-01

    Excellent plan [~cbarber]!
  5. Ingo Muschenetz 2016-03-01

    [~fokkezb] can you circulate this idea quickly with some of the above affected module parties to see how they feel about it?
  6. Hans Knöchel 2016-03-01

    Thanks Chris, sounds great! For me being affected with ti.googlemaps, it's fine.
  7. Fokke Zandbergen 2016-03-01

    [~ben.bahrenburg@gmail.com] [~timanrebel] what do you think of Chris is solution to have a Resources folder under the module?
  8. Fokke Zandbergen 2016-03-01

    [~cbarber] one note on the name of the folder. Does it do exactly the same as if you would have these files in the project's Resources folder? If not then we should use a different name.
  9. Chris Barber 2016-03-01

    [~fokkezb] It does the same exact thing as the Resources in apps.
  10. Chris Barber 2016-03-01

    master PR: https://github.com/appcelerator/titanium_mobile/pull/7790 5_2_X PR: https://github.com/appcelerator/titanium_mobile/pull/7791
  11. Hans Knöchel 2016-03-01

    Chris, thanks! How can we use this PR for the module development? Same "iphone/Resources/" folder?
  12. Chris Barber 2016-03-01

    Apply this PR. Create a new module. Put stuff in the iphone/Resources folder. Build it. Install it. Create a Titanium app. Add the module to the tiapp.xml. Build the app.
  13. Hans Knöchel 2016-03-02

    Scons'd the SDK, made it the default SDK, created a folder "Resources" inside <module_name>/iphone/, copied the bundle (GoogleMaps.bundle) inside and built it using the module build-script (build.py). The packaged module does not seem to include the file and the module doesn't work. I'm sure I just have the wrong folder structure on module-side, but the users will definitely need at least a [updated guide](https://wiki.appcelerator.org/display/guides2/iOS+Module+Development+Guide) in order to update their modules properly. Module PR to pull and test: https://github.com/hansemannn/Ti.GoogleMaps/pull/13
  14. Chris Barber 2016-03-02

    [~hansknoechel] The build.py is deprecated. There's a message at the top build.py output that told you to use the CLI.
        cd /path/to/module
        cd iphone
        ti build -p ios --build-only
        
  15. Hans Knöchel 2016-03-02

    Yes, but only for new modules. Existing module dev's will not get that message at all. Further notes: - If I don't have the assets directory, the build fails (build.py didn't). - All those discussions should into the guide before we merge - The update will force both module and app developers to use at least 5.2.1 Will test now. *EDIT*: Works fine!
  16. Ingo Muschenetz 2016-03-02

    I would guess that you would keep the assets in two places for maximum compatibility? The only issue would be that you couldn't specifically use 5.2.0. * Old location for < 5.2.0 * New location for > 5.2.0
  17. Chris Barber 2016-03-02

    Part of the problem with the old build.py is it NEVER gets updated regardless of the SDK. So, that makes sense you didn't see the message. I'll fix the PR quick to not require an assets dir. Update: fixed!
  18. Feon Sua Xin Miao 2016-03-03

    PR merged.
  19. Fokke Zandbergen 2016-03-03

    So... we now need to create a.. TIDOC-2470 :) Do newly generated modules still have a build.py? Do Android modules also need to be build via ti build? And how about [Studio](http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-BuildandPackagetheModule.1), is that already updated to use ti build instead of the build.py script?
  20. Chris Barber 2016-03-03

    [~fokkezb] Answered most of your questions on TIDOC-2470. We'll need someone from Studio to chime in.
  21. Fokke Zandbergen 2016-03-03

  22. Timan Rebel 2016-03-07

    Bit late to the party (was on holiday), but great idea to have a Resources folder. Also removes some tricks in the module.xconfig where I always forget the change the version number to the correct module version. Thanks!
  23. Eric Wieber 2016-03-22

    Verified fixed, using: MacOS 10.11.4 (15E65) Studio 4.5.0.201602170821 Ti SDK 5.2.1.v20160318225121 Appc NPM 4.2.4-2 Appc CLI 5.2.1-20 Alloy 1.8.1 Xcode 7.3 (7D175) Tested the new build process by building modules that did not need updating and contained a build.py. Verified commonJS modules, modules with multiple architectures, asset bundling, doc generation and the standard modules were able to build. Then updated several modules from the list in the ticket body and went through the same checklist after removing the build.py and verifying that the modules were working as expected with the new build process.

JSON Source