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

Configurable buffer size and flat compression for file entries for SBT #375

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 5 additions & 1 deletion io/src/main/scala/sbt/io/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ object IO {
val temporaryDirectory = new File(System.getProperty("java.io.tmpdir"))

/** The size of the byte or char buffer used in various methods. */
private val BufferSize = 8192
private val BufferSize =
Option(System.getProperty("sbt.io.buffer.size")).map(_.toInt).getOrElse(8192)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/sbt/sbt/blob/bcf5ded572711854b9ba28cec1e30114b428380b/main/src/main/scala/sbt/internal/SysProp.scala#L81-L92, which is a mini style guide for system properties. I'd suggest name sbt.io.bufferbyte?

In general, I wonder if we should copy-paste SysProp.scala to sbt.internal.io or something.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for paying attention!

I believe as is it does comply with style guidelines as articulated in SysProp.scala

// System property style:
// 1. use sbt. prefix
// 2. prefer short nouns
// 3. use dot for namespacing, and avoid making dot-separated English phrase
// 4. make active/enable properties, instead of "sbt.disable."

and also existing values such as

  def taskTimings: Boolean = getOrFalse("sbt.task.timings")
  def taskTimingsOnShutdown: Boolean = getOrFalse("sbt.task.timings.on.shutdown")
  def taskTimingsThreshold: Long = long("sbt.task.timings.threshold", 0L)
  def taskTimingsOmitPaths: Boolean = getOrFalse("sbt.task.timings.omit.paths")

that being said, it's all cosmetics, it's up to you as maintainer to define final naming

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste SysProp.scala to sbt.internal.io

looks a good suggestion, however this was far out of scope of my humble hack


private val DoNotCompressFiles = Option(System.getProperty("sbt.io.files.uncompressed")).exists(_.toBoolean)

/** File scheme name */
private[sbt] val FileScheme = "file"
Expand Down Expand Up @@ -711,6 +714,7 @@ object IO {
// log.debug("\tAdding " + file + " as " + name + " ...")
val e = createEntry(name)
e setTime time.getOrElse(getModifiedTimeOrZero(file))
if (DoNotCompressFiles) e setMethod ZipEntry.STORED
e
}
def addFileEntry(file: File, name: String) = {
Expand Down