HEADS-project / training

Training material to get started with the HEADS technologies
10 stars 16 forks source link

Unable to find "my.package.MyComponent" in current model nor on Kevoree registry when deploying an incomplete kescript (with non-connected ports). #61

Closed skorsky closed 9 years ago

skorsky commented 9 years ago

On exercise 3.2_Manually_Wrapping_JS_Code, I apply in HEADS IDE 'ThingML (Deprecated) --> Compile JS Kevoree' to _javascript/timer.thingml. Afterwards I run yo kevoree and I get:

Deployment0JS@1.0.0 prepublish D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Manually_Wrapping_JS_Code\thingml-gen\javascript\Deployment0JS grunt

bower ENOENT No bower.json present Running "kevoree_genmodel:main" (kevoree_genmodel) task Model generation failed!

Error: Cannot find module './Connector' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Manually_Wrapping_JS_Code\thingml-gen\javascript\Deployment0JS\lib\Deployment0JS.js:1:79) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) Fatal error: Cannot find module './Connector'

npm ERR! Deployment0JS@1.0.0 prepublish: grunt npm ERR! Exit status 1

brice-morin commented 9 years ago

I have to update the README (the ThingML to Kevoree/JS compiler was not completly ready when I started writing the readme...)

Basically, the ThingML to Kevoree/JS compiler generates everything you need. No need to run yo kevoree (this will actually erase some of what has been generated). Simply npm install and you should be ready to deploy.

skorsky commented 9 years ago

When I run npm install in the 3.2_Manually_Wrapping_JS_Code\thingml-gen\javascript\Deployment0JS folder, I get following error:

Running "kevoree_genmodel:main" (kevoree_genmodel) task
Model generation failed!

Error: Cannot find module './Connector'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Manually_Wrapping_JS_Code\thingml-gen\javascript\Deployment0JS\lib\Deployment0JS.js:1:79)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
Fatal error: Cannot find module './Connector'
brice-morin commented 9 years ago

Ok... do you have a Connector.js in your lib folder? And I guess you did not run yo kevoree, right? (which you should not, cf previous comment and updated Readme)

skorsky commented 9 years ago

While writing the comment above, I had not Connector.js in the lib folder.

I found when I use HEADS / ThingML --> Javascript for Node.js, I get Connector.js generated in the lib folder.

If I use ThingML (deprecated) --> Compile JS Kevoree, I don't get a connector.js.

I have installed in HEADS IDE: ThingML 0.6.0.201502251038 org.thingml.eclipse.feature.feature.group SINTEF-9012

brice-morin commented 9 years ago

Very true. You should use the "official" JS compiler first and then the "deprecated" Kevoree/JS compiler

skorsky commented 9 years ago

I start with

3.2_Automatically_Wrapping_JS_Code/
    _javascript
        timer.thingml
    README.md
    timer.thingml

I run the official JS compiler. Log is

Compiling with "Javascript for NodeJS" (Platform: javascript)
Selected input file: L/3.2_Automatically_Wrapping_JS_Code/_javascript/timer.thingml (D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code\_javascript\timer.thingml)
Creating thingml-gen folder in D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code
Creating folder javascript in D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code\thingml-gen
Running Javascript for NodeJS compiler on configuration Deployment0JS
Compilation complete.
Configuration Deployment0JS compiled successfully.

and get in thingml-gen/javascript/Deployment0JS the files Connector.js, main.js, package.json, state-factory.js, TimerJS.js. As mentioned in the README.md.

Now I run the deprecated Kevoree/JS compiler and I get Deployment0JS/kevs/main.kevs Deployment0JS/lib/Deployment0JS.js Deployment0JS/Gruntfile.js Log:

cleaning folder D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code\thingml-gen
Creating folder javascript in D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code\thingml-gen

The files generated in the first step are gone (according to the log cleaning folder ...). Thus, Connector.js is missing again.

brice-morin commented 9 years ago

Ah yes..... it was another issue because we did not clean the thingml-gen folder and could be a problem when you changed names in your ThingML models... but I thought I did not implement the clean for the kevoree generators (which typically need the core files). Obviously the cleaning step there is there for the kevoree/js compiler (which just move files in lib folder + generate some more files).

brice-morin commented 9 years ago

OK, my bad, I did it properly for the Kevoree/Java compiler, but not for the Kevoree/JS compiler. It should be fixed now.

@skorsky @sdalgard Note that I also updated the Kevoree generator (which I migrated according to the new transformation framework). If you have time, you can re-try your Java contributions and make sure it still work. I made some tests, but you never know ;-)

skorsky commented 9 years ago

This does not work for me. I get one step further: npm install is OK now. I get

Running "kevoree_genmodel:main" (kevoree_genmodel) task
Package:         my.package
TypeDefinition:  TestTimerJS
Version:         1.0.0
DeployUnit:      Deployment0JS
Input port(s):   [ Deployment0JS_timer_timer_in ]
Output port(s):  [ Deployment0JS_timer_timer_out ]

Model generation done
Model 'kevlib.json' saved at kevlib.json

Done, without errors.

but grunt kevoree fails with

Running "kevoree" task
16:37:28  ALL    KevoreeLogger    Set logLevel= debug
>> Platform node name: node0
>> Bootstrap script: kevs\main.kevs
16:37:28  DEBUG  NPMResolver      modulesPath= D:\Users\mask\git\skorsky\training\3.Wrapping_ThingML_into_Kevoree\3.2_Automatically_Wrapping_JS_Code\thingml-gen\javascript\Deployment0JS\.deploy_units\node0
Fatal error: "grunt-kevoree" unable to parse KevScript
Unable to find "my.package.Deployment0JS" in current model nor on Kevoree registry.
brice-morin commented 9 years ago

@maxleiko can you try exercise 2 in tuto 3?

maxleiko commented 9 years ago

I'll have a look next week (holidays sorry)

brice-morin commented 9 years ago

Deployment0 in Exercice 2 in tutorial 3 produces an "incomplete" Kevoree configuration (some ports are not connected). If you try the second configuration:

configuration TestTimerJS {
    instance timer : TimerJS
    instance client : SimpleTimerClient
    connector client.timer => timer.timer    
}

It produces a complete Kevoree model, which you should be able to npm install and grunt kevoree.

Probably the error reporting in Kevoree/JS should be improved. As far as I can tell, it is not a problem with the ThingML->Kevoree/JS transformation. If the ThingML configuration is incomplete, there is no way we can generate a complete Kevoree model. The generated kevscript should then be update manually (or you should specify everything in your ThingML configuration, but would endup with a single Kevoree component, which is not really ideal).

Note that according to the instructions in the ThingML file, Deployment0 configuration is only intended for generation of plain JS code + manual registration of a listener.

So I will assign the issue to @maxleiko so that he provides a better message when one tries to deploy an incomplete model (actually, I am not sure why it crashes when deploying such an imcomplete configuration...)

maxleiko commented 9 years ago

Looks like this is related to https://github.com/HEADS-project/training/issues/71

Kevoree model generator outputs that:

Running "kevoree_genmodel:main" (kevoree_genmodel) task
Package:         my.package
TypeDefinition:  TestTimerJS
Version:         1.0.0
DeployUnit:      Deployment0JS
Input port(s):   [ Deployment0JS_timer_timer_in ]
Output port(s):  [ Deployment0JS_timer_timer_out ]

DeployUnit and TypeDefinition are not the same (but they should be).
@brice-morin fixed this in #71, update your IDE and it should fix the issue.

skorsky commented 9 years ago

works now!

Thanks for help!