am 6e18ca49
: Fix java resource glob file list location
* commit '6e18ca49f83c18772299677a4bd949d9dc978a62': Fix java resource glob file list location
This commit is contained in:
@@ -20,7 +20,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/pathtools"
|
"github.com/google/blueprint/pathtools"
|
||||||
@@ -51,7 +50,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func genYacc(ctx common.AndroidModuleContext, yaccFile, yaccFlags string) (cppFile, headerFile string) {
|
func genYacc(ctx common.AndroidModuleContext, yaccFile, yaccFlags string) (cppFile, headerFile string) {
|
||||||
cppFile = strings.TrimPrefix(yaccFile, common.ModuleSrcDir(ctx))
|
cppFile = common.SrcDirRelPath(ctx, yaccFile)
|
||||||
cppFile = filepath.Join(common.ModuleGenDir(ctx), cppFile)
|
cppFile = filepath.Join(common.ModuleGenDir(ctx), cppFile)
|
||||||
cppFile = pathtools.ReplaceExtension(cppFile, "cpp")
|
cppFile = pathtools.ReplaceExtension(cppFile, "cpp")
|
||||||
hppFile := pathtools.ReplaceExtension(cppFile, "hpp")
|
hppFile := pathtools.ReplaceExtension(cppFile, "hpp")
|
||||||
@@ -74,7 +73,7 @@ func genYacc(ctx common.AndroidModuleContext, yaccFile, yaccFlags string) (cppFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func genLex(ctx common.AndroidModuleContext, lexFile string) (cppFile string) {
|
func genLex(ctx common.AndroidModuleContext, lexFile string) (cppFile string) {
|
||||||
cppFile = strings.TrimPrefix(lexFile, common.ModuleSrcDir(ctx))
|
cppFile = common.SrcDirRelPath(ctx, lexFile)
|
||||||
cppFile = filepath.Join(common.ModuleGenDir(ctx), cppFile)
|
cppFile = filepath.Join(common.ModuleGenDir(ctx), cppFile)
|
||||||
cppFile = pathtools.ReplaceExtension(cppFile, "cpp")
|
cppFile = pathtools.ReplaceExtension(cppFile, "cpp")
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
@@ -105,3 +106,15 @@ func CheckSrcDirsExist(ctx AndroidModuleContext, dirs []string, prop string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a path relative to the top level source directory. Panics if path is not inside the
|
||||||
|
// top level source directory.
|
||||||
|
func SrcDirRelPath(ctx AndroidModuleContext, path string) string {
|
||||||
|
srcDir := ctx.AConfig().SrcDir()
|
||||||
|
relPath, err := filepath.Rel(srcDir, path)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("%q is not inside %q: %s", path, srcDir, err.Error()))
|
||||||
|
}
|
||||||
|
|
||||||
|
return relPath
|
||||||
|
}
|
||||||
|
@@ -20,7 +20,6 @@ package java
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/pathtools"
|
"github.com/google/blueprint/pathtools"
|
||||||
@@ -63,7 +62,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func genAidl(ctx common.AndroidModuleContext, aidlFile, aidlFlags string) string {
|
func genAidl(ctx common.AndroidModuleContext, aidlFile, aidlFlags string) string {
|
||||||
javaFile := strings.TrimPrefix(aidlFile, common.ModuleSrcDir(ctx))
|
javaFile := common.SrcDirRelPath(ctx, aidlFile)
|
||||||
javaFile = filepath.Join(common.ModuleGenDir(ctx), javaFile)
|
javaFile = filepath.Join(common.ModuleGenDir(ctx), javaFile)
|
||||||
javaFile = pathtools.ReplaceExtension(javaFile, "java")
|
javaFile = pathtools.ReplaceExtension(javaFile, "java")
|
||||||
depFile := javaFile + ".d"
|
depFile := javaFile + ".d"
|
||||||
@@ -83,7 +82,7 @@ func genAidl(ctx common.AndroidModuleContext, aidlFile, aidlFlags string) string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func genLogtags(ctx common.AndroidModuleContext, logtagsFile string) string {
|
func genLogtags(ctx common.AndroidModuleContext, logtagsFile string) string {
|
||||||
javaFile := strings.TrimPrefix(logtagsFile, common.ModuleSrcDir(ctx))
|
javaFile := common.SrcDirRelPath(ctx, logtagsFile)
|
||||||
javaFile = filepath.Join(common.ModuleGenDir(ctx), javaFile)
|
javaFile = filepath.Join(common.ModuleGenDir(ctx), javaFile)
|
||||||
javaFile = pathtools.ReplaceExtension(javaFile, "java")
|
javaFile = pathtools.ReplaceExtension(javaFile, "java")
|
||||||
|
|
||||||
|
@@ -56,7 +56,8 @@ func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs, exclu
|
|||||||
resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir)
|
resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir)
|
||||||
dirs := ctx.Glob("java_resources", resourceDir, nil)
|
dirs := ctx.Glob("java_resources", resourceDir, nil)
|
||||||
for _, dir := range dirs {
|
for _, dir := range dirs {
|
||||||
fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
|
relDir := common.SrcDirRelPath(ctx, dir)
|
||||||
|
fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", relDir, "resources.list")
|
||||||
depFile := fileListFile + ".d"
|
depFile := fileListFile + ".d"
|
||||||
|
|
||||||
glob := filepath.Join(dir, "**/*")
|
glob := filepath.Join(dir, "**/*")
|
||||||
|
Reference in New Issue
Block a user