-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ondřej Pelech
committed
May 19, 2022
1 parent
d07215b
commit e0498d1
Showing
4 changed files
with
23 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ lazy val cldrApiVersion = "3.1.0" | |
|
||
Global / onChangedBuildSource := ReloadOnSourceChanges | ||
|
||
resolvers in Global += Resolver.sonatypeRepo("public") | ||
|
||
lazy val scalaVersion213 = "2.13.8" | ||
lazy val scalaVersion3 = "3.1.2" | ||
ThisBuild / scalaVersion := scalaVersion213 | ||
|
@@ -50,7 +48,6 @@ ThisBuild / githubWorkflowBuildMatrixExclusions ++= List( | |
ThisBuild / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat | ||
|
||
val commonSettings: Seq[Setting[_]] = Seq( | ||
organization := "io.github.cquiroz", | ||
scalacOptions ~= (_.filterNot( | ||
Set( | ||
"-Wdead-code", | ||
|
@@ -61,16 +58,7 @@ val commonSettings: Seq[Setting[_]] = Seq( | |
"-Ywarn-value-discard" | ||
) | ||
)), | ||
Compile / doc / scalacOptions := Seq(), | ||
// Compile / doc / sources := { if (isDotty.value) Seq() else (Compile / doc / sources).value }, | ||
Compile / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("main", | ||
baseDirectory.value, | ||
scalaVersion.value | ||
), | ||
Test / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("test", | ||
baseDirectory.value, | ||
scalaVersion.value | ||
) | ||
Compile / doc / scalacOptions := Seq() | ||
) | ||
|
||
inThisBuild( | ||
|
@@ -88,36 +76,15 @@ inThisBuild( | |
Developer("alonsodomin", "A. Alonso Dominguez", "", url("https://github.com/alonsodomin")), | ||
Developer("mkotsbak", "Marius B. Kotsbak", "", url("https://github.com/mkotsbak")), | ||
Developer("TimothyKlim", "Timothy Klim", "", url("https://github.com/TimothyKlim")) | ||
), | ||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/cquiroz/scala-java-locales"), | ||
"scm:git:[email protected]:cquiroz/scala-java-locales.git" | ||
) | ||
) | ||
) | ||
) | ||
|
||
def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scalaVersion: String) = { | ||
def extraDirs(suffix: String) = | ||
List(CrossType.Pure, CrossType.Full) | ||
.flatMap(_.sharedSrcDir(srcBaseDir, srcName).toList.map(f => file(f.getPath + suffix))) | ||
CrossVersion.partialVersion(scalaVersion) match { | ||
case Some((2, y)) => extraDirs("-2.x") ++ (if (y >= 13) extraDirs("-2.13+") else Nil) | ||
case Some((0 | 3, _)) => extraDirs("-2.13+") ++ extraDirs("-3.x") | ||
case _ => Nil | ||
} | ||
} | ||
|
||
lazy val scalajs_locales: Project = project | ||
lazy val root: Project = project | ||
.in(file(".")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "locales", | ||
publish := {}, | ||
publishLocal := {}, | ||
publishArtifact := false, | ||
crossScalaVersions := Nil | ||
publish / skip := true | ||
) | ||
.aggregate( | ||
core.js, | ||
|
@@ -137,19 +104,10 @@ lazy val scalajs_locales: Project = project | |
demo.native | ||
) | ||
|
||
def isScala3 = Def.task { | ||
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((3, _)) => | ||
true | ||
case _ => | ||
false | ||
} | ||
} | ||
|
||
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) | ||
.crossType(CrossType.Full) | ||
.in(file("core")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "scala-java-locales", | ||
libraryDependencies ++= Seq( | ||
|
@@ -164,11 +122,12 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) | |
) | ||
.jsSettings( | ||
scalacOptions ++= { | ||
if (isScala3.value) Seq("-scalajs-genStaticForwardersForNonTopLevelObjects") | ||
if (scalaVersion.value == scalaVersion3) | ||
Seq("-scalajs-genStaticForwardersForNonTopLevelObjects") | ||
else Seq("-P:scalajs:genStaticForwardersForNonTopLevelObjects") | ||
}, | ||
scalacOptions ++= { | ||
if (isScala3.value) Seq.empty | ||
if (scalaVersion.value == scalaVersion3) Seq.empty | ||
else { | ||
val tagOrHash = | ||
if (isSnapshot.value) sys.process.Process("git rev-parse HEAD").lineStream_!.head | ||
|
@@ -187,7 +146,7 @@ lazy val cldrDbVersion = "36.0" | |
|
||
lazy val localesFullCurrenciesDb = project | ||
.in(file("localesFullCurrenciesDb")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.configure(_.enablePlugins(LocalesPlugin)) | ||
.configure(_.enablePlugins(ScalaJSPlugin)) | ||
.settings( | ||
|
@@ -207,7 +166,7 @@ lazy val localesFullCurrenciesDb = project | |
lazy val localesFullDb = crossProject(JSPlatform, NativePlatform) | ||
.crossType(CrossType.Pure) | ||
.in(file("localesFullDb")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.configure(_.enablePlugins(LocalesPlugin)) | ||
.settings( | ||
name := "locales-full-db", | ||
|
@@ -225,7 +184,7 @@ lazy val localesFullDb = crossProject(JSPlatform, NativePlatform) | |
|
||
lazy val localesMinimalEnDb = crossProject(JSPlatform, NativePlatform) | ||
.in(file("localesMinimalEnDb")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.configure(_.enablePlugins(LocalesPlugin)) | ||
.settings( | ||
name := "locales-minimal-en-db", | ||
|
@@ -243,7 +202,7 @@ lazy val localesMinimalEnDb = crossProject(JSPlatform, NativePlatform) | |
|
||
lazy val localesMinimalEnUSDb = crossProject(JSPlatform, NativePlatform) | ||
.in(file("localesMinimalEnUSDb")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.configure(_.enablePlugins(LocalesPlugin)) | ||
.settings( | ||
name := "locales-minimal-en_US-db", | ||
|
@@ -261,12 +220,10 @@ lazy val localesMinimalEnUSDb = crossProject(JSPlatform, NativePlatform) | |
|
||
lazy val testSuite = crossProject(JVMPlatform, JSPlatform, NativePlatform) | ||
.in(file("testSuite")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.settings( | ||
publish := {}, | ||
publishLocal := {}, | ||
publishArtifact := false, | ||
name := "scala-java-locales test", | ||
publish / skip := true, | ||
name := "test", | ||
libraryDependencies += "org.scalameta" %%% "munit" % "1.0.0-M4" % Test, | ||
testFrameworks += new TestFramework("munit.Framework"), | ||
scalacOptions ~= (_.filterNot( | ||
|
@@ -277,7 +234,6 @@ lazy val testSuite = crossProject(JVMPlatform, JSPlatform, NativePlatform) | |
)) | ||
) | ||
.jsSettings(Test / parallelExecution := false, | ||
name := "scala-java-locales testSuite on JS", | ||
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)) | ||
) | ||
.jsConfigure(_.dependsOn(core.js, macroUtils, localesFullCurrenciesDb)) | ||
|
@@ -293,7 +249,6 @@ lazy val testSuite = crossProject(JVMPlatform, JSPlatform, NativePlatform) | |
"-Dfile.encoding=UTF8", | ||
"-Xmx6G" | ||
), | ||
name := "scala-java-locales testSuite on JVM", | ||
libraryDependencies += "io.github.cquiroz" %%% "cldr-api" % cldrApiVersion | ||
) | ||
.jvmConfigure(_.dependsOn(macroUtils)) | ||
|
@@ -318,30 +273,26 @@ lazy val macroUtils = project | |
.settings( | ||
name := "macroutils", | ||
libraryDependencies ++= { | ||
CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((3, _)) => | ||
Seq.empty | ||
case _ => | ||
Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value) | ||
} | ||
if (scalaVersion.value == scalaVersion3) Seq.empty | ||
else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value) | ||
}, | ||
scalacOptions ~= (_.filterNot( | ||
Set( | ||
"-deprecation", | ||
"-Xfatal-warnings" | ||
) | ||
)), | ||
Compile / doc / sources := { if (isScala3.value) Seq() else (Compile / doc / sources).value } | ||
Compile / doc / sources := { | ||
if (scalaVersion.value == scalaVersion3) Seq() else (Compile / doc / sources).value | ||
} | ||
) | ||
|
||
lazy val demo = crossProject(JSPlatform, NativePlatform) | ||
.in(file("demo")) | ||
.settings(commonSettings: _*) | ||
.settings(commonSettings) | ||
.settings( | ||
publish := {}, | ||
publishLocal := {}, | ||
publishArtifact := false, | ||
publish / skip := true, | ||
scalaJSUseMainModuleInitializer := true, | ||
name := "scala-java-locales demo" | ||
name := "demo" | ||
) | ||
.dependsOn(core) |
File renamed without changes.
File renamed without changes.
File renamed without changes.