Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
[maintenance] fixed installer and install targets cleanup | #BAZEL-8 …
Browse files Browse the repository at this point in the history
…Done

buildifier

alias out

e2e update

install script works now


Merge-request: BAZEL-MR-400
Merged-by: Marcin Abramowicz <marcin.abramowicz@jetbrains.com>
  • Loading branch information
abrams27 authored and qodana-bot committed Jul 27, 2023
1 parent b11e3a1 commit 0314e75
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 37 deletions.
14 changes: 2 additions & 12 deletions e2e/runTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,9 @@ echo -e "==================================="
echo -e "Running BSP test '$TEST_TARGET' in '$TEST_PROJECT_PATH'..."
echo -e "-----------------------------------\n"

echo "Building project..."
cd "$BUILD_WORKSPACE_DIRECTORY" || exit
bazel build //server/src/main/java/org/jetbrains/bsp/bazel:bsp-install
EXECUTION_CODE=$?
if [ $EXECUTION_CODE -ne 0 ]; then
echo -e "${RED}building failed :(${NC}"
exit 1
fi

TEST_BSP_WORKSPACE_ROOT=$BUILD_WORKSPACE_DIRECTORY/bazel-integration-tests
mkdir -p $TEST_BSP_WORKSPACE_ROOT
BSP_ROOT=$(mktemp -d "$TEST_BSP_WORKSPACE_ROOT/XXXXXXX")
bsp_path="$(bazel info bazel-bin)/server/src/main/java/org/jetbrains/bsp/bazel/bsp-install"
echo "Building done."

echo "Cleaning project directory..."
if [ "$#" -eq 2 ]; then
Expand All @@ -49,7 +38,8 @@ rm -r .bazelbsp/ > /dev/null 2>&1
echo "Cleaning project directory done!"

echo "Installing BSP... for $TEST_PROJECT_PATH"
"$bsp_path" -d $BSP_ROOT -w $TEST_PROJECT_PATH || exit
cd "$BUILD_WORKSPACE_DIRECTORY" || exit
bazel run //install:install-server -- -d "$BSP_ROOT" -w "$TEST_PROJECT_PATH" || exit
echo "Installing done."
echo "Environment has been prepared!"
echo -e "-----------------------------------\n"
Expand Down
5 changes: 0 additions & 5 deletions install-server/BUILD

This file was deleted.

16 changes: 11 additions & 5 deletions install/BUILD
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_binary", "kt_jvm_library")

java_library(
kt_jvm_library(
name = "install",
visibility = ["//visibility:public"],
exports = [
"//install/src/main/java/org/jetbrains/bsp/bazel/install",
],
)

java_binary(
name = "bsp-install",
kt_jvm_binary(
name = "install-server",
main_class = "org.jetbrains.bsp.bazel.install.Install",
runtime_deps = ["//install/src/main/java/org/jetbrains/bsp/bazel/install"],
resources = ["//log4j_config"],
visibility = ["//visibility:public"],
runtime_deps = [
"//commons",
"//install",
"//server/src/main/java/org/jetbrains/bsp/bazel/server",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import org.apache.commons.cli.DefaultParser
import org.apache.commons.cli.HelpFormatter
import org.apache.commons.cli.Option
import org.apache.commons.cli.Options
import java.lang.System
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.io.path.Path

class CliOptionsProvider(private val args: Array<String>) {

Expand Down Expand Up @@ -268,7 +270,11 @@ class CliOptionsProvider(private val args: Array<String>) {

private fun buildFlags(cmd: CommandLine): List<String>? = cmd.getOptionValues(BUILD_FLAGS_SHORT_OPT)?.toList()

private fun calculateCurrentAbsoluteDirectory(): Path = Paths.get("").toAbsolutePath()
private fun calculateCurrentAbsoluteDirectory(): Path = calculateCurrentDir().toAbsolutePath()

private fun calculateCurrentDir(): Path =
System.getenv("BUILD_WORKING_DIRECTORY")
?.let { Path(it) } ?: Path("")

private fun directories(cmd: CommandLine): List<String>? = cmd.getOptionValues(DIRECTORIES_SHORT_OPT)?.toList()

Expand Down
14 changes: 0 additions & 14 deletions server/src/main/java/org/jetbrains/bsp/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@rules_java//java:defs.bzl", "java_binary")
load("@bazel_sonatype//:defs.bzl", "sonatype_java_export")

sonatype_java_export(
Expand All @@ -15,16 +14,3 @@ sonatype_java_export(
"//server/src/main/java/org/jetbrains/bsp/bazel/server",
],
)

java_binary(
name = "bsp-install",
srcs = glob(["*.java"]),
main_class = "org.jetbrains.bsp.bazel.install.Install",
resources = ["//log4j_config"],
visibility = ["//visibility:public"],
runtime_deps = [
"//commons",
"//install",
"//server/src/main/java/org/jetbrains/bsp/bazel/server",
],
)
1 change: 1 addition & 0 deletions server/src/main/java/org/jetbrains/bsp/bazel/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ kt_jvm_library(
]),
visibility = [
"//bspcli:__subpackages__",
"//install:__subpackages__",
"//server:__subpackages__",
],
deps = [
Expand Down

0 comments on commit 0314e75

Please sign in to comment.