Hyperloop is re-writing source JS then failing subsequent clean builds

205 views Asked by At

I've just updated to the latest 5.2.0.GA and am trying a simple Hyperloop test app.

Building the app causes references to hyperloop code in the source JavaScript to be re-written. Then it will fail the next rebuild due to Skipping Hyperloop compile, no usage found ... error, since JS code was re-written...

Reference here and here

Environment :


    OS X     : 10.10.5
    node -v  : v0.12.7
    Studio   : 4.5.0.201602170821
    TiSDK    : 5.2.0.GA 
    ti -v    : 5.0.6
    appc -v  : 5.2.0
    hyperloop: 1.1.0 

  1. Create new Classic Single Window Application mobile app project. Test build.
  2. Add hyperloop requirements to tiapp.xml

    <plugins>
        <plugin>hyperloop</plugin>
    </plugins>
    <modules>
        <module>hyperloop</module>
    </modules>

and


    <ios>
        <run-on-main-thread>true</run-on-main-thread>
        <use-jscore-framework>true</use-jscore-framework>
    </ios>

  1. As per example code in the "Hyperloop for iOS Programming Guide" PDF, I attempted to add a simple red UIView. ( In /Resources/ui/common/FirstView.js )

    //FirstView Component Constructor
    function FirstView() {
        //create object instance, a parasitic subclass of Observable
        var self = Ti.UI.createView();

        //label using localization-ready strings from /i18n/en/strings.xml
        var label = Ti.UI.createLabel({
            color:'#000000',
            text:String.format(L('welcome'),'Titanium'),
            height:'auto',
            width:'auto'
        });
        self.add(label);

        //Add behavior for UI
        label.addEventListener('click', function(e) {
            alert(e.source.text);
        });

        // Test native view 
        var UIView = require('UIKit/UIView'),
        UIColor = require('UIKit/UIColor'),
        CGRectMake = require('CoreGraphics').CGRectMake;

        var view = UIView.alloc().initWithFrame(CGRectMake(0,0,100,100));
        view.backgroundColor = UIColor.redColor();
        self.add(view);

        return self;
    }
    module.exports = FirstView;

  1. In terminal, run : appc ti build -p ios -f

The app launches. A small red view is seen in the top left corner.

All good.

BUT when I look back at the source JavaScript FirstView.js, the references to the native UIView, UIColor and CGRectMake have been edited. (I also notice that the build process created hyperloop folder within the Resources folder containing what appears to be the location of the newly edited references:


    var UIView = require('hyperloop/uikit/uiview'),
    UIColor = require('hyperloop/uikit/uicolor'),
    CGRectMake = require('hyperloop/coregraphics/coregraphics').CGRectMake;

NOW when trying to build the app again using appc ti build -p ios -f - the build fails with this error during the Hyperloop assembly :

    ...
    [INFO]  Starting Hyperloop assembly
    [INFO]  Skipping Hyperloop compile, no usage found ...
    An uncaught exception was thrown!
    callback is not defined
    callback is not defined

Anyone have any ideas? I know this is beta, but am I missing a flag?

BONUS BUG: The -f force clean build flag does not appear to be cleaning out the build/hyperloop folder.

0

There are 0 answers