| 67 | info.hostPlatform = "test"; |
| 68 | info.packageVariant = "host"; |
| 69 | info.source = "test"; |
| 70 | info.sourceHash = ""; |
| 71 | info.validation = "passed"; |
| 72 | const StringView phases[] = {"installFakeRegistryPackage", "writeReceipt"}; |
| 73 | info.phases = phases; |
| 74 | const Tools::PackageReceiptExport exports[] = { |
| 75 | {Tools::PackageExportKind::Tool, "fake-tool", "bin/fake-tool"}, |
| 76 | {Tools::PackageExportKind::Capability, "tool.fake", "bin/fake-tool"}, |
| 77 | }; |
| 78 | return Tools::writePackageReceipt(package, info, exports); |
| 79 | } |
| 80 | |
| 81 | static Result writePackageReceiptFixture(StringView packageRoot, StringView packageName, |
| 82 | Span<const Tools::PackageReceiptExport> exports) |
| 83 | { |
| 84 | FileSystem fs; |
| 85 | SC_TRY(fs.init(".")); |
| 86 | if (fs.existsAndIsDirectory(packageRoot)) |
| 87 | { |
| 88 | SC_TRY(fs.removeDirectoriesRecursive(packageRoot)); |
| 89 | } |
| 90 | SC_TRY(fs.makeDirectoryRecursive(packageRoot)); |
| 91 | |
| 92 | for (const Tools::PackageReceiptExport& packageExport : exports) |
| 93 | { |
| 94 | if (packageExport.relativePath == "."_a8) |
| 95 | { |
| 96 | continue; |
| 97 | } |
| 98 | |
| 99 | String exportedPath = StringEncoding::Utf8; |
| 100 | SC_TRY(Path::join(exportedPath, {packageRoot, packageExport.relativePath})); |
| 101 | SC_TRY(fs.makeDirectoryRecursive(Path::dirname(exportedPath.view(), Path::AsNative))); |
| 102 | SC_TRY(fs.writeString(exportedPath.view(), "fake")); |
| 103 | } |
| 104 | |
| 105 | Tools::Package package; |
| 106 | package.installDirectoryLink = packageRoot; |
| 107 | |
| 108 | Tools::PackageReceiptInfo info; |
| 109 | info.packageName = packageName; |
| 110 | info.packageVersion = "1"; |
| 111 | info.recipeVersion = "1"; |
no test coverage detected