diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionTableProvider.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionTableProvider.java index 43d5dc92fc..53f82fbf98 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionTableProvider.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionTableProvider.java @@ -166,6 +166,18 @@ public class ExtensionTableProvider extends DialogComponentProvider { private boolean installExtensions(List files) { boolean didInstall = false; for (File file : files) { + + // A sanity check for users that try to install an extension from a source folder + // instead of a fully built extension. + if (new File(file, "build.gradle").isFile()) { + Msg.showWarn(this, null, "Invalid Extension", "The selected extension folder " + + "contains a 'build.gradle' file.\nGhidra does not support installing " + + "extensions in source form.\nPlease build the extension and install its zip " + + "file."); + didInstall = false; + continue; + } + boolean success = ExtensionUtils.install(file); didInstall |= success; } @@ -200,7 +212,7 @@ public class ExtensionTableProvider extends DialogComponentProvider { } /** - * Filter for a {@link GhidraFileChooser} that restricts selection to those files that are + * Filter for a {@link GhidraFileChooser} that restricts selection to those files that are * Ghidra Extensions (zip files with an extension.properties file) or folders. */ private class ExtensionFileFilter implements GhidraFileFilter { diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionUtils.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionUtils.java index 0bedb9946c..e7d4c1e8e4 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionUtils.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/extensions/ExtensionUtils.java @@ -54,9 +54,9 @@ import utility.application.ApplicationLayout; * * *

- * Extensions may be installed/uninstalled by users at runtime, using the - * {@link ExtensionTableProvider}. Installation consists of unzipping the extension archive to an - * installation folder, currently {ghidra user settings dir}/Extensions. To uninstall, + * Extensions may be installed/uninstalled by users at runtime, using the + * {@link ExtensionTableProvider}. Installation consists of unzipping the extension archive to an + * installation folder, currently {ghidra user settings dir}/Extensions. To uninstall, * the unpacked folder is simply removed. */ public class ExtensionUtils { @@ -71,7 +71,7 @@ public class ExtensionUtils { private static final Logger log = LogManager.getLogger(ExtensionUtils.class); /** - * Performs extension maintenance. This should be called at startup, before any plugins or + * Performs extension maintenance. This should be called at startup, before any plugins or * extension points are loaded. */ public static void initializeExtensions() { @@ -87,7 +87,7 @@ public class ExtensionUtils { /** * Gets all known extensions that have not been marked for removal. - * + * * @return set of installed extensions */ public static Set getActiveInstalledExtensions() { @@ -148,8 +148,8 @@ public class ExtensionUtils { /** * Returns all archive extensions. These are all the extensions found in - * {@link ApplicationLayout#getExtensionArchiveDir}. This are added to an installation as - * part of the build processes. + * {@link ApplicationLayout#getExtensionArchiveDir}. This are added to an installation as + * part of the build processes. *

* Archived extensions may be zip files and directories. * @@ -221,7 +221,7 @@ public class ExtensionUtils { } /** - * Installs the given extension file. This can be either an archive (zip) or a directory that + * Installs the given extension file. This can be either an archive (zip) or a directory that * contains an extension.properties file. * * @param file the extension to install @@ -515,10 +515,6 @@ public class ExtensionUtils { if (file.isDirectory() && file.canRead()) { File propertyFile = new File(file, PROPERTIES_FILE_NAME); if (propertyFile.isFile()) { - if (new File(file, "build.gradle").isFile()) { - log.error("Extension source directories are not valid extensions"); - return null; - } return tryToLoadExtensionFromProperties(propertyFile); } } @@ -580,7 +576,7 @@ public class ExtensionUtils { * Searching the child directories of a directory allows clients to pick an extension parent * directory that contains multiple extension directories. * - * @param installDir the directory that contains extension subdirectories + * @param installDir the directory that contains extension subdirectories * @return list of extension.properties files */ private static List findExtensionPropertyFiles(File installDir) { @@ -601,7 +597,7 @@ public class ExtensionUtils { } /** - * Returns an extension.properties or extension.properties.uninstalled file if the given + * Returns an extension.properties or extension.properties.uninstalled file if the given * directory contains one. * * @param dir the directory to search