Move sharding functions for reuse
Move shardPaths and shardTests to android.ShardPaths and android.ShardStrings for reuse in other packages. Test: m checkbuild Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
This commit is contained in:
14
java/java.go
14
java/java.go
@@ -580,18 +580,6 @@ func hasSrcExt(srcs []string, ext string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func shardPaths(paths android.Paths, shardSize int) []android.Paths {
|
||||
ret := make([]android.Paths, 0, (len(paths)+shardSize-1)/shardSize)
|
||||
for len(paths) > shardSize {
|
||||
ret = append(ret, paths[0:shardSize])
|
||||
paths = paths[shardSize:]
|
||||
}
|
||||
if len(paths) > 0 {
|
||||
ret = append(ret, paths)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (j *Module) hasSrcExt(ext string) bool {
|
||||
return hasSrcExt(j.properties.Srcs, ext)
|
||||
}
|
||||
@@ -1156,7 +1144,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
|
||||
shardSize := int(*(j.properties.Javac_shard_size))
|
||||
var shardSrcs []android.Paths
|
||||
if len(uniqueSrcFiles) > 0 {
|
||||
shardSrcs = shardPaths(uniqueSrcFiles, shardSize)
|
||||
shardSrcs = android.ShardPaths(uniqueSrcFiles, shardSize)
|
||||
for idx, shardSrc := range shardSrcs {
|
||||
classes := j.compileJavaClasses(ctx, jarName, idx, shardSrc,
|
||||
nil, flags, extraJarDeps)
|
||||
|
Reference in New Issue
Block a user