feat(ide): package the VS Code extension as a VSIX
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 8s
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 6s
VoidBuildSystem CI / fuzz-clang (push) Failing after 6s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 11s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 48s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 8s
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 6s
VoidBuildSystem CI / fuzz-clang (push) Failing after 6s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 11s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 48s
This commit is contained in:
1 parent
3f5b21a570
commit
f032c9f7fe
10 files changed
+269
-74
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include <Void/Build/BootstrapConfig.hpp>
|
||||
#include <Void/Build/Editor/CompDb.hpp>
|
||||
|
||||
#include <Void/Build/Package/Archive.hpp>
|
||||
#include <Void/Build/Platform/FileOps.hpp>
|
||||
#include <Void/Build/Util/Json.hpp>
|
||||
#include <Void/Build/Util/Sha256.hpp>
|
||||
@@ -1451,6 +1452,65 @@ console.log('extension tests passed: ' + terminals.length + ' commands');
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
}
|
||||
|
||||
// Optional VSIX package: a ZIP that `code --install-extension` accepts.
|
||||
if (options.vsix_path) {
|
||||
const std::string vsix_manifest =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||
"<PackageManifest Version=\"2.0.0\" "
|
||||
"xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\">\n"
|
||||
" <Metadata>\n"
|
||||
" <Identity Language=\"en-US\" Id=\"vbs-tools\" Version=\"0.1.0\" "
|
||||
"Publisher=\"void\" />\n"
|
||||
" <DisplayName>VoidBuildSystem</DisplayName>\n"
|
||||
" <Description xml:space=\"preserve\">Build, test, install and package with "
|
||||
"VoidBuildSystem.</Description>\n"
|
||||
" <Tags>vbs</Tags>\n"
|
||||
" <Categories>Other</Categories>\n"
|
||||
" <GalleryFlags>Public</GalleryFlags>\n"
|
||||
" </Metadata>\n"
|
||||
" <Installation>\n"
|
||||
" <InstallationTarget Id=\"Microsoft.VisualStudio.Code\" />\n"
|
||||
" </Installation>\n"
|
||||
" <Dependencies />\n"
|
||||
" <Assets>\n"
|
||||
" <Asset Type=\"Microsoft.VisualStudio.Code.Manifest\" "
|
||||
"Path=\"extension/package.json\" Addressable=\"true\" />\n"
|
||||
" </Assets>\n"
|
||||
"</PackageManifest>\n";
|
||||
const std::string content_types =
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||
"<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n"
|
||||
" <Default Extension=\".json\" ContentType=\"application/json\" />\n"
|
||||
" <Default Extension=\".js\" ContentType=\"application/javascript\" />\n"
|
||||
" <Default Extension=\".md\" ContentType=\"text/markdown\" />\n"
|
||||
" <Default Extension=\".vsixmanifest\" ContentType=\"text/xml\" />\n"
|
||||
" <Default Extension=\".xml\" ContentType=\"text/xml\" />\n"
|
||||
"</Types>\n";
|
||||
const auto manifest_path = output / ".vsix" / "extension.vsixmanifest";
|
||||
const auto types_path = output / ".vsix" / "[Content_Types].xml";
|
||||
if (auto written = Platform::atomic_write_file(manifest_path, vsix_manifest, true);
|
||||
!written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
if (auto written = Platform::atomic_write_file(types_path, content_types, true); !written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
std::vector<Package::ArchiveEntrySpec> vsix_entries{
|
||||
{"extension.vsixmanifest", manifest_path, 0644u},
|
||||
{"[Content_Types].xml", types_path, 0644u}};
|
||||
for (const auto &name :
|
||||
{"package.json", "extension.js", "README.md", "test/extension.test.js"}) {
|
||||
vsix_entries.push_back({std::string{"extension/"} + name, output / name, 0644u});
|
||||
}
|
||||
if (options.vsix_path->has_parent_path()) {
|
||||
std::filesystem::create_directories(options.vsix_path->parent_path(), ec);
|
||||
}
|
||||
if (auto zipped = Package::create_stored_zip(*options.vsix_path, vsix_entries); !zipped) {
|
||||
return std::unexpected{zipped.error()};
|
||||
}
|
||||
std::filesystem::remove_all(output / ".vsix", ec);
|
||||
}
|
||||
return report;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user