// if package contains native image, skip AOT.
std::string rootPath = getRootPath(pkgId);
- if (!rootPath.empty()) {
- if (exist(concatPath(rootPath, concatPath("bin", APP_NI_SUB_DIR)))) {
- _INFO("Package already contains native images. Skip native image generation");
- doAOT = false;
+ std::string binPath = concatPath(rootPath, "bin");
+ std::string nativeImagePath = concatPath(binPath, APP_NI_SUB_DIR);
+ if (rootPath.empty()) {
+ _ERR("Failed to get root path from [%s]", pkgId);
+ return -1;
+ }
+
+ if (exist(nativeImagePath)) {
+ if (exist(concatPath(binPath, PRE_COMPILED_PACKAGE_FILE))) {
+ _INFO("The %s is a Pre-Compiled package.", pkgId);
+ try {
+ for (auto& ni : bf::recursive_directory_iterator(nativeImagePath)) {
+ std::string niFile = ni.path().string();
+ if (isNativeImage(niFile)) {
+ std::string dllFile = changeExtension(niFile, ".ni.dll", ".dll");
+ bf::create_symlink(getFileName(niFile), dllFile);
+ copySmackAndOwnership(niFile, dllFile, true);
+ }
+ }
+ } catch (const bf::filesystem_error& error) {
+ _ERR("Failed to recursive directory: %s", error.what());
+ }
}
+ _INFO("Package already contains native images. Skip native image generation");
+ doAOT = false;
}
if (doAOT) {