Implemented: removed the plugin activate/deactivate feature
(OFBIZ-9182)
In preparation for moving to a new svn, we removed the component-load.xml file
which was the way in which components were activated / deactivated in
/plugins. This is made redundant and hence removing unnecessary code.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1780828 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/build.gradle b/build.gradle
index 7d7410cb..9053b6b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -576,7 +576,6 @@
generateFileFromTemplate(templateDir+"/build.gradle", pluginDir,
filterTokens, "build.gradle")
- activatePlugin pluginId
println "plugin successfully created in directory ${pluginsDir}/${pluginId}."
}
}
@@ -603,7 +602,7 @@
* as a gradle subproject and install it i.e. gradle calling gradle
*/
doLast {
- activateAndInstallPlugin pluginId
+ installPlugin pluginId
}
}
}
@@ -623,10 +622,6 @@
if (project.hasProperty('pluginId') && taskExistsInproject(":plugins:${pluginId}", 'uninstall')) {
dependsOn ":plugins:${pluginId}:uninstall"
}
-
- doLast {
- deactivatePlugin pluginId
- }
}
task removePlugin(group: ofbizPlugin, description: 'Uninstall a plugin and delete its files') {
@@ -722,7 +717,7 @@
from zipTree(pluginArchive)
into "${pluginsDir}/${pluginId}"
}
- activateAndInstallPlugin pluginId
+ installPlugin pluginId
}
}
}
@@ -1012,43 +1007,7 @@
return taskExists
}
-def activatePlugin(pluginId) {
- def pluginLoadFile = "${pluginsDir}/component-load.xml"
- def componentRegister = new XmlParser().parse(pluginLoadFile)
-
- // check that plugin directory exists.
- if (!file("${pluginsDir}/${pluginId}").exists()) {
- throw new GradleException("Cannot add plugin \"${pluginId}\", directory does not exist")
- }
-
- // only add plugin if it does not exist in component-load.xml
- if (!componentExistsInRegister(componentRegister, pluginId)) {
- componentRegister.appendNode('load-component', ['component-location':pluginId])
- groovy.xml.XmlUtil.serialize(componentRegister, new FileWriter(pluginLoadFile))
- println "Activated plugin ${pluginId}"
- } else {
- println "The plugin ${pluginId} is already activated"
- }
-}
-
-def deactivatePlugin(pluginId) {
- def pluginLoadFile = "${pluginsDir}/component-load.xml"
- def componentRegister = new XmlParser().parse(pluginLoadFile)
-
- // Ensure that the plugin exists in component-load.xml then remove it
- if (componentExistsInRegister(componentRegister, pluginId)) {
- componentRegister.children().removeIf { plugin ->
- pluginId.equals(plugin.@"component-location")
- }
- groovy.xml.XmlUtil.serialize(componentRegister, new FileWriter(pluginLoadFile))
- println "Deactivated plugin ${pluginId}"
- } else {
- println "The plugin ${pluginId} is not active"
- }
-}
-
-def activateAndInstallPlugin(pluginId) {
- activatePlugin pluginId
+def installPlugin(pluginId) {
def gradleRunner = os.contains('windows') ? 'gradlew.bat' : './gradlew'
exec { commandLine gradleRunner, 'installPlugin', "-PpluginId=${pluginId}" }
}