Merge "Limit the number of the Java source files in a single compilation unit" am: a61a042fa6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1590694 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ib2fc03fc0e30e99b530bb130c16a358511b027ce
This commit is contained in:
commit
3e97f39674
|
@ -913,6 +913,25 @@ func (c *config) XrefCuEncoding() string {
|
|||
return "json"
|
||||
}
|
||||
|
||||
// XrefCuJavaSourceMax returns the maximum number of the Java source files
|
||||
// in a single compilation unit
|
||||
const xrefJavaSourceFileMaxDefault = "1000"
|
||||
|
||||
func (c Config) XrefCuJavaSourceMax() string {
|
||||
v := c.Getenv("KYTHE_JAVA_SOURCE_BATCH_SIZE")
|
||||
if v == "" {
|
||||
return xrefJavaSourceFileMaxDefault
|
||||
}
|
||||
if _, err := strconv.ParseUint(v, 0, 0); err != nil {
|
||||
fmt.Fprintf(os.Stderr,
|
||||
"bad KYTHE_JAVA_SOURCE_BATCH_SIZE value: %s, will use %s",
|
||||
err, xrefJavaSourceFileMaxDefault)
|
||||
return xrefJavaSourceFileMaxDefault
|
||||
}
|
||||
return v
|
||||
|
||||
}
|
||||
|
||||
func (c *config) EmitXrefRules() bool {
|
||||
return c.XrefCorpusName() != ""
|
||||
}
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
# BUILD_NUMBER build number, used to generate unique ID (will use UUID if not set)
|
||||
# DIST_DIR where the resulting all.kzip will be placed
|
||||
# KYTHE_KZIP_ENCODING proto or json (proto is default)
|
||||
# KYTHE_JAVA_SOURCE_BATCH_SIZE maximum number of the Java source files in a compilation unit
|
||||
# OUT_DIR output directory (out if not specified})
|
||||
# TARGET_BUILD_VARIANT variant, e.g., `userdebug`
|
||||
# TARGET_PRODUCT target device name, e.g., 'aosp_blueline'
|
||||
# XREF_CORPUS source code repository URI, e.g., 'android.googlesource.com/platform/superproject'
|
||||
|
||||
: ${BUILD_NUMBER:=$(uuidgen)}
|
||||
: ${KYTHE_JAVA_SOURCE_BATCH_SIZE:=500}
|
||||
: ${KYTHE_KZIP_ENCODING:=proto}
|
||||
export KYTHE_KZIP_ENCODING
|
||||
export KYTHE_JAVA_SOURCE_BATCH_SIZE KYTHE_KZIP_ENCODING
|
||||
|
||||
# The extraction might fail for some source files, so run with -k and then check that
|
||||
# sufficiently many files were generated.
|
||||
|
|
|
@ -80,6 +80,8 @@ var (
|
|||
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCorpusName() })
|
||||
_ = pctx.VariableFunc("kytheCuEncoding",
|
||||
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCuEncoding() })
|
||||
_ = pctx.VariableFunc("kytheCuJavaSourceMax",
|
||||
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCuJavaSourceMax() })
|
||||
_ = pctx.SourcePathVariable("kytheVnames", "build/soong/vnames.json")
|
||||
// Run it with -add-opens=java.base/java.nio=ALL-UNNAMED to avoid JDK9's warning about
|
||||
// "Illegal reflective access by com.google.protobuf.Utf8$UnsafeProcessor ...
|
||||
|
@ -93,6 +95,7 @@ var (
|
|||
`KYTHE_CORPUS=${kytheCorpus} ` +
|
||||
`KYTHE_VNAMES=${kytheVnames} ` +
|
||||
`KYTHE_KZIP_ENCODING=${kytheCuEncoding} ` +
|
||||
`KYTHE_JAVA_SOURCE_BATCH_SIZE=${kytheCuJavaSourceMax} ` +
|
||||
`${config.SoongJavacWrapper} ${config.JavaCmd} ` +
|
||||
`--add-opens=java.base/java.nio=ALL-UNNAMED ` +
|
||||
`-jar ${config.JavaKytheExtractorJar} ` +
|
||||
|
|
Loading…
Reference in New Issue