mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJI-3417 installers.cmd/tests.cmd should use Bazel to run
GitOrigin-RevId: 07befbd801c0757deca5d676b1191662694d886e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cec32fb07f
commit
8a4d4e0a09
@@ -102,15 +102,13 @@ If IntelliJ IDEA displays a message about a missing or out-of-date required plug
|
||||
Options to build installers are passed as system properties to `installers.cmd` command.
|
||||
You may find the list of available properties in [BuildOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/BuildOptions.kt)
|
||||
|
||||
Pass --debug to suspend and wait for debugger at port 5005
|
||||
|
||||
Installer build examples:
|
||||
```bash
|
||||
# Build installers only for current operating system:
|
||||
./installers.cmd -Dintellij.build.target.os=current
|
||||
```
|
||||
```bash
|
||||
# Build source code _incrementally_ (do not build what was already built before):
|
||||
./installers.cmd -Dintellij.build.incremental.compilation=true
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
>
|
||||
@@ -126,10 +124,7 @@ docker run --rm -it --user "$(id -u)" --volume "${PWD}:/community" "$(docker bui
|
||||
> [!NOTE]
|
||||
>
|
||||
> Please remember to specify the `--user "$(id -u)"` argument for the container's user to match the host's user.
|
||||
> This prevents issues with permissions for the checked-out repository, the build output, and the mounted Maven cache, if any.
|
||||
>
|
||||
To reuse the existing Maven cache from the host system, add the following option to `docker run` command:
|
||||
`--volume "$HOME/.m2:/home/ide_builder/.m2"`
|
||||
> This prevents issues with permissions for the checked-out repository, the build output, if any.
|
||||
|
||||
---
|
||||
## Running IntelliJ IDEA
|
||||
@@ -147,13 +142,15 @@ Options to run tests are passed as system properties to `tests.cmd` command.
|
||||
You may find the list of available properties in [TestingOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/TestingOptions.kt)
|
||||
|
||||
```bash
|
||||
# Build source code _incrementally_ (do not build what was already built before): `
|
||||
./tests.cmd -Dintellij.build.incremental.compilation=true
|
||||
# Run specific run configuration:
|
||||
./tests.cmd -Dintellij.build.test.configurations=ApiCheckTest
|
||||
```
|
||||
```bash
|
||||
#Run a specific test:
|
||||
# Run a specific test:
|
||||
./tests.cmd -Dintellij.build.test.patterns=com.intellij.util.ArrayUtilTest
|
||||
```
|
||||
|
||||
to debug tests use: `-Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005`
|
||||
|
||||
`tests.cmd` is used just to run [CommunityRunTestsBuildTarget](build/src/CommunityRunTestsBuildTarget.kt) from the command line.
|
||||
You can also call it directly from IDEA, see run configuration `tests` for an example.
|
||||
@@ -1,6 +1,25 @@
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_jvm//:jvm.bzl", "jvm_library")
|
||||
|
||||
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")
|
||||
|
||||
java_binary(
|
||||
name = "installers_build_target",
|
||||
runtime_deps = [":build"],
|
||||
main_class = "OpenSourceCommunityInstallersBuildTarget",
|
||||
add_opens = INTELLIJ_ADD_OPENS,
|
||||
data = ALL_COMMUNITY_TARGETS,
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "run_tests_build_target",
|
||||
runtime_deps = [":build"],
|
||||
main_class = "CommunityRunTestsBuildTarget",
|
||||
add_opens = INTELLIJ_ADD_OPENS,
|
||||
data = ALL_COMMUNITY_TARGETS,
|
||||
)
|
||||
|
||||
# Dev-build targets for running IDEs locally via `bazel run //build:<target>`
|
||||
intellij_dev_binary_community(
|
||||
|
||||
+41
-4
@@ -7,10 +7,47 @@ GOTO :CMDSCRIPT
|
||||
# THIS SCRIPTS WORKS FOR ALL SYSTEMS Linux/Windows/macOS
|
||||
# See README.md for usage scenarios
|
||||
|
||||
set -eux
|
||||
# Arguments are passed as JVM options
|
||||
# and used in org.jetbrains.intellij.build.BuildOptions
|
||||
|
||||
# Pass --debug to suspend and wait for debugger at port 5005
|
||||
|
||||
set -eu
|
||||
root="$(cd "$(dirname "$0")"; pwd)"
|
||||
exec "$root/platform/jps-bootstrap/jps-bootstrap.sh" "$@" "$root" intellij.idea.community.build OpenSourceCommunityInstallersBuildTarget
|
||||
|
||||
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[@]}"
|
||||
|
||||
:CMDSCRIPT
|
||||
|
||||
call "%~dp0\platform\jps-bootstrap\jps-bootstrap.cmd" %* "%~dp0." intellij.idea.community.build OpenSourceCommunityInstallersBuildTarget
|
||||
EXIT /B %ERRORLEVEL%
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
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%
|
||||
|
||||
@@ -7,6 +7,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import org.jetbrains.intellij.build.BuildOptions
|
||||
import org.jetbrains.intellij.build.CompilationContext
|
||||
import org.jetbrains.intellij.build.impl.logging.jps.withJpsLogging
|
||||
import org.jetbrains.intellij.build.org.jetbrains.intellij.bazelEnvironment.BazelRunfiles
|
||||
import org.jetbrains.intellij.build.telemetry.TraceManager
|
||||
import org.jetbrains.intellij.build.telemetry.TraceManager.spanBuilder
|
||||
import org.jetbrains.intellij.build.telemetry.use
|
||||
@@ -122,6 +123,10 @@ internal class JpsCompilationRunner(private val context: CompilationContext) {
|
||||
resolveProjectDependencies: Boolean = false,
|
||||
canceledStatus: CanceledStatus = CanceledStatus.NULL,
|
||||
) = context.withCompilationLock {
|
||||
require(!BazelRunfiles.isRunningFromBazel) {
|
||||
"Running JPS compiler is not supported when running from Bazel."
|
||||
}
|
||||
|
||||
val compilationData = context.compilationData
|
||||
|
||||
val forceBuild = !context.options.incrementalCompilation || !context.compilationData.isIncrementalCompilationDataAvailable()
|
||||
|
||||
+10
@@ -105,6 +105,11 @@ internal fun checkCompilationOptions(context: CompilationContext) {
|
||||
}
|
||||
|
||||
internal fun isCompilationRequired(options: BuildOptions): Boolean {
|
||||
// Compilation is never required with Bazel
|
||||
if (isRunningFromBazelOut()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return options.forceRebuild ||
|
||||
!options.useCompiledClassesFromProjectOutput &&
|
||||
options.pathToCompiledClassesArchive == null &&
|
||||
@@ -112,6 +117,11 @@ internal fun isCompilationRequired(options: BuildOptions): Boolean {
|
||||
}
|
||||
|
||||
internal fun keepCompilationState(options: BuildOptions): Boolean {
|
||||
if (isRunningFromBazelOut()) {
|
||||
// Do not clean JPS output, we do not know exactly what classes directory is
|
||||
return true
|
||||
}
|
||||
|
||||
return !options.forceRebuild &&
|
||||
(isPortableCompilationCacheEnabled ||
|
||||
options.useCompiledClassesFromProjectOutput ||
|
||||
|
||||
@@ -6,6 +6,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.intellij.build.dependencies.BuildDependenciesCommunityRoot
|
||||
import org.jetbrains.intellij.build.impl.addToClasspathAgent.AddToClasspathUtil
|
||||
import org.jetbrains.intellij.build.org.jetbrains.intellij.bazelEnvironment.BazelRunfiles
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -34,6 +35,11 @@ class KotlinBinaries(private val communityHome: BuildDependenciesCommunityRoot)
|
||||
}
|
||||
|
||||
suspend fun loadKotlinJpsPluginToClassPath() {
|
||||
require(!BazelRunfiles.isRunningFromBazel) {
|
||||
"Dynamically loading Kotlin JPS plugin is not supported while running from Bazel. " +
|
||||
"JPS compilation at all is not supported when running from Bazel."
|
||||
}
|
||||
|
||||
val required = KotlinCompilerDependencyDownloader.getKotlinJpsPluginVersion(communityHome)
|
||||
|
||||
val current = getCurrentKotlinJpsPluginVersionFromClassPath()
|
||||
|
||||
@@ -7,10 +7,48 @@ GOTO :CMDSCRIPT
|
||||
# THIS SCRIPTS WORKS FOR ALL SYSTEMS Linux/Windows/macOS
|
||||
# See README.md for usage scenarios
|
||||
|
||||
set -eux
|
||||
# Arguments are passed as JVM options
|
||||
# and used in org.jetbrains.intellij.build.BuildOptions and org.jetbrains.intellij.build.TestingOptions
|
||||
|
||||
# To debug build scripts (CommunityRunTestsBuildTarget) use: --debug
|
||||
# To debug tests use: -Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005
|
||||
|
||||
set -eu
|
||||
|
||||
root="$(cd "$(dirname "$0")"; pwd)"
|
||||
exec "$root/platform/jps-bootstrap/jps-bootstrap.sh" -Dintellij.build.incremental.compilation=true -Dintellij.build.use.compiled.classes=false "$@" "$root" intellij.idea.community.build CommunityRunTestsBuildTarget
|
||||
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[@]}"
|
||||
|
||||
:CMDSCRIPT
|
||||
|
||||
call "%~dp0\platform\jps-bootstrap\jps-bootstrap.cmd" -Dintellij.build.incremental.compilation=true -Dintellij.build.use.compiled.classes=false %* "%~dp0." intellij.idea.community.build CommunityRunTestsBuildTarget
|
||||
EXIT /B %ERRORLEVEL%
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
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%
|
||||
|
||||
Reference in New Issue
Block a user