error_prone.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. package config
  15. import (
  16. "strings"
  17. )
  18. var (
  19. // These will be filled out by external/error_prone/soong/error_prone.go if it is available
  20. ErrorProneClasspath []string
  21. ErrorProneChecksError []string
  22. ErrorProneChecksWarning []string
  23. ErrorProneChecksDefaultDisabled []string
  24. ErrorProneChecksOff []string
  25. ErrorProneFlags []string
  26. )
  27. // Wrapper that grabs value of val late so it can be initialized by a later module's init function
  28. func errorProneVar(val *[]string, sep string) func() string {
  29. return func() string {
  30. return strings.Join(*val, sep)
  31. }
  32. }
  33. func init() {
  34. exportedVars.ExportVariableFuncVariable("ErrorProneClasspath", errorProneVar(&ErrorProneClasspath, ":"))
  35. exportedVars.ExportVariableFuncVariable("ErrorProneChecksError", errorProneVar(&ErrorProneChecksError, " "))
  36. exportedVars.ExportVariableFuncVariable("ErrorProneChecksWarning", errorProneVar(&ErrorProneChecksWarning, " "))
  37. exportedVars.ExportVariableFuncVariable("ErrorProneChecksDefaultDisabled", errorProneVar(&ErrorProneChecksDefaultDisabled, " "))
  38. exportedVars.ExportVariableFuncVariable("ErrorProneChecksOff", errorProneVar(&ErrorProneChecksOff, " "))
  39. exportedVars.ExportVariableFuncVariable("ErrorProneFlags", errorProneVar(&ErrorProneFlags, " "))
  40. exportedVars.ExportStringListStaticVariable("ErrorProneChecks", []string{
  41. "${ErrorProneChecksOff}",
  42. "${ErrorProneChecksError}",
  43. "${ErrorProneChecksWarning}",
  44. "${ErrorProneChecksDefaultDisabled}",
  45. })
  46. }