X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=meta-app-framework%2Fclasses%2Faglwgt.bbclass;h=f42c282a73f6c04db30731b040592a73f16c5b98;hb=1b0d65113b277610135b5599c8810ca7a4e3df4c;hp=b5f7be8bf0220974a3981aed0ed5ef11be607f41;hpb=dad22a2b3c3cced169c4790e8fe5d8cf2cc62ee2;p=AGL%2Fmeta-agl.git diff --git a/meta-app-framework/classes/aglwgt.bbclass b/meta-app-framework/classes/aglwgt.bbclass index b5f7be8bf..f42c282a7 100644 --- a/meta-app-framework/classes/aglwgt.bbclass +++ b/meta-app-framework/classes/aglwgt.bbclass @@ -9,116 +9,143 @@ # # 'wgtpkg-pack' in af-main-native is required. -DEPENDS_append = " af-main-native" +DEPENDS:append = " af-main-native" -# for bindings af-binder is required. -DEPENDS_append = " af-binder" +# for bindings af-binder is required. +DEPENDS:append = " af-binder" -# for bindings that use the cmake-apps-module -DEPENDS_append = " cmake-apps-module-native" +# 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" +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 ${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" +# Whether the widget should be auto-installed on first boot +AGLWGT_AUTOINSTALL ?= "1" -# 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" +# 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() { +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") +} + +# 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 - cd ${B} - if ! $bldcmd package BUILD_DIR=${B} DEST=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}; then - bbwarn "Target: package failed" + if [ "${S}" != "${B}" ]; then + rm -rf ${B} + mkdir -p ${B} + cd ${B} 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 - bbwarn "Target: package-test failed" - fi - fi + $bldcmd package BUILD_DIR=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS} + $bldcmd package-debug BUILD_DIR_DEBUG=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS} - 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 - bbwarn "Target: package-debug failed" - fi + if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then + # Only try building the test widget if there's source for it, to avoid spurious errors + if [ -f ${S}/test/CMakeLists.txt ]; then + $bldcmd package-test BUILD_DIR_TEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS} + 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 - bbwarn "Target: package-coverage failed" + # The coverage widget should always build + $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS} 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 fi - if [ "$(find ${B}/build-release -name '*.wgt')" ]; then + wgt="$(find ${B}/build-release -maxdepth 1 -name '*.wgt'| head -n 1)" + if [ -n "$wgt" ]; then install -d ${D}/usr/AGL/apps/$DEST - install -m 0644 ${B}/build-release/*.wgt ${D}/usr/AGL/apps/$DEST/ + install -m 0644 $wgt ${D}/usr/AGL/apps/$DEST/ else - bberror "no package found in widget directory" + bbfatal "no package found in widget directory" fi - for t in test debug coverage; do - if [ "$(find ${B}/build-${t} -name *-${t}.wgt)" ]; then + for t in debug coverage test; do + if [ "$(find ${B}/build-${t} -maxdepth 1 -name *-${t}.wgt)" ]; 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 - if [ "$t" != "test" ]; then - bbwarn "no package found in ${t} widget directory" - elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "true" ]; then - bbwarn "no package found in ${t} widget directory" + elif [ "$t" = "debug" ]; then + # HTML5 widgets complicate things here, need to detect them and + # not error out in that case. ATM this requires looking in the + # config.xml of the release widget. + rm -rf ${B}/tmp + unzip $wgt config.xml -d ${B}/tmp + if [ -f ${B}/tmp/config.xml -a \ + ! cat ${B}/tmp/config.xml | \ + grep -q '^[[:space:]]*