Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTP: enable Scala 2.13 and 2.12.9 compilation #1779

Merged
merged 7 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- env: CMD="++2.11.12 Test/compile"
name: "Compile all code with Scala 2.11"
if: type != cron
- env: CMD="++2.12.7 Test/compile"
name: "Compile all code with Scala 2.12 and fatal warnings enabled. Run locally with: env CI=true sbt ++2.12.7 Test/compile"
- env: CMD="++2.12.9 Test/compile"
name: "Compile all code with Scala 2.12 and fatal warnings enabled. Run locally with: env CI=true sbt ++2.12.9 Test/compile"
- env: CMD="++2.13.0 Test/compile"
name: "Compile all code with Scala 2.13"
- env: CMD="unidoc"
Expand Down Expand Up @@ -144,8 +144,8 @@ jobs:
- stage: publish
env: CMD="++2.11.12 publish"
name: "Publish artifacts for Scala 2.11.12"
- env: CMD="++2.12.7 publish"
name: "Publish artifacts for Scala 2.12.7"
- env: CMD="++2.12.9 publish"
name: "Publish artifacts for Scala 2.12.9"
- env: CMD="++2.13.0 publish"
name: "Publish artifacts for Scala 2.13.0"
- script: openssl aes-256-cbc -K $encrypted_bbf1dc4f2a07_key -iv $encrypted_bbf1dc4f2a07_iv -in .travis/travis_alpakka_rsa.enc -out .travis/id_rsa -d && eval "$(ssh-agent -s)" && chmod 600 .travis/id_rsa && ssh-add .travis/id_rsa && sbt -jvm-opts .jvmopts-travis docs/publishRsync
Expand Down
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ lazy val ftp = alpakkaProject(
parallelExecution in Test := false,
fork in Test := true,
// To avoid potential blocking in machines with low entropy (default is `/dev/random`)
javaOptions in Test += "-Djava.security.egd=file:/dev/./urandom",
crossScalaVersions -= Dependencies.Scala213 // https://github.com/akka/alpakka/issues/1532
javaOptions in Test += "-Djava.security.egd=file:/dev/./urandom"
)

lazy val geode =
Expand Down
7 changes: 5 additions & 2 deletions ftp/src/main/mima-filters/1.1.x.backwards.excludes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Allow changes to impl
ProblemFilters.exclude[Problem]("akka.stream.alpakka.ftp.impl.*")
# Restructure to enable compilation with Scala 2.12.8+ PR #1779
ProblemFilters.exclude[DirectAbstractMethodProblem]("akka.stream.alpakka.ftp.javadsl.FtpApi.*")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.alpakka.ftp.javadsl.FtpApi.ftpLike")
ProblemFilters.exclude[DirectAbstractMethodProblem]("akka.stream.alpakka.ftp.scaladsl.FtpApi.*")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.alpakka.ftp.scaladsl.FtpApi.ftpLike")
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ private[ftp] trait CommonFtpOperations {

private def getPosixFilePermissions(file: FTPFile) =
Map(
PosixFilePermission.OWNER_READ file.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.OWNER_WRITE file.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.OWNER_EXECUTE file.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION),
PosixFilePermission.GROUP_READ file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.GROUP_WRITE file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.GROUP_EXECUTE file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION),
PosixFilePermission.OTHERS_READ file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.OTHERS_WRITE file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.OTHERS_EXECUTE file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)
PosixFilePermission.OWNER_READ -> file.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.OWNER_WRITE -> file.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.OWNER_EXECUTE -> file.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION),
PosixFilePermission.GROUP_READ -> file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.GROUP_WRITE -> file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.GROUP_EXECUTE -> file.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION),
PosixFilePermission.OTHERS_READ -> file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION),
PosixFilePermission.OTHERS_WRITE -> file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION),
PosixFilePermission.OTHERS_EXECUTE -> file.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)
).collect {
case (perm, true) perm
case (perm, true) => perm
}.toSet

def listFiles(handler: Handler): immutable.Seq[FtpFile] = listFiles("", handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private[ftp] trait FtpIOSinkStage[FtpClient, S <: RemoteFileSettings]
write(grab(in))
pull(in)
} catch {
case NonFatal(e)
case NonFatal(e) =>
failed = true
matFailure(e)
failStage(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import org.apache.commons.net.ftp.{FTPClient, FTPSClient}
* INTERNAL API
*/
@InternalApi
private[ftp] trait FtpSourceFactory[FtpClient] { self =>

type S <: RemoteFileSettings
private[ftp] trait FtpSourceFactory[FtpClient, S <: RemoteFileSettings] { self =>

protected[this] final val DefaultChunkSize = 8192

Expand Down Expand Up @@ -140,7 +138,7 @@ private[ftp] trait FtpSourceFactory[FtpClient] { self =>
* INTERNAL API
*/
@InternalApi
private[ftp] trait FtpSource extends FtpSourceFactory[FTPClient] {
private[ftp] trait FtpSource extends FtpSourceFactory[FTPClient, FtpSettings] {
protected final val FtpBrowserSourceName = "FtpBrowserSource"
protected final val FtpIOSourceName = "FtpIOSource"
protected final val FtpDirectorySource = "FtpDirectorySource"
Expand All @@ -157,7 +155,7 @@ private[ftp] trait FtpSource extends FtpSourceFactory[FTPClient] {
* INTERNAL API
*/
@InternalApi
private[ftp] trait FtpsSource extends FtpSourceFactory[FTPSClient] {
private[ftp] trait FtpsSource extends FtpSourceFactory[FTPSClient, FtpsSettings] {
protected final val FtpsBrowserSourceName = "FtpsBrowserSource"
protected final val FtpsIOSourceName = "FtpsIOSource"
protected final val FtpsDirectorySource = "FtpsDirectorySource"
Expand All @@ -174,7 +172,7 @@ private[ftp] trait FtpsSource extends FtpSourceFactory[FTPSClient] {
* INTERNAL API
*/
@InternalApi
private[ftp] trait SftpSource extends FtpSourceFactory[SSHClient] {
private[ftp] trait SftpSource extends FtpSourceFactory[SSHClient, SftpSettings] {
protected final val sFtpBrowserSourceName = "sFtpBrowserSource"
protected final val sFtpIOSourceName = "sFtpIOSource"
protected final val sFtpDirectorySource = "sFtpDirectorySource"
Expand All @@ -195,8 +193,8 @@ private[ftp] trait SftpSource extends FtpSourceFactory[SSHClient] {
private[ftp] trait FtpDefaultSettings {
protected def defaultSettings(
hostname: String,
username: Option[String],
password: Option[String]
username: Option[String] = None,
password: Option[String] = None
): FtpSettings =
FtpSettings(
InetAddress.getByName(hostname)
Expand All @@ -215,8 +213,8 @@ private[ftp] trait FtpDefaultSettings {
private[ftp] trait FtpsDefaultSettings {
protected def defaultSettings(
hostname: String,
username: Option[String],
password: Option[String]
username: Option[String] = None,
password: Option[String] = None
): FtpsSettings =
FtpsSettings(
InetAddress.getByName(hostname)
Expand All @@ -235,8 +233,8 @@ private[ftp] trait FtpsDefaultSettings {
private[ftp] trait SftpDefaultSettings {
protected def defaultSettings(
hostname: String,
username: Option[String],
password: Option[String]
username: Option[String] = None,
password: Option[String] = None
): SftpSettings =
SftpSettings(
InetAddress.getByName(hostname)
Expand Down
Loading