blob: 725a14559668181f4fe50816875d7e1892ab9bd9 [file] [log] [blame]
Colin Cross68f55102015-03-25 14:43:57 -07001// Copyright 2015 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Colin Cross635c3b02016-05-18 15:37:25 -070015package android
Colin Cross68f55102015-03-25 14:43:57 -070016
17import (
Lukacs T. Berki3243aa52021-02-25 14:44:14 +010018 "android/soong/shared"
Colin Cross68f55102015-03-25 14:43:57 -070019)
20
Lukacs T. Berkif0b3b942021-03-23 11:46:47 +010021// This file supports dependencies on environment variables. During build
22// manifest generation, any dependency on an environment variable is added to a
23// list. At the end of the build, a JSON file called soong.environment.used is
24// written containing the current value of all used environment variables. The
25// next time the top-level build script is run, soong_ui parses the compare the
26// contents of the used environment variables, then, if they changed, deletes
27// soong.environment.used to cause a rebuild.
28//
29// The dependency of build.ninja on soong.environment.used is declared in
30// build.ninja.d
Colin Cross68f55102015-03-25 14:43:57 -070031
Dan Willemsen66068722017-05-08 21:15:59 +000032var originalEnv map[string]string
33
Lukacs T. Berki7690c092021-02-26 14:27:36 +010034func InitEnvironment(envFile string) {
35 var err error
36 originalEnv, err = shared.EnvFromFile(envFile)
37 if err != nil {
38 panic(err)
Lukacs T. Berki848e00e2020-11-06 10:42:50 +010039 }
Lukacs T. Berkia5e0f712020-05-18 09:50:18 +020040}