Fix several bugs.
1. Incorrect string pool offset calculation.
2. Move the sha1 checksum calculation code forward.
3. Assign file to mFile (in order to share with different method).
diff --git a/lib/bcc/Script.cpp b/lib/bcc/Script.cpp
index c6ccfa1..133002b 100644
--- a/lib/bcc/Script.cpp
+++ b/lib/bcc/Script.cpp
@@ -188,6 +188,12 @@
return 1;
}
+ if (sourceBC) {
+ // If we are going to create cache file. We have to calculate sha1sum
+ // first (no matter we can open the file now or not.)
+ calcSHA1(sourceSHA1, sourceBC, sourceSize);
+ }
+
FileHandle file;
if (file.open(cacheFile, OpenMode::Read) < 0) {
@@ -202,7 +208,6 @@
reader.addDependency(BCC_FILE_RESOURCE, pathLibRS, sha1LibRS);
if (sourceBC) {
- calcSHA1(sourceSHA1, sourceBC, sourceSize);
reader.addDependency(BCC_APK_RESOURCE, sourceResName, sourceSHA1);
}
@@ -282,6 +287,14 @@
if (file.open(cacheFile, OpenMode::Write) >= 0) {
CacheWriter writer;
+ // Dependencies
+ writer.addDependency(BCC_FILE_RESOURCE, pathLibBCC, sha1LibBCC);
+ writer.addDependency(BCC_FILE_RESOURCE, pathLibRS, sha1LibRS);
+
+ if (sourceBC) {
+ writer.addDependency(BCC_APK_RESOURCE, sourceResName, sourceSHA1);
+ }
+
// libRS is threadable dirty hack
// TODO: This should be removed in the future
uint32_t libRS_threadable = 0;