mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build scripts: report error if multiple modules in plugin contain plugin.xml files
This will help to avoid problems like IDEA-159769 in the future.
This commit is contained in:
@@ -22,7 +22,7 @@ import com.intellij.openapi.util.MultiValuesMap
|
||||
* @author nik
|
||||
*/
|
||||
abstract class BaseLayout {
|
||||
/** JAR name (or path relative to 'lib' directory) to module name */
|
||||
/** JAR name (or path relative to 'lib' directory) to names of modules */
|
||||
final MultiValuesMap<String, String> moduleJars = new MultiValuesMap<>(true)
|
||||
final List<ModuleResourceData> resourcePaths = []
|
||||
/** module name to entries which should be excluded from its output */
|
||||
|
||||
+12
@@ -293,10 +293,22 @@ class DistributionJARsBuilder {
|
||||
def enabledModulesSet = buildContext.productProperties.productLayout.enabledPluginModules
|
||||
pluginsToInclude.each { plugin ->
|
||||
def actualModuleJars = plugin.getActualModules(enabledModulesSet)
|
||||
checkOutputOfPluginModules(plugin.mainModule, actualModuleJars.values())
|
||||
buildByLayout(layoutBuilder, plugin, "$targetDirectory/$plugin.directoryName", actualModuleJars)
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOutputOfPluginModules(String mainPluginModule, Collection<String> moduleNames) {
|
||||
def modulesWithPluginXml = moduleNames.findAll { containsFileInOutput(it, "META-INF/plugin.xml") }
|
||||
if (modulesWithPluginXml.size() > 1) {
|
||||
buildContext.messages.error("Multiple modules (${modulesWithPluginXml.join(", ")}) from '$mainPluginModule' plugin contain plugin.xml files so the plugin won't work properly")
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsFileInOutput(String moduleName, String filePath) {
|
||||
return new File(buildContext.projectBuilder.getModuleOutput(buildContext.findRequiredModule(moduleName), false), filePath).exists()
|
||||
}
|
||||
|
||||
private void buildByLayout(LayoutBuilder layoutBuilder, BaseLayout layout, String targetDirectory, MultiValuesMap<String, String> moduleJars) {
|
||||
def ant = buildContext.ant
|
||||
def resourceExcluded = RESOURCES_EXCLUDED
|
||||
|
||||
@@ -55,6 +55,9 @@ class PluginLayout extends BaseLayout {
|
||||
return layout
|
||||
}
|
||||
|
||||
/**
|
||||
* @return map from a JAR name to list of modules
|
||||
*/
|
||||
MultiValuesMap<String, String> getActualModules(Set<String> enabledPluginModules) {
|
||||
def result = new MultiValuesMap<String, String>(true)
|
||||
for (Map.Entry<String, Collection<String>> entry : moduleJars.entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user