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

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

Merge "Move environment staleness check to soong_ui."

parents cfcaddc5 3243aa51
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ bootstrap_go_package {
        "soong",
        "soong-android-soongconfig",
        "soong-bazel",
        "soong-env",
        "soong-shared",
        "soong-ui-metrics_proto",
    ],
+2 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import (
	"strings"
	"syscall"

	"android/soong/env"
	"android/soong/shared"
)

// This file supports dependencies on environment variables.  During build manifest generation,
@@ -113,7 +113,7 @@ func (c *envSingleton) GenerateBuildActions(ctx SingletonContext) {
		return
	}

	data, err := env.EnvFileContents(envDeps)
	data, err := shared.EnvFileContents(envDeps)
	if err != nil {
		ctx.Errorf(err.Error())
	}
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ bootstrap_go_binary {
        "soong",
        "soong-android",
        "soong-bp2build",
        "soong-env",
        "soong-ui-metrics_proto",
    ],
    srcs: [

cmd/soong_env/Android.bp

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

bootstrap_go_binary {
    name: "soong_env",
    deps: [
        "soong-env",
    ],
    srcs: [
        "soong_env.go",
    ],
    default: true,
}

cmd/soong_env/soong_env.go

deleted100644 → 0
+0 −57
Original line number Diff line number Diff line
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// soong_env determines if the given soong environment file (usually ".soong.environment") is stale
// by comparing its contents to the current corresponding environment variable values.
// It fails if the file cannot be opened or corrupted, or its contents differ from the current
// values.

package main

import (
	"flag"
	"fmt"
	"os"

	"android/soong/env"
)

func usage() {
	fmt.Fprintf(os.Stderr, "usage: soong_env env_file\n")
	fmt.Fprintf(os.Stderr, "exits with success if the environment varibles in env_file match\n")
	fmt.Fprintf(os.Stderr, "the current environment\n")
	flag.PrintDefaults()
	os.Exit(2)
}

// This is a simple executable packaging, and the real work happens in env.StaleEnvFile.
func main() {
	flag.Parse()

	if flag.NArg() != 1 {
		usage()
	}

	stale, err := env.StaleEnvFile(flag.Arg(0))
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err.Error())
		os.Exit(1)
	}

	if stale {
		os.Exit(1)
	}

	os.Exit(0)
}
Loading