This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new bdbc08a4c2 Fixed: Replace SvnCheckout in Gradle (OFBIZ-12868)
bdbc08a4c2 is described below
commit bdbc08a4c2d91e11fae583655611ad84fa1f6c67
Author: Jacques Le Roux <[email protected]>
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
---
build.gradle | 56 ----------------------------------------------------
pullPluginSource.bat | 26 ++++++++++++------------
pullPluginSource.sh | 21 ++++++++++----------
3 files changed, 23 insertions(+), 80 deletions(-)
diff --git a/build.gradle b/build.gradle
index 7c0866217f..e55529938c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,7 +16,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.jvm.AsciidoctorTask
@@ -30,7 +29,6 @@ plugins {
id 'checkstyle'
id 'codenarc'
id 'maven-publish'
- id 'at.bxm.svntools' version '3.1'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id 'org.owasp.dependencycheck' version '7.4.4' apply false
@@ -980,60 +978,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')) {
- // GitHub SVN feature
https://docs.github.com/en/github/importing-your-projects-to-github/working-with-subversion-on-github/support-for-subversion-clients
- task pullPluginFromSvn(type: SvnCheckout) {
- def currentBranch = getCurrentGitBranch()
- // Only used for release branches
- if (currentBranch == "trunk") {
- svnUrl =
"https://github.com/apache/ofbiz-plugins/trunk/${pluginId}"
- } else {
- svnUrl = "https://github.com/apache/ofbiz-plugins/branches/" +
currentBranch + "/${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)
{
- // GitHub SVN feature
https://docs.github.com/en/github/importing-your-projects-to-github/working-with-subversion-on-github/support-for-subversion-clients
- def currentBranch = getCurrentGitBranch()
- // Only used for release branches
- if (currentBranch == "trunk") {
- svnUrl = "https://github.com/apache/ofbiz-plugins/trunk"
- } else {
- svnUrl = "https://github.com/apache/ofbiz-plugins/branches/" +
currentBranch
- }
- workspaceDir = "${pluginsDir}"
- }
- dependsOn pullPluginsFromSvn
-
- task installAllPlugins {
- subdirs(file("${pluginsDir}"))
- .filter(this.isComponentEnabled)
- .filter { taskExistsInproject(":plugins:${it.name}", 'install') }
- .forEach({ plugin ->
- 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 ..