23
sbt, past and future eugene yokota (@eed3si9n, @eed3si9n_ja) sbt、傾向と対策

sbt, past and future / sbt, 傾向と対策

Embed Size (px)

DESCRIPTION

Presentation material with Japanese subs, by Mr. Eugene Yokota at ScalaMatsuri 2014 http://scalamatsuri.org/en/

Citation preview

Page 1: sbt, past and future / sbt, 傾向と対策

sbt, past and future

eugene yokota (@eed3si9n, @eed3si9n_ja)

sbt、傾向と対策

Page 2: sbt, past and future / sbt, 傾向と対策

demo

Page 3: sbt, past and future / sbt, 傾向と対策

sbt

• interactive build tool

– build definition (build.sbt)

– sbt shell

インタラクティブなビルドツール

ビルド定義と シェルから構成される

Page 4: sbt, past and future / sbt, 傾向と対策

build

• sets of projects

ビルド: プロジェクトの集合

Page 5: sbt, past and future / sbt, 傾向と対策

project

• configuration

• settings

• (scalaVersion)

プロジェクト: コンフィグレーションとセッティングと (scalaVersion)

Page 6: sbt, past and future / sbt, 傾向と対策

settings

• transformation of key-value map

セッティングは key-value マップの変換

key value

name helloWorld

version 0.1.0-SNAPSHOT

organization com.example

Page 7: sbt, past and future / sbt, 傾向と対策

settings

• transformation of key-value map

key := { val x = otherKey.value x + 1 } key += { ... } key ++= Seq(...)

セッティングは key-value マップの変換

Page 8: sbt, past and future / sbt, 傾向と対策

scoped keys

• entry point for sbt shell

• Attributes:

– key name

– key type

– project (default "This")

– configuration (default "This")

– in-task (default "This")

– (implicitly, scalaVersion)

スコープ付けされたキー

キー名、キー型、プロジェクト、コンフィギュレーション、in タスク、(scalaVersion)

Page 9: sbt, past and future / sbt, 傾向と対策

scoped keys

• entry point for sbt shell

{url}proj-id/config:inTask::keyName

keyName in (proj, Compile, inTask) := { ... }

• in build.sbt

sbt シェルへの入り口

build.sbt での記法と異なる

Page 10: sbt, past and future / sbt, 傾向と対策

when "This" is used

• shell will default to "This"

• default delegation rule

– project: x, ThisBuild, then Global

– configuration: in the order of ivyConfigurations, then Global

– task: no delegation

シェルで軸に指定が無い場合は This

This の委譲のルール

Page 11: sbt, past and future / sbt, 傾向と対策

configuration

• sets of source and library dependencies

– Compile

– Test

– etc.

コンフィギュレーションはソースとライブラリ依存性の集合

Page 12: sbt, past and future / sbt, 傾向と対策

library dependencies

• managed dependencies via Ivy

def specs2Version = "2.4.2" def specs2 = "org.specs2" %% "specs2" % specs2Version lazy val root = (project in file(".")). settings( scalaVersion := "2.11.2", libraryDependencies ++= Seq(specs2 % "test") )

Ivy 経由でライブラリ依存性を管理

Page 13: sbt, past and future / sbt, 傾向と対策

incremental compiler

• compile

compile と打ち込めばインクリメンタルコンパイルされる

Page 14: sbt, past and future / sbt, 傾向と対策

sbt 1.0 technology previews

• adding features to 0.13.x without breaking binary compatibility

sbt 1.0 は出したいけど、API が固定化する前に入れたいものもある

Page 15: sbt, past and future / sbt, 傾向と対策

0.13.5/6: Auto plugins

• default features as auto plugins

• manages plugin dependencies

– triggered plugins (e.g. coffeescript on all web)

次世代プラグイン。プラグイン同士の依存性を追跡

自動的にセッティング順を計算

Page 16: sbt, past and future / sbt, 傾向と対策

0.13.6: HTTPS by default

• Maven Central

• Typesafe repositories

• sbt plugin repository

HTTPS がデフォルト

Page 17: sbt, past and future / sbt, 傾向と対策

0.13.6: Consolidated resolution

• resolution performance improvement sponsored by LinkedIn

• consolidates sub-project dependency resolution with identical dependency graph def commonSettings = Seq( updateOptions := updateOptions.value.withConsolidatedResolution(true) ) lazy val app = (project in file("app")). settings(commonSettings: _*)

ライブラリ依存性のグラフが同一な場合に解決を一括化

Page 18: sbt, past and future / sbt, 傾向と対策

0.13.6: Eviction warning

• eviction

– when multiple versions are found on resolved dependencies tree, sbt selects the latest by default.

• 0.13.6 guesses binary incompatible evictions [warn] There may be incompatibilities among your library dependencies. [warn] Here are some of the libraries that were evicted: [warn] * commons-io:commons-io:1.3 -> 2.1 [warn] Run 'evicted' to see detailed eviction warnings

eviction: 同じライブラリの複数のバージョンがあった場合の「追い出し」 バイナリ互換性が無い eviction の推論

Page 19: sbt, past and future / sbt, 傾向と対策

0.13.6: Unresolved Exception

• guesses dependencies tree of unresolved dependencies [warn] Note: Unresolved dependencies path: [warn] foundrylogic.vpp:vpp:2.2.1 [warn] +- org.apache.cayenne:cayenne-tools:3.0.2 [warn] +- org.apache.cayenne.plugins:maven-cayenne-plugin:3.0.2 (C:\cygwin64\home\eed3si9n\work\helloworld\build.sbt#L12) [warn] +- root:root_2.11:0.1-SNAPSHOT

解決不能なライブラリ依存性のエラー表示の改善

Page 20: sbt, past and future / sbt, 傾向と対策

0.13.6: –SNAPSHOT handling

• checks all resolvers for the latest (This could slow things down)

• sbt used to pick the first one it found

-SNAPSHOT 処理の改善

以前はキャッシュから JAR を消す必要があった

Page 21: sbt, past and future / sbt, 傾向と対策

0.13.x: sbt server

• better integration with IDE, vim/emacs/sublime, Jenkins, Activator, etc

• many possibilities (remote compilation, caching, inter-project communication)

IDE や他のツールとの統合

リモートコンパイルなど多くの可能性がある

Page 22: sbt, past and future / sbt, 傾向と対策

0.13.x: more performance updates

• cablecar: Ivy "rewrite" prototype in Scala

– https://github.com/sbt/sbt/tree/wip/cablecar

• or, enhancement on consolidated resolution (global cache, support for different graphs)

• resolution performance improvement

sponsored by LinkedIn

cablecar: Ivy のライブラリ解決機能の Scala rewrite プロトタイプ

解決の一括化をさらに改善すればその方向の方が速くなるかも

Page 23: sbt, past and future / sbt, 傾向と対策

thanks!