Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24471] iOS: Building an iOS module will fail if the module doesn't contain a Classes directory

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-03-14T21:23:41.000+0000
Affected Version/sRelease 6.0.2
Fix Version/sRelease 6.0.3
ComponentsCLI, iOS
Labelsn/a
ReporterChristopher Williams
AssigneeChristopher Williams
Created2017-03-09T21:18:26.000+0000
Updated2017-03-14T21:53:46.000+0000

Description

If you attempt to build an iOS module with appc ti build, it will fail unless there's a Classes directory that already exists. We should simply create the directory before trying to write a file to it if we need to.

Attachments

FileDateSize
ti.testmodule.zip2017-03-13T16:01:58.000+000029112

Comments

  1. Christopher Williams 2017-03-09

    master: https://github.com/appcelerator/titanium_mobile/pull/8877 6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8878
  2. Hans Knöchel 2017-03-13

    For QE: I attached the sample module "ti.testmodule" that has it's classes in the "src" directory and does not have the "Classes" one. Without the change, it will fail during build, with the fix, it will generate the "Classes" directory and put the generated assets class in it. Testing steps:

    Unpack the zip and navigate to ti.testmodule/iphone

    Build the module with appc run -p ios --build-only

    Expected behavior: - Before: The build failed, the compiler could not locate the "Classes" directory - Fix with fix: The "Classes" directory is generated, the build succeeds
  3. Abir Mukherjee 2017-03-13

    [~hansknoechel] With the fix, I do see a new folder created with the name Classes, however, I get this error as well:
       [INFO]  Project directory: /Users/amukherjee/Downloads/ti.testmodule/iphone
       [INFO]  Module ID: ti.testmodule
       [WARN]  Please update the LICENSE file with your license text before distributing.
       [ERROR] [xcode-dist] ** BUILD FAILED **
       [ERROR] [xcode-dist] The following build commands failed:
       [ERROR] [xcode-dist] 	CompileC build/ti.testmodule.build/Release-iphoneos/ti.testmodule.build/Objects-normal/armv7/TiTestmoduleModule.o src/TiTestmoduleModule.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
       [ERROR] [xcode-dist] 	CompileC build/ti.testmodule.build/Release-iphoneos/ti.testmodule.build/Objects-normal/arm64/TiTestmoduleModule.o src/TiTestmoduleModule.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
       [ERROR] [xcode-dist] (2 failures)
        
       amukherjee:iphone amukherjee$ 
       
  4. Christopher Williams 2017-03-14

    So, to re-iterate what I stated on our standup call - I do not think the error [~amukherjee] is seeing is related to the ticket/PR/fix. My fix was solely to handle when an iOS module had no existing Classes sub-folder, it now will generate the folder if necessary before trying to generate a file underneath it. I don't really know what exactly is failing in the output above. [~amukherjee] You should be able to just generate a native iOS module using the CLI itself and then deleting the Classes folder and trying to build:
       appc new -t timodule -n example-mod
       cd example-mod
       cd iphone
       rm -rf Classes
       appc ti build --build-only
       
  5. Abir Mukherjee 2017-03-14

    [~cwilliams] Even when I follow your steps above, I get the same error. I also discovered that if I keep the Classes directory (i.e. don't delete it), but I delete the files in the Classes folder, I get the same error. So it appears that the files in the Classes directory are needed to build the module.
  6. Hans Knöchel 2017-03-14

    You cannot just delete the Classes directory, the build needs the "xxxModule" files. The error is probably because you have assigned the classes to that location and you did not re-reference them inside the Xcode project. That's why I've sent the example module that should not cause any problems. Let's do a Hangout if you have questions.
  7. Abir Mukherjee 2017-03-14

    FR PASSED with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.3 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2.1 I verified that the Classes folder is created and the required files are copied into the directory. This was using 6.0.3. To verify that this fixed a problem from 6.0.2. I tried to build with the Classes folder deleted using 6.0.2, and the build failed. Therefore the fix for 6.0.3 is validated. Additionally, FR also passed with 6.1.0. EDIT: Closing this ticket as changes are confirmed in SDK 6.0.3.v20170314141715

JSON Source