[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    kservice_to_json dependency troubles
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2013-11-13 13:13:44
Message-ID: l5vttv$hod$1 () ger ! gmane ! org
[Download RAW message or body]

Hi,

I have been investigating some weird build failures on build.kde.org, such 
as this one:

http://build.kde.org/job/kde-workspace_master_qt5/1432/console (error is
at 12:04:37)

I found out this is a dependency issue: the new json system should run
commands in this order (commands are simplified):

    desktoptojson \
        plasma-containmentactions-contextmenu.desktop \
        plasma-containmentactions-contextmenu.json

    moc menu.cpp -o menu.moc

    g++ menu.cpp -o menu.o

The kservice framework provides a macro to call desktoptojson:
kservice_desktop_to_json. The problem right now is that the macro does
not define a dependency to express that the json file should be
generated before moc is run.

I put together a new test for kservice to reproduce this problem, see
attached patch. It builds successfully with `make -j1` in the test dir,
but I am able to reproduce the build failure with `make -j4`.
(Note that you must manually rm the .json file from the build dir to
reproduce it over and over: `make clean` does not remove it)

I tried to express the missing dependency using various mixes of
OBJECT_DEPENDS, but I can't find a way to say: "this target must be
built before moc". Do you have any advice?

Aurélien

["0001-Add-test-for-kservice_desktop_to_json.patch" (text/x-patch)]

From 097d935f32683a8c79dc09f6c7207af02ed8243d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aurélien Gâteau?= <agateau@kde.org>
Date: Thu, 7 Nov 2013 10:37:22 +0100
Subject: [PATCH] Add test for kservice_desktop_to_json

---
 tier3/kservice/src/desktoptojson/CMakeLists.txt |  1 +
 tier3/kservice/tests/CMakeLists.txt             |  7 +++++++
 tier3/kservice/tests/dummy-service.desktop      | 10 ++++++++++
 tier3/kservice/tests/dummyplugin.cpp            |  9 +++++++++
 tier3/kservice/tests/dummyplugin.h              | 13 +++++++++++++
 5 files changed, 40 insertions(+)
 create mode 100644 tier3/kservice/tests/dummy-service.desktop
 create mode 100644 tier3/kservice/tests/dummyplugin.cpp
 create mode 100644 tier3/kservice/tests/dummyplugin.h

diff --git a/tier3/kservice/src/desktoptojson/CMakeLists.txt \
b/tier3/kservice/src/desktoptojson/CMakeLists.txt index 9dc8635..afe21f2 100644
--- a/tier3/kservice/src/desktoptojson/CMakeLists.txt
+++ b/tier3/kservice/src/desktoptojson/CMakeLists.txt
@@ -4,6 +4,7 @@ add_executable(desktoptojson
     main.cpp
     kconfigtojson.cpp
 )
+add_executable(KF5::desktoptojson ALIAS desktoptojson)

 target_link_libraries(desktoptojson
     Qt5::Core
diff --git a/tier3/kservice/tests/CMakeLists.txt \
b/tier3/kservice/tests/CMakeLists.txt index 70c450c..4f03aac 100644
--- a/tier3/kservice/tests/CMakeLists.txt
+++ b/tier3/kservice/tests/CMakeLists.txt
@@ -30,3 +30,10 @@ ecm_mark_as_test(kmimeassociationstest)

 target_link_libraries(kmimeassociationstest KService KF5::KConfigCore Qt5::Test)
 target_include_directories(kmimeassociationstest PRIVATE \
"${CMAKE_CURRENT_SOURCE_DIR}/../src/kbuildsycoca/") +
+######### kservicetojsontest ########
+include(../KServiceMacros.cmake)
+kservice_desktop_to_json(dummy-service.desktop)
+add_library(kservicetojsontest dummyplugin.cpp)
+target_link_libraries(kservicetojsontest KF5::KService)
+target_include_directories(kservicetojsontest PRIVATE \
                "${CMAKE_CURRENT_SOURCE_DIR}/../src/plugin/")
diff --git a/tier3/kservice/tests/dummy-service.desktop \
b/tier3/kservice/tests/dummy-service.desktop new file mode 100644
index 0000000..217e6de
--- /dev/null
+++ b/tier3/kservice/tests/dummy-service.desktop
@@ -0,0 +1,10 @@
+[Desktop entry]
+Type=Service
+Icon+Name=Dummy
+ServiceTypes=Dummy
+X-KDE-Library=kservicetojsontest
+X-KDE-PluginInfo-Author=Aurélien Gâteau
+X-KDE-PluginInfo-Email=agateau@kde.org
+X-KDE-PluginInfo-Name=kservicetojsontest
+X-KDE-PluginInfo-Version= °.1
diff --git a/tier3/kservice/tests/dummyplugin.cpp \
b/tier3/kservice/tests/dummyplugin.cpp new file mode 100644
index 0000000..ca6acdb
--- /dev/null
+++ b/tier3/kservice/tests/dummyplugin.cpp
@@ -0,0 +1,9 @@
+#include <dummyplugin.h>
+#include <kpluginfactory.h>
+
+DummyPlugin::DummyPlugin(QObject*, const QVariantList&)
+{}
+
+K_PLUGIN_FACTORY_WITH_JSON(DummyPluginFactory, "dummy-service.json", \
registerPlugin<DummyPlugin>();) +
+#include <dummyplugin.moc>
diff --git a/tier3/kservice/tests/dummyplugin.h b/tier3/kservice/tests/dummyplugin.h
new file mode 100644
index 0000000..33b1403
--- /dev/null
+++ b/tier3/kservice/tests/dummyplugin.h
@@ -0,0 +1,13 @@
+#ifndef DUMMYPLUGIN_H
+#define DUMMYPLUGIN_H
+
+#include <QObject>
+
+class DummyPlugin : public QObject
+{
+    Q_OBJECT
+public:
+    DummyPlugin(QObject*, const QVariantList&);
+};
+
+#endif /* DUMMYPLUGIN_H */
--
1.8.3.2



_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic