Debugging Acceleo M2T Transformation within MTL file - acceleo

I'm currently setting up an Acceleo project to generate Java source code from an Eclipse UML2 model. I do have experiences with the Xtend code generator, but not with the Acceleo one. However, I wanted to try Acceleo as an alternative to Xtend.
Unfortunately, I do have problems with debugging the M2T transformation from within the MTL template file. All breakpoints I set in the MTL are just ignored and the debugger runs the transformation without stopping.
I've searched Stackoverflow and other sources for help, but none of the responses helped me to get the debugger to work.
I'm running the transformation as an Acceleo Application and am using the Java Application runner since the Acceleo Plug-in Application is no longer supported with Eclipse Oxygen.
Did anyone of you have similar troubles and/or found any solution?
Thanks for any hint.
Best regards
Timo Rohrberg

I have the same requirement, but apparently there is not way to debug it at runtime, as far as I know.
https://www.eclipse.org/forums/index.php?t=msg&th=1080008&goto=1740153&#msg_1740153
Create a wrapper service for java printing/logging.
This is not the best solution, but, I was able to make do.
You could also use the acceleo interpreter (using the acceleo eclipse perspective) to try and evaluate queries before changing your code.
https://wiki.eclipse.org/Acceleo/Interpreter
I use this with papyrus and it works nicely.

I found a solution (or workaround) to debug .mtl files.
In the manifest editor window of your eclipse plugin
-on the runtime tab add your bin folder (the folder containing the compiled .class and .emtl files) to the classpath.
After this your breakpoints in the .mtl files will work, if you run your Acceleo launcher in "Acceleo Plug-in Application" mode. (Configuration section in the Acceleo launcher window)
(Tested with Eclipse 19-03, Acceleo 3.7)

Related

QtCreator doesn't find header files (.h) belonging to my project

I'm using QtCreator to develop a "plain" C++ based software (in particular, this one). By "plain" I mean my software is not using Qt libraries or any other Qt stuff appart from the IDE.
QtCreator version is 4.14.1.
Everything goes fine (building, running application, debugging, etc.) but the editor is reporting problems finding header files (i.e. .h files) belonging to my project, as shown in the screenshoot below:
Interesting to note that system headers (e.g. stdio.h) are correctly found.
So maybe I'm missing some piece of configuration in my project. First thing I thougth was the .includes added by QtCreator at project creation time (fiware-orion.includes in my case), which is like that:
src/lib/cache
src/lib/mongoBackend
src/lib/parseArgs
...
which are the places in which the header files are (e.g. src/lib/mongoBackend/MongoGlobal.h) so everything seems fine in that file...
Any idea or suggestion is really welcomed :)
I think I found the answer myself just after publishing the question (use to happen :)
Adding to the .includes file this line:
src/lib
solved the problem.
It makes sense... as my header names are like mongoBackend/MongoGlobal.h then
src/lib + mongoBackend/MongoGlobal.h = src/lib/mongoBackend/MongoGlobal.h

How to create a Qt-Quick Test

I have to create a Unit-Test.
But first, I´ve to get clear what to do.
There is a QtQuick2-App written and now I would like to do Unit-Tests with the GUI. What are the steps for Unit-Tests with GUI? After reading the Qt-documents, I could not create any ideas for starting with the test.
Hope somebody can help me.
Edit: I was able to run some tests, after adding tst_button.qml and tst_test.cpp to my Project (main.cpp is in comments now). Is this the right way, or should I create a new project just for the Tests? If yes, what kind of project is needed?
And the last question: Do I need to build up my MainForm for pressing buttons for example?
tst_button.qml
import QtQuick 2.4
import QtTest 1.0
Rectangle{
id: myRec
property var myMainForm: null
TestCase{
name:"ButtonClick"
when:windowShown
function test_init(){
var createMyWindow = "import QtQuick 2.0; MainForm{id:myForm}"
var myMainForm = Qt.createQmlObject(createMyWindow,myRec)
myRec.myMainForm = myMainForm
}
}
}
tst_test.cpp
#include <QtQuickTest/quicktest.h>
QUICK_TEST_MAIN(test)
Testing and Debugging lists two ways:
Qt Test (also known as testlib) - a framework for unit tests of C++ code
Qt Quick Test - a framework for unit tests of QML code
You can use Qt Test for testing Qt Quick applications, but that's generally better for when you need access to C++ API that isn't available in QML.
Do I just add a *.qml file to my project and fill it with my code? If yes, what do I have to do to start the test?
You'll first need to make the tests a separate project, unless you're planning on using qmltestrunner (I have no idea why that tool isn't documented by Qt itself).
The Running Tests section of Qt Quick Test's documentation details how to get a test up and running.
I was able to run some tests, after adding tst_button.qml and tst_test.cpp to my Project (main.cpp is in comments now). Is this the right way, or should I create a new project just for the Tests?
If your application is pure QML and only intended to be run with qmlscene, for example, then doing it that way is fine. However, if you intend to deploy/ship your application, you'll probably need to have an executable, which means making separate projects for the application and the tests.
If yes, what kind of project is needed?
You could have a SUBDIRS project, so that your tests and the application itself can all be opened at once in Qt Creator. Something like this:
myapp.pro
app/
main.cpp
app.pro
resources.qrc
main.qml
tests/
tests.pro
data/
tst_stuff.qml
And the last question: Do I need to build up my MainForm for pressing buttons for example?
No. The .ui feature is just a format that allows Qt Creator to enforce certain constraints to make it easier to design Qt Quick UIs with Qt Quick Designer. MainForm.ui.qml is therefore just a convenience. If you already have an existing component in QML, you can create instances of that and test it.

sonarqube 4.5 has misidentified a cpp module as c - how can I fix it

I created a multi-module project with a single sonar-project.properties. Most of the project is in c but one module is c++. I left the sonar.language property blank and ran sonar-runner with analysis.
The project and modules were created in the database and everything looked OK but when I did a preview on the same code I had a large number of new issues on the c++ project.
On closer inspection I found that the module in sonarqube was all wrong - it consisted of only the header files (.h) and most of the issues were the use of C style comments. It seems that the module was identified as a C module so all the .cpp files were ignored. However, in the preview the language was identified correctly and issues were found in the .cpp files that were clearly not know to sonarqube.
I cannot find any place in the UI to change the language of a module nor can I figure out a way to force it after the fact in my sonar-project.profiles.
First, sonar.language is apparently deprecated, and second, using module.sonar.language=cpp caused an error:
Caused by: sonar.profile was set to 'DEFAULT_C' but didn't match any profile for any language. Please check your configuration.
DEFAULT_C is something that we use for projects generally but not the one I'm working on. I have different profiles set up for different languages via the UI, but if I cannot get the analysis to see the correct language it doesn't help me much.
Any one have any idea how I can force the language of a module after the fact?
Hmm. I considered just deleting this but if I had found an answer on stackoverflow it would have eased my pain a little.
Brute force works.
Just set the language and the profile you want for the moudle and ignore complaints about such things being deprecated. Chosing a language won't force the right profile even if you have set up an explicit profile for the language in the UI - so just state it in the sonar-project.properties file.
In my case:
module.sonar.language=cpp
module.sonar.profile=MY_CPP_PROFILE
Throw sonar-runner at that and it will beat the backend into shape.

Acceleo code-generation doesn't start, Couldn't load main class

I created a new very easy Acceleo project, with just one main module generate.mtl that tries to create a new file. The package is exported in the Manifest. When I launch the .mtl file, I get this error
!MESSAGE Couldn't load class org.eclipse.acceleo.module.sample.main.Generate. Check that its containing package is exported.
!MESSAGE Couldn't load class org.eclipse.acceleo.module.sample.main.Generate from project org.eclipse.acceleo.module.sample
I don't really know why and what to do.
I had a similar problem and I solved it by adding the bin directory to the classpath in the Manifest file.
I did this because of Etienne's answer here: Can't generate java from UML using Acceleo in Eclipse1
When you open up the MANIFEST.MF with the "Plugin Manifest Editor", there is a "Runtime" tab at the bottom. On the right side bottom of that screen there is a place to edit the classpath. I added "bin/"
After that, I had no problems with loading the class.
I solved using the version 3.4 of Acceleo, instead of the 3.5. The 3.4 works
Your solution #jpcahoon - Solved my problem with Acceleo 3.5.1
I had the same problem today despite having the Classpath declared in the Manifest file.
The solution for me was to tweak the Execution Environment in the Overview tab of the manifest file (In my case, setting it to JavaSE-1.6 solved the problem).

Visual Studio C++ Solution in Maven2

A new project is coming up that will require interaction between Java and C++. It's been decided that the project will be built via Maven2.
Unfortunately I don't know anything about Maven and the Java guys don't know anything about C++.
They have their build chain all set up with various reports being emitted for each part related to CheckStyle, Findbugs, Corbortura(?) etc. and they want the same to be done with the C++ side.
Currently we have 4 apps that need building: 2 services, a tray app and a simple dialog based application. I've been told I need to have a pom for each and configure each to output to a target directory, have the tool chain produce the reports - the most particular being the code coverage which the client wants 100%.
I have sourced the tools - Bullseye and QA-C++ and requested eval copies - but I am dismayed to find there is very little information on C++ & Maven, and what little there is seems to be horror stories.
Does anyone on SO have a good story about it (or have link to blog post)?
Is there a simple explanation anywhere for configuring a Visual Studio solution (preferably C++) to be Mavenized?
I am expecting pain but I am getting increasingly wary of this venture - but unfortunately the project manager is Java side and seems hell-bent on Mavenizing it.
See the following stack over flow on the topic.
Using Maven for C/C++ projects
Hope it helps

Resources