Commit graph

7 commits

Author SHA1 Message Date
Jooyung Han
e9793a7e82 Fix: soong_ui.bash's wrong check for TOP variable
soong_ui.bash defines `gettop` function and it finds top of the source
tree. It also checks if `TOP` is properly set and if set use it.
However its check was using the wrong operator (`-z`) for it.

Test: m -j
Change-Id: Ie86dc340a9f89f45ff0828ea43f6afa3713bda76
2018-12-28 14:43:52 +09:00
Dan Willemsen
91f9b54767 Switch to blueprint's microfactory
Bug: 63720725
Test: m -j nothing
Test: mkdir o; ../bootstrap.bash; ./soong
Change-Id: Id1f8312678f36afd08b49f8511fec3e6e5ba8de2
2017-07-24 15:29:14 -07:00
Dan Willemsen
1b82286736 Support running soong_ui.bash from anywhere in the tree
It will cd to $TOP before running soong_ui itself, so that soong_ui
still runs from the top of the tree. ORIGINAL_PWD is saved so that we
can reference that later (for example, to move 'mma' implementation into
Go).

Test: cd system; ../build/soong/soong_ui.bash
Test: Set absolute / relative OUT_DIR or OUT_DIR_COMMON_BASE and repeat
Change-Id: Icb67a3ee6a3358cca50300755c8953419fc19437
2017-07-12 16:41:09 -07:00
Dan Willemsen
0df1517259 Add build_test.sh, split common parts of soong_ui.bash
Move common microfactory functions to cmd/microfactory/microfactory.bash
so that they can be used to build both soong_ui for normal build and
multiproduct_kati for build system tests.

Test: m -j
Test: build/soong/build_test.bash
Change-Id: I9512642d846ce54d05a027b6d33a2b3029b3f90b
2017-05-15 17:26:52 -07:00
Dan Willemsen
0c3919e996 Fix OUT_DIR_COMMON_BASE with soong_ui
Currently, Kati is the only one that is respecting OUT_DIR_COMMON_BASE,
causing the build to fail when ninja tries to match up the Soong and
Kati ninja files.

The soong_ui.bash script change is necessary to move the microfactory
built outputs to the correct location.

The config.go change takes care of setting OUT_DIR in the environment of
every subprocess, so that we could remove the OUT_DIR_COMMON_BASE
handling from Make once the USE_SOONG_UI=false path goes away.

Bug: 35929763
Test: m -j blueprint_tools
Test: OUT_DIR=... m -j blueprint_tools
Test: OUT_DIR_COMMON_BASE=... m -j blueprint_tools
Change-Id: I4184f2b4392d32c5bea51e51162a48df0e5c90d5
2017-03-02 19:42:21 -08:00
Dan Willemsen
fde8534680 Don't use runtime.Version() to find the current go version
That will be the go version at compile time. So read $GOROOT/VERSION, or
fall back to executing `$GOROOT/bin/go version` to find the go version
currently in GOROOT.

Test: Ensure everything rebuilds when switching between go1.8rc2 and go1.8
Change-Id: I8738a7aa249a088b1e0668af260fa3974844dab7
2017-02-22 22:03:04 -08:00
Dan Willemsen
0043c0e767 Add microfactory to bootstrap a go program with minimal overhead
microfactory is a tool to incrementally compile a go program. It's
similar to `go install`, but doesn't require a GOPATH. A package->path
mapping can be specified as command line options. All input files are
hashed, and if any change, the necessary packages will be rebuilt.

microfactory can (re)build itself as necessary, so combined with a shell
script that runs `go run microfactory.go` the first time, it can
bootstrap a go program entirely from sources with just a working goroot.

Time to build soong_ui only using source & GOROOT:

            first time    no-change incremental
microfactory  1400ms               15ms
go install     670ms              130ms

While microfactory takes longer the first time, almost half of that time
is from `go run` and building microfactory for use later. If
microfactory only has to build soong_ui, it's about 580ms.

Test: USE_SOONG_UI=true m -j blueprint_tools
Test: go test -bench . build/soong/cmd/microfactory/microfactory_test.go
Change-Id: I4d2b9825788144fa10042bbd804482e44f459a54
2017-02-06 14:05:07 -08:00