Move bcc::getCommandLine to fw/rs
libbcc had a utility function to concatenate string arguments. This
patch moves that function to frameworks/rs. The function will no longer
be needed in libbcc once we move all the checksum/cache invalidation
logic to frameworks/rs.
Change-Id: I2b1c15c2763d90d7b099e41257bb72f200680943
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index a618a17..6804d59 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -25,7 +25,6 @@
#include <bcc/BCCContext.h>
#include <bcc/Config/Config.h>
#include <bcc/Renderscript/RSCompilerDriver.h>
- #include <bcc/Renderscript/RSInfo.h>
#include <bcinfo/MetadataExtractor.h>
#include <cutils/properties.h>
@@ -257,6 +256,17 @@
}
}
+std::string getCommandLine(int argc, const char* const* argv) {
+ std::string s;
+ for (int i = 0; i < argc; i++) {
+ if (i > 0) {
+ s += ' ';
+ }
+ s += argv[i];
+ }
+ return s;
+}
+
#endif // !defined(RS_COMPATIBILITY_LIB)
} // namespace
@@ -289,7 +299,7 @@
nullptr
};
- std::string cmdLineStr = bcc::getCommandLine(args.size()-1, args.data());
+ std::string cmdLineStr = getCommandLine(args.size()-1, args.data());
pid_t pid = fork();
@@ -837,7 +847,7 @@
useRSDebugContext, bccPluginName);
// The last argument of compileArguments ia a nullptr, so remove 1 from the size.
std::string compileCommandLine =
- bcc::getCommandLine(compileArguments.size() - 1, compileArguments.data());
+ getCommandLine(compileArguments.size() - 1, compileArguments.data());
if (!is_force_recompile() && !useRSDebugContext) {
mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName);