This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push:
new 6da924da5a Fixed: Replace SvnCheckout in Gradle (OFBIZ-12868)
6da924da5a is described below
commit 6da924da5aaddeaafa02e031160d79afe93bfd34
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
Conflict handled by hand in build.gradle
---
build.gradle | 21 ---------------------
pullPluginSource.bat | 26 +++++++++++++-------------
pullPluginSource.sh | 21 ++++++++++-----------
3 files changed, 23 insertions(+), 45 deletions(-)
diff --git a/build.gradle b/build.gradle
index e7145e5f1b..113fed5736 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
@@ -29,7 +28,6 @@ plugins {
id 'eclipse'
id 'checkstyle'
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
@@ -948,25 +946,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()
- 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,
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 ..