blob: 862217f7770f635d4a32a411a75f3f92dc060c20 [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
21 ErrorProneJavacJar string
22 ErrorProneJar string
23 ErrorProneClasspath string
24 ErrorProneChecksError string
25 ErrorProneFlags string
26)
27
28// Wrapper that grabs value of val late so it can be initialized by a later module's init function
29func errorProneVar(name string, val *string) {
Colin Cross0875c522017-11-28 17:34:01 -080030 pctx.VariableFunc(name, func(config android.Config) (string, error) {
Colin Crossfee57cb2017-09-05 13:16:45 -070031 return *val, nil
32 })
33}
34
35func init() {
36 errorProneVar("ErrorProneJar", &ErrorProneJar)
37 errorProneVar("ErrorProneJavacJar", &ErrorProneJavacJar)
38 errorProneVar("ErrorProneClasspath", &ErrorProneClasspath)
39 errorProneVar("ErrorProneChecksError", &ErrorProneChecksError)
40 errorProneVar("ErrorProneFlags", &ErrorProneFlags)
41
42 pctx.StaticVariable("ErrorProneCmd",
43 "${JavaCmd} -Xmx${JavacHeapSize} -Xbootclasspath/p:${ErrorProneJavacJar} "+
44 "-cp ${ErrorProneJar}:${ErrorProneClasspath} "+
45 "${ErrorProneFlags} ${CommonJdkFlags} ${ErrorProneChecksError}")
46
47}