mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJI-3418 build scripts: Bazel: simplify running build targets by extracting common cmd/ps1 scripts
GitOrigin-RevId: b6ba24b1038dbba6878df610a919fee6e1528f4b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8ee8c401b3
commit
a3286712a0
+2
-1
@@ -5,8 +5,9 @@ load("//build:intellij_dev_community.bzl", "intellij_dev_binary_community")
|
||||
load("//build:intellij_dev.bzl", "INTELLIJ_ADD_OPENS")
|
||||
load("@jps_dynamic_deps_community//:targets.bzl", "ALL_COMMUNITY_TARGETS")
|
||||
|
||||
# Can't name the target 'installers' since it triggers elevation in Windows
|
||||
java_binary(
|
||||
name = "installers_build_target",
|
||||
name = "i_build_target",
|
||||
runtime_deps = [":build"],
|
||||
main_class = "OpenSourceCommunityInstallersBuildTarget",
|
||||
add_opens = INTELLIJ_ADD_OPENS,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true, Position = 0)]
|
||||
[string]$root,
|
||||
|
||||
[Parameter(Mandatory = $true, Position = 1)]
|
||||
[string]$build_target,
|
||||
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]]$rest
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
# See how Bazel java wrapper works
|
||||
# Here we pass arguments to it in the following way:
|
||||
# - "--debug" becomes "--debug"
|
||||
# - everything else becomes "--jvm-arg=<value>"
|
||||
$ARGS = @()
|
||||
foreach ($arg in $rest) {
|
||||
if ($arg -eq '--debug') {
|
||||
$ARGS += '--debug'
|
||||
} else {
|
||||
$ARGS += "--jvm-arg=$arg"
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location $root
|
||||
try {
|
||||
& (Join-Path $root 'bazel.cmd') run $build_target -- @ARGS
|
||||
$exitCode = $LASTEXITCODE
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
exit $exitCode
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
root="$1"
|
||||
build_target_name="$2"
|
||||
shift
|
||||
shift
|
||||
|
||||
# See java_stub_template.txt on how bazel java wrapper works
|
||||
args=()
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" == "--debug" ]; then
|
||||
args+=("--debug")
|
||||
else
|
||||
args+=("--jvm_flag=$arg")
|
||||
fi
|
||||
done
|
||||
|
||||
cd "$root"
|
||||
exec /bin/bash "$root/bazel.cmd" run "$build_target_name" -- "${args[@]}"
|
||||
+9
-32
@@ -15,39 +15,16 @@ GOTO :CMDSCRIPT
|
||||
set -eu
|
||||
root="$(cd "$(dirname "$0")"; pwd)"
|
||||
|
||||
cd "$root"
|
||||
|
||||
# See java_stub_template.txt for available arguments
|
||||
args=()
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" == "--debug" ]; then
|
||||
args+=("--debug")
|
||||
else
|
||||
args+=("--jvm_flag=$arg")
|
||||
fi
|
||||
done
|
||||
|
||||
exec /bin/bash "$root/bazel.cmd" run @community//build:installers_build_target -- "${args[@]}"
|
||||
exec "$root/build/run_build_target.sh" "$root" //build:i_build_target "$@"
|
||||
|
||||
:CMDSCRIPT
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
set "ROOT=%~dp0"
|
||||
set "ROOT=%ROOT:~0,-1%"
|
||||
|
||||
set "ARGS="
|
||||
:loop
|
||||
if "%~1"=="" goto run
|
||||
if "%~1"=="--debug" (
|
||||
set "ARGS=!ARGS! "--debug""
|
||||
) else (
|
||||
set "ARGS=!ARGS! "--jvm-arg=%~1""
|
||||
)
|
||||
shift
|
||||
goto loop
|
||||
|
||||
:run
|
||||
|
||||
pushd "%~dp0"
|
||||
call "%~dp0\bazel.cmd" run @community//build:installers_build_target -- %ARGS%
|
||||
set _exit_code=%ERRORLEVEL%
|
||||
popd
|
||||
EXIT /B %_exit_code%
|
||||
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" ^
|
||||
-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass ^
|
||||
-File "%~dp0build\run_build_target.ps1" ^
|
||||
"%ROOT%" ^
|
||||
"@community//build:i_build_target" ^
|
||||
%*
|
||||
|
||||
@@ -14,41 +14,18 @@ GOTO :CMDSCRIPT
|
||||
# To debug tests use: -Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005
|
||||
|
||||
set -eu
|
||||
|
||||
root="$(cd "$(dirname "$0")"; pwd)"
|
||||
cd "$root"
|
||||
|
||||
# See java_stub_template.txt for available arguments
|
||||
args=()
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" == "--debug" ]; then
|
||||
args+=("--debug")
|
||||
else
|
||||
args+=("--jvm_flag=$arg")
|
||||
fi
|
||||
done
|
||||
|
||||
exec /bin/bash "$root/bazel.cmd" run @community//build:run_tests_build_target -- "${args[@]}"
|
||||
exec "$root/build/run_build_target.sh" "$root" //build:run_tests_build_target "$@"
|
||||
|
||||
:CMDSCRIPT
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
set "ROOT=%~dp0"
|
||||
set "ROOT=%ROOT:~0,-1%"
|
||||
|
||||
set "ARGS="
|
||||
:loop
|
||||
if "%~1"=="" goto run
|
||||
if "%~1"=="--debug" (
|
||||
set "ARGS=!ARGS! "--debug""
|
||||
) else (
|
||||
set "ARGS=!ARGS! "--jvm-arg=%~1""
|
||||
)
|
||||
shift
|
||||
goto loop
|
||||
|
||||
:run
|
||||
|
||||
pushd "%~dp0"
|
||||
call "%~dp0\bazel.cmd" run @community//build:run_tests_build_target -- %ARGS%
|
||||
set _exit_code=%ERRORLEVEL%
|
||||
popd
|
||||
EXIT /B %_exit_code%
|
||||
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" ^
|
||||
-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass ^
|
||||
-File "%~dp0build\run_build_target.ps1" ^
|
||||
"%ROOT%" ^
|
||||
"@community//build:run_tests_build_target" ^
|
||||
%*
|
||||
|
||||
Reference in New Issue
Block a user