這是 sbt 1.0.x 系列的熱修補版本。
ArrayIndexOutOfBoundsException
錯誤。ivy#27,由 @xuwei-k 提供。-jvm-debug
。launcher-package197,由 @mkurz 提供。run
輸出偵錯層級記錄。#3655/#3717,由 @cunei 提供。testQuick
的效能回歸問題。#3680/#3720,由 @OlegYch 提供。templateStats()
並非執行緒安全的問題。#3743,由 @cunei 提供。http:
和 https:
註冊 Ivy 通訊協定,使其更友善於外掛程式。lm183,由 @tpunder 提供。expr
,修正與 bc
相關的腳本問題。launcher-package#199,由 @thatfulvioguy 提供。非常感謝每一位透過使用 sbt 和 Zinc 1、回報錯誤、改進我們的文件、移植建置、移植外掛程式,以及提交和審查提取要求,協助改進 sbt 和 Zinc 1 的人。
根據 sbt、zinc、librarymanagement、util、io 和網站上的 git shortlog -sn --no-merges v1.0.3..v1.0.4
,此版本由 17 位貢獻者帶給您:Eugene Yokota、Kenji Yoshida (xuwei-k)、Jorge Vicente Cantero (jvican)、Dale Wijnand、Leonard Ehrenfried、Antonio Cunei、Brett Randall、Guillaume Martres、Arnout Engelen、Fulvio Valente、Jens Grassel、Matthias Kurz、OlegYch、Philippus Baalman、Sam Halliday、Tim Underwood、Tom Most。謝謝!
這是 sbt 1.0.x 系列的熱修補版本。
~
在迴圈中重新編譯(當存在來源產生器或 sbt-buildinfo 時)。#3501/#3634,由 @dwijnand 提供。getGenericParameterTypes
傳回 null
的問題。zinc#446,由 @jvican 提供。/
。lm#170,由 @laughedelic 提供。sbt.watch.mode
系統屬性,以允許切換回舊的輪詢行為進行監看。請參閱下方以了解更多詳細資訊。sbt 1.0.0 引入了一種新的機制,用於根據 Java 1.7 中的 NIO WatchService
監看來源變更。在某些平台上(尤其是 macOS),這會導致在擷取變更之前出現長時間的延遲。針對這些平台,sbt 1.1.0 計劃推出替代的 WatchService
(#3527),同時新增了一個選項來選擇使用哪個監看服務。
新增了新的 sbt.watch.mode
JVM 旗標,並支援下列值
polling
:(macOS 的預設值)輪詢檔案系統以進行變更(sbt 0.13 中使用的機制)。nio
(其他平台的預設值):使用基於 NIO 的 WatchService
。如果您在非 macOS 機器上遇到長時間的延遲,請嘗試將 -Dsbt.watch.mode=polling
新增至您的 sbt 選項。
#3597,由 @stringbean 提供。
非常感謝每一位透過使用 sbt 和 Zinc 1、回報錯誤、改進我們的文件、移植建置、移植外掛程式,以及提交和審查提取要求,協助改進 sbt 和 Zinc 1 的人。
根據 sbt、zinc、librarymanagement、util、io 和網站上的 git shortlog -sn --no-merges v1.0.2..v1.0.3
,此版本由 15 位貢獻者帶給您:Eugene Yokota、Dale Wijnand、Michael Stringer、Jorge Vicente Cantero (jvican)、Alexey Alekhin、Antonio Cunei、Andrey Artemov、Jeffrey Olchovy、Kenji Yoshida (xuwei-k)、Dominik Winter、Long Jinwei、Arnout Engelen、Justin Kaeser、Leonard Ehrenfried、Sakib Hadžiavdić。謝謝!
這是 sbt 1.0.x 系列的熱修補版本。
deliver
任務,並新增 makeIvyXml
作為名稱更合理的任務。#3487,由 @cunei 提供。OkUrlFactory
使用方式,並修正連線洩漏問題。lm#164,由 @dpratt 提供。run
和 bgRun
未擷取類別路徑中目錄變更的問題。#3517,由 @dwijnand 提供。++
,使其不會變更 crossScalaVersion
的值。#3495/#3526,由 @dwijnand 提供。consoleProject
。 zinc#386 by @dwijnandsbt.gigahorse
,以啟用/停用內部使用 Gigahorse 來解決與 repositories
覆寫一起使用時,JavaNetAuthenticator
中發生的 NPE 問題。lm#167 by @cuneisbt.server.autostart
,以啟用/停用在 sbt shell 中自動啟動 sbt 伺服器的功能。同時也新增了 startServer
命令來手動啟動伺服器。 by @eed3si9n非常感謝所有透過使用 sbt 和 Zinc 1、回報錯誤、改善我們的文件、移植外掛程式,以及提交和審閱 pull request 來協助改進 sbt 和 Zinc 1 的每個人。
這次的發布由 19 位貢獻者共同完成,根據 sbt、zinc、librarymanagement 和網站上的 git shortlog -sn --no-merges v1.0.1..v1.0.2
結果:Dale Wijnand、Eugene Yokota、Kenji Yoshida (xuwei-k)、Antonio Cunei、David Pratt、Karol Cz (kczulko)、Amanj Sherwany、Emanuele Blanco、Eric Peters、Guillaume Bort、James Roper、Joost de Vries、Marko Elezovic、Martynas Mickevičius、Michael Stringer、Răzvan Flavius Panda、Peter Vlugter、Philippus Baalman 和 Wiesław Popielarski。謝謝你們!
這是 sbt 1.0.x 系列的熱修補版本。
+
命令的命令支援。在 sbt 1.0 中加入的 +
會遍歷子專案,並尊重 crossScalaVersions
;然而,它不再接受命令作為參數。此修正恢復了對此功能的支持。#3446 by @jroperaddSbtPlugin
在 cross building 期間使用正確的 sbt 版本的問題。 #3442 by @dwijnandrun in Compile
任務未包含 Runtime
配置的問題,透過使用 bgRun
重新實作 run
來解決。 #3477 by @eed3si9nactual
作為 inspect
的潛在選項 #3335 by @DuhemmNullPointerException
日誌記錄問題。 util#121 by @eed3si9n監看來源功能從 sbt 0.13 到 sbt 1.0 經歷了使用 NIO 的重大變更;然而,它沒有清晰的遷移路徑,因此我們在 sbt 1.0.1 中修正了這個問題。
首先,sbt.WatchSource
是 sbt.internal.io.Source
的新別名。希望這很容易記住,因為鍵的名稱是 watchSources
。接下來,def apply(base: File)
和 def apply(base: File, includeFilter: FileFilter, excludeFilter: FileFilter)
建構子被新增到 sbt.WatchSource
的伴生物件中。
為了向後相容,sbt 1.0.1 新增了從 File
到 Seq[WatchSource]
的 +=
支援 (Append
實例)。
因此,如果您有一個想要監看的目錄
watchSources += WatchSource(sourceDirectory.value)
如果您有一個檔案清單
watchSources ++= (sourceDirectory.value ** "*.scala").get
#3438 by @Duhemm; #3478 和 io#74 by @eed3si9n
另請參閱 從 sbt 0.13.x 遷移。
.copy(foo = xxx)
遷移至 withFoo(xxx)
。例如,UpdateConfiguration
、RetrieveConfiguration
、PublishConfiguration
被重構為使用 builder 模式。config("xyz")
必須直接賦值給大寫的 val
,例如 val Xyz = config("xyz")
。這會將 lhs 識別符號捕獲到配置中,以便我們稍後可以從 shell 中使用它。publishTo
和 otherResolvers
從 SettingKeys 變更為 TaskKeys。 #2059/#2662 by @dwijnandPath.relativizeFile(baseFile, file)
被重新命名為 IO.relativizeFile(baseFile, file)
。PathFinder
的 .***
方法被重新命名為 .allPaths
方法。PathFinder.x_!(mapper)
被移動到 PathFinder
上的 def pair
。sbt.Path
上的許多方法(例如 relativeTo
和 rebase
和 flat
)現在不再位於預設命名空間中。使用 sbt.io.Path
可以再次存取它們。Global
重新命名為 Zero
,以消除與 GlobalScope
的歧義。 @eed3si9nString
來引用配置的地方使用 ConfigRef
,例如 update.value.configuration(...)
。傳入 Configuration
,它會隱式轉換為 ConfigRef
。sourceArtifactTypes
和 docArtifactTypes
從 Set[String]
變更為 Seq[String]
設定。--<command>
重新命名為 early(<command>)
。publishLocal
而不是 publish-local
)。-error
、-warn
、-info
、-debug
被新增為 "early(error)"
等的簡寫。sbt.Process
和 sbt.ProcessExtra
被刪除。改用 scala.sys.process
。incOptions.value.withNameHashing(...)
選項被移除,因為名稱雜湊功能始終開啟。TestResult.Value
現在稱為 TestResult
。%%
。刪除已棄用的項目:
Build
特徵在 sbt 0.13.12 中已被棄用,現已移除。請遷移到 build.sbt。自動外掛程式和 Build
特徵無法很好地協同工作,並且它的功能現在很大程度上被多專案 build.sbt 取代。Project(...)
建構子被限制為兩個參數。這是因為 settings
參數無法與自動外掛程式很好地協同工作。改用 project
。<<=
、<+=
、<++=
已移除。請遷移到 :=、+= 和 ++=。這些運算符長期以來一直是許多使用者的困惑來源,並且早已從 0.13 文件中刪除,並且自 sbt 0.13.13 以來已正式棄用。sbt.Plugin
特徵已刪除。請遷移到 AutoPlugin。自動外掛程式更容易設定,並且彼此之間可以更好地協同工作。Project
中移除 settingsSets
方法(以及 add/setSbtFiles
)。InputTask
apply
方法和 inputTask
DSL 方法。使用 Def.inputTask
和 Def.spaceDelimited().parsed
。ProjectReference
隱式提升。使用 RootProject(<uri>)
、RootProject(<file>)
或 LocalProject(<string>)
。seq(..)
DSL 方法。使用 Seq
或傳入設定而不需包裝。File
/Seq[File]
設定擴充。使用 .value
和 Def.setting
。SubProcess
apply
多載。使用 SubProcess(ForkOptions(runJVMOptions = ..))
。toError(opt: Option[String]): Unit
(等同於 opt foreach sys.error
);如果用於包裝 ScalaRun#run
,則替換為 scalaRun.run(...).failed foreach (sys error _.getMessage)
console
任務。 zinc#295 by @dwijnandupdate
任務的任務快取。 #3233 by @eed3si9nbuild.sbt
的靜態驗證。請參閱下文scalas
的腳本模式下,啟動日誌級別被降至 -error
。 #840 by @eed3si9nivyLoggingLevel
將降至 UpdateLogging.Quiet
。 @eed3si9nbuild.sbt
(符合 *.sbt
)檔案的名稱記錄。 #1911 by @valydiaaggregate
的功能。By @xuwei-kasciiGraphWidth
,用於控制由 inspect tree
等命令列印的 ASCII 圖的最大寬度。預設值對應於先前硬編碼的 40 個字元的值。By @RomanIakovlev。^
和 ^^
命令用於外掛程式 cross building。請參閱下文。autoImport
。#3115 由 @jvican 貢獻。InteractionService
,以保持與 sbt 0.13 的相容性。#3182 由 @eed3si9n 貢獻。PollingWatchService
和 Java NIO 的 WatchService
。io#47 由 @Duhemm 代表 Scala Center 貢獻。sbt.io.CopyOptions()
的 IO.copyFile
和 IO.copyDirectory
變體。詳情請見下文。Path.directory
和 Path.contentOf
是從 sbt-native-packager 捐贈的。io#38 由 @muuki88 貢獻。Grzegorz Kossakowski(由 Lightbend 委託)為 Zinc 1.0 帶來的一項重大改進是基於類別的名稱雜湊,這將加快大型專案中 Scala 的增量編譯速度。
Zinc 1.0 的名稱雜湊會追蹤程式碼在類別層級的依賴關係,而不是在原始碼檔案層級。GitHub 議題 sbt/sbt#1104 列出了一些專案中在現有類別中新增方法的比較。
ScalaTest AndHaveWord class: Before 49s, After 4s (12x)
Specs2 OptionResultMatcher class: Before 48s, After 1s (48x)
scala/scala Platform class: Before 59s, After 15s (3.9x)
scala/scala MatchCodeGen class: Before 48s, After 17s (2.8x)
這取決於一些因素,例如類別的組織方式,但可以看到 3 倍到 40 倍的效能提升。加速的原因是它透過將類別從原始碼檔案中解開,來編譯比以前更少的原始碼檔案。在將方法新增至 scala/scala 的 Platform 類別的範例中,sbt 0.13 的名稱雜湊過去會編譯 72 個來源,但新的 Zinc 會編譯 6 個來源。
xsbti.compile
套件下的 Java 類別,例如 IncOptions
隱藏建構函式。請使用工廠方法 xsbti.compile.Foo.of(...)
。ivyScala: IvyScala
鍵重新命名為 scalaModuleInfo: ScalaModuleInfo
。xsbti.Reporter#log(...)
將 xsbti.Problem
作為參數。呼叫 log(problem.position, problem.message, problem.severity)
以委派給舊的 log(...)
。xsbi.Maybe
、xsbti.F0
和 sxbti.F1
已變更為對應的 Java 8 類別 java.util.Optional
、java.util.Supplier
和 java.util.Function
。sbt 1.0 包含伺服器功能,允許 IDE 和其他工具透過 JSON API 查詢建置設定並叫用命令。與 sbt 0.13 中的互動式 Shell 使用 shell
命令實作的方式類似,「server」也只是 shell
命令,可同時監聽人工輸入和網路輸入。作為使用者,由於伺服器,影響應該是最小的。
在 2016 年 3 月,我們 重新啟動了「伺服器」功能,使其盡可能小。我們與 JetBrains 的 @jastice(他負責 IntelliJ 的 sbt 介面)合作,以縮小功能清單。sbt 1.0 不會具備我們最初想要的所有功能,但從長遠來看,我們希望看到 IDE 和 sbt 生態系統之間使用此系統進行更好的整合。例如,IDE 將能夠發出編譯任務並以 JSON 事件的形式檢索編譯器警告。
{"type":"xsbti.Problem","message":{"category":"","severity":"Warn","message":"a pure expression does nothing in statement position; you may be omitting necessary parentheses","position":{"line":2,"lineContent":" 1","offset":29,"pointer":2,"pointerSpace":" ","sourcePath":"/tmp/hello/Hello.scala","sourceFile":"file:/tmp/hello/Hello.scala"}},"level":"warn"}
新增的另一個相關功能是 bgRun
任務,例如,它允許伺服器程序在背景中執行,同時針對它執行測試。
sbt 1.0 禁止在任務中 if 運算式和匿名函式的主體內呼叫 .value
,可以使用 @sbtUnchecked
註釋來覆寫檢查。
靜態驗證也會捕捉到您是否忘記在任務主體中呼叫 .value
。
sbt 1.0 改善了逐出警告的呈現方式。
之前
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.google.code.findbugs:jsr305:2.0.1 -> 3.0.0
[warn] Run 'evicted' to see detailed eviction warnings
之後
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.0 is selected over 2.4.17
[warn] +- de.heikoseeberger:akka-log4j_2.12:1.4.0 (depends on 2.5.0)
[warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.6 (depends on 2.4.17)
[warn] +- com.typesafe.akka:akka-stream_2.12:2.4.17 () (depends on 2.4.17)
[warn]
[warn] Run 'evicted' to see detailed eviction warnings
@jrudolph 的 sbt-cross-building 是一個外掛程式作者的外掛程式。它新增了交叉命令 ^
和 sbtVersion 切換命令 ^^
,類似於 +
和 ++
,但用於在主要版本之間切換多個 sbt 版本。sbt 0.13.16 將這些命令合併到 sbt 中,因為它提供的功能在我們將外掛程式遷移到 sbt 1.0 時很有用。
若要從 Shell 切換 pluginCrossBuild
中的 sbtVersion
,請使用
^^ 1.0.0-M5
您的外掛程式現在將使用 sbt 1.0.0-M5(及其 Scala 版本 2.12.2)建置。
如果需要對特定 sbt 版本進行變更,現在可以將它們包含到 src/main/scala-sbt-0.13
和 src/main/scala-sbt-1.0.0-M5
中,其中二進位 sbt 版本號碼會用作後綴。
若要跨多個 sbt 版本執行命令,請設定
crossSbtVersions := Vector("0.13.15", "1.0.0-M5")
然後,執行
^ compile
#3133 由 @eed3si9n 貢獻(從 0.13.16-M1 正向移植)。
sbt IO 1.0 新增接受 sbt.io.CopyOptions()
的 IO.copyFile
和 IO.copyDirectory
變體。CopyOptions()
是類似於建構器模式的偽案例類別範例。
import sbt.io.{ IO, CopyOptions }
IO.copyDirectory(source, target)
// The above is same as the following
IO.copyDirectory(source, target, CopyOptions()
.withOverwrite(false)
.withPreserveLastModified(true)
.withPreserveExecutable(true))
sbt 1.0 新增了由 Lightbend 的 Eugene Yokota (@eed3si9n) 和 Scala Center 的 Martin Duhem (@Duhemm) 共同撰寫的函式庫管理 API。此 API 旨在抽象化 Apache Ivy 以及其他依賴解析引擎,例如 Ivy、快取解析和 Coursier。
Ivy 引擎的並行構件下載是由 Scala Center 的 Jorge (@jvican) 貢獻的。它還引入了 Gigahorse OkHttp 作為網路 API,並且它也使用 Square OkHttp 進行構件下載。
lm#124 由 @eed3si9n/@Duhemm 貢獻、 lm#90 由 @jvican/@jsuereth 貢獻,以及 lm#104 由 @eed3si9n 貢獻。
Scala Center 的 Jorge (@jvican) 使用 Google Procol Buffer 為 Zinc 的內部儲存貢獻了二進位格式。新格式為我們提供了三個主要優勢
依賴鎖定功能仍在開發中,但 Scala Center 的 Jorge (@jvican) 新增了一些相關功能,這些功能應該可以共同運作以允許依賴鎖定。
有太多人要感謝了。請參閱 Credits