Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 397d7f5c authored by Martin Stjernholm's avatar Martin Stjernholm Committed by Automerger Merge Worker
Browse files

Merge "Add new user setup command banchan for module building." am: 7af86b16

Original change: https://android-review.googlesource.com/c/platform/build/+/1671570

Change-Id: I3446cd1016f5cffa6db939be677adb3507543afe
parents d8d232e2 7af86b16
Loading
Loading
Loading
Loading

banchanHelp.sh

0 → 100755
+25 −0
Original line number Diff line number Diff line
#!/bin/bash

# locate some directories
cd "$(dirname $0)"
SCRIPT_DIR="${PWD}"
cd ../..
TOP="${PWD}"

message='usage: banchan <module> ... [arm|x86|arm64|x86_64] [eng|userdebug|user]

banchan selects individual APEX modules to be built by the Android build system.
Like "tapas", "banchan" does not request the building of images for a device but
instead configures it for an unbundled build of the given modules, suitable for
installing on any api-compatible device.

The difference from "tapas" is that "banchan" sets the appropriate products etc
for building APEX modules rather than apps (APKs).

The module names should match apex{} modules in Android.bp files, typically
starting with "com.android.".

The usage of the other arguments matches that of the rest of the platform
build system and can be found by running `m help`'

echo "$message"
+55 −0
Original line number Diff line number Diff line
@@ -9,6 +9,9 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
              build, and stores those selections in the environment to be read by subsequent
              invocations of 'm' etc.
- tapas:      tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
              Sets up the build environment for building unbundled apps (APKs).
- banchan:    banchan <module1> [<module2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
              Sets up the build environment for building unbundled modules (APEXes).
- croot:      Changes directory to the top of the tree, or a subdirectory thereof.
- m:          Makes from the top of the tree.
- mm:         Builds and installs all of the modules in the current directory, and their
@@ -791,6 +794,58 @@ function tapas()
    destroy_build_var_cache
}

# Configures the build to build unbundled Android modules (APEXes).
# Run banchan with one or more module names (from apex{} modules).
function banchan()
{
    local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)"
    local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|arm64|x86_64)$' | xargs)"
    local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)"
    local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|arm64|x86_64)$' | xargs)"

    if [ "$showHelp" != "" ]; then
      $(gettop)/build/make/banchanHelp.sh
      return
    fi

    if [ $(echo $arch | wc -w) -gt 1 ]; then
        echo "banchan: Error: Multiple build archs supplied: $arch"
        return
    fi
    if [ $(echo $variant | wc -w) -gt 1 ]; then
        echo "banchan: Error: Multiple build variants supplied: $variant"
        return
    fi
    if [ -z "$apps" ]; then
        echo "banchan: Error: No modules supplied"
        return
    fi

    local product=module_arm
    case $arch in
      x86)    product=module_x86;;
      arm64)  product=module_arm64;;
      x86_64) product=module_x86_64;;
    esac
    if [ -z "$variant" ]; then
        variant=eng
    fi

    export TARGET_PRODUCT=$product
    export TARGET_BUILD_VARIANT=$variant
    export TARGET_BUILD_DENSITY=alldpi
    export TARGET_BUILD_TYPE=release

    # This setup currently uses TARGET_BUILD_APPS just like tapas, but the use
    # case is different and it may diverge in the future.
    export TARGET_BUILD_APPS=$apps

    build_build_var_cache
    set_stuff_for_environment
    printconfig
    destroy_build_var_cache
}

function gettop
{
    local TOPFILE=build/make/core/envsetup.mk