Skip to content

Commit 6ad2065

Browse files
authored
add scalafmt (#634)
1 parent e0cbebb commit 6ad2065

File tree

2 files changed

+173
-76
lines changed

2 files changed

+173
-76
lines changed

configs/community.dbuild

Lines changed: 167 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
//// about spaces
22

3-
// currently we have three spaces: default, jawn_0_10, jawn_0_11.
4-
// the split is because sbt 1 uses jawn 0.10.x (via its dependency
3+
// currently we have five spaces.
4+
5+
// the jawn split is because sbt 1 uses jawn 0.10.x (via its dependency
56
// on sjson-new) and the sbt team is worried about the possible
67
// impact of upgrading on binary compatibility of sbt plugins.
78
// but in the meantime the whole Typelevel ecosystem is moving onto
89
// jawn 0.11, and the two versions are source-incompatible.
910

11+
// the scalameta split is because we want to have both scalafmt
12+
// and scalafix, but the latter uses scalameta 2.x while the
13+
// former is stuck in scalameta 1.x land. (this is easy to
14+
// keep segregated since scalafmt and scalafix tend to be
15+
// build-level dependencies, not project-level dependencies.)
16+
1017
//// from environment
1118

1219
vars: {
@@ -95,7 +102,7 @@ build += {
95102
cross-version: disabled
96103

97104
space.from: default
98-
space.to: [ default, jawn_0_10, jawn_0_11 ]
105+
space.to: [ default, jawn_0_10, jawn_0_11, scalameta_1, scalameta_2 ]
99106

100107
projects: [
101108
{
@@ -147,7 +154,7 @@ build += {
147154
build += {
148155

149156
space.from: default
150-
space.to: [ default, jawn_0_10, jawn_0_11 ]
157+
space.to: [ default, jawn_0_10, jawn_0_11, scalameta_1, scalameta_2 ]
151158

152159
check-missing: [ true, false ]
153160
cross-version: [ disabled, standard ]
@@ -977,30 +984,6 @@ build += {
977984
extra.options: ["-Dbintray.user=dummy", "-Dbintray.pass=dummy"]
978985
}
979986

980-
// forked (updated September 2017) to remove coursier.
981-
// refreshing the fork should be approached with caution;
982-
// see Olafur's remarks at
983-
// https://github.com/scala/community-builds/issues/499#issuecomment-287307613
984-
// about the instability of both scalameta and scalafix.
985-
${vars.base} {
986-
name: "scalameta"
987-
uri: ${vars.uris.scalameta-uri}
988-
// else, bintray stuff goes boom
989-
extra.options: ["-Dsbt.prohibit.publish=true"]
990-
extra.projects: ["scalametaJVM", "contribJVM", "semanticdbScalac"] // no Scala.js
991-
extra.exclude: [
992-
// we never build sbt plugins or benchmarks
993-
"benchmarks"
994-
]
995-
// use right version-specific source directories regardless of our weird dbuild Scala version numbers
996-
extra.commands: ${vars.default-commands} [
997-
"set unmanagedSourceDirectories in (commonJVM, Compile) += (baseDirectory in commonJVM).value / \"src\" / \"main\" / \"scala-2.12\""
998-
"set unmanagedSourceDirectories in (dialectsJVM, Compile) += (baseDirectory in dialectsJVM).value / \"src\" / \"main\" / \"scala-2.12\""
999-
"set unmanagedSourceDirectories in (scalametaJVM, Compile) += (baseDirectory in scalametaJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1000-
"set unmanagedSourceDirectories in (semanticdbScalac, Compile) += (baseDirectory in semanticdbScalac).value / \"src\" / \"main\" / \"scala-2.12.4\""
1001-
]
1002-
}
1003-
1004987
// dependency of scalafix
1005988
// (we use allanrenucci's fork because that's where `organization` is set
1006989
// as scalafix expects; it's where 0.1.4 was apparently published from,
@@ -1010,13 +993,6 @@ build += {
1010993
uri: ${vars.uris.scala-xml-quote-uri}
1011994
}
1012995

1013-
// dependency of scalafix
1014-
${vars.base} {
1015-
name: "metaconfig"
1016-
uri: ${vars.uris.metaconfig-uri}
1017-
extra.projects: ["metaconfig-hoconJVM", "metaconfig-typesafe-config"] // no Scala.js plz
1018-
}
1019-
1020996
${vars.base} {
1021997
name: "geny"
1022998
uri: ${vars.uris.geny-uri}
@@ -1076,19 +1052,6 @@ build += {
10761052
extra.projects: ["lensesJVM"] // no Scala.js plz
10771053
}
10781054

1079-
// adding (September 2017) because scalafix's "cli" subproject uses it.
1080-
// forked to remove coursier and upgrade sbt-bintray
1081-
${vars.base} {
1082-
name: "semanticdb-sbt"
1083-
uri: ${vars.uris.semanticdb-sbt-uri}
1084-
extra.options: ["-Dbintray.user=dummy", "-Dbintray.pass=dummy"]
1085-
extra.commands: ${vars.default-commands} [
1086-
"set every bintrayReleaseOnPublish := false"
1087-
]
1088-
// this is enough for scalafix
1089-
extra.projects: ["runtime"]
1090-
}
1091-
10921055
// adding (September 2017) because scalafix's "cli" subproject uses it.
10931056
// forked to modify some version number manipulation code to be
10941057
// dbuild-friendly; we can unfork once
@@ -1243,7 +1206,8 @@ build += {
12431206
build += {
12441207

12451208
space.from: jawn_0_10
1246-
space.to: [ jawn_0_10 ]
1209+
// to scalameta spaces to provide ammonite-ops
1210+
space.to: [ jawn_0_10, scalameta_1, scalameta_2 ]
12471211

12481212
check-missing: [ true, false ]
12491213
cross-version: [ disabled, standard ]
@@ -1364,31 +1328,6 @@ build += {
13641328
extra.options: ["-Xms1g", "-Xmx4g", "-Xss2m", "-XX:MaxMetaspaceSize=256m"]
13651329
}
13661330

1367-
// (here in this space because of ammonite-ops dependency)
1368-
// forked (refreshed September 2017) to remove coursier
1369-
// caution, refreshing the fork any further can be problematic;
1370-
// see Olafur's remarks at
1371-
// https://github.com/scala/community-builds/issues/499#issuecomment-287307613
1372-
// about the instability of both scalameta and scalafix
1373-
${vars.base} {
1374-
name: "scalafix"
1375-
uri: ${vars.uris.scalafix-uri}
1376-
extra.exclude: [
1377-
// we never build sbt plugins
1378-
"scalafix-sbt"
1379-
// requires scalatex-site which requires Scala.js
1380-
"readme"
1381-
// no Scala.js please
1382-
"coreJS", "diffJS"
1383-
// Scala 2.10 based
1384-
"testsInputSbt"
1385-
// do I *look* like Dotty?
1386-
"testsOutputDotty"
1387-
// can't expand macros compiled by previous versions of Scala
1388-
"testsOutputSbt"
1389-
]
1390-
}
1391-
13921331
]}
13931332

13941333
//// space: jawn_0_11
@@ -1516,3 +1455,157 @@ build += {
15161455
}
15171456

15181457
]}
1458+
1459+
//// space: scalameta_1
1460+
1461+
build += {
1462+
1463+
space.from: scalameta_1
1464+
space.to: [ scalameta_1 ]
1465+
1466+
check-missing: [ true, false ]
1467+
cross-version: [ disabled, standard ]
1468+
extraction-version: ${vars.scala-version}
1469+
sbt-version: ${vars.sbt-version}
1470+
1471+
projects: [
1472+
1473+
// forked (refreshed November 2017) to disable bintray stuff, IntelliJ stuff,
1474+
// and to remove a failing git-based test
1475+
${vars.base} {
1476+
name: "scalafmt"
1477+
uri: ${vars.uris.scalafmt-uri}
1478+
extra.projects: ["coreJVM", "cli", "tests"]
1479+
}
1480+
1481+
// dependency of scalafmt. frozen at an old version because that's what
1482+
// scalafmt expects. (over in the other scalameta space, scalafix expects
1483+
// a newer version.)
1484+
${vars.base} {
1485+
name: "metaconfig-old"
1486+
uri: ${vars.uris.metaconfig-old-uri}
1487+
extra.projects: ["metaconfig-hoconJVM", "metaconfig-typesafe-config"] // no Scala.js plz
1488+
}
1489+
1490+
// dependency of scalafmt
1491+
// forked (July 2017) for dbuild friendliness
1492+
${vars.base} {
1493+
name: "meta-paradise"
1494+
uri: ${vars.uris.meta-paradise-uri}
1495+
// only goal right now (November 2017) is to get scalafmt in, so, let's just
1496+
// add the project we actually need and not worry about the rest
1497+
extra.projects: ["paradise"]
1498+
// use right version-specific source directory regardless of our weird dbuild Scala version number
1499+
extra.commands: [
1500+
"set unmanagedSourceDirectories in (paradise, Compile) += (baseDirectory in paradise).value / \"src\" / \"main\" / \"scala-2.12.2\""
1501+
]
1502+
}
1503+
1504+
// dependency of scalafmt
1505+
${vars.base} {
1506+
name: "scalameta-1"
1507+
uri: ${vars.uris.scalameta-1-uri}
1508+
// else, bintray stuff goes boom
1509+
extra.options: ["-Dsbt.prohibit.publish=true"]
1510+
extra.projects: ["scalametaJVM", "testkit"] // no Scala.js. just the minimum scalafmt needs?
1511+
extra.exclude: [
1512+
// we never build sbt plugins or benchmarks
1513+
"benchmarks"
1514+
]
1515+
extra.commands: ${vars.default-commands} [
1516+
// Disable fatal Scaladoc warnings, too fragile
1517+
"removeScalacOptions -Xfatal-warnings"
1518+
// use right version-specific source directories regardless of our weird dbuild Scala version numbers
1519+
"set unmanagedSourceDirectories in (commonJVM, Compile) += (baseDirectory in commonJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1520+
"set unmanagedSourceDirectories in (dialectsJVM, Compile) += (baseDirectory in dialectsJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1521+
"set unmanagedSourceDirectories in (scalametaJVM, Compile) += (baseDirectory in scalametaJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1522+
"set unmanagedSourceDirectories in (scalahost, Compile) += (baseDirectory in scalahost).value / \"src\" / \"main\" / \"scala-2.12.1\""
1523+
]
1524+
}
1525+
1526+
]}
1527+
1528+
//// space: scalameta_2
1529+
1530+
build += {
1531+
1532+
space.from: scalameta_2
1533+
space.to: [ scalameta_2 ]
1534+
1535+
check-missing: [ true, false ]
1536+
cross-version: [ disabled, standard ]
1537+
extraction-version: ${vars.scala-version}
1538+
sbt-version: ${vars.sbt-version}
1539+
1540+
projects: [
1541+
1542+
// forked (updated September 2017) to remove coursier.
1543+
// refreshing the fork should be approached with caution;
1544+
// see Olafur's remarks at
1545+
// https://github.com/scala/community-builds/issues/499#issuecomment-287307613
1546+
// about the instability of both scalameta and scalafix.
1547+
${vars.base} {
1548+
name: "scalameta-2"
1549+
uri: ${vars.uris.scalameta-2-uri}
1550+
// else, bintray stuff goes boom
1551+
extra.options: ["-Dsbt.prohibit.publish=true"]
1552+
extra.projects: ["scalametaJVM", "contribJVM", "semanticdbScalac"] // no Scala.js
1553+
extra.exclude: [
1554+
// we never build sbt plugins or benchmarks
1555+
"benchmarks"
1556+
]
1557+
// use right version-specific source directories regardless of our weird dbuild Scala version numbers
1558+
extra.commands: ${vars.default-commands} [
1559+
"set unmanagedSourceDirectories in (commonJVM, Compile) += (baseDirectory in commonJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1560+
"set unmanagedSourceDirectories in (dialectsJVM, Compile) += (baseDirectory in dialectsJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1561+
"set unmanagedSourceDirectories in (scalametaJVM, Compile) += (baseDirectory in scalametaJVM).value / \"src\" / \"main\" / \"scala-2.12\""
1562+
"set unmanagedSourceDirectories in (semanticdbScalac, Compile) += (baseDirectory in semanticdbScalac).value / \"src\" / \"main\" / \"scala-2.12.4\""
1563+
]
1564+
}
1565+
1566+
// adding (September 2017) because scalafix's "cli" subproject uses it.
1567+
// forked to remove coursier and upgrade sbt-bintray
1568+
${vars.base} {
1569+
name: "semanticdb-sbt"
1570+
uri: ${vars.uris.semanticdb-sbt-uri}
1571+
extra.options: ["-Dbintray.user=dummy", "-Dbintray.pass=dummy"]
1572+
extra.commands: ${vars.default-commands} [
1573+
"set every bintrayReleaseOnPublish := false"
1574+
]
1575+
// this is enough for scalafix
1576+
extra.projects: ["runtime"]
1577+
}
1578+
1579+
// dependency of scalafix
1580+
${vars.base} {
1581+
name: "metaconfig-new"
1582+
uri: ${vars.uris.metaconfig-new-uri}
1583+
extra.projects: ["metaconfig-hoconJVM", "metaconfig-typesafe-config"] // no Scala.js plz
1584+
}
1585+
1586+
// (here in this space because of ammonite-ops dependency)
1587+
// forked (refreshed September 2017) to remove coursier
1588+
// caution, refreshing the fork any further can be problematic;
1589+
// see Olafur's remarks at
1590+
// https://github.com/scala/community-builds/issues/499#issuecomment-287307613
1591+
// about the instability of both scalameta and scalafix
1592+
${vars.base} {
1593+
name: "scalafix"
1594+
uri: ${vars.uris.scalafix-uri}
1595+
extra.exclude: [
1596+
// we never build sbt plugins
1597+
"scalafix-sbt"
1598+
// requires scalatex-site which requires Scala.js
1599+
"readme"
1600+
// no Scala.js please
1601+
"coreJS", "diffJS"
1602+
// Scala 2.10 based
1603+
"testsInputSbt"
1604+
// do I *look* like Dotty?
1605+
"testsOutputDotty"
1606+
// can't expand macros compiled by previous versions of Scala
1607+
"testsOutputSbt"
1608+
]
1609+
}
1610+
1611+
]}

configs/project-refs.conf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ vars.uris: {
5151
machinist-uri: "https://github.com/typelevel/machinist.git"
5252
macro-compat-uri: "https://github.com/milessabin/macro-compat.git"
5353
macro-paradise-uri: "https://github.com/scalacommunitybuild/paradise.git#community-build-2.12"
54-
metaconfig-uri: "https://github.com/olafurpg/metaconfig.git"
54+
meta-paradise-uri: "https://github.com/scalacommunitybuild/paradise.git#community-build-2.12-meta-paradise"
55+
metaconfig-old-uri: "https://github.com/olafurpg/metaconfig.git#b13e6bbbf"
56+
metaconfig-new-uri: "https://github.com/olafurpg/metaconfig.git"
5557
mima-uri: "https://github.com/lightbend/migration-manager.git"
5658
minitest-uri: "https://github.com/monix/minitest.git"
5759
monix-uri: "https://github.com/monix/monix.git#18f91fdf5" # was master
@@ -95,10 +97,12 @@ vars.uris: {
9597
scalacheck-uri: "https://github.com/rickynils/scalacheck.git#9b71bb3dfe186c03292faa59976487af2ee23caa"
9698
scalacheck-shapeless-uri: "https://github.com/alexarchambault/scalacheck-shapeless.git"
9799
scalafix-uri: "https://github.com/scalacommunitybuild/scalafix.git#community-build-2.12"
100+
scalafmt-uri: "https://github.com/scalacommunitybuild/scalafmt.git#community-build-2.12"
98101
scalaj-http-uri: "https://github.com/scalaj/scalaj-http.git"
99102
scalachess-uri: "https://github.com/ornicar/scalachess.git"
100103
scalalib-uri: "https://github.com/ornicar/scalalib.git"
101-
scalameta-uri: "https://github.com/scalacommunitybuild/scalameta.git#community-build-2.12"
104+
scalameta-1-uri: "https://github.com/scalacommunitybuild/scalameta.git#community-build-2.12-scalameta1" # was v1.7.0
105+
scalameta-2-uri: "https://github.com/scalacommunitybuild/scalameta.git#community-build-2.12"
102106
scalameter-uri: "https://github.com/scalameter/scalameter.git"
103107
scalamock-uri: "https://github.com/paulbutcher/ScalaMock.git#1e84ffe" # was master
104108
scalapb-lenses-uri: "https://github.com/scalapb/Lenses.git"

0 commit comments

Comments
 (0)