blob: 48681b5c90c05abea5e341aa3416a1d74a7edaee [file] [log] [blame]
Colin Crossfee57cb2017-09-05 13:16:45 -07001// Copyright 2017 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
15package config
16
Colin Cross66548102018-06-19 22:47:35 -070017import (
18 "strings"
19
20 "android/soong/android"
21)
Colin Cross0875c522017-11-28 17:34:01 -080022
Colin Crossfee57cb2017-09-05 13:16:45 -070023var (
24 // These will be filled out by external/error_prone/soong/error_prone.go if it is available
Colin Cross66548102018-06-19 22:47:35 -070025 ErrorProneClasspath []string
26 ErrorProneChecksError []string
27 ErrorProneChecksWarning []string
28 ErrorProneChecksDefaultDisabled []string
29 ErrorProneChecksOff []string
30 ErrorProneFlags []string
Colin Crossfee57cb2017-09-05 13:16:45 -070031)
32
33// Wrapper that grabs value of val late so it can be initialized by a later module's init function
Colin Cross66548102018-06-19 22:47:35 -070034func errorProneVar(name string, val *[]string, sep string) {
Dan Willemsen54daaf02018-03-12 13:24:09 -070035 pctx.VariableFunc(name, func(android.PackageVarContext) string {
Colin Cross66548102018-06-19 22:47:35 -070036 return strings.Join(*val, sep)
Colin Crossfee57cb2017-09-05 13:16:45 -070037 })
38}
39
40func init() {
Colin Cross66548102018-06-19 22:47:35 -070041 errorProneVar("ErrorProneClasspath", &ErrorProneClasspath, ":")
42 errorProneVar("ErrorProneChecksError", &ErrorProneChecksError, " ")
43 errorProneVar("ErrorProneChecksWarning", &ErrorProneChecksWarning, " ")
44 errorProneVar("ErrorProneChecksDefaultDisabled", &ErrorProneChecksDefaultDisabled, " ")
45 errorProneVar("ErrorProneChecksOff", &ErrorProneChecksOff, " ")
46 errorProneVar("ErrorProneFlags", &ErrorProneFlags, " ")
47 pctx.StaticVariable("ErrorProneChecks", strings.Join([]string{
48 "${ErrorProneChecksOff}",
49 "${ErrorProneChecksError}",
50 "${ErrorProneChecksWarning}",
51 "${ErrorProneChecksDefaultDisabled}",
52 }, " "))
Colin Crossfee57cb2017-09-05 13:16:45 -070053}