Skip to content

Instantly share code, notes, and snippets.

@goyaljai
Last active January 31, 2023 18:06
Show Gist options
  • Save goyaljai/c4a375fac3f1c375e3c9f014d4b671bc to your computer and use it in GitHub Desktop.
Save goyaljai/c4a375fac3f1c375e3c9f014d4b671bc to your computer and use it in GitHub Desktop.
Lunch Flow
function print_lunch_menu()
{
...
choices=$(TARGET_BUILD_VARIANT= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null)
...
}
function get_build_var()
{
...
build/soong/soong_ui.bash --dumpvar-mode $1)
}
func main() {
...
config := c.config(buildCtx, args...)
...
f := build.NewSourceFinder(buildCtx, config)
defer f.Shutdown()
build.FindSources(buildCtx, config, f)
...
}
function lunch()
{
print_lunch_menu
...
read selection
...
product=${selection%%-*} # Trim everything after first dash
variant_and_version=${selection#*-} # Trim everything up to first dash
if [ "$variant_and_version" != "$selection" ]; then
variant=${variant_and_version%%-*}
if [ "$variant" != "$variant_and_version" ]; then
version=${variant_and_version#*-}
fi
fi
...
TARGET_PRODUCT=$product \
TARGET_BUILD_VARIANT=$variant \
TARGET_PLATFORM_VERSION=$version \
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment