-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 9-add-coursier-deps-service
- Loading branch information
Showing
15 changed files
with
192 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
package rules_scala3.deps.src | ||
|
||
import sbt.librarymanagement.syntax.* | ||
import sbt.librarymanagement.{DependencyBuilders, ModuleID, Resolver}, DependencyBuilders.OrganizationArtifactName | ||
import scala.util.Try | ||
import scala.reflect.runtime.universe._ | ||
|
||
object Deps: | ||
def main(args: Array[String]): Unit = | ||
given Vars = Vars(args.toIndexedSeq).getOrElse(sys.exit(2)) | ||
|
||
val jmhV = "1.37" | ||
|
||
given DepsCfg = DepsCfg( | ||
resolvers = Vector( | ||
"mavencentral".at("https://repo1.maven.org/maven2/"), | ||
"sonatype releases".at("https://oss.sonatype.org/service/local/repositories/releases/content"), | ||
"apache staging".at("https://repository.apache.org/content/repositories/staging"), | ||
"apache snapshots".at("https://repository.apache.org/snapshots"), | ||
"google".at("https://maven.google.com/"), | ||
"jitsi-maven-repository".at("https://github.com/jitsi/jitsi-maven-repository/raw/master/releases") | ||
), | ||
val dependenciesClassName = summon[Vars].dependencies | ||
val dependenciesClass = getDependenciesClass(name = dependenciesClassName) | ||
|
||
val resolversField = dependenciesClass.getMethod("resolvers").invoke(null).asInstanceOf[Vector[Resolver]] | ||
val replacementsField = dependenciesClass.getMethod("replacements").invoke(null).asInstanceOf[Map[OrganizationArtifactName, String]] | ||
val dependenciesField = dependenciesClass.getMethod("dependencies").invoke(null).asInstanceOf[Vector[ModuleID]] | ||
|
||
// Replacements are not handled by `librarymanagement`. any Scala prefix in the name will be dropped. | ||
// It also doesn't matter whether you use double `%` to get the Scala version or not. | ||
replacements = Map( | ||
"org.scala-lang" % "scala3-library" -> "@scala_library_3_3_1//jar", | ||
"org.scala-lang" % "scala-library" -> "@scala_library_2_13_11//jar", | ||
"org.scala-lang" % "scala-reflect" -> "@scala_reflect_2_13_11//jar" | ||
), | ||
dependencies = Vector( | ||
"org.openjdk.jmh" % "jmh-core" % jmhV, | ||
"org.openjdk.jmh" % "jmh-generator-bytecode" % jmhV, | ||
"org.openjdk.jmh" % "jmh-generator-reflection" % jmhV, | ||
"org.openjdk.jmh" % "jmh-generator-asm" % jmhV, | ||
"com.github.scopt" %% "scopt" % "4.1.0" | ||
) | ||
given DepsCfg = DepsCfg( | ||
resolvers = resolversField, | ||
replacements = replacementsField, | ||
dependencies = dependenciesField | ||
) | ||
|
||
MakeTree() | ||
|
||
private def getDependenciesClass(name: String) = | ||
val dependenciesClass = Try(Class.forName(name)) match | ||
case scala.util.Success(clazz) => clazz | ||
case scala.util.Failure(e) => | ||
throw new ClassNotFoundException(s"Failed to load Dependencies class: ${e.getMessage}", e) | ||
dependenciesClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package rules_scala3.rules.scala_proto | ||
|
||
import sbt.librarymanagement.syntax.* | ||
import sbt.librarymanagement.{DependencyBuilders, ModuleID, Resolver}, DependencyBuilders.OrganizationArtifactName | ||
|
||
object Dependencies: | ||
|
||
private val scalapbV = "1.0.0-alpha.1" | ||
private val protocBridgeV = "0.9.7" | ||
private val grpcwebV = "0.7.0" | ||
|
||
val resolvers: Seq[Resolver] = Vector( | ||
"sonatype releases".at("https://oss.sonatype.org/service/local/repositories/releases/content"), | ||
"apache staging".at("https://repository.apache.org/content/repositories/staging"), | ||
"apache snapshots".at("https://repository.apache.org/snapshots"), | ||
"google".at("https://maven.google.com/"), | ||
"jitsi-maven-repository".at("https://github.com/jitsi/jitsi-maven-repository/raw/master/releases") | ||
) | ||
val replacements: Map[OrganizationArtifactName, String] = Map( | ||
"org.scala-lang" % "scala3-library" -> "@scala3_library//jar", | ||
"org.scala-lang" % "scala-library" -> "@scala_library_2_13//jar", | ||
"org.scala-lang" % "scala-reflect" -> "@scala_reflect_2_13//jar" | ||
) | ||
val dependencies: Seq[ModuleID] = Vector( | ||
"com.thesamet.scalapb" %% "compilerplugin" % scalapbV, | ||
"com.thesamet.scalapb" % "protoc-bridge_2.13" % protocBridgeV, | ||
"com.thesamet.scalapb" % "protoc-gen_2.13" % protocBridgeV, | ||
"com.thesamet.scalapb.grpcweb" %% "scalapb-grpcweb-code-gen" % grpcwebV | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package rules_scala3.rules.scalafmt | ||
|
||
import sbt.librarymanagement.syntax.* | ||
import sbt.librarymanagement.{DependencyBuilders, ModuleID, Resolver}, DependencyBuilders.OrganizationArtifactName | ||
|
||
object Dependencies: | ||
|
||
private val scalafmtV = "3.8.3" | ||
private val parsersV = "4.10.2" | ||
|
||
val resolvers: Seq[Resolver] = Vector( | ||
"mavencentral".at("https://repo1.maven.org/maven2/"), | ||
"sonatype releases".at("https://oss.sonatype.org/service/local/repositories/releases/content"), | ||
"apache staging".at("https://repository.apache.org/content/repositories/staging"), | ||
"apache snapshots".at("https://repository.apache.org/snapshots"), | ||
"google".at("https://maven.google.com/"), | ||
"jitsi-maven-repository".at("https://github.com/jitsi/jitsi-maven-repository/raw/master/releases") | ||
) | ||
// Replacements are not handled by `librarymanagement`. any Scala prefix in the name will be dropped. | ||
// It also doesn't matter whether you use double `%` to get the Scala version or not. | ||
val replacements: Map[OrganizationArtifactName, String] = Map( | ||
"org.scala-lang" % "scala3-library" -> "@scala3_library//jar", | ||
"org.scala-lang" % "scala-library" -> "@scala_library_2_13//jar", | ||
"org.scala-lang" % "scala-reflect" -> "@scala_reflect_2_13//jar" | ||
) | ||
val dependencies: Seq[ModuleID] = Vector( | ||
"com.geirsson" % "metaconfig-core_2.13" % "0.12.0", | ||
"org.scalameta" % "parsers_2.13" % parsersV, | ||
"org.scalameta" % "trees_2.13" % parsersV, | ||
"org.scalameta" % "scalafmt-core_2.13" % scalafmtV, | ||
"org.scalameta" % "scalafmt-sysops_2.13" % scalafmtV, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package rules_scala3.scala | ||
|
||
import sbt.librarymanagement.syntax.* | ||
import sbt.librarymanagement.{DependencyBuilders, ModuleID, Resolver}, DependencyBuilders.OrganizationArtifactName | ||
|
||
object Dependencies: | ||
|
||
private val sbtVersion = "2.0.0-M2" | ||
private val zincVersion = "2.0.0-alpha14" | ||
val scalapbV = "1.0.0-alpha.1" | ||
|
||
val resolvers: Seq[Resolver] = Vector( | ||
"mavencentral".at("https://repo1.maven.org/maven2/"), | ||
"sonatype releases".at("https://oss.sonatype.org/service/local/repositories/releases/content"), | ||
"apache staging".at("https://repository.apache.org/content/repositories/staging"), | ||
"apache snapshots".at("https://repository.apache.org/snapshots"), | ||
"google".at("https://maven.google.com/"), | ||
"jitsi-maven-repository".at("https://github.com/jitsi/jitsi-maven-repository/raw/master/releases") | ||
) | ||
val replacements: Map[OrganizationArtifactName, String] = Map( | ||
"org.scala-lang" % "scala3-library" -> "@scala3_library//jar", | ||
"org.scala-lang" % "scala-library" -> "@scala_library_2_13//jar", | ||
"org.scala-lang" % "scala-reflect" -> "@scala_reflect_2_13//jar" | ||
) | ||
val dependencies: Seq[ModuleID] = Vector( | ||
"org.jacoco" % "org.jacoco.core" % "0.8.10", | ||
"org.jline" % "jline-reader" % "3.24.1", | ||
"org.scala-lang.modules" %% "scala-xml" % "2.3.0", | ||
"org.scala-sbt" % "test-interface" % "1.0", | ||
"org.scala-sbt" % "compiler-interface" % zincVersion, | ||
"org.scala-sbt" % "util-interface" % sbtVersion, | ||
"org.scala-sbt" %% "util-logging_3" % sbtVersion, | ||
"org.scala-sbt" %% "zinc_3" % zincVersion, | ||
"org.scala-sbt" %% "zinc-core" % zincVersion, | ||
"org.scala-sbt" %% "zinc-classpath" % zincVersion, | ||
"org.scala-sbt" %% "zinc-compile-core" % zincVersion, | ||
"org.scala-sbt" %% "zinc-persist" % zincVersion, | ||
"org.scala-sbt" %% "zinc-apiinfo" % zincVersion, | ||
"org.scalameta" %% "munit_3" % "1.0.2", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters