| 19 | #endif |
| 20 | |
| 21 | bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, const String& projectFolderPath) |
| 22 | { |
| 23 | if (_deployedBuilds.Contains(path)) |
| 24 | return false; |
| 25 | LOG(Info, "Deploying binaries from build {0}", path); |
| 26 | _deployedBuilds.Add(path); |
| 27 | |
| 28 | // Read file contents |
| 29 | Array<byte> fileData; |
| 30 | if (File::ReadAllBytes(path, fileData)) |
| 31 | { |
| 32 | LOG(Error, "Failed to read file {0} contents.", path); |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | // Parse Json data |
| 37 | rapidjson_flax::Document document; |
| 38 | document.Parse((const char*)fileData.Get(), fileData.Count()); |
| 39 | if (document.HasParseError()) |
| 40 | { |
| 41 | LOG(Error, "Failed to parse {0} file contents.", path); |
| 42 | return true; |
| 43 | } |
| 44 | |
| 45 | // Deploy all references |
| 46 | auto referencesMember = document.FindMember("References"); |
| 47 | if (referencesMember != document.MemberEnd()) |
| 48 | { |
| 49 | auto& referencesArray = referencesMember->value; |
| 50 | ASSERT(referencesArray.IsArray()); |
| 51 | for (rapidjson::SizeType i = 0; i < referencesArray.Size(); i++) |
| 52 | { |
| 53 | auto& reference = referencesArray[i]; |
| 54 | String referenceProjectPath = JsonTools::GetString(reference, "ProjectPath", String::Empty); |
| 55 | String referencePath = JsonTools::GetString(reference, "Path", String::Empty); |
| 56 | if (referenceProjectPath.IsEmpty() || referencePath.IsEmpty()) |
| 57 | { |
| 58 | LOG(Error, "Empty reference in {0}.", path); |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | Scripting::ProcessBuildInfoPath(referenceProjectPath, projectFolderPath); |
| 63 | Scripting::ProcessBuildInfoPath(referencePath, projectFolderPath); |
| 64 | |
| 65 | String referenceProjectFolderPath = StringUtils::GetDirectoryName(referenceProjectPath); |
| 66 | |
| 67 | if (DeployBinaries(data, referencePath, referenceProjectFolderPath)) |
| 68 | { |
| 69 | LOG(Error, "Failed to load reference in {0} to {1}.", path, referenceProjectPath); |
| 70 | return true; |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Deploy all binary modules |
| 76 | auto binaryModulesMember = document.FindMember("BinaryModules"); |
| 77 | if (binaryModulesMember != document.MemberEnd()) |
| 78 | { |
nothing calls this directly
no test coverage detected