blob: 2c1c002bab07c6a74fdf21dd9fb8c8cc9e176aba [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 Cross0875c522017-11-28 17:34:01 -080017import "android/soong/android"
18
Colin Crossfee57cb2017-09-05 13:16:45 -070019var (
20 // These will be filled out by external/error_prone/soong/error_prone.go if it is available
Andreas Gampe05f08542018-06-01 15:44:26 -070021 ErrorProneJavacJar string
22 ErrorProneJar string
23 ErrorProneClasspath string
24 ErrorProneChecksError string
25 ErrorProneChecksWarning string
26 ErrorProneChecksDefaultDisabled string
27 ErrorProneFlags string
Colin Crossfee57cb2017-09-05 13:16:45 -070028)
29
30// Wrapper that grabs value of val late so it can be initialized by a later module's init function
31func errorProneVar(name string, val *string) {
Dan Willemsen54daaf02018-03-12 13:24:09 -070032 pctx.VariableFunc(name, func(android.PackageVarContext) string {
33 return *val
Colin Crossfee57cb2017-09-05 13:16:45 -070034 })
35}
36
37func init() {
38 errorProneVar("ErrorProneJar", &ErrorProneJar)
39 errorProneVar("ErrorProneJavacJar", &ErrorProneJavacJar)
40 errorProneVar("ErrorProneClasspath", &ErrorProneClasspath)
41 errorProneVar("ErrorProneChecksError", &ErrorProneChecksError)
Andreas Gampe05f08542018-06-01 15:44:26 -070042 errorProneVar("ErrorProneChecksWarning", &ErrorProneChecksWarning)
43 errorProneVar("ErrorProneChecksDefaultDisabled", &ErrorProneChecksDefaultDisabled)
Colin Crossfee57cb2017-09-05 13:16:45 -070044 errorProneVar("ErrorProneFlags", &ErrorProneFlags)
45
46 pctx.StaticVariable("ErrorProneCmd",
47 "${JavaCmd} -Xmx${JavacHeapSize} -Xbootclasspath/p:${ErrorProneJavacJar} "+
48 "-cp ${ErrorProneJar}:${ErrorProneClasspath} "+
Andreas Gampe05f08542018-06-01 15:44:26 -070049 "${ErrorProneFlags} ${CommonJdkFlags} "+
50 "${ErrorProneChecksError} ${ErrorProneChecksWarning} ${ErrorProneChecksDefaultDisabled}")
Colin Crossfee57cb2017-09-05 13:16:45 -070051
52}