Skip to content

Commit

Permalink
chore(deps): Update and centralize dependencies (carlrobertoh#436)
Browse files Browse the repository at this point in the history
* chore(deps): Update and centralize dependencies

* Update treesitter to 0.22.2
* Update kotlin to 1.9.23
* Update jackson to 2.17.0
* Update gradle-intellij-plugin to 1.17.3
* Update gradle to 8.7
* Use BOMs where possible
* Centralize dependencies in version catalog
* Allow Dependabot to update other modules (add treesitter and buildSrc/src/main/kotlin, remove core)

* fix: preload credentials only once for all headers
  • Loading branch information
reneleonhardt authored Apr 6, 2024
1 parent 52ceaa6 commit 7f505e2
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ updates:
interval: "daily"

- package-ecosystem: "gradle"
directory: "/buildSrc"
directory: "/buildSrc/src/main/kotlin" # /buildSrc and /codegpt-telemetry use only references
schedule:
interval: "daily"

- package-ecosystem: "gradle"
directory: "/codegpt-core"
directory: "/codegpt-treesitter"
schedule:
interval: "daily"
17 changes: 9 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun environment(key: String) = providers.environmentVariable(key)

plugins {
id("codegpt.java-conventions")
id("org.jetbrains.changelog") version "2.2.0"
alias(libs.plugins.changelog)
}

group = properties("pluginGroup").get()
Expand All @@ -50,15 +50,16 @@ dependencies {
implementation(project(":codegpt-telemetry"))
implementation(project(":codegpt-treesitter"))

implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.2")
implementation("com.vladsch.flexmark:flexmark-all:0.64.8") {
implementation(enforcedPlatform("com.fasterxml.jackson:jackson-bom:${libs.versions.jackson.get()}"))
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation(libs.flexmark.all) {
// vulnerable transitive dependency
exclude(group = "org.jsoup", module = "jsoup")
}
implementation("org.jsoup:jsoup:1.17.2")
implementation("org.apache.commons:commons-text:1.11.0")
implementation("com.knuddels:jtokkit:1.0.0")
implementation(libs.jsoup)
implementation(libs.commons.text)
implementation(libs.jtokkit)
}

tasks.register<Exec>("updateSubmodules") {
Expand Down Expand Up @@ -154,4 +155,4 @@ tasks {
showStandardStreams = true
}
}
}
}
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ repositories {
}

dependencies {
implementation("org.jetbrains.intellij.plugins", "gradle-intellij-plugin", "1.17.2")
implementation("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.9.22")
implementation(libs.gradle.intellij.plugin)
implementation(libs.kotlin.gradle.plugin)
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml")) // Allow references
}
}
}
9 changes: 5 additions & 4 deletions buildSrc/src/main/kotlin/codegpt.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ checkstyle {
dependencies {
implementation("ee.carlrobert:llm-client:0.7.0")

testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.2"))
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
}

tasks {
Expand Down
4 changes: 2 additions & 2 deletions codegpt-telemetry/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ plugins {
}

dependencies {
implementation("com.rudderstack.sdk.java.analytics:analytics:3.0.0")
}
implementation(libs.analytics)
}
4 changes: 2 additions & 2 deletions codegpt-treesitter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation("io.github.bonede:tree-sitter:0.21.0")
implementation(libs.tree.sitter)
implementation("io.github.bonede:tree-sitter-erlang:0.1.0")
implementation("io.github.bonede:tree-sitter-elixir:0.1.1")
implementation("io.github.bonede:tree-sitter-dockerfile:0.1.2")
Expand Down Expand Up @@ -37,4 +37,4 @@ dependencies {
implementation("io.github.bonede:tree-sitter-php:0.20.0")
implementation("io.github.bonede:tree-sitter-typescript:0.20.3")
implementation("io.github.bonede:tree-sitter-query:0.1.0")
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ platformPlugins =
javaVersion = 17

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.5
gradleVersion = 8.7

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
Expand All @@ -38,4 +38,4 @@ org.gradle.caching = true
systemProp.org.gradle.unsafe.kotlin.assignment = true

# Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom
kotlin.incremental.useClasspathSnapshot = false
kotlin.incremental.useClasspathSnapshot = false
30 changes: 30 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[versions]
analytics = "3.0.0"
assertj = "3.25.3"
changelog = "2.2.0"
commons-text = "1.11.0"
flexmark = "0.64.8"
gradle-intellij-plugin-version="1.17.3"
jackson = "2.17.0"
jsoup = "1.17.2"
jtokkit = "1.0.0"
junit = "5.10.2"
kotlin = "1.9.23"
llm-client = "0.7.0"
tree-sitter = "0.22.2"

[libraries]
analytics = { module = "com.rudderstack.sdk.java.analytics:analytics", version.ref = "analytics" }
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
commons-text = { module = "org.apache.commons:commons-text", version.ref = "commons-text" }
flexmark-all = { module = "com.vladsch.flexmark:flexmark-all", version.ref = "flexmark" }
gradle-intellij-plugin = { module = "org.jetbrains.intellij.plugins:gradle-intellij-plugin", version.ref = "gradle-intellij-plugin-version" }
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
jtokkit = { module = "com.knuddels:jtokkit", version.ref = "jtokkit" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
llm-client = { module = "ee.carlrobert:llm-client", version.ref = "llm-client" }
tree-sitter = { module = "io.github.bonede:tree-sitter", version.ref = "tree-sitter" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ private static Request buildCustomOpenAIChatCompletionRequest(
List<OpenAIChatCompletionMessage> messages,
boolean streamRequest) {
var requestBuilder = new Request.Builder().url(customConfiguration.getUrl().trim());
var credential = CredentialsStore.INSTANCE.getCredential(CUSTOM_SERVICE_API_KEY);
for (var entry : customConfiguration.getHeaders().entrySet()) {
String value = entry.getValue();
var credential = CredentialsStore.INSTANCE.getCredential(CUSTOM_SERVICE_API_KEY);
if (value.contains("$CUSTOM_SERVICE_API_KEY") && credential != null) {
if (credential != null && value.contains("$CUSTOM_SERVICE_API_KEY")) {
value = value.replace("$CUSTOM_SERVICE_API_KEY", credential);
}
requestBuilder.addHeader(entry.getKey(), value);
Expand Down

0 comments on commit 7f505e2

Please sign in to comment.