summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-06-25 18:26:23 -0400
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-06-26 13:02:06 +0000
commit6ba0b4d2b38b88fef8bb847fe8631995d72910b6 (patch)
treeb9dafa01ad87200ec4a0d0be60bf127e71b9b15a
parentdd45b827fa33b83e3ad84bea983db0625fe28149 (diff)
meta-app-framework: rework aglwgt.bbclass to solely use autobuild
Changes include: - OE_QMAKE_STRIP definition added to re-enable strip so it will work for qmake based widgets. - AGLWGT_HAVE_TESTS and AGLWGT_PACKAGE_WARN changed to use 0/1 instead or true/false to match more typical OE flag usage. As well, their definitions are now done with ?= to make over-riding more straightforward. - The AGLWGT_AUTOINSTALL_${PN} variable has been renamed to just be AGLWGT_AUTOINSTALL, and a default definition has been added to make the behavior more explicit. There is only one in-tree user (the agl-service-can-high-viwi binding), which is currently not built and has been slated for removal, so this change is thought to have no impact. - A new AGLWGT_CMAKE_CONFIGURE_ARGS variable has been added with a definition derived from what is used in cmake.bbclass, and a combination of anonymous python and a prefunc is used to append its value to AGLWGT_EXTRA_BUILD_ARGS if cmake.bbclass has been inherited. This fixes issues with e.g. widgets that use CMake and Qt5, as the Qt5 CMake modules seem to have issues with finding module includes if the generated toolchain.cmake and OE_CMAKE* values are not passed down to CMake. - The do_aglwgt_package and do_aglwgt_deploy tasks have been converted into aglwgt_do_compile and aglwgt_do_install, and aglwgt_do_compile now calls autobuild to build and package all widgets. This fixes a lot of inconsistencies with respect to the debug/test/coverage widget build environment that were seen with the previous approach. - Logic has been added to clear out the target build directory (${B}) if it is not the same as the source directory (${S}) to match the behavior of do_configure in cmake.bbclass. - All autobuild invocations are now done with the working directory being the build directory (${B}). If a widget build for some reason needs it to be inside the source tree (i.e. ${S}), as before, it should either over-ride the value of B in its recipe, or change directories in its autobuild script. An example of widgets that this affects are the html5-* applications, their autobuild scripts have been appropriately updated. - The BUILD_DIR* output directory arguments passed to the autobuild script now point into ${B} and not ${S}, to ensure that the widget source trees are not contaminated if at all possible. It is believed that the previous rounds of autobuild script rework have addressed the need to support this in all in-tree widgets. - The do_install_bbappend in the agl-service-network binding recipe has been updated for the change to build output directory location. Bug-AGL: SPEC-2049, SPEC-3300 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I88ca33ad7a460436008442a3a8f1adf197f5a669 Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/24884 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
-rw-r--r--meta-agl-profile-core/recipes-apis/agl-service-network/agl-service-network_git.bb8
-rw-r--r--meta-app-framework/classes/aglwgt.bbclass123
2 files changed, 69 insertions, 62 deletions
diff --git a/meta-agl-profile-core/recipes-apis/agl-service-network/agl-service-network_git.bb b/meta-agl-profile-core/recipes-apis/agl-service-network/agl-service-network_git.bb
index dbe9b3e..c7fb72f 100644
--- a/meta-agl-profile-core/recipes-apis/agl-service-network/agl-service-network_git.bb
+++ b/meta-agl-profile-core/recipes-apis/agl-service-network/agl-service-network_git.bb
@@ -14,12 +14,12 @@ S = "${WORKDIR}/git"
DEPENDS = "glib-2.0 json-c"
-FILES_${PN}-tools = "${sbindir}/agl-service-network-ctl"
-PACKAGES = "${PN}-tools ${PN}-dbg ${PN}"
+inherit cmake aglwgt pkgconfig
do_install_append() {
install -d ${D}${sbindir}
- install -m 755 ${B}/test/agl-service-network-ctl ${D}${sbindir}
+ install -m 755 ${B}/build-release/test/agl-service-network-ctl ${D}${sbindir}
}
-inherit cmake aglwgt pkgconfig
+FILES_${PN}-tools = "${sbindir}/agl-service-network-ctl"
+PACKAGES_prepend = "${PN}-tools "
diff --git a/meta-app-framework/classes/aglwgt.bbclass b/meta-app-framework/classes/aglwgt.bbclass
index 1a76992..4dd3fec 100644
--- a/meta-app-framework/classes/aglwgt.bbclass
+++ b/meta-app-framework/classes/aglwgt.bbclass
@@ -11,88 +11,109 @@
# '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"
-# Set the default build type for cmake based projects
-# NOTE: This can be removed after switching to using the autobuild
-# script to do compilation
-EXTRA_OECMAKE_append = " -DCMAKE_BUILD_TYPE=RELEASE"
+# Re-enable strip for qmake based projects (default value is "echo")
+OE_QMAKE_STRIP = "${STRIP}"
-# FIXME: Remove once CMake+ninja issues are resolved
-OECMAKE_GENERATOR = "Unix Makefiles"
+# Extra build arguments passed to the autobuild script invocations
+AGLWGT_EXTRA_BUILD_ARGS ?= 'VERBOSE=TRUE BUILD_ARGS="${PARALLEL_MAKE}"'
-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 "true" to force
+# assumed to have tests by default, set this to "1" to force
# building/packaging of the test widget for other widgets.
-AGLWGT_HAVE_TESTS = "false"
+AGLWGT_HAVE_TESTS ?= "0"
# Warning on missing test/debug/coverage packages disabled by default
# for now to reduce build output clutter.
-AGLWGT_PACKAGE_WARN = "false"
+AGLWGT_PACKAGE_WARN ?= "0"
-# There are some widgets with build issues wrt test/debug/coverage
-# that are currently non-fatal but do not yield a widget, allow empty
-# test and coverage packages for now to allow the build to proceed.
-# This matches the default behavior for -dbg packages.
-#
-# NOTE: This should revisited after a round of autobuild script rework
-# to address SPEC-3300.
-ALLOW_EMPTY_${PN}-coverage = "1"
-ALLOW_EMPTY_${PN}-debug = "1"
-ALLOW_EMPTY_${PN}-test = "1"
+# 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"
-do_aglwgt_package() {
+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')
+}
+
+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")
+}
+
+do_configure[noexec] = "1"
+
+aglwgt_do_compile() {
bldcmd=${S}/autobuild/agl/autobuild
if [ ! -x "$bldcmd" ]; then
bbfatal "Missing autobuild/agl/autobuild script"
fi
- cd ${B}
- if ! $bldcmd package BUILD_DIR=${B} DEST=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ 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
- mkdir -p ${S}/build-debug
- cd ${S}/build-debug
- if ! $bldcmd package-debug BUILD_DIR=${S}/build-debug DEST=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ 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}" = "true" ]; then
- mkdir -p ${S}/build-test
- cd ${S}/build-test
- if ! $bldcmd package-test BUILD_DIR=${S}/build-test DEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ 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
- mkdir -p ${S}/build-coverage
- cd ${S}/build-coverage
- if ! $bldcmd package-coverage BUILD_DIR=${S}/build-coverage DEST=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}; then
+ if ! $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}; then
bbwarn "Target: package-coverage failed"
fi
fi
}
-python () {
- d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
-}
-
POST_INSTALL_LEVEL ?= "10"
POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
EXTRA_WGT_POSTINSTALL ?= ""
-do_aglwgt_deploy() {
+aglwgt_do_install() {
DEST=release
if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then
DEST=manualinstall
@@ -109,16 +130,16 @@ do_aglwgt_deploy() {
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}" = "true" ]; then
+ 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}" = "true" ]; then
+ elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
bbwarn "no package found in ${t} widget directory"
fi
fi
done
- if [ "${AGLWGT_AUTOINSTALL_${PN}}" != "0" ]; then
+ 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
@@ -140,12 +161,6 @@ EOF
fi
}
-do_install() {
-}
-
-addtask aglwgt_deploy before do_package after do_install
-addtask aglwgt_package before do_aglwgt_deploy after do_compile
-
PACKAGES += "${PN}-test ${PN}-debug ${PN}-coverage"
FILES_${PN} += " \
@@ -161,12 +176,4 @@ FILES_${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt"
# Test widgets need the parent widget and the test framework
RDEPENDS_${PN}-test = "${PN} afb-test"
-# 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
-
+EXPORT_FUNCTIONS do_compile do_install