Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2926e75 authored by Lukács T. Berki's avatar Lukács T. Berki Committed by Gerrit Code Review
Browse files

Merge "Make null builds always be null builds."

parents a1063c09 c99c947c
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import (
	"os"
	"path/filepath"
	"strings"
	"time"

	"android/soong/shared"
	"github.com/google/blueprint/bootstrap"
@@ -191,13 +192,24 @@ func main() {
func writeUsedVariablesFile(path string, configuration android.Config) {
	data, err := shared.EnvFileContents(configuration.EnvDeps())
	if err != nil {
		fmt.Fprintf(os.Stderr, "error writing used variables file %s: %s", path, err)
		fmt.Fprintf(os.Stderr, "error writing used variables file %s: %s\n", path, err)
		os.Exit(1)
	}

	err = ioutil.WriteFile(path, data, 0666)
	if err != nil {
		fmt.Fprintf(os.Stderr, "error writing used variables file %s: %s", path, err)
		fmt.Fprintf(os.Stderr, "error writing used variables file %s: %s\n", path, err)
		os.Exit(1)
	}

	// Touch the output Ninja file so that it's not older than the file we just
	// wrote. We can't write the environment file earlier because one an access
	// new environment variables while writing it.
	outputNinjaFile := shared.JoinPath(topDir, bootstrap.CmdlineOutFile())
	currentTime := time.Now().Local()
	err = os.Chtimes(outputNinjaFile, currentTime, currentTime)
	if err != nil {
		fmt.Fprintf(os.Stderr, "error touching output file %s: %s\n", outputNinjaFile, err)
		os.Exit(1)
	}
}