Powershell build script

Guys, i spent some time on a small script that permits to spare time on build.

This script creates a folder and clone the « dev » branch into it.
It removes references to CI and build the sources.
Feel free to use it or adapt it (it is not perfect, but it works).

################################# CLONE REPO ###############################

$axelor_version = "axelor-erp-7.2.5-dev-20240111-01"
$axelor_path = "C:\SOURCES\"

# CREATE REPOSITORY FOLDER
if (Test-Path $axelor_path) {
    Write-Host "Folder $axelor_path already exists."
} else {
    New-Item -ItemType Directory -Path $axelor_path | Out-Null
    Write-Host "Folder $axelor_path has been created."
}

cd $axelor_path
git clone -b dev https://github.com/axelor/open-suite-webapp.git $axelor_version

(Get-Content $axelor_version/.gitmodules) -replace 'git@github.com:', 'https://github.com/' | Set-Content $axelor_version/.gitmodules

cd $axelor_version

git checkout dev

git submodule sync

git submodule init

git submodule update

git submodule foreach git checkout dev

git submodule foreach git pull origin dev



################################# END OF CLONE REPO ########################


########################### BUILD CORRECTIONS ##############################

$axelor_react_timesheet_path = "$axelor_path\$axelor_version\modules\axelor-open-suite\axelor-human-resource\src\main\axelor-react-timesheet\package.json"
$task_editor_path = "$axelor_path\$axelor_version\modules\axelor-open-suite\axelor-project\src\main\task-editor\package.json"

$axelor_react_timesheet_target_content="CI=false node scripts/build.js"
$axelor_react_timesheet_required_content="set 'CI=false' && node scripts/build.js"

$task_editor_target_content="CI=false GENERATE_SOURCEMAP=false react-scripts build"
$task_editor_required_content="set 'CI=false' && set 'GENERATE_SOURCEMAP=false' && react-scripts build"


(Get-Content $axelor_react_timesheet_path ) -replace $axelor_react_timesheet_target_content, $axelor_react_timesheet_required_content | Set-Content $axelor_react_timesheet_path
(Get-Content $task_editor_path ) -replace $task_editor_target_content, $task_editor_required_content | Set-Content $task_editor_path



./gradlew clean build

pause

########################### END OF BUILD CORRECTIONS ###########################

3 « J'aime »