github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/soong/java/config/error_prone.go (about)

     1  // 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  
    15  package config
    16  
    17  import "android/soong/android"
    18  
    19  var (
    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
    29  func errorProneVar(name string, val *string) {
    30  	pctx.VariableFunc(name, func(android.PackageVarContext) string {
    31  		return *val
    32  	})
    33  }
    34  
    35  func 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  }