Eclipse PDE headless builds modifies source dirs and MANIFEST.MF - eclipse

The problem
From a number of OSGi bundles, I am creating a p2 update site using the PDE headless feature build. I don't want to copy the entire source tree (if it can be avoided) so I point the buildDirectory property to the location of my sources.
The general problem I encounter is that the PDE build sprinkles build artifacts all over the source directory (and not like all other decent build tools where the build artifacts are stored to a separate location like e.g. Maven's target folder). I can live with this but more annoying is that the PDE build modifies the MANIFEST.MF file of each compiled bundle.
The only real change to the MANIFEST.MF file is that
Bundle-Version: 1.0.0.qualifier
is rewritten to
Bundle-Version: 1.0.0.<yyyyMMddhhmm>
Apart from that, the entire file is reformatted. Of course it is correct to rewrite the file to what should end up in the assembled jars but the modified manifest should IMHO not overwrite the source manifest.
A possible solution?
Does anybody know if there is a way to tell PDE headless build to send all build artifacts to a location separate from the source files?
The nitty gritty details...
Please find below the details about my build.
How I call PDE headless
This is the command I use to call PDE headless build:
java \
-jar \
<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar \
-application \
org.eclipse.ant.core.antRunner \
-buildfile \
<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.pde.build_3.8.1.v20120725-202643/scripts/build.xml \
-data \
<prefix>/target/pde_workspace \
-Dbuilder=<prefix>/eclipse/3.8.1/SDK/plugins/org.eclipse.pde.build_3.8.1.v20120725-202643/templates/headless-build \
-DtopLevelElementId=org.example.myproject.feature \
-DtopLevelElementType=feature \
-DbuildDirectory=<prefix>/source \
-DbaseLocation=<prefix>/targetPlatform \
-DjavacSource=1.7 \
-DjavacTarget=1.7 \
-DcompilerArg=-g \
-DbuildLabel=output \
-DarchivePrefix=org.example.myproject \
-DbuildId=org.example.myproject.feature \
-DarchivesFormat=*,*,* - folder \
-Dp2.gathering=true \
-Dp2.build.repo=<prefix>/target/update-site \
-DskipMirroring=true \
-DcollectingFolder=<prefix>/target/tmp
My hope was that adding -DcollectingFolder would redirect all build artifacts to this folder, but it is left empty.
PDE headless documentation
The documentation for PDE headless builds is comprehensive yet somewhat imprecise. For example, for one of its many options it says:
buildType: Type of build, normally something like I, N, M, etc.
The documentation I have been able to find is this:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Freference%2Fpde_builder_config.htm
Does anyone know of other documentation of the PDE headless builds?

You want to set the properties buildTempFolder and feature.temp.folder. I don't believe that these properties are documented anywhere.
If you are familiar with ant, the way to discover this would be to look at the build.xml file that gets generated for a plugin. In the <init> target, if buildTempFolder is set, then the build will end up setting something like
build.result.folder=${buildTempFolder}/plugins/org.example.plugin_1.2.3.201411110853`
If buildTempFolder is not set, then the default value is ${basedir}, which is the root folder of the plugin.
This build.result.folder will be the destination for most of the compiled .class files (see the <#dot> target), and the manifest will be copied there before it is modified (see the <publish.bin.parts> target. If you use customBuildCallbacks, then everything will be staged here before calling your custom callbacks.
The feature.temp.folder is similar to the buildTempFolder but affects features instead of plugins.

Related

How can I determine what is causing an unwanted package to be built in Yocto?

I am trying to build an console image for an RPi using the core-image-base recipe, but somewhere in my configuration, I seem to have switched something on that is increasing the number of recipes built by around 1000 which include many things that don't feel like they belong in a console image (libx11, gnome-desktop-testing, etc.)
I am trying to track down why these recipes are being included in my build. My method so far has been to run the following commands:
# Generate a massive dot file with all the dependencies in it
bitbake -g core-image-base
# grep through that file to find out what is bringing in
# gnome-desktop-testing.
cat task-depends.dot | grep -i gnome-desktop-testing | grep -vi do_package_write_rpm
I removed do_package_write_rpm from the matching since everything seems to match against it. This leaves the following:
"core-image-base.do_build" -> "gnome-desktop-testing.do_build"
"core-image-base.do_rootfs" -> "gnome-desktop-testing.do_package_qa"
"core-image-base.do_rootfs" -> "gnome-desktop-testing.do_packagedata"
"core-image-base.do_rootfs" -> "gnome-desktop-testing.do_populate_lic"
"glib-2.0.do_package_qa" -> "gnome-desktop-testing.do_packagedata"
(followed by many dependencies between the tasks of the gnome-desktop-testing recipe)
So, if my interpretation is correct, it seems that core-image-base is depending directly on gnome-desktop-testing. This seems unusual since core-image-base is supposed to be a console only image.
I tried adding PACKAGE_EXCLUDE = "gnome-desktop-testing" to my local.conf hoping that it would give back some more information, but the build just seems to proceed regardless of this variable's setting :/
How can I figure out why gnome-desktop-testing is being built by Yocto? Ideally I would like to have a solution not involving toaster.
I ran into this issue and so I thought I would post the answer.
First, I removed the recipe, rebuilt and then looked at the first dependency chain.
NOTE: Runtime target 'shared-mime-info' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['shared-mime-info', 'glib-2.0', 'gnome-desktop-testing']
Then we look in the recipe to see that glib-ptest has an RDEPENDS on gnome-desktop-testing.
RDEPENDS_${PN}-ptest += "\
coreutils \
libgcc \
dbus \
gnome-desktop-testing \
tzdata \
So then to fix that you will need to disable "ptest". This can be done from the your distro configuration (meta-layer/conf/distro/*.conf).
One brutal solution to this problem is to just delete the recipe that you don't want and to rerun bitbake. This gives you a useful message such as:
ERROR: Required build target 'core-image-base' has no buildable providers.
Missing or unbuildable dependency chain was:
['core-image-base', 'packagegroup-base-extended', 'ofono', 'glib-2.0', 'gnome-desktop-testing']
If you have brought in these layers using git, the changes can be quickly reverted with git checkout path/to/deleted/recipe

How to add Room,Lifecycle,Paging libraries in Android.mk ( AOSP build)

I created an application with Room,Lifecycle,Paging libraries in android studio,its working well.
Then I tried to build the same application in AOSP,But I can't include Room,Lifecycle,Paging libraries.
I found all these libraries in frameworks/support/ .
But i don't have any idea about how to add these libraries.
Any clues on how to do it?
Add the following lines in your Android.mk file
LOCAL_STATIC_ANDROID_LIBRARIES += \
android-arch-room-runtime \
android-arch-paging-runtime \

How do I link a static lib to a yocto autotools project in Eclipse

I have created a Yocto autotools project in Eclipse (based on a Hello World project).
I wanted to separate my code into a number of libs and then link them in a form of static libs (.a) to my project.
Now I have one app and a number of static libs. However, no matter what I try I can't get my code to compile. Each separate lib compiles and produces a .a file, but my app doesn't.
After searching the web I have a possible solution - add a direct link to my static libs:
MyApp_CPPFLAGS="-I$LOCATION"
MyApp_LDADD="/home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a"
This is my Makefile.am file, where libEncoding2.a exist in that path.
The error I get is:
make[2]: *** No rule to make target `"/home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a"', needed by `MyApp'. Stop.
I already built the lib so I am not sure why a make try is even needed.
Any help will be appreciated.
Because you use static library in your recipes, you can make a soft link to the library in your project source folder, i.e., hello-world-0.1, using following command to link to your static library
ln -s /home/xxx/workspace/MyApp/Encoding2/Debug/libEncoding2.a
and then edit your bb file, hello-world_0.1.bb, adding the source path to your URL
SRC_URI = " \
file://libEncoding2.a \
file://hello-world.c \
"
and in the do_compile block, using follow command to compile your project
do_compile() {
${CC} hello-world.c libEncoding.a -o hello-world
}
do_install() {
install -d ${D}${bindir}/Hello
install -m 0755 enet ${D}${bindir}/Hello
}
After you bitbake your project
bitbake hello-world
and run mkefidisk.sh, you can find the hello-world in /usr/bin/Hello/hello-world. Hope this hint can help you.
BTW, I am not familiar with autotools, I just use make to bitbake the recipes. And your static library should also be created in Yocto not in Eclipse I think. So I think your path for the static library maybe not correct, it should locate in ~/yocto/build/tmp/... or some where like this. In my case, it was located in ln -s ~/yocto/build/tmp/sysroots/intel-corei7-64/usr/lib/libEncoding.a depends on your target environment.
Depending on whether you're using libtool or not, you should have either a noinst_LTLIBRARIES or noinst_LIBRARIES list of targets, respectively. This should only include the name of your library (libEncoding2.la or libEncoding2.a.)
You should never use a full path for this, and you should not quote Make variables, so what you were looking for is
MyApp_CPPFLAGS = -I$LOCATION
MyApp_LDADD = libEncoding2.la # or .a
And that would work.
But on the other hand it seems like you should take some time to understand how autotools work, as it might not be what you're looking for. With a grain of salt you can take my Autotools Mythbuster as a starting point.

Gigaspaces: set directory with runtime dependecies for PUs

My processing units have runtime dependencies and if I put them into $GigaSpaces_root/lib/required then my PUs deploys fine.
But I'd like to keep GS root distr unattached (even owned by root) and put these libs into some other custom dir. But I can't find a way to configure GS to look for dependencies in my custom dir. PRE_CLASSPATH, CLASSPATH, POST_CLASSPATH don't help. Other useful variables are overwritten by setenv.sh on GS initialization. What I'v done:
strings -a /proc/{GSC_PID}/environ | grep tmp
POST_CLASSPATH=/tmp/lib
PRE_CLASSPATH=/tmp/lib
CLASSPATH=/tmp/lib
The question is how to configure GS to look for libraries in custom directory?
Solution is here: http://docs.gigaspaces.com/sbp/moving-into-production-checklist.html#runtime-files-location
export GSC_JAVA_OPTIONS="$GSC_JAVA_OPTIONS -Dcom.gs.pu-common=YOUR_DIR_FOR_LIB"

Eclipse, QT and "C++ project": is it possible?

Need your help:
I want to use Eclipse CDT and QT without creating a "Qt gui project". Is it possible? How to include QT libraries to my C++ project, and how to call qmake/make to compile the program? This Similar question didn't help me(
I want to use 'C++ project' instead of 'QT Gui project' because there is an issue with external libraries indexing in the QT project (this problem)
Thank you a lot!
Nikolai.
We've done something similar using Qt with a vendor customized version of Eclipse (Momentics) and CDT. To get it to work, we ended up creating a generic makefile project in Eclipse with our own, hand generated Makefile.
The hand generated Makefile basically contained enough information to invoke QMake on the appropriate .pro file ("qt.pro") and then invoke the resulting Makefile ("qtmake.mk").
all: qtmake.mk
$(MAKE) -f qtmake.mk
qtmake.mk: qt.pro
qmake -r -o qtmake.mk qt.pro
clean: qtmake.mk
$(MAKE) -f qtmake.mk clean
install: qtmake.mk
$(MAKE) -f qtmake.mk install
Doing this is quite bothering, I suggest you don't do it. I've tried it only on small projects.
As far as I know you'll have to write a correct Makefile yourself (or setup CDT to create it) by including all the include paths you need for Qt headers. Then you'll have to link to all the Qt libraries your project is using.
If you make use of the Qt meta-object system you'll have to run the moc before compiling and linking. The moc generates C++ sources that you'll have to link to the other sources. If you're using GNU make, and I guess you are, it seems to be possible to automate the moc writing the correct instructions in the Makefile CDT will create. For detailed information read this: http://doc.qt.io/qt-5/moc.html#writing-make-rules-for-invoking.
By the way, isn't it possible for you to use Qt Creator?
This is very easy making use of Netbeans, since qt is integrated in the c++ projects.
But if you use Eclipse, as is my case, you could follow these two steps (for linux users):
Include the directories with the Qt headers, for example /usr/include/qt4/Qt.
Generate the moc files from the headers that contain Qt macros, such as Q_OBJECT. This can be done using the following command in the project directory before the build process:
find . -name ".h" | sed 's/(.)(/)(.*)(.h)/moc-qt4 -D & -o \1\2moc_\3.cpp/' | sh
where you have to define the you want. Just run it once, or use the following command before from the project directory:
find . -name "moc_*.cpp" -exec -rm -f {} \;
Build your project.
By the way, have you tried the qt plugging?
J.
Here is an improved variant of the jwernerny's makefile:
first: all
all clean distclean install uninstall: qtmake.mk
$(MAKE) -f qtmake.mk $#
qtmake.mk: *.pro
qmake -r -o qtmake.mk $<
.PHONY: first all clean distclean install uninstall
It should not to be edited when will be copied to another project, and actually the same rules was merged into one.