Skip to content

Commit c87c7a4

Browse files
committed
update for 2.13 compat
1 parent 34eb700 commit c87c7a4

File tree

6 files changed

+26
-22
lines changed

6 files changed

+26
-22
lines changed

datastore-cli/src/main/scala/org/allenai/datastore/cli/DownloadApp.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ object DownloadApp extends App {
1313
)
1414

1515
val parser = new scopt.OptionParser[Options]("scopt") {
16-
opt[Boolean]("assumeFile") action { (f, c) =>
16+
opt[Boolean]("assumeFile").action { (f, c) =>
1717
c.copy(assumeFile = f)
1818
} text ("Assumes that the object in the datastore is a file.")
1919

20-
opt[Boolean]("assumeDirectory") action { (d, c) =>
20+
opt[Boolean]("assumeDirectory").action { (d, c) =>
2121
c.copy(assumeDirectory = d)
2222
} text ("Assumes that the object in the datastore is a directory.")
2323

@@ -34,19 +34,19 @@ object DownloadApp extends App {
3434
"whether the object in the datastore is a file or a directory."
3535
)
3636

37-
opt[String]('g', "group") required () action { (g, c) =>
37+
opt[String]('g', "group").required().action { (g, c) =>
3838
c.copy(group = g)
3939
} text ("Group name of the object in the datastore")
4040

41-
opt[String]('n', "name") required () action { (n, c) =>
41+
opt[String]('n', "name").required().action { (n, c) =>
4242
c.copy(name = n)
4343
} text ("Name of the object in the datastore")
4444

45-
opt[Int]('v', "version") required () action { (v, c) =>
45+
opt[Int]('v', "version").required().action { (v, c) =>
4646
c.copy(version = v)
4747
} text ("Version number of the object in the datastore")
4848

49-
opt[String]('d', "datastore") action { (d, c) =>
49+
opt[String]('d', "datastore").action { (d, c) =>
5050
c.copy(datastore = Some(Datastore(d)))
5151
} text (s"Datastore to use. Default is ${Datastore.defaultName}")
5252

datastore-cli/src/main/scala/org/allenai/datastore/cli/UploadApp.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,35 @@ object UploadApp extends App {
1515
)
1616

1717
val parser = new scopt.OptionParser[Options]("scopt") {
18-
opt[File]('p', "path") required () action { (p, c) =>
18+
opt[File]('p', "path").required().action { (p, c) =>
1919
c.copy(path = p)
2020
} text ("Path to the file or directory you want uploaded")
2121

22-
opt[String]('g', "group") required () action { (g, c) =>
22+
opt[String]('g', "group").required().action { (g, c) =>
2323
c.copy(group = g)
2424
} text ("Group name to store the file or directory under")
2525

26-
opt[String]('n', "name") required () action { (n, c) =>
26+
opt[String]('n', "name").required().action { (n, c) =>
2727
c.copy(name = n)
2828
} text ("Name to store the file or directory under")
2929

30-
opt[Int]('v', "version") required () action { (v, c) =>
30+
opt[Int]('v', "version").required().action { (v, c) =>
3131
c.copy(version = v)
3232
} text ("Version number to store the file or directory under")
3333

34-
opt[String]('d', "datastore") action { (d, c) =>
34+
opt[String]('d', "datastore").action { (d, c) =>
3535
c.copy(datastore = Some(Datastore(d)))
3636
} text (s"Datastore to use. Default is ${Datastore.defaultName}")
3737

38-
opt[Boolean]("overwrite") action { (_, c) =>
38+
opt[Boolean]("overwrite").action { (_, c) =>
3939
c.copy(overwrite = true)
4040
} text ("Overwrite if the group, version, and name already exists")
4141

4242
help("help")
4343
}
4444

4545
Common.handleDatastoreExceptions {
46-
parser.parse(args, Options()) foreach { config =>
46+
parser.parse(args, Options()).foreach { config =>
4747
val datastore = config.datastore.getOrElse {
4848
Common.printDefaultDatastoreWarning()
4949
Datastore

datastore-cli/src/main/scala/org/allenai/datastore/cli/UrlApp.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ object UrlApp extends App {
1313
)
1414

1515
val parser = new scopt.OptionParser[Options]("scopt") {
16-
opt[Boolean]("assumeFile") action { (f, c) =>
16+
opt[Boolean]("assumeFile").action { (f, c) =>
1717
c.copy(assumeFile = f)
1818
} text ("Assumes that the object in the datastore is a file.")
1919

20-
opt[Boolean]("assumeDirectory") action { (d, c) =>
20+
opt[Boolean]("assumeDirectory").action { (d, c) =>
2121
c.copy(assumeDirectory = d)
2222
} text ("Assumes that the object in the datastore is a directory.")
2323

@@ -34,27 +34,27 @@ object UrlApp extends App {
3434
"whether the object in the datastore is a file or a directory."
3535
)
3636

37-
opt[String]('g', "group") required () action { (g, c) =>
37+
opt[String]('g', "group").required().action { (g, c) =>
3838
c.copy(group = g)
3939
} text ("Group name of the object in the datastore")
4040

41-
opt[String]('n', "name") required () action { (n, c) =>
41+
opt[String]('n', "name").required().action { (n, c) =>
4242
c.copy(name = n)
4343
} text ("Name of the object in the datastore")
4444

45-
opt[Int]('v', "version") required () action { (v, c) =>
45+
opt[Int]('v', "version").required().action { (v, c) =>
4646
c.copy(version = v)
4747
} text ("Version number of the object in the datastore")
4848

49-
opt[String]('d', "datastore") action { (d, c) =>
49+
opt[String]('d', "datastore").action { (d, c) =>
5050
c.copy(datastore = Some(Datastore(d)))
5151
} text (s"Datastore to use. Default is ${Datastore.defaultName}")
5252

5353
help("help")
5454
}
5555

5656
Common.handleDatastoreExceptions {
57-
parser.parse(args, Options()) foreach { config =>
57+
parser.parse(args, Options()).foreach { config =>
5858
val datastore = config.datastore.getOrElse {
5959
Common.printDefaultDatastoreWarning()
6060
Datastore

datastore/src/main/scala/org/allenai/datastore/Datastore.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import org.apache.commons.io.FileUtils
1919
import org.slf4j.LoggerFactory
2020
import ch.qos.logback.classic.Level
2121

22+
import scala.collection.compat._
2223
import scala.collection.JavaConverters._
2324
import scala.util.control.NonFatal
2425
import scala.util.Random
@@ -684,7 +685,7 @@ class Datastore(val name: String, val s3: AmazonS3Client) extends Logging {
684685
getAllListings(listObjectsRequest)
685686
.flatMap(_.getCommonPrefixes.asScala)
686687
.map(_.stripSuffix("/"))
687-
.to[collection.SortedSet]
688+
.to(collection.SortedSet)
688689
}
689690

690691
/** Lists all items in a group
@@ -706,7 +707,7 @@ class Datastore(val name: String, val s3: AmazonS3Client) extends Logging {
706707
.map { os =>
707708
Locator.fromKey(os.getKey)
708709
}
709-
.to[collection.SortedSet]
710+
.to(collection.SortedSet)
710711
}
711712

712713
//

project/Dependencies.scala

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import sbt._
22

33
object Dependencies {
4+
val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.4.3"
5+
46
val commonVersion = "2.3.1"
57
val allenAiCommon = "org.allenai.common" %% "common-core" % commonVersion
68
val allenAiTestkit = "org.allenai.common" %% "common-testkit" % commonVersion

project/GlobalPlugin.scala

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ object GlobalPlugin extends AutoPlugin {
1717
scalaVersion := ScalaVersions.SCALA_213,
1818
CodeArtifactKeys.codeArtifactUrl := "https://org-allenai-s2-896129387501.d.codeartifact.us-west-2.amazonaws.com/maven/private",
1919
fork in Test := true,
20+
libraryDependencies += scalaCollectionCompat,
2021
dependencyOverrides ++= Logging.loggingDependencyOverrides
2122
)
2223
}

0 commit comments

Comments
 (0)