Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 1 | // 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 Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 15 | package android |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 16 | |
| 17 | import ( |
Lukacs T. Berki | 3243aa5 | 2021-02-25 14:44:14 +0100 | [diff] [blame] | 18 | "android/soong/shared" |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 19 | ) |
| 20 | |
Lukacs T. Berki | f0b3b94 | 2021-03-23 11:46:47 +0100 | [diff] [blame] | 21 | // 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 Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 31 | |
Dan Willemsen | 6606872 | 2017-05-08 21:15:59 +0000 | [diff] [blame] | 32 | var originalEnv map[string]string |
| 33 | |
Lukacs T. Berki | 7690c09 | 2021-02-26 14:27:36 +0100 | [diff] [blame] | 34 | func InitEnvironment(envFile string) { |
| 35 | var err error |
| 36 | originalEnv, err = shared.EnvFromFile(envFile) |
| 37 | if err != nil { |
| 38 | panic(err) |
Lukacs T. Berki | 848e00e | 2020-11-06 10:42:50 +0100 | [diff] [blame] | 39 | } |
Lukacs T. Berki | a5e0f71 | 2020-05-18 09:50:18 +0200 | [diff] [blame] | 40 | } |