blob: 31cbf2c9e3d5d317dff4e5d6ae9e839c49f9de92 [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
17var (
18 // These will be filled out by external/error_prone/soong/error_prone.go if it is available
19 ErrorProneJavacJar string
20 ErrorProneJar string
21 ErrorProneClasspath string
22 ErrorProneChecksError string
23 ErrorProneFlags string
24)
25
26// Wrapper that grabs value of val late so it can be initialized by a later module's init function
27func errorProneVar(name string, val *string) {
28 pctx.VariableFunc(name, func(config interface{}) (string, error) {
29 return *val, nil
30 })
31}
32
33func init() {
34 errorProneVar("ErrorProneJar", &ErrorProneJar)
35 errorProneVar("ErrorProneJavacJar", &ErrorProneJavacJar)
36 errorProneVar("ErrorProneClasspath", &ErrorProneClasspath)
37 errorProneVar("ErrorProneChecksError", &ErrorProneChecksError)
38 errorProneVar("ErrorProneFlags", &ErrorProneFlags)
39
40 pctx.StaticVariable("ErrorProneCmd",
41 "${JavaCmd} -Xmx${JavacHeapSize} -Xbootclasspath/p:${ErrorProneJavacJar} "+
42 "-cp ${ErrorProneJar}:${ErrorProneClasspath} "+
43 "${ErrorProneFlags} ${CommonJdkFlags} ${ErrorProneChecksError}")
44
45}