Skip to content

Commit

Permalink
Implemented: Replace SvnCheckout in Gradle (OFBIZ-12868)
Browse files Browse the repository at this point in the history
As mentionned in https://lists.apache.org/thread/on7n6nsbj0w237sqgmw7bfmw31116wcy
the SvnCheckout Gradle plugin will not be usable after January 8, 2024.

This is a replacement using OS scripts. Only for now to test with BuildBot
  • Loading branch information
JacquesLeRoux committed Dec 31, 2023
1 parent 0530a58 commit fd52ae3
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pullAllPluginsSource.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@echo off
rem #####################################################################
rem Licensed to the Apache Software Foundation (ASF) under one
rem or more contributor license agreements. See the NOTICE file
rem distributed with this work for additional information
rem regarding copyright ownership. The ASF licenses this file
rem to you under the Apache License, Version 2.0 (the
rem "License"); you may not use this file except in compliance
rem with the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing,
rem software distributed under the License is distributed on an
rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations
rem under the License.
rem #####################################################################

rem Whatever, create anew
if EXIST plugins\ (
cmd /c rd /s/q plugins
)
git branch --show-current > temp.txt
set /p branch=<temp.txt
del temp.txt

git clone https://github.com/apache/ofbiz-plugins.git plugins
cd plugins

rem By default the clone branch is trunk
if NOT trunk == %branch% (
call git switch -c %branch% --track origin/%branch%
)

rem Remove .git, in this case it's big useless information
cmd /c rd /s/q .git
cd ..
40 changes: 40 additions & 0 deletions pullAllPluginsSource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Whatever, create anew
if [ -d "plugins" ]
then
rm -rf plugins
fi

git branch --show-current > temp.txt
branch=$(cat temp.txt)
rm temp.txt

git clone https://github.com/apache/ofbiz-plugins.git plugins
cd plugins

# By default the clone branch is trunk
if [ ! trunk == "$branch" ]
then
git switch -c "$branch" --track origin/"$branch"
fi

# remove .git, in this case it's big useless information
rm -rf .git
cd ..
48 changes: 48 additions & 0 deletions pullPluginSource.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@echo off
rem #####################################################################
rem Licensed to the Apache Software Foundation (ASF) under one
rem or more contributor license agreements. See the NOTICE file
rem distributed with this work for additional information
rem regarding copyright ownership. The ASF licenses this file
rem to you under the Apache License, Version 2.0 (the
rem "License"); you may not use this file except in compliance
rem with the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing,
rem software distributed under the License is distributed on an
rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations
rem under the License.
rem #####################################################################

rem Remove plugins dir in case of all plugins present
if EXIST plugins\ (
if NOT EXIST plugins\.git\ (
cmd /c rd/s/q plugins
)
)
rem Clone if new else simply init sparse-checkout
if NOT EXIST plugins\.git\ (
git clone --filter=blob:none --sparse https://github.com/apache/ofbiz-plugins.git plugins
cd plugins
) 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
)

rem Add the plugin
git sparse-checkout add %1


git branch --show-current > temp.txt
set /p branch=<temp.txt
del temp.txt
rem By default the clone branch is trunk
if NOT trunk == %branch% (
call git switch -c %1 --track origin/%1
)
cd ..
51 changes: 51 additions & 0 deletions pullPluginSource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


# Remove plugins dir in case of all plugins present
if [ -d "plugins" ]
then
if [ ! -d "plugins\.git" ]
then
rm -rf plugins
fi
fi

# Clone if new else simply init sparse-checkout
if [ ! -d "plugins\.git" ]
then
git clone --filter=blob:none --sparse https://github.com/apache/ofbiz-plugins.git plugins
cd plugins
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
fi

# Add the plugin
git sparse-checkout add "$1"
git branch --show-current > temp.txt
branch=$(cat temp.txt)
rm temp.txt

# By default the clone branch is trunk
if [ ! trunk == "$branch" ]
then
call git switch -c "$1" --track origin/"$1"
fi
cd ..

0 comments on commit fd52ae3

Please sign in to comment.