[ref] Refactor build-tree and fetch-binaries