Author: taher
Date: Sun Jan 29 18:13:18 2017 New Revision: 1780828 URL: http://svn.apache.org/viewvc?rev=1780828&view=rev Log: 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. Modified: ofbiz/trunk/build.gradle Modified: ofbiz/trunk/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.gradle?rev=1780828&r1=1780827&r2=1780828&view=diff ============================================================================== --- ofbiz/trunk/build.gradle (original) +++ ofbiz/trunk/build.gradle Sun Jan 29 18:13:18 2017 @@ -576,7 +576,6 @@ task createPlugin(group: ofbizPlugin, de generateFileFromTemplate(templateDir+"/build.gradle", pluginDir, filterTokens, "build.gradle") - activatePlugin pluginId println "plugin successfully created in directory ${pluginsDir}/${pluginId}." } } @@ -603,7 +602,7 @@ task installPlugin(group: ofbizPlugin, d * as a gradle subproject and install it i.e. gradle calling gradle */ doLast { - activateAndInstallPlugin pluginId + installPlugin pluginId } } } @@ -623,10 +622,6 @@ task uninstallPlugin(group: ofbizPlugin, 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 @@ task pullPlugin(group: ofbizPlugin, desc from zipTree(pluginArchive) into "${pluginsDir}/${pluginId}" } - activateAndInstallPlugin pluginId + installPlugin pluginId } } } @@ -1012,43 +1007,7 @@ def taskExistsInproject(fullyQualifiedPr 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}" } } |
Free forum by Nabble | Edit this page |