mirror of https://github.com/sbt/sbt.git
[2.x] ci: Update java file formatter plugin (#8892)
This commit is contained in:
parent
1ab9411446
commit
963e38256c
13
build.sbt
13
build.sbt
|
|
@ -98,16 +98,12 @@ def commonSettings: Seq[Setting[?]] = Def.settings(
|
|||
)
|
||||
},
|
||||
*/
|
||||
Compile / javafmtOnCompile := Def
|
||||
.taskDyn(if ((scalafmtOnCompile).value) Compile / javafmt else Def.task(()))
|
||||
.value,
|
||||
Test / javafmtOnCompile := Def
|
||||
.taskDyn(if ((Test / scalafmtOnCompile).value) Test / javafmt else Def.task(()))
|
||||
.value,
|
||||
Compile / javafmtOnCompile := scalafmtOnCompile.value,
|
||||
Test / javafmtOnCompile := (Test / scalafmtOnCompile).value,
|
||||
Compile / unmanagedSources / inputFileStamps :=
|
||||
(Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmtOnCompile).value,
|
||||
(Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmt).value,
|
||||
Test / unmanagedSources / inputFileStamps :=
|
||||
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value,
|
||||
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmt).value,
|
||||
Test / publishArtifact := false,
|
||||
run / fork := true,
|
||||
)
|
||||
|
|
@ -1075,7 +1071,6 @@ lazy val docProjects: ScopeFilter = ScopeFilter(
|
|||
),
|
||||
inConfigurations(Compile)
|
||||
)
|
||||
lazy val javafmtOnCompile = taskKey[Unit]("Formats java sources before compile")
|
||||
lazy val scriptedProjects = ScopeFilter(inAnyProject)
|
||||
|
||||
def customCommands: Seq[Setting[?]] = Seq(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
package sbt.internal.scripted;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import xsbti.Logger;
|
||||
|
||||
public class ScriptConfig {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.file.Files;
|
||||
|
|
@ -33,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import net.openhft.hashing.LongHashFunction;
|
||||
import org.scalasbt.ipcsocket.UnixDomainServerSocket;
|
||||
import org.scalasbt.ipcsocket.Win32NamedPipeServerSocket;
|
||||
import org.scalasbt.ipcsocket.Win32NamedPipeSocket;
|
||||
import org.scalasbt.ipcsocket.Win32SecurityLevel;
|
||||
import sbt.internal.util.Terminal;
|
||||
import xsbti.AppConfiguration;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import java.net.URL;
|
|||
import java.net.URLClassLoader;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
import xsbti.AppProvider;
|
||||
import xsbti.ScalaProvider;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.8.0")
|
|||
addSbtPlugin("com.github.sbt" % "sbt-header" % "5.11.0")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1")
|
||||
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.5")
|
||||
addSbtPlugin("com.swoval" % "sbt-java-format" % "0.3.1")
|
||||
addSbtPlugin("com.github.sbt" % "sbt-java-formatter" % "0.9.0")
|
||||
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.4")
|
||||
addDependencyTreePlugin
|
||||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.5")
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package org.scalasbt.shadedgson.com.google.gson.typeadapters;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.scalasbt.shadedgson.com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import org.scalasbt.shadedgson.com.google.gson.Gson;
|
||||
import org.scalasbt.shadedgson.com.google.gson.JsonElement;
|
||||
|
|
@ -27,9 +30,6 @@ import org.scalasbt.shadedgson.com.google.gson.TypeAdapterFactory;
|
|||
import org.scalasbt.shadedgson.com.google.gson.reflect.TypeToken;
|
||||
import org.scalasbt.shadedgson.com.google.gson.stream.JsonReader;
|
||||
import org.scalasbt.shadedgson.com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Adapts values whose runtime type may differ from their declaration type. This is necessary when a
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
package sbt.internal.worker1;
|
||||
|
||||
import java.net.URI;
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ConsoleInfo implements Serializable {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
package sbt.internal.worker1;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Paths;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import xsbti.compile.ConsoleInterface1;
|
||||
|
||||
public final class ForkConsoleMain {
|
||||
|
|
@ -39,8 +37,7 @@ public final class ForkConsoleMain {
|
|||
|
||||
private void runInterface1(ConsoleInterface1 intf, ConsoleInfo info) throws Exception {
|
||||
String toolsJars =
|
||||
info.toolsJars
|
||||
.stream()
|
||||
info.toolsJars.stream()
|
||||
.map(u -> Paths.get(u).toString())
|
||||
.collect(Collectors.joining(File.pathSeparator));
|
||||
String classpathJars =
|
||||
|
|
@ -75,8 +72,7 @@ public final class ForkConsoleMain {
|
|||
Object[].class,
|
||||
xsbti.Logger.class);
|
||||
String toolsJars =
|
||||
info.toolsJars
|
||||
.stream()
|
||||
info.toolsJars.stream()
|
||||
.map(u -> Paths.get(u).toString())
|
||||
.collect(Collectors.joining(File.pathSeparator));
|
||||
String classpathJars =
|
||||
|
|
|
|||
|
|
@ -8,19 +8,16 @@
|
|||
|
||||
package sbt.internal.worker1;
|
||||
|
||||
import org.scalasbt.shadedgson.com.google.gson.Gson;
|
||||
|
||||
import sbt.testing.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
import org.scalasbt.shadedgson.com.google.gson.Gson;
|
||||
import sbt.testing.*;
|
||||
|
||||
public class ForkTestMain {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
package sbt.internal.worker1;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import sbt.testing.TaskDef;
|
||||
|
||||
public class TestLogInfo implements Serializable {
|
||||
public final long id;
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
|
||||
package sbt.internal.worker1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import org.scalasbt.shadedgson.com.google.gson.Gson;
|
||||
import org.scalasbt.shadedgson.com.google.gson.TypeAdapter;
|
||||
import org.scalasbt.shadedgson.com.google.gson.TypeAdapterFactory;
|
||||
import org.scalasbt.shadedgson.com.google.gson.reflect.TypeToken;
|
||||
import org.scalasbt.shadedgson.com.google.gson.stream.JsonReader;
|
||||
import org.scalasbt.shadedgson.com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ThrowableAdapterFactory implements TypeAdapterFactory {
|
||||
private ThrowableAdapterFactory() {}
|
||||
|
|
|
|||
|
|
@ -8,28 +8,25 @@
|
|||
|
||||
package sbt.internal.worker1;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetAddress;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Scanner;
|
||||
import org.scalasbt.shadedgson.com.google.gson.Gson;
|
||||
import org.scalasbt.shadedgson.com.google.gson.GsonBuilder;
|
||||
import org.scalasbt.shadedgson.com.google.gson.JsonElement;
|
||||
import org.scalasbt.shadedgson.com.google.gson.JsonObject;
|
||||
import org.scalasbt.shadedgson.com.google.gson.JsonParser;
|
||||
import org.scalasbt.shadedgson.com.google.gson.JsonPrimitive;
|
||||
import org.scalasbt.shadedgson.com.google.gson.typeadapters.RuntimeTypeAdapterFactory;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import sbt.testing.*;
|
||||
|
||||
/**
|
||||
|
|
@ -203,8 +200,7 @@ public final class WorkerMain {
|
|||
|
||||
private URLClassLoader createClassLoader(RunInfo.JvmRunInfo info, ClassLoader parent) {
|
||||
URL[] urls =
|
||||
info.classpath
|
||||
.stream()
|
||||
info.classpath.stream()
|
||||
.map(
|
||||
filePath -> {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
package xsbti.compile;
|
||||
|
||||
import java.io.File;
|
||||
import sbt.internal.inc.ZincComponentCompiler;
|
||||
import sbt.internal.inc.ZincComponentManager;
|
||||
import sbt.librarymanagement.DependencyResolution;
|
||||
|
|
@ -17,8 +18,6 @@ import xsbti.ComponentProvider;
|
|||
import xsbti.GlobalLock;
|
||||
import xsbti.Logger;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface ZincBridgeProvider {
|
||||
/**
|
||||
* Returns an ivy resolver to resolve dependencies locally in the default `.ivy2/local`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue