Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10991] Compiler plugins pre-empted, can't run an app with no Resources directory (Alloy)

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2013-03-25T16:44:42.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsCore
Labelsn/a
ReporterTony Lukasavage
AssigneeIngo Muschenetz
Created2012-09-19T12:06:46.000+0000
Updated2017-03-22T20:41:30.000+0000

Description

In Alloy, the "Resources" directory is essentially recreated on every build via compiler plugin. In order for the generated "Resources" directory to reflect changes made in the Alloy "app/assets" directory (added/removed files), we need to delete then re-create the "Resources" directory each time. Alloy maintains the platform-specific folders in "app/assets", so generally this isn't an issue. The problem arises when a developer would want to import an Alloy project that has no "Resources" folder already in it. From an Alloy developer's perspective, the "Resources" folder is unnecessary baggage since all things that would be contained in it can be found throughout the "app" directory. It would likely be common that Alloy projects in version control won't even keep the "Resources" directory. When a developer imports an Alloy project without a "Resources" directory, or has an existing Alloy project and manually deletes the "Resources" directory, then attempts to run on any platform, they will encounter the following errors:

ios

[INFO] One moment, building ...
[INFO] app property, ti.ui.defaultunit : system
[INFO] Traceback (most recent call last):
[INFO] File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.2.0/iphone/builder.py", line 1596, in <module>
[INFO] main(sys.argv)
[INFO] File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.2.0/iphone/builder.py", line 723, in main
[INFO] find_name_conflicts(project_dir, app_name)
[INFO] File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.2.0/iphone/builder.py", line 508, in find_name_conflicts
[INFO] for name in os.listdir(os.path.join(project_dir, dir)):
[INFO] OSError: [Errno 2] No such file or directory: '/Users/tlukasavage/Development/alloy/test/projects/Harness/Resources'

android

Traceback (most recent call last):
  File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/android/builder.py", line 2187, in <module>
    s = Builder(project_name,sdk_dir,project_dir,template_dir,app_id)
  File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/android/builder.py", line 248, in __init__
    android_creator.create(parent_dir, project_dir=self.top_dir, build_time=True)
  File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/android/android.py", line 338, in create
    copy_resources(os.path.join(template_dir,'resources'),android_project_resources)
  File "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/android/android.py", line 45, in copy_resources
    os.mkdir(os.path.expanduser(target))
OSError: [Errno 2] No such file or directory: '/Users/tlukasavage/Development/alloy/test/projects/Harness/Resources/android'
The reason this seems to occur is that the above validation is happening before the compiler plugin has a chance to repopulate the Resources directory. Is it possible for the compiler plugin to run before this validation? If not, a more complex method of tracking differences between the changes in the "app" directory and the "Resources" directory will need to be maintained by Alloy.

Steps to Reproduce

Create a new Titanium mobile project with the Alloy template

Delete the "Resources" directory

Attempt to run for android or ios

Comments

  1. Tony Lukasavage 2012-09-19

    To note, placing an empty "iphone" or "android" folder, depending on the build target of course, will cause the build to execute as normal. There doesn't need to be anything else in the folders, so it seems as though it is unnecessary to have this validation before the compiler plugin processes. Unfortunately I can't do anything on the alloy side until the compiler plugin fires, but it is never reached.
  2. Tony Lukasavage 2013-01-22

    bump, would be nice to get a fix version or something on this one. The Resources directory is hidden in Alloy projects now, but it still needs to exist or the CLI will crash attempting to create the app.
  3. Lee Morris 2017-03-22

    Closing ticket as duplicate of the ticket that is mentioned above and has since been closed.

JSON Source