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
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ _GRADLE_VERSION = "9.5.0"
maven.install(
name = "rules_jvm_external_deps",
artifacts = [
"ch.qos.logback:logback-classic:1.5.23",
"com.github.jknack:handlebars:4.3.1",
"com.google.auth:google-auth-library-credentials:1.35.0",
"com.google.auth:google-auth-library-oauth2-http:1.35.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,7 @@ java_library(
srcs = [
"GradleMain.java",
],
resources = ["logback.xml"],
resource_strip_prefix = "private/tools/java/com/github/bazelbuild/rules_jvm_external/resolver/gradle",
visibility = ["//visibility:public"],
runtime_deps = [
artifact(
"ch.qos.logback:logback-classic",
repository_name = "rules_jvm_external_deps",
),
],
deps = [
":gradle",
"//private/tools/java/com/github/bazelbuild/rules_jvm_external/resolver",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@ private void update() {
}
}

private String elideLine(int maxWidth, String toShorten) {
static String elideLine(int maxWidth, String toShorten) {
if (maxWidth <= 0) {
return "";
}

int length = toShorten.length();
if (length < maxWidth) {
if (length <= maxWidth) {
return toShorten;
}

int start = length - maxWidth - 3;
return "..." + toShorten.substring(start);
if (maxWidth <= 3) {
return toShorten.substring(length - maxWidth);
}

return "..." + toShorten.substring(length - maxWidth + 3);
}

private int getConsoleWidth() {
Expand Down
131 changes: 0 additions & 131 deletions rules_jvm_external_deps_install.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": {
"ch.qos.logback:logback-classic": 1508585996,
"com.github.jknack:handlebars": -755722588,
"com.google.auth:google-auth-library-credentials": 625892332,
"com.google.auth:google-auth-library-oauth2-http": 1668304142,
Expand Down Expand Up @@ -47,10 +46,6 @@
"__RESOLVED_ARTIFACTS_HASH": {
"aopalliance:aopalliance": 1403132272,
"aopalliance:aopalliance:jar:sources": -1259601821,
"ch.qos.logback:logback-classic": -1379276622,
"ch.qos.logback:logback-classic:jar:sources": 395806198,
"ch.qos.logback:logback-core": 324997309,
"ch.qos.logback:logback-core:jar:sources": 1534388064,
"com.fasterxml.jackson.core:jackson-core": -1299936085,
"com.fasterxml.jackson.core:jackson-core:jar:sources": -320764492,
"com.github.jknack:handlebars": -1335956533,
Expand Down Expand Up @@ -400,20 +395,6 @@
},
"version": "1.0"
},
"ch.qos.logback:logback-classic": {
"shasums": {
"jar": "f80ed51f2621488cee4997982031a0614a9e1757ef58700c4e5d8081c0eb948f",
"sources": "9f00e2d6af67ffa5cb0a108d2239ca631e5ac41e9a0ba4fdc754d8a97b4ccb6f"
},
"version": "1.5.23"
},
"ch.qos.logback:logback-core": {
"shasums": {
"jar": "c07ee90df0c49d8890bfbe9844d34324f2751b81caf69cd84caddcc1f6107400",
"sources": "90d3c4b085ffd24fa63ebbc30186dafa6c950f75165a3ec343570bf7243a9f03"
},
"version": "1.5.23"
},
"com.fasterxml.jackson.core:jackson-core": {
"shasums": {
"jar": "d8054ae7c0d1c2d2f55d28e46026ebe5892881f3fab5f439233184381c3b4a1f",
Expand Down Expand Up @@ -1591,10 +1572,6 @@
}
},
"dependencies": {
"ch.qos.logback:logback-classic": [
"ch.qos.logback:logback-core",
"org.slf4j:slf4j-api"
],
"com.github.jknack:handlebars": [
"org.slf4j:slf4j-api"
],
Expand Down Expand Up @@ -2214,78 +2191,6 @@
"org.aopalliance.aop",
"org.aopalliance.intercept"
],
"ch.qos.logback:logback-classic": [
"ch.qos.logback.classic",
"ch.qos.logback.classic.boolex",
"ch.qos.logback.classic.encoder",
"ch.qos.logback.classic.filter",
"ch.qos.logback.classic.helpers",
"ch.qos.logback.classic.html",
"ch.qos.logback.classic.joran",
"ch.qos.logback.classic.joran.action",
"ch.qos.logback.classic.joran.sanity",
"ch.qos.logback.classic.joran.serializedModel",
"ch.qos.logback.classic.jul",
"ch.qos.logback.classic.layout",
"ch.qos.logback.classic.log4j",
"ch.qos.logback.classic.model",
"ch.qos.logback.classic.model.processor",
"ch.qos.logback.classic.model.util",
"ch.qos.logback.classic.net",
"ch.qos.logback.classic.net.server",
"ch.qos.logback.classic.pattern",
"ch.qos.logback.classic.pattern.color",
"ch.qos.logback.classic.selector",
"ch.qos.logback.classic.selector.servlet",
"ch.qos.logback.classic.servlet",
"ch.qos.logback.classic.sift",
"ch.qos.logback.classic.spi",
"ch.qos.logback.classic.turbo",
"ch.qos.logback.classic.tyler",
"ch.qos.logback.classic.util"
],
"ch.qos.logback:logback-core": [
"ch.qos.logback.core",
"ch.qos.logback.core.boolex",
"ch.qos.logback.core.encoder",
"ch.qos.logback.core.filter",
"ch.qos.logback.core.helpers",
"ch.qos.logback.core.hook",
"ch.qos.logback.core.html",
"ch.qos.logback.core.joran",
"ch.qos.logback.core.joran.action",
"ch.qos.logback.core.joran.conditional",
"ch.qos.logback.core.joran.event",
"ch.qos.logback.core.joran.node",
"ch.qos.logback.core.joran.sanity",
"ch.qos.logback.core.joran.spi",
"ch.qos.logback.core.joran.util",
"ch.qos.logback.core.joran.util.beans",
"ch.qos.logback.core.layout",
"ch.qos.logback.core.model",
"ch.qos.logback.core.model.conditional",
"ch.qos.logback.core.model.processor",
"ch.qos.logback.core.model.processor.conditional",
"ch.qos.logback.core.model.util",
"ch.qos.logback.core.net",
"ch.qos.logback.core.net.server",
"ch.qos.logback.core.net.ssl",
"ch.qos.logback.core.pattern",
"ch.qos.logback.core.pattern.color",
"ch.qos.logback.core.pattern.parser",
"ch.qos.logback.core.pattern.util",
"ch.qos.logback.core.property",
"ch.qos.logback.core.read",
"ch.qos.logback.core.recovery",
"ch.qos.logback.core.rolling",
"ch.qos.logback.core.rolling.helper",
"ch.qos.logback.core.sift",
"ch.qos.logback.core.spi",
"ch.qos.logback.core.status",
"ch.qos.logback.core.subst",
"ch.qos.logback.core.testUtil",
"ch.qos.logback.core.util"
],
"com.fasterxml.jackson.core:jackson-core": [
"com.fasterxml.jackson.core",
"com.fasterxml.jackson.core.async",
Expand Down Expand Up @@ -2327,12 +2232,7 @@
"com.github.jknack.handlebars.internal.lang3.tuple",
"com.github.jknack.handlebars.internal.path",
"com.github.jknack.handlebars.internal.text",
"com.github.jknack.handlebars.internal.text.diff",
"com.github.jknack.handlebars.internal.text.io",
"com.github.jknack.handlebars.internal.text.lookup",
"com.github.jknack.handlebars.internal.text.matcher",
"com.github.jknack.handlebars.internal.text.numbers",
"com.github.jknack.handlebars.internal.text.similarity",
"com.github.jknack.handlebars.internal.text.translate",
"com.github.jknack.handlebars.io"
],
Expand Down Expand Up @@ -2819,8 +2719,6 @@
"io.netty.util.concurrent",
"io.netty.util.internal",
"io.netty.util.internal.logging",
"io.netty.util.internal.shaded.org.jctools.counters",
"io.netty.util.internal.shaded.org.jctools.maps",
"io.netty.util.internal.shaded.org.jctools.queues",
"io.netty.util.internal.shaded.org.jctools.queues.atomic",
"io.netty.util.internal.shaded.org.jctools.queues.atomic.unpadded",
Expand Down Expand Up @@ -2952,12 +2850,7 @@
"io.opentelemetry.sdk.metrics.internal.view"
],
"io.opentelemetry:opentelemetry-sdk-trace": [
"io.opentelemetry.internal.shaded.jctools.counters",
"io.opentelemetry.internal.shaded.jctools.maps",
"io.opentelemetry.internal.shaded.jctools.queues",
"io.opentelemetry.internal.shaded.jctools.queues.atomic",
"io.opentelemetry.internal.shaded.jctools.queues.atomic.unpadded",
"io.opentelemetry.internal.shaded.jctools.queues.unpadded",
"io.opentelemetry.internal.shaded.jctools.util",
"io.opentelemetry.sdk.trace",
"io.opentelemetry.sdk.trace.data",
Expand Down Expand Up @@ -4040,10 +3933,6 @@
"https://repo1.maven.org/maven2/": [
"aopalliance:aopalliance",
"aopalliance:aopalliance:jar:sources",
"ch.qos.logback:logback-classic",
"ch.qos.logback:logback-classic:jar:sources",
"ch.qos.logback:logback-core",
"ch.qos.logback:logback-core:jar:sources",
"com.fasterxml.jackson.core:jackson-core",
"com.fasterxml.jackson.core:jackson-core:jar:sources",
"com.github.jknack:handlebars",
Expand Down Expand Up @@ -4383,10 +4272,6 @@
"https://repo.gradle.org/gradle/libs-releases/": [
"aopalliance:aopalliance",
"aopalliance:aopalliance:jar:sources",
"ch.qos.logback:logback-classic",
"ch.qos.logback:logback-classic:jar:sources",
"ch.qos.logback:logback-core",
"ch.qos.logback:logback-core:jar:sources",
"com.fasterxml.jackson.core:jackson-core",
"com.fasterxml.jackson.core:jackson-core:jar:sources",
"com.github.jknack:handlebars",
Expand Down Expand Up @@ -4725,22 +4610,6 @@
]
},
"services": {
"ch.qos.logback:logback-classic": {
"jakarta.servlet.ServletContainerInitializer": [
"ch.qos.logback.classic.servlet.LogbackServletContainerInitializer"
],
"org.slf4j.spi.SLF4JServiceProvider": [
"ch.qos.logback.classic.spi.LogbackServiceProvider"
]
},
"ch.qos.logback:logback-classic:jar:sources": {
"jakarta.servlet.ServletContainerInitializer": [
"ch.qos.logback.classic.servlet.LogbackServletContainerInitializer"
],
"org.slf4j.spi.SLF4JServiceProvider": [
"ch.qos.logback.classic.spi.LogbackServiceProvider"
]
},
"com.fasterxml.jackson.core:jackson-core": {
"com.fasterxml.jackson.core.JsonFactory": [
"com.fasterxml.jackson.core.JsonFactory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ java_test(
],
)

java_test(
name = "GradleResolverLoggingTest",
size = "small",
srcs = ["GradleResolverLoggingTest.java"],
test_class = "com.github.bazelbuild.rules_jvm_external.resolver.gradle.GradleResolverLoggingTest",
deps = [
"//private/tools/java/com/github/bazelbuild/rules_jvm_external/resolver/gradle:gradle-resolver-lib",
"@gradle",
artifact(
"junit:junit",
repository_name = "regression_testing_coursier",
),
],
)

java_test(
name = "GradleBuildScriptGeneratorTestFixturesTest",
srcs = ["GradleBuildScriptGeneratorTestFixturesTest.java"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2026 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.github.bazelbuild.rules_jvm_external.resolver.gradle;

import static org.junit.Assert.assertEquals;

import java.util.List;
import java.util.ServiceLoader;
import java.util.stream.Collectors;
import org.junit.Test;
import org.slf4j.spi.SLF4JServiceProvider;

public class GradleResolverLoggingTest {

@Test
public void usesOnlyGradlesSlf4jProvider() {
List<String> providers =
ServiceLoader.load(SLF4JServiceProvider.class).stream()
.map(provider -> provider.type().getName())
.collect(Collectors.toList());

assertEquals(List.of("org.gradle.internal.logging.slf4j.StaticLoggerProvider"), providers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2026 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.github.bazelbuild.rules_jvm_external.resolver.ui;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class AnsiConsoleListenerTest {

@Test
public void leavesLineShorterThanWidthUnchanged() {
assertEquals("short", AnsiConsoleListener.elideLine(6, "short"));
}

@Test
public void leavesLineMatchingWidthUnchanged() {
assertEquals("exact", AnsiConsoleListener.elideLine(5, "exact"));
}

@Test
public void elidesLinesJustOverWidthWithoutExceedingWidth() {
String line = "abcdefghijklmnopqrstuvwxyz";

for (int extra : new int[] {1, 2, 3, 6}) {
int width = line.length() - extra;
String elided = AnsiConsoleListener.elideLine(width, line);
assertEquals(width, elided.length());
assertEquals("..." + line.substring(line.length() - width + 3), elided);
}
}

@Test
public void keepsTailWhenWidthCannotFitEllipsis() {
assertEquals("", AnsiConsoleListener.elideLine(-1, "abcdef"));
assertEquals("", AnsiConsoleListener.elideLine(0, "abcdef"));
assertEquals("f", AnsiConsoleListener.elideLine(1, "abcdef"));
assertEquals("ef", AnsiConsoleListener.elideLine(2, "abcdef"));
assertEquals("def", AnsiConsoleListener.elideLine(3, "abcdef"));
}

@Test
public void accountsForDownloadIndentWithinTerminalWidth() {
int terminalWidth = 20;
String line =
" "
+ AnsiConsoleListener.elideLine(
terminalWidth - 4, "https://example.com/very/long/file.jar");

assertEquals(terminalWidth, line.length());
}
}
Loading