extension: Ensure that compiled extension provides at least one feature (#47715)

Finn Evers created

This PR adds a check during extension compilation to ensure that every
compiled extension provides at least one feature, as otherwise, the
extension is useless to have.

With this in, compiling an extension that does not provide anything will
fail.

Release Notes:

- N/A

Change summary

crates/extension_cli/src/main.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Detailed changes

crates/extension_cli/src/main.rs 🔗

@@ -78,6 +78,12 @@ async fn main() -> Result<()> {
         .await
         .context("failed to compile extension")?;
 
+    let extension_provides = extension_provides(&manifest);
+
+    if extension_provides.is_empty() {
+        bail!("extension does not provide any features");
+    }
+
     let grammars = test_grammars(&manifest, &extension_path, &mut wasm_store)?;
     test_languages(&manifest, &extension_path, &grammars)?;
     test_themes(&manifest, &extension_path, fs.clone()).await?;
@@ -102,8 +108,6 @@ async fn main() -> Result<()> {
         );
     }
 
-    let extension_provides = extension_provides(&manifest);
-
     let manifest_json = serde_json::to_string(&rpc::ExtensionApiManifest {
         name: manifest.name,
         version: manifest.version,