diff --git a/build.gradle.kts b/build.gradle.kts index 14cad7c1..ff4a2ccc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,7 +33,7 @@ dependencies { implementation("com.github.javaparser:javaparser-core:3.18.0") implementation("net.sf.jopt-simple:jopt-simple:5.0.4") implementation("org.apache.ant:ant-compress:1.5") - implementation("commons-io:commons-io:2.6") + implementation(libs.commonIo) implementation("org.openjdk.jmc:flightrecorder:8.0.1") implementation("com.googlecode.plist:dd-plist:1.23") { because("To extract launch details from Android Studio installation") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 38aa94b5..333ccb45 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,8 @@ groovy = "3.0.15" spock = "2.1-groovy-3.0" [libraries] +commonIo = "commons-io:commons-io:2.11.0" +ideStarter = "com.jetbrains.intellij.tools:ide-starter-squashed:233.13135.103" toolingApi = "org.gradle:gradle-tooling-api:7.2" spock-core = { module = "org.spockframework:spock-core", version.ref = "spock" } diff --git a/src/main/java/org/gradle/profiler/CommandExec.java b/src/main/java/org/gradle/profiler/CommandExec.java index 49008bef..9a6a6690 100644 --- a/src/main/java/org/gradle/profiler/CommandExec.java +++ b/src/main/java/org/gradle/profiler/CommandExec.java @@ -1,5 +1,7 @@ package org.gradle.profiler; +import org.apache.commons.io.output.TeeOutputStream; + import javax.annotation.Nullable; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/src/main/java/org/gradle/profiler/Logging.java b/src/main/java/org/gradle/profiler/Logging.java index d076a128..66e28bf5 100644 --- a/src/main/java/org/gradle/profiler/Logging.java +++ b/src/main/java/org/gradle/profiler/Logging.java @@ -1,5 +1,7 @@ package org.gradle.profiler; +import org.apache.commons.io.output.TeeOutputStream; + import java.io.*; public class Logging { diff --git a/src/main/java/org/gradle/profiler/TeeOutputStream.java b/src/main/java/org/gradle/profiler/TeeOutputStream.java deleted file mode 100644 index 5992ef5a..00000000 --- a/src/main/java/org/gradle/profiler/TeeOutputStream.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.gradle.profiler; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.List; - -class TeeOutputStream extends OutputStream { - private final List targets; - - public TeeOutputStream(OutputStream... targets) { - this.targets = Arrays.asList(targets); - } - - @Override - public void write(int b) throws IOException { - withAll(stream -> stream.write(b)); - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - withAll(stream -> stream.write(b, off, len)); - } - - @Override - public void flush() throws IOException { - withAll(stream -> stream.flush()); - } - - @Override - public void close() throws IOException { - withAll(stream -> stream.close()); - } - - private void withAll(IOAction action) throws IOException { - IOException failure = null; - for (OutputStream target : targets) { - try { - action.withStream(target); - } catch (IOException e) { - failure = e; - } - } - if (failure != null) { - throw failure; - } - } - - private interface IOAction { - void withStream(OutputStream stream) throws IOException; - } -} diff --git a/src/test/groovy/org/gradle/profiler/AbstractIntegrationTest.groovy b/src/test/groovy/org/gradle/profiler/AbstractIntegrationTest.groovy index bbfbd6cb..053086d2 100644 --- a/src/test/groovy/org/gradle/profiler/AbstractIntegrationTest.groovy +++ b/src/test/groovy/org/gradle/profiler/AbstractIntegrationTest.groovy @@ -1,5 +1,6 @@ package org.gradle.profiler +import org.apache.commons.io.output.TeeOutputStream import spock.lang.Specification class AbstractIntegrationTest extends Specification { diff --git a/subprojects/ide-provisioning/build.gradle.kts b/subprojects/ide-provisioning/build.gradle.kts index 3c6b34c5..bc0633c9 100644 --- a/subprojects/ide-provisioning/build.gradle.kts +++ b/subprojects/ide-provisioning/build.gradle.kts @@ -11,19 +11,14 @@ java { repositories { maven { url = uri("https://www.jetbrains.com/intellij-repository/releases") } maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") } - - maven { url = uri("https://cache-redirector.jetbrains.com/maven-central") } - maven { url = uri("https://www.jetbrains.com/intellij-repository/snapshots") } - maven { - url = uri("https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/grazi/grazie-platform-public") - } } dependencies { - implementation("com.jetbrains.intellij.tools:ide-starter-squashed:233.13135.103") { + implementation(libs.ideStarter) { exclude(group = "io.ktor") exclude(group = "com.jetbrains.infra") exclude(group = "com.jetbrains.intellij.remoteDev") } testImplementation(libs.bundles.testDependencies) + testImplementation(libs.commonIo) } diff --git a/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/TeeOutputStream.java b/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/TeeOutputStream.java deleted file mode 100644 index 11e5ebe4..00000000 --- a/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/TeeOutputStream.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.gradle.profiler; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.List; - -public class TeeOutputStream extends OutputStream { - private final List targets; - - public TeeOutputStream(OutputStream... targets) { - this.targets = Arrays.asList(targets); - } - - @Override - public void write(int b) throws IOException { - withAll(stream -> stream.write(b)); - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - withAll(stream -> stream.write(b, off, len)); - } - - @Override - public void flush() throws IOException { - withAll(stream -> stream.flush()); - } - - @Override - public void close() throws IOException { - withAll(stream -> stream.close()); - } - - private void withAll(IOAction action) throws IOException { - IOException failure = null; - for (OutputStream target : targets) { - try { - action.withStream(target); - } catch (IOException e) { - failure = e; - } - } - if (failure != null) { - throw failure; - } - } - - private interface IOAction { - void withStream(OutputStream stream) throws IOException; - } -} diff --git a/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/ide/AbstractIdeProvisioningTest.groovy b/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/ide/AbstractIdeProvisioningTest.groovy index 2f2b8a1f..66da88a7 100644 --- a/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/ide/AbstractIdeProvisioningTest.groovy +++ b/subprojects/ide-provisioning/src/test/groovy/org/gradle/profiler/ide/AbstractIdeProvisioningTest.groovy @@ -1,6 +1,6 @@ package org.gradle.profiler.ide -import org.gradle.profiler.TeeOutputStream +import org.apache.commons.io.output.TeeOutputStream import org.junit.Rule import org.junit.rules.TemporaryFolder import spock.lang.Specification