Android envsetup.sh overrides pre-set TARGET_BUILD_TYPE env variable!

247 views
Skip to first unread message

Abhayadev S

unread,
Jan 4, 2022, 5:41:31 PM1/4/22
to Android Building
Hi,

I am using a master build script to trigger the android build and the master script does the following steps,

source build/envsetup.sh && lunch <num>

Now in my master script i was planning to export the TARGET_BUILD_TYPE as debug or release according to my other options.

Now I see that the  build/envsetup.sh is over-writing it by exporting  TARGET_BUILD_TYPE always as release in the lunch function ! (ref: https://cs.android.com/android/platform/superproject/+/master:build/make/envsetup.sh;drc=6a012266a18cdf89d4e94a3ce7aa15a9c462a448;l=718)

is this expected? its really blocking any possibilities for automation right?

regards,
abhay

Dan Willemsen

unread,
Jan 4, 2022, 5:54:16 PM1/4/22
to android-...@googlegroups.com
We never really use anything other than TARGET_BUILD_TYPE=release -- in AOSP changing that flag is effectively a no-op. TARGET_BUILD_VARIANT=eng or runtime flags tend to control more debug-like features, but in general it's problematic to turn on any sort of "debug" for everything in a build (doesn't fit in the partitions, too slow on device, yet another cross-cutting feature that isn't regularly tested, etc).

We also tend to avoid using `lunch` (or even envsetup.sh) at all for automation -- it's only setting ~3 variables that the build actually uses (TARGET_PRODUCT / TARGET_BUILD_VARIANT / TARGET_BUILD_APPS, plus TARGET_BUILD_TYPE=release). So much of our automation just does:

build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=my_product TARGET_BUILD_VARIANT=userdebug droid dist <other things to build>

Which is roughly equivalent to:

source build/envsetup.sh && lunch my_product-userdebug && m dist

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/1ef6ee61-9e47-4116-96c3-b64041461b03n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages