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

[POC] Unroll default arguments for binary compatibility #254

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
9 changes: 5 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ val communityBuildDottyVersion = sys.props.get("dottyVersion").toList
val scala213Version = "2.13.10"

val scalaVersions = Seq(
"3.1.3",
"3.3.1",
"2.12.17",
scala213Version,
"2.11.12"
) ++ communityBuildDottyVersion

object Deps {
Expand Down Expand Up @@ -69,6 +68,8 @@ trait OsLibModule
with SafeDeps
with PlatformScalaModule { outer =>

def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(ivy"com.lihaoyi::unroll-plugin:0.1.12")
def ivyDeps = super.ivyDeps() ++ Agg(ivy"com.lihaoyi::unroll-annotation:0.1.12")
def publishVersion = VcsVersion.vcsState().format()
def pomSettings = PomSettings(
description = artifactName(),
Expand Down Expand Up @@ -99,7 +100,7 @@ trait OsLibModule
}

trait OsModule extends OsLibModule { outer =>
def ivyDeps = Agg(Deps.geny)
def ivyDeps = super.ivyDeps() ++ Agg(Deps.geny)

def artifactName = "os-lib"

Expand Down Expand Up @@ -131,7 +132,7 @@ object os extends Module {

object native extends Cross[OsNativeModule](scalaVersions)
trait OsNativeModule extends OsModule with ScalaNativeModule {
def scalaNativeVersion = "0.4.5"
def scalaNativeVersion = "0.4.14"
object test extends ScalaNativeTests with OsLibTestModule {
def nativeLinkStubs = true
}
Expand Down
51 changes: 3 additions & 48 deletions os/src/FileOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import java.nio.file.{Path => _, _}
import java.nio.file.attribute.{FileAttribute, PosixFilePermission, PosixFilePermissions}

import scala.util.Try
import scala.annotation.unroll

/**
* Create a single directory at the specified path. Optionally takes in a
Expand Down Expand Up @@ -174,7 +175,7 @@ object copy {
replaceExisting: Boolean = false,
copyAttributes: Boolean = false,
createFolders: Boolean = false,
mergeFolders: Boolean = false
@unroll mergeFolders: Boolean = false
): Unit = {
if (createFolders) makeDir.all(to / up)
val opts1 =
Expand Down Expand Up @@ -205,29 +206,6 @@ object copy {
if (stat(from, followLinks = followLinks).isDir) walk(from).map(copyOne)
}

/** This overload is only to keep binary compatibility with older os-lib versions. */
@deprecated(
"Use os.copy(from, to, followLinks, replaceExisting, copyAttributes, " +
"createFolders, mergeFolders) instead",
"os-lib 0.7.5"
)
def apply(
from: Path,
to: Path,
followLinks: Boolean,
replaceExisting: Boolean,
copyAttributes: Boolean,
createFolders: Boolean
): Unit = apply(
from = from,
to = to,
followLinks = followLinks,
replaceExisting = replaceExisting,
copyAttributes = copyAttributes,
createFolders = createFolders,
mergeFolders = false
)

/**
* Copy a file into a particular folder, rather
* than into a particular path
Expand All @@ -240,7 +218,7 @@ object copy {
replaceExisting: Boolean = false,
copyAttributes: Boolean = false,
createFolders: Boolean = false,
mergeFolders: Boolean = false
@unroll mergeFolders: Boolean = false
): Unit = {
os.copy(
from,
Expand All @@ -252,29 +230,6 @@ object copy {
mergeFolders
)
}

/** This overload is only to keep binary compatibility with older os-lib versions. */
@deprecated(
"Use os.copy.into(from, to, followLinks, replaceExisting, copyAttributes, " +
"createFolders, mergeFolders) instead",
"os-lib 0.7.5"
)
def apply(
from: Path,
to: Path,
followLinks: Boolean,
replaceExisting: Boolean,
copyAttributes: Boolean,
createFolders: Boolean
): Unit = apply(
from = from,
to = to,
followLinks = followLinks,
replaceExisting = replaceExisting,
copyAttributes = copyAttributes,
createFolders = createFolders,
mergeFolders = false
)
}

/**
Expand Down