Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
*.class
*.log

# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
.bloop

_site/

# Scala-IDE specific
.scala_dependencies
.worksheet

.idea

# ENSIME specific
.ensime_cache/
.ensime

.metals/
metals.sbt
metals/project/

.bsp

.vscode/

local.*

.DS_Store

node_modules

lib/core/metadata.js
lib/core/MetadataBlog.js

website/translated_docs
website/build/
website/yarn.lock
website/node_modules
website/i18n/*

project/metals.sbt
out/
*.hnir
test-report.json
index.scip

./generated
/sources
bazel-bin
bazel-scip-java
bazel-out
bazel-testlogs
bazel-lsif-java

VERSION

semanticdb-gradle-plugin/gradle
aspects/scip_java.bzl
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM eclipse-temurin:17

RUN apt-get update && apt-get install --yes jq wget curl zip unzip git python3 python3-pip autoconf automake libtool build-essential libtool make g++

WORKDIR /workdir

COPY ./bin/docker-setup.sh .
RUN ./docker-setup.sh


ENV PATH=/opt/maven/bin:${PATH}
ENV PATH=/opt/gradle/bin:${PATH}
ENV PATH=/root/.local/share/coursier/bin:${PATH}

ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport"
RUN git config --global --add safe.directory *

COPY . .

RUN sbt publishLocal dumpScipJavaVersion
RUN mkdir -p /app && coursier bootstrap "com.sourcegraph:scip-java_2.13:$(cat VERSION)" -f -o /app/scip-java -M com.sourcegraph.scip_java.ScipJava

COPY ./bin/scip-java-docker-script.sh /usr/bin/scip-java

WORKDIR /sources

RUN rm -rf /workdir
Binary file modified bin/coursier
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/docker-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eux
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.0-RC5/coursier
curl -fLo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.1.5/coursier
chmod +x /usr/local/bin/coursier
coursier setup --yes

Expand Down
2 changes: 1 addition & 1 deletion bin/scip-java-docker-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ do
eval "$(coursier java --jvm "$JVM_VERSION" --env --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json)"

java -version
if /app/scip-java/bin/scip-java "$@"; then
if /app/scip-java "$@"; then
LAST_CODE="0"
else
LAST_CODE=$?
Expand Down
59 changes: 3 additions & 56 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sbtdocker.DockerfileBase
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
import scala.xml.transform.{RewriteRule, RuleTransformer}
import java.io.File
Expand Down Expand Up @@ -318,62 +319,8 @@ lazy val cli = project
latest ++ versioned

},
docker / dockerfile := {
val binaryDistribution = pack.value
val scipJavaWrapper = (ThisBuild / baseDirectory).value / "bin" /
"scip-java-docker-script.sh"
val dockerSetup = (ThisBuild / baseDirectory).value / "bin" /
"docker-setup.sh"
new Dockerfile {
from("eclipse-temurin:17")

// Setup system dependencies.
run("apt-get", "update")
run(
"apt-get",
"install",
"--yes",
"jq",
"wget",
"curl",
"zip",
"unzip",
"git",
// C++ and Python dependencies that may be needed by some random JVM
// builds.
"python3",
"python3-pip",
"autoconf",
"automake",
"libtool",
"build-essential",
"libtool",
"make",
"g++"
)

// Install SDKMAN
add(dockerSetup, "/docker-setup.sh")
run("bash", "/docker-setup.sh")

env("PATH", "/opt/maven/bin:${PATH}")
env("PATH", "/opt/gradle/bin:${PATH}")
env("PATH", "/root/.local/share/coursier/bin:${PATH}")
env(
"JAVA_TOOL_OPTIONS",
"-XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport"
)

// Mark all directories as safe for Git, so that it doesn't
// trigger this check and error:
// `detected dubious ownership in repository at <folder>`
run("git", "config", "--global", "--add", "safe.directory", "*")

// Install `scip-java` binary.
add(scipJavaWrapper, "/usr/local/bin/scip-java")
add(binaryDistribution, "/app/scip-java")
}
}
docker / dockerfile :=
NativeDockerfile((ThisBuild / baseDirectory).value / "Dockerfile")
)
.enablePlugins(PackPlugin, DockerPlugin, BuildInfoPlugin)
.dependsOn(scip)
Expand Down
4 changes: 1 addition & 3 deletions project/JavaToolchainPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ object JavaToolchainPlugin extends AutoPlugin {
coursier.toString,
"java-home",
"--jvm",
jvmName(v),
"--architecture",
jvmArchitecture
jvmName(v)
) ++ index

new File(Process(arguments).!!.trim)
Expand Down