Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ffc3919
WIP: Injectable gradle plugin
keynmol Apr 25, 2023
8c0b510
Run tests on CI
keynmol Apr 26, 2023
2a9011c
Actually run the tests
keynmol Apr 26, 2023
6ce3e82
WIP
keynmol May 2, 2023
b8e12a1
Add Gradle plugin written in Scala
keynmol May 4, 2023
8cd632d
Target Gradle 7, but handle earlier versions as well
keynmol May 4, 2023
85e116f
Generate semanticdb in the proper build directory
keynmol May 4, 2023
0b3e255
Add random timestamp flag to force Gradle's recompilation
keynmol May 4, 2023
1d33b0d
Embed gradle plugin assembly in cli resources
keynmol May 4, 2023
26693a4
Configurable semanticdb root, correctly handle jvm args without
keynmol May 4, 2023
6d66811
Use javacplugin jar instead of maven dependency
keynmol May 4, 2023
ef21548
No boom please
keynmol May 4, 2023
6d4b9fb
Restore kotlin support!
keynmol May 4, 2023
85cf780
Delete kotlin version of the plugin
keynmol May 4, 2023
e875f43
delete gradle tests from workflows
keynmol May 4, 2023
f9a37eb
Restore kotlin multiplatform support
keynmol May 5, 2023
308ec56
Restore dependency printing support
keynmol May 5, 2023
8f786bc
Add tests on a grid of Gradle versions
keynmol May 5, 2023
3b30c7a
Clean up tests
keynmol May 5, 2023
986cd9e
Huh?
keynmol May 5, 2023
9e9ee8c
Add Java 11 to tests
keynmol May 5, 2023
7eef259
Don't use new APIs on java.util.List
keynmol May 5, 2023
b2f6bf9
Compile gradle plugin with JDK 8
keynmol May 5, 2023
631e347
Disable non-local publishing of Gradle plugin
keynmol May 5, 2023
778b78e
Extract Kotlin Gradle plugin version
keynmol May 5, 2023
b94fd27
Merge branch 'main' into gradle-plugin
keynmol May 5, 2023
5801d20
Inject java agent into the forked Zinc JVM args
keynmol May 5, 2023
8eabbfc
If we failed to add javac plugin, inject agent instead
keynmol May 5, 2023
2b44ac7
Don't run Gradle 6.7 tests on anything other java 8 or 11
keynmol May 5, 2023
bad92f4
temp: run only the broken tests on 17
keynmol May 5, 2023
7b8cca3
Fix test run command
keynmol May 5, 2023
623eb63
Build agent on Java 8?
keynmol May 5, 2023
d063538
Revert back to Java 8 only tag
keynmol May 5, 2023
77b4c0e
Restore test matrix
keynmol May 5, 2023
ab5f10d
Print dependencies first, and then compile
keynmol May 9, 2023
c3e124e
Add comments and return type annotations
keynmol May 9, 2023
baafb70
chore: formatting
keynmol May 9, 2023
325d07d
Merge branch 'main' into gradle-plugin
keynmol May 9, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:
# NOTE(olafurpg) Windows is not enabled because it times out due to reasons I don't understand.
# os: [windows-latest, ubuntu-latest]
os: [ubuntu-latest]
java: [8, 17]
java: [8, 11, 17]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin"
cache: "sbt"
java-version: ${{ matrix.java }}
- run: sbt test
- name: Main project tests
run: sbt test

docker_test:
runs-on: ${{ matrix.os }}
Expand All @@ -49,7 +50,6 @@ jobs:
docker run -v $PWD:/sources -w /sources sourcegraph/scip-java:latest scip-java index --cwd circe
file circe/index.scip || (echo "circe SCIP index doesn't exist!"; exit 1)


bazel:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ bazel-testlogs
bazel-lsif-java

VERSION

semanticdb-gradle-plugin/gradle
85 changes: 67 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ lazy val V =
val coursier = "2.0.8"
val bsp = "2.0.0-M13"
val moped = "0.1.11"
def scala213 = "2.13.10"
def scala212 = "2.12.17"
def scala211 = "2.11.12"
def scala3 = "3.2.2"
def metals = "0.11.11"
def scalameta = "4.7.6"
def semanticdbKotlinc = "0.3.0"
def testcontainers = "0.39.3"
def requests = "0.6.5"
def minimalMillVersion = "0.10.0"
def millScipVersion = "0.3.2"
val gradle = "7.0"
val scala213 = "2.13.10"
val scala212 = "2.12.17"
val scala211 = "2.11.12"
val scala3 = "3.2.2"
val metals = "0.11.11"
val scalameta = "4.7.6"
val semanticdbKotlinc = "0.3.0"
val testcontainers = "0.39.3"
val requests = "0.6.5"
val minimalMillVersion = "0.10.0"
val millScipVersion = "0.3.2"
val kotlinGradlePlugin = "1.5.31"
}

inThisBuild(
Expand Down Expand Up @@ -90,6 +92,7 @@ lazy val agent = project
.settings(
fatjarPackageSettings,
javaOnlySettings,
javaToolchainVersion := "8",
moduleName := "semanticdb-agent",
libraryDependencies ++=
List(
Expand All @@ -104,8 +107,51 @@ lazy val agent = project
"Premain-Class" -> "com.sourcegraph.semanticdb_javac.SemanticdbAgent"
)
)
lazy val gradlePlugin = project
.in(file("semanticdb-gradle-plugin"))
.settings(
name := "semanticdb-gradle",
scalaVersion := V.scala213,
buildInfoPackage := "com.sourcegraph.scip_java",
publish / skip := true,
javaToolchainVersion := "8",
scalacOptions ++= Seq("-target:8", "-release", "8"),
libraryDependencies ++=
List(
"dev.gradleplugins" % "gradle-api" % V.gradle % Provided,
"dev.gradleplugins" % "gradle-test-kit" % V.gradle % Provided,
"org.jetbrains.kotlin" % "kotlin-gradle-plugin" % V.kotlinGradlePlugin %
Provided
),
buildInfoKeys :=
Seq[BuildInfoKey](
version,
sbtVersion,
scalaVersion,
"javacModuleOptions" -> javacModuleOptions,
"semanticdbScalacVersions" ->
com
.sourcegraph
.sbtsourcegraph
.Versions
.cachedSemanticdbVersionsByScalaVersion,
"sbtSourcegraphVersion" ->
com.sourcegraph.sbtsourcegraph.BuildInfo.version,
"semanticdbVersion" -> V.scalameta,
"semanticdbKotlincVersion" -> V.semanticdbKotlinc,
"mtagsVersion" -> V.metals,
"scala211" -> V.scala211,
"scala212" -> V.scala212,
"scala213" -> V.scala213,
"scala3" -> V.scala3,
"bspVersion" -> V.bsp,
"minimalMillVersion" -> V.minimalMillVersion,
"millScipVersion" -> V.millScipVersion
)
)
.enablePlugins(BuildInfoPlugin)

lazy val plugin = project
lazy val javacPlugin = project
.in(file("semanticdb-javac"))
.settings(
fatjarPackageSettings,
Expand Down Expand Up @@ -204,13 +250,14 @@ lazy val cli = project
}

addJar(
(plugin / Compile / Keys.`package`).value,
(javacPlugin / Compile / Keys.`package`).value,
"semanticdb-plugin.jar"
)
addJar(
(agent / Compile / Keys.`package`).value,
"semanticdb-agent.jar"
)
addJar((gradlePlugin / Compile / assembly).value, "gradle-plugin.jar")

IO.copy(outs)
val props = new Properties()
Expand Down Expand Up @@ -333,13 +380,13 @@ lazy val minimizedSettings = List[Def.Setting[_]](
lazy val minimized = project
.in(file("tests/minimized/.j11"))
.settings(minimizedSettings, javaOnlySettings)
.dependsOn(agent, plugin)
.dependsOn(agent, javacPlugin)
.disablePlugins(JavaFormatterPlugin)

lazy val minimized8 = project
.in(file("tests/minimized/.j8"))
.settings(minimizedSettings, javaToolchainVersion := "8", javaOnlySettings)
.dependsOn(agent, plugin)
.dependsOn(agent, javacPlugin)
.disablePlugins(JavaFormatterPlugin)

def javacModuleOptions =
Expand All @@ -364,7 +411,7 @@ lazy val minimized17 = project
javaToolchainVersion := "17",
javacOptions ++= javacModuleOptions
)
.dependsOn(agent, plugin)
.dependsOn(agent, javacPlugin)
.disablePlugins(JavaFormatterPlugin)

lazy val minimizedScala = project
Expand Down Expand Up @@ -397,7 +444,7 @@ lazy val unit = project
),
buildInfoPackage := "tests"
)
.dependsOn(plugin, cli)
.dependsOn(javacPlugin, cli)
.enablePlugins(BuildInfoPlugin)

lazy val buildTools = project
Expand All @@ -407,7 +454,7 @@ lazy val buildTools = project
(Test / javaOptions) ++=
List(
s"-javaagent:${(agent / Compile / Keys.`package`).value}",
s"-Dsemanticdb.pluginpath=${(plugin / Compile / Keys.`package`).value}",
s"-Dsemanticdb.pluginpath=${(javacPlugin / Compile / Keys.`package`).value}",
s"-Dsemanticdb.sourceroot=${(ThisBuild / baseDirectory).value}",
s"-Dsemanticdb.targetroot=${(agent / Compile / target).value / "semanticdb-targetroot"}"
)
Expand Down Expand Up @@ -541,3 +588,5 @@ dumpScipJavaVersion := {

IO.write((ThisBuild / baseDirectory).value / "VERSION", versionValue)
}

ThisBuild / version := sys.env.get("CI").fold("dev")(_ => version.value)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ object Embedded {
def semanticdbJar(tmpDir: Path): Path =
copyFile(tmpDir, "semanticdb-plugin.jar")

def gradlePluginJar(tmpDir: Path): Path =
copyFile(tmpDir, "gradle-plugin.jar")

def agentJar(tmpDir: Path): Path = copyFile(tmpDir, "semanticdb-agent.jar")
def coursier(tmpDir: Path): Path = {
val result = copyFile(tmpDir, "scip-java/coursier")
Expand Down
Loading