summaryrefslogtreecommitdiffstats
path: root/meta-agl/meta-app-framework/classes/aglwgt.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta-agl/meta-app-framework/classes/aglwgt.bbclass')
-rw-r--r--meta-agl/meta-app-framework/classes/aglwgt.bbclass198
1 files changed, 136 insertions, 62 deletions
diff --git a/meta-agl/meta-app-framework/classes/aglwgt.bbclass b/meta-agl/meta-app-framework/classes/aglwgt.bbclass
index 717bd7b9..042c0fa9 100644
--- a/meta-agl/meta-app-framework/classes/aglwgt.bbclass
+++ b/meta-agl/meta-app-framework/classes/aglwgt.bbclass
@@ -8,82 +8,152 @@
# The makefile needs to use wgtpkg-pack.
#
-
# 'wgtpkg-pack' in af-main-native is required.
DEPENDS_append = " af-main-native"
-# for bindings af-binder is required.
+# for bindings af-binder is required.
DEPENDS_append = " af-binder"
-# for bindings that use the cmake-apps-module
+# for bindings that use the cmake-apps-module
DEPENDS_append = " cmake-apps-module-native"
# for hal bindings genskel is required.
DEPENDS_append = " af-binder-devtools-native"
-EXTRA_OECMAKE_append_agl-ptest = " -DBUILD_TEST_WGT=TRUE"
-
-# FIXME: Remove once CMake+ninja issues are resolved
-OECMAKE_GENERATOR = "Unix Makefiles"
+# Re-enable strip for qmake based projects (default value is "echo")
+OE_QMAKE_STRIP = "${STRIP}"
+
+# Extra build arguments passed to the autobuild script invocations
+AGLWGT_EXTRA_BUILD_ARGS ?= 'VERBOSE=TRUE BUILD_ARGS="${PARALLEL_MAKE}"'
+
+# CMake based widgets that inherit cmake.bbclass will have the
+# following automatically appended to AGLWGT_EXTRA_BUILD_ARGS as
+# the value of CONFIGURE_FLAGS. This definition may need to be
+# extended to include more of what is passed in cmake.bbclass's
+# do_configure if it is found insufficient. Using the generated
+# toolchain.cmake file does fix issues with respect to finding the
+# Qt5 CMake modules that seem difficult to fix otherwise, so at the
+# very minimum it should be present.
+AGLWGT_CMAKE_CONFIGURE_ARGS ?= "-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake ${EXTRA_OECMAKE}"
+
+# Only widgets with recipe names starting with agl-service- are
+# assumed to have tests by default, set this to "1" to force
+# building/packaging of the test widget for other widgets.
+AGLWGT_HAVE_TESTS ?= "0"
+
+# Warning on missing test/debug/coverage packages disabled by default
+# for now to reduce build output clutter.
+AGLWGT_PACKAGE_WARN ?= "0"
+
+# Whether the widget should be auto-installed on first boot
+AGLWGT_AUTOINSTALL ?= "1"
+
+# Signature keys
+# These are default keys for development purposes !
+# Change it for production.
+WGTPKG_AUTOSIGN_0_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/developer.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/developer.cert.pem"
+WGTPKG_AUTOSIGN_1_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/platform.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/platform.cert.pem"
+
+export WGTPKG_AUTOSIGN_0
+export WGTPKG_AUTOSIGN_1
+
+python __anonymous () {
+ # NOTE: AGLWGT_CMAKE_CONFIGURE_ARGS is not updated directly here,
+ # but via the prefunc below to avoid issues around anonymous
+ # python ordering conflicts with e.g. externalsrc.bbclass.
+ if bb.data.inherits_class("cmake", d):
+ d.appendVarFlag('do_compile', 'prefuncs', ' aglwgt_cmake_configure')
+}
-do_aglwgt_package() {
- cd ${B}
- ${S}/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B} VERBOSE=TRUE || \
- ( ${S}/conf.d/autobuild/agl/autobuild package BUILD_DIR=${B} DEST=${B}/package VERBOSE=TRUE && \
- ( bbwarn "OBSOLETE: Your autobuild script should be located in :" ; \
- bbwarn "autobuild/agl/ from the project root source folder"; \
- bbwarn "and generate a .wgt file using wgtpack in the build"; \
- bbwarn "root folder calling:" ; \
- bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>" ; \
- bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes" \
- )
- ) ||
- ( bbwarn "OBSOLETE: You must have an autobuild script located in:" ; \
- bbwarn "autobuild/agl/ from the project root source folder"; \
- bbwarn "with filename autobuild which should generate"; \
- bbwarn "a .wgt file using wgtpack in the build"; \
- bbwarn "root folder calling:" ; \
- bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>" ; \
- bbwarn "Fix your package as it will not work within the SDK" ; \
- bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes"; \
- make package)
+python aglwgt_cmake_configure () {
+ # Define CONFIGURE_FLAGS appropriately if cmake.bbclass has been
+ # inherited, see description of AGLWGT_CMAKE_CONFIGURE_ARGS above
+ # for more details.
+ cmake_config_args = d.getVar("AGLWGT_CMAKE_CONFIGURE_ARGS")
+ if bb.data.inherits_class("cmake", d) and cmake_config_args:
+ d.appendVar("AGLWGT_EXTRA_BUILD_ARGS", ' CONFIGURE_ARGS="' + cmake_config_args + '"')
+ d.appendVarFlag("AGLWGT_EXTRA_BUILD_ARGS", "vardeps", " AGLWGT_CMAKE_CONFIGURE_ARGS")
}
-python () {
- d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
+# Placeholder to keep things like externalsrc that prefunc or append
+# do_configure working as expected.
+aglwgt_do_configure() {
+ true
}
+aglwgt_do_compile() {
+ bldcmd=${S}/autobuild/agl/autobuild
+ if [ ! -x "$bldcmd" ]; then
+ bbfatal "Missing autobuild/agl/autobuild script"
+ fi
+
+ if [ "${S}" != "${B}" ]; then
+ rm -rf ${B}
+ mkdir -p ${B}
+ cd ${B}
+ fi
+
+ if ! $bldcmd package BUILD_DIR=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ bbwarn "Target: package failed"
+ fi
+
+ if ! $bldcmd package-debug BUILD_DIR_DEBUG=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ bbwarn "Target: package-debug failed"
+ fi
+
+ if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
+ if ! $bldcmd package-test BUILD_DIR_TEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ bbwarn "Target: package-test failed"
+ fi
+
+ if ! $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ bbwarn "Target: package-coverage failed"
+ fi
+ fi
+}
POST_INSTALL_LEVEL ?= "10"
POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
EXTRA_WGT_POSTINSTALL ?= ""
-do_aglwgt_deploy() {
- TEST_WGT="*-test.wgt"
- if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]
- then
- install -d ${D}/usr/AGL/apps/manualinstall
- install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/manualinstall || \
- install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/manualinstall
+aglwgt_do_install() {
+ DEST=release
+ if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then
+ DEST=manualinstall
+ fi
+
+ if [ "$(find ${B}/build-release -name '*.wgt' -maxdepth 1)" ]; then
+ install -d ${D}/usr/AGL/apps/$DEST
+ install -m 0644 ${B}/build-release/*.wgt ${D}/usr/AGL/apps/$DEST/
else
- install -d ${D}/usr/AGL/apps/autoinstall
- install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/autoinstall || \
- install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/autoinstall
-
- if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${TEST_WGT})" ]
- then
- install -d ${D}/usr/AGL/apps/testwgt
- mv ${D}/usr/AGL/apps/autoinstall/*-test.wgt ${D}/usr/AGL/apps/testwgt
- fi
+ bbfatal "no package found in widget directory"
fi
- APP_FILES=""
- for file in ${D}/usr/AGL/apps/autoinstall/*.wgt;do
- APP_FILES="${APP_FILES} $(basename $file)";
+ for t in test debug coverage; do
+ if [ "$(find ${B}/build-${t} -name *-${t}.wgt -maxdepth 1)" ]; then
+ install -d ${D}/usr/AGL/apps/${t}
+ install -m 0644 ${B}/build-${t}/*-${t}.wgt ${D}/usr/AGL/apps/${t}/
+ elif [ "${AGLWGT_PACKAGE_WARN}" = "1" ]; then
+ if [ "$t" != "test" -a "$t" != "coverage" ]; then
+ bbwarn "no package found in ${t} widget directory"
+ elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
+ bbwarn "no package found in ${t} widget directory"
+ fi
+ fi
done
- install -d ${D}/${sysconfdir}/agl-postinsts
- cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
+
+ if [ "${AGLWGT_AUTOINSTALL}" != "0" ]; then
+ # For now assume autoinstall of the release versions
+ rm -rf ${D}/usr/AGL/apps/autoinstall
+ ln -sf release ${D}/usr/AGL/apps/autoinstall
+
+ APP_FILES=""
+ for file in ${D}/usr/AGL/apps/autoinstall/*.wgt; do
+ APP_FILES="${APP_FILES} $(basename $file)";
+ done
+ install -d ${D}/${sysconfdir}/agl-postinsts
+ cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
#!/bin/sh -e
for file in ${APP_FILES}; do
/usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
@@ -91,19 +161,23 @@ done
sync
${EXTRA_WGT_POSTINSTALL}
EOF
- chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
+ chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
+ fi
}
-FILES_${PN} += "/usr/AGL/apps/autoinstall/*.wgt \
- /usr/AGL/apps/manualinstall/*.wgt \
- /usr/AGL/apps/testwgt/*.wgt \
- ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
- "
-
-do_install() {
-}
+PACKAGES += "${PN}-test ${PN}-debug ${PN}-coverage"
-addtask aglwgt_deploy before do_package after do_install
-addtask aglwgt_package before do_aglwgt_deploy after do_compile
+FILES_${PN} += " \
+ /usr/AGL/apps/release/*.wgt \
+ /usr/AGL/apps/autoinstall \
+ /usr/AGL/apps/manualinstall \
+ ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
+"
+FILES_${PN}-test = "/usr/AGL/apps/test/*.wgt"
+FILES_${PN}-debug = "/usr/AGL/apps/debug/*.wgt"
+FILES_${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt"
+# Test widgets need the parent widget and the test framework
+RDEPENDS_${PN}-test = "${PN} afb-test"
+EXPORT_FUNCTIONS do_configure do_compile do_install