blob: 5f853c81239348cb850c004da4211b6e211e2c5c [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"
Colin Cross66548102018-06-19 22:47:35 -070019)
Colin Cross0875c522017-11-28 17:34:01 -080020
Colin Crossfee57cb2017-09-05 13:16:45 -070021var (
22 // These will be filled out by external/error_prone/soong/error_prone.go if it is available
Colin Cross66548102018-06-19 22:47:35 -070023 ErrorProneClasspath []string
24 ErrorProneChecksError []string
25 ErrorProneChecksWarning []string
26 ErrorProneChecksDefaultDisabled []string
27 ErrorProneChecksOff []string
28 ErrorProneFlags []string
Colin Crossfee57cb2017-09-05 13:16:45 -070029)
30
31// Wrapper that grabs value of val late so it can be initialized by a later module's init function
Sam Delmerico932c01c2022-03-25 16:33:26 +000032func errorProneVar(val *[]string, sep string) func() string {
33 return func() string {
Colin Cross66548102018-06-19 22:47:35 -070034 return strings.Join(*val, sep)
Sam Delmerico932c01c2022-03-25 16:33:26 +000035 }
Colin Crossfee57cb2017-09-05 13:16:45 -070036}
37
38func init() {
Sam Delmerico932c01c2022-03-25 16:33:26 +000039 exportedVars.ExportVariableFuncVariable("ErrorProneClasspath", errorProneVar(&ErrorProneClasspath, ":"))
40 exportedVars.ExportVariableFuncVariable("ErrorProneChecksError", errorProneVar(&ErrorProneChecksError, " "))
41 exportedVars.ExportVariableFuncVariable("ErrorProneChecksWarning", errorProneVar(&ErrorProneChecksWarning, " "))
42 exportedVars.ExportVariableFuncVariable("ErrorProneChecksDefaultDisabled", errorProneVar(&ErrorProneChecksDefaultDisabled, " "))
43 exportedVars.ExportVariableFuncVariable("ErrorProneChecksOff", errorProneVar(&ErrorProneChecksOff, " "))
44 exportedVars.ExportVariableFuncVariable("ErrorProneFlags", errorProneVar(&ErrorProneFlags, " "))
45 exportedVars.ExportStringListStaticVariable("ErrorProneChecks", []string{
Colin Cross66548102018-06-19 22:47:35 -070046 "${ErrorProneChecksOff}",
47 "${ErrorProneChecksError}",
48 "${ErrorProneChecksWarning}",
49 "${ErrorProneChecksDefaultDisabled}",
Sam Delmerico932c01c2022-03-25 16:33:26 +000050 })
Colin Crossfee57cb2017-09-05 13:16:45 -070051}