diff options
author | 2024-09-06 16:42:36 +0000 | |
---|---|---|
committer | 2024-09-06 16:42:36 +0000 | |
commit | 63abf09fd92ab7c12e08bbef5aef3e464207f9f8 (patch) | |
tree | a3bf516df407dea0101f2362a5e09b6bd68e3156 /java/aar.go | |
parent | ab8082c117254b33a2899d4088b5d46db913946a (diff) | |
parent | 9d269b6956939b7faed39a4bb86ce06c0200f000 (diff) |
Merge "Remove asset dir glob files" into main am: f2c204c655 am: 9d269b6956
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3257951
Change-Id: I14d1f997a18e08b46333c5bcf376b5841d34e8b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/aar.go')
-rw-r--r-- | java/aar.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/java/aar.go b/java/aar.go index bffe88bd6..62edd05a4 100644 --- a/java/aar.go +++ b/java/aar.go @@ -15,10 +15,10 @@ package java import ( + "crypto/sha256" "fmt" "path/filepath" "slices" - "strconv" "strings" "android/soong/android" @@ -236,18 +236,20 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte rroDirs = append(rroDirs, resRRODirs...) } + assetDirsHasher := sha256.New() var assetDeps android.Paths - for i, dir := range assetDirs { + for _, dir := range assetDirs { // Add a dependency on every file in the asset directory. This ensures the aapt2 // rule will be rerun if one of the files in the asset directory is modified. - assetDeps = append(assetDeps, androidResourceGlob(ctx, dir)...) + dirContents := androidResourceGlob(ctx, dir) + assetDeps = append(assetDeps, dirContents...) - // Add a dependency on a file that contains a list of all the files in the asset directory. + // Add a hash of all the files in the asset directory to the command line. // This ensures the aapt2 rule will be run if a file is removed from the asset directory, // or a file is added whose timestamp is older than the output of aapt2. - assetFileListFile := android.PathForModuleOut(ctx, "asset_dir_globs", strconv.Itoa(i)+".glob") - androidResourceGlobList(ctx, dir, assetFileListFile) - assetDeps = append(assetDeps, assetFileListFile) + for _, path := range dirContents.Strings() { + assetDirsHasher.Write([]byte(path)) + } } assetDirStrings := assetDirs.Strings() @@ -282,6 +284,7 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte linkDeps = append(linkDeps, manifestPath) linkFlags = append(linkFlags, android.JoinWithPrefix(assetDirStrings, "-A ")) + linkFlags = append(linkFlags, fmt.Sprintf("$$(: %x)", assetDirsHasher.Sum(nil))) linkDeps = append(linkDeps, assetDeps...) // Returns the effective version for {min|target}_sdk_version |