[Toybox] Question about android's header generation policy.

enh enh at google.com
Fri Nov 12 17:26:50 PST 2021


On Fri, Nov 12, 2021 at 2:08 AM Rob Landley <rob at landley.net> wrote:
>
> Why is Android checking in generated files again?

because it's the easiest choice.

> I ask because I'm fiddling with scripts/single.sh so it doesn't depend on
> .config existing. (It should make a temporary defconfig to harvest symbols from
> in that case; I'm going down a rathole of adding record-commands support to
> mkroot.sh which needs to do a standalone build of the logging wrapper as part of
> the airlock step...)
>
> Anyway, there's code in single.sh to touch .config  with the comment that it
> forces a header rebuild, and I'm going A) if .config isn't there it shouldn't
> touch it, B) rm generated/Config.in is a more reliable way to force a header
> rebuild anyway, C) rebuilding the headers doesn't take very long so it should
> probably ALWAYS do it...
>
> Except Android checks the generated/ files into the build, which conflicts with
> B and C both. I don't remember why it does this. It SEEMS like it should just
> have a kconfig/android_defconfig like macos and freebsd do, but I vaguely recall
> Elliott had some policy reason for not running the header generation part of the
> build scripts? (And in any case, it currently _doesn't_, so I can't make this
> change right now...)

no policy, just difficulty. maybe in 10 years when there's no real
churn, but since any change you made would need to be replicated in
make^Wsoong^Wbazel ... vita brevis and all that.

> Also, Android.bp says to run ./regenerate.sh which isn't there when I "git clone
> https://android.googlesource.com/platform/external/toybox" but _is_ there in the
> aosp full repo checkout I haven't updated since july, and I thought "maybe it
> got renamed to post_update.sh?" but when I do a "git log post_update.sh" it only
> shows 2 commits and when I do a "git log --follow post_update.sh" it shows
> NOTHING...? (I did a fresh checkout to make sure my android toybox dir hadn't
> gone weird and yes: git is being strange, and I am REALLY confused now.)

yeah, regenerate.sh was what i'd run manually. post_update.sh is the
name that file needs to have to be automatically run by
`tools/external_updater/updater.sh update --branch_and_commit
--push_change toybox`, except for the life of me i can't work out why
that's not working. which, in turn, is why i haven't yet updated the
instructions in the .mk^W.bp file; i'll replace the lot with that
updater.sh invocation once it works.

> Rob
>
> P.S. I need to replace kconfig/ at which point there's probably a
> scripts/kconfig to build defconfig and such which  means I can clean out calls
> to "make" from scripts/*.sh and then the Makefile can be a pure optional wrapper
> like it's supposed to. It's on the todo list, after getting toysh to run
> everything in scripts/*.sh.

yeah, separating the concerns out a bit so i don't have to do library
detection (while cross-compiling!) and so on would probably help, but
like i said --- may as well wait for things to have seen no churn (on
our side as well as yours) before rewriting everything.



More information about the Toybox mailing list