Merge "Get latest api version"
am: 39b31fa071
Change-Id: I3d141c7bfeb8f1014edfc2c99ef5d4189bafe477
This commit is contained in:
commit
1b3a31eab2
1 changed files with 13 additions and 8 deletions
|
@ -103,19 +103,25 @@ func createFilegroup(mctx android.TopDownMutatorContext, module string, scope st
|
|||
mctx.CreateModule(android.ModuleFactoryAdaptor(android.FileGroupFactory), &filegroupProps)
|
||||
}
|
||||
|
||||
func prebuiltSdkStubs(mctx android.TopDownMutatorContext) {
|
||||
func getPrebuiltFiles(mctx android.TopDownMutatorContext, name string) []string {
|
||||
mydir := mctx.ModuleDir() + "/"
|
||||
// <apiver>/<scope>/<module>.jar
|
||||
var files []string
|
||||
for _, apiver := range mctx.Module().(*prebuiltApis).properties.Api_dirs {
|
||||
for _, scope := range []string{"public", "system", "test", "core"} {
|
||||
vfiles, err := mctx.GlobWithDeps(mydir+apiver+"/"+scope+"*/*.jar", nil)
|
||||
vfiles, err := mctx.GlobWithDeps(mydir+apiver+"/"+scope+"/"+name, nil)
|
||||
if err != nil {
|
||||
mctx.ModuleErrorf("failed to glob jar files under %q: %s", mydir+apiver+"/"+scope, err)
|
||||
mctx.ModuleErrorf("failed to glob %s files under %q: %s", name, mydir+apiver+"/"+scope, err)
|
||||
}
|
||||
files = append(files, vfiles...)
|
||||
}
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
func prebuiltSdkStubs(mctx android.TopDownMutatorContext) {
|
||||
mydir := mctx.ModuleDir() + "/"
|
||||
// <apiver>/<scope>/<module>.jar
|
||||
files := getPrebuiltFiles(mctx, "*.jar")
|
||||
|
||||
for _, f := range files {
|
||||
// create a Import module for each jar file
|
||||
|
@ -128,10 +134,8 @@ func prebuiltSdkStubs(mctx android.TopDownMutatorContext) {
|
|||
func prebuiltApiFiles(mctx android.TopDownMutatorContext) {
|
||||
mydir := mctx.ModuleDir() + "/"
|
||||
// <apiver>/<scope>/api/<module>.txt
|
||||
files, err := mctx.GlobWithDeps(mydir+"*/*/api/*.txt", nil)
|
||||
if err != nil {
|
||||
mctx.ModuleErrorf("failed to glob api txt files under %q: %s", mydir, err)
|
||||
}
|
||||
files := getPrebuiltFiles(mctx, "api/*.txt")
|
||||
|
||||
if len(files) == 0 {
|
||||
mctx.ModuleErrorf("no api file found under %q", mydir)
|
||||
}
|
||||
|
@ -161,6 +165,7 @@ func prebuiltApiFiles(mctx android.TopDownMutatorContext) {
|
|||
strings.Compare(apiver, info.apiver) > 0) {
|
||||
info.apiver = apiver
|
||||
info.path = localPath
|
||||
m[key] = info
|
||||
}
|
||||
}
|
||||
// create filegroups for the latest version of (<module>, <scope>) pairs
|
||||
|
|
Loading…
Reference in a new issue