This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch release18.12 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release18.12 by this push: new c9009b3a4d Fixed: Replace SvnCheckout in Gradle (OFBIZ-12868) c9009b3a4d is described below commit c9009b3a4d028715fd602dbe533956541329cd61 Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Thu Jan 4 09:47:31 2024 +0100 Fixed: Replace SvnCheckout in Gradle (OFBIZ-12868) Removes definitely SvnCheckout, pullPluginSource and pullAllPluginsSource tasks from Gradle (in build.gradle) Fixes both pullPluginSource scripts, notably uses a shallow clone rather than a blobless clone as suggested by Eugen, less space, faster Conflict handled by hand in build.gradle Conflicts handled by hand in build.gradle --- build.gradle | 47 ----------------------------------------------- pullPluginSource.bat | 26 +++++++++++++------------- pullPluginSource.sh | 21 ++++++++++----------- 3 files changed, 23 insertions(+), 71 deletions(-) diff --git a/build.gradle b/build.gradle index 5469b8c358..c602e7559a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,6 @@ * specific language governing permissions and limitations * under the License. */ -import at.bxm.gradleplugins.svntools.tasks.SvnCheckout import org.apache.tools.ant.filters.ReplaceTokens import org.asciidoctor.gradle.AsciidoctorTask @@ -42,7 +41,6 @@ apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'eclipse' apply plugin: 'maven-publish' -apply plugin: 'at.bxm.svntools' apply plugin: 'org.asciidoctor.convert' apply plugin: 'checkstyle' @@ -964,51 +962,6 @@ task pullPlugin(group: ofbizPlugin, description: 'Download and install a plugin } } } -/* The pullPluginSource and pullPluginSource task are now replaced by the OS scripts pullPluginSource and pullAllPluginsSource -task pullPluginSource(group: ofbizPlugin, description: 'Download and install a plugin from source control') { - - if (project.hasProperty('pluginId')) { - task pullPluginFromSvn(type: SvnCheckout) { - svnUrl = "https://github.com/apache/ofbiz-plugins/branches/release18.12/${pluginId}" - workspaceDir = "${pluginsDir}/${pluginId}" - } - dependsOn pullPluginFromSvn - } - doLast { - gradlewSubprocess(['installPlugin', "-PpluginId=${pluginId}"]) - } -} - -task pullAllPluginsSource(group: ofbizPlugin, - description: 'Download and install all plugins from source control. Warning! deletes existing plugins') { - - task deleteBeforePulling { - doLast { delete "${pluginsDir}" } - } - task pullPluginsFromSvn(type: SvnCheckout, dependsOn: deleteBeforePulling) { - svnUrl = "https://github.com/apache/ofbiz-plugins/branches/release18.12" - workspaceDir = "${pluginsDir}" - } - dependsOn pullPluginsFromSvn - - task installAllPlugins { - file("${pluginsDir}").eachDir { plugin -> - iterateOverActiveComponents { component -> - if (component.name == plugin.name) { - if (subprojectExists(":plugins:${plugin.name}")) { - if (taskExistsInproject(":plugins:${plugin.name}", 'install')) { - dependsOn ":plugins:${plugin.name}:install" - doLast { println "installed plugin ${plugin.name}" } - } - } - } - } - } - } - doLast { - gradlewSubprocess(['installAllPlugins']) - } -}*/ // ========== Clean up tasks ========== task cleanCatalina(group: cleanupGroup, description: 'Clean Catalina data in runtime/catalina/work') { diff --git a/pullPluginSource.bat b/pullPluginSource.bat index a3d5960157..c11ebcce0f 100644 --- a/pullPluginSource.bat +++ b/pullPluginSource.bat @@ -18,31 +18,31 @@ rem specific language governing permissions and limitations rem under the License. rem ##################################################################### -rem Remove plugins dir in case of all plugins present +rem Remove plugins dir in case of all plugins present (no .git) if EXIST plugins\ ( if NOT EXIST plugins\.git\ ( cmd /c rd/s/q plugins ) ) -rem Clone if new else simply init sparse-checkout +rem Clone and set if new else simply add if NOT EXIST plugins\.git\ ( - git clone --filter=blob:none --sparse https://github.com/apache/ofbiz-plugins.git plugins - cd plugins + git clone --depth=1 --sparse https://github.com/apache/ofbiz-plugins.git plugins + cd plugins + git sparse-checkout set %1 ) else ( cd plugins - rem the documentation says init is deprecated but set does work here: https://git-scm.com/docs/git-sparse-checkout - git sparse-checkout init --cone --sparse-index + git sparse-checkout add %1 ) -rem Add the plugin -git sparse-checkout add %1 - - +rem Get the branch used in framework +cd .. git branch --show-current > temp.txt set /p branch=<temp.txt del temp.txt -rem By default the clone branch is trunk + +rem By default the cloned branch is trunk, switch if necessary if NOT trunk == %branch% ( - call git switch -c %1 --track origin/%1 + cd plugins + git switch -C %branch% + cd .. ) -cd .. diff --git a/pullPluginSource.sh b/pullPluginSource.sh index 6a4948545f..ec306da844 100755 --- a/pullPluginSource.sh +++ b/pullPluginSource.sh @@ -17,28 +17,26 @@ # under the License. -# Remove plugins dir in case of all plugins present +# Remove plugins dir in case of all plugins present (no .git) if [ -d "plugins" ] then - if [ ! -d "plugins\.git" ] + if [ ! -d "plugins/.git" ] then rm -rf plugins fi fi -# Clone if new else simply init sparse-checkout -if [ ! -d "plugins\.git" ] +# Clone and set if new else simply add +if [ ! -d "plugins/.git" ] then - git clone --filter=blob:none --sparse https://github.com/apache/ofbiz-plugins.git plugins + git clone --depth=1 --sparse https://github.com/apache/ofbiz-plugins.git plugins cd plugins + git sparse-checkout set "$1" else cd plugins - # the documentation says init is deprecated but set does work here: https://git-scm.com/docs/git-sparse-checkout - git sparse-checkout init --cone --sparse-index + git sparse-checkout add "$1" fi -# Add the plugin -git sparse-checkout add "$1" # Get the branch used in framework cd .. @@ -46,9 +44,10 @@ git branch --show-current > temp.txt branch=$(cat temp.txt) rm temp.txt -# By default the clone branch is trunk +# By default the cloned branch is trunk, switch if necessary if [ ! "$branch" = trunk ] then + cd plugins git switch -C "$branch" + cd .. fi -cd ..