• This repository has been archived on 18/Sep/2021
  • Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created over 14 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A slightly more standard sbt project plugin library

standard-project

Standard-project is a basic set of extensions to sbt to codify best practices.

General Usage

Getting StandardProject

To make a plugin available to your project definition you need to create a file called "Plugins.scala" in the project/plugins directory of your project. This is pretty straightforward boilerplate. An example is

import sbt._

class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val twitterRepo = "twitter-repo" at "http://maven.twttr.com/"
  val standardProject = "com.twitter" % "standard-project" % "0.11.16"
}

Extending a StandardProject base

In general a project will extend either StandardServiceProject (if it's are an application) or StandardLibraryProject (if it's a library). It will then

  • Specify its specific dependencies
  • Optionally specify its main class

A full project specification follows

import sbt._
import com.twitter.sbt._

class MyProject(info: ProjectInfo) extends StandardServiceProject(info) {
  val utilCore = "com.twitter" % "util-core" % "1.2.4"
  override def mainClass = Some("com.example.awesome.MyClass")
}

Reference

Extensible Classes

Instead of extending SBT's DefaultProject or DefaultParentProject, standard-project provides the following project classes you can extend.

StandardProject

This extends SBT's DefaultProject, and mixes in the following traits

  • StandardManagedProject
  • DependencyChecking
  • PublishLocalWithMavenStyleBasePattern
  • PublishSourcesAndJavadocs
  • BuildProperties
  • Ramdiskable

It sets up an optional ivy cache directory specified by the SBT_CACHE environment variable, and sets up a resolver to point to libs/, allowing you to stick jars of the form [artifact]-[revision].jar in libs.

The Scala/Java compile order is set to JavaThenScala, and some handy default compile options are set.

The test action is overridden to allow disabling by setting the environment variable NO_TESTS to 1.

StandardParentProject

Extends SBT's ParentProject and mixes in StandardManagedProject. This pretty much just lets you have subproject in a StandardProject setting.

StandardLibraryProject

Extends StandardProject and mixes in PackageDist. This is intended for use by libraries, i.e. projects that don't package and distribute an executable.

StandardServiceProject

Extends StandardProject and mixes in PackageDist. This is intended for use by "services", i.e. those applications that package and distribute something with a commonly executed main method

Traits

AdhocInlines

Allows specifying dependencies that you have the source for, via the following construct

val util = "com.twitter" % "util" % "1.1.3" relativePath("util")

This tells SBT to build util from source when possible, and use the artifact it puts into target as your dependency. Using adhoc inlines allows you to more easily make changes across multiple projects.

In order to use AdhocInlines functionality you must set the SBT_ADHOC_INLINE environment variable.

BuildProperties

Generates an object that contains your build info, e.g.

// AUTOGENERATED BY STANDARD-PROJECT. TURN BACK WHILE YOU STILL CAN!
package com.twitter.sbt
object BuildInfo {
  val version = "0.11.12-SNAPSHOT"
  val date = "2011-04-14"
}

It will be placed into your projects main package as defined in build.properties

CorrectDependencies

Enforces stronger maven/ivy dependency checking, and whines if there are version incompatibilities in the dependency tree.

DefaultRepos

Sets up a standard set of repositories for your project. It uses the following environment variables

  • SBT_PROXY_REPO - If defined, use the given url as the only resolver.
  • SBT_OPEN_TWITTER - If defined, use Twitter's internal open-source artifactory repo as the only resolver. This is intended for use by open source projects that can't pull from Twitter's private repo.
  • SBT_TWITTER - If defined, use Twitter's internal artifactory repo. (deprecated)

If none of these are set, it falls back to a list of "standard" repos.

DependencyChecking

Fails the build if your managed libraries directory doesn't exist (i.e. you haven't run sbt update)

EnsimeGenerator

Adds an action to generate a .ensime file for the project. Should really be a processor.

Environmentalist

Sets up a Map representation of the current environment in the val "environment"

FileFilter

Simple token replacement for source files. To replace all instances of "@foo@" with "bar" in source and write it to destination, do

filter(source, destination, Map("foo" -> "bar")

GitHelpers

Adds several utilities to tag/commit/check the current git tree

GithubPublisher

Support for publishing artifacts to github.

InlineDependencies

Predecessor of AdhocInlines??? Used by AdhocInlines???

IntegrationSpecs

Adds an integration-test action that will run all specs that end with "IntegrationSpec". Also excludes all IntegrationSpecs from the regular test actian.

LibDirClasspath

Adds all jar files in "lib" to the classpath. Semi-deprecated?

ManagedClasspathFilter

Scary stuff I don't understand very well.

NoisyDependencies

Make SBT bitch more about version mismatches?

PackageDist

Adds a package-dist action that wraps up scala stuff into our standard zip layout for deploys.

ProjectCache

Used to avoid multiple instantiation of projects across inline/birdcage builds.

ProjectDependencies

Predecessor to AdhocInlines?

PublishLocalWithMavenStyleBasePattern

Force publish-local to lay things out maven style. There were problems in the past with publish-local'd ivy style artifacts not picking up transitive dependencies. Bludgeoning SBT into maven style for this action seemed to fix it.

PublishSite

Builds a dope website including a processed README.md, anything in your src/site directory, and your generated javadoc.

Also adds a task to publish said site to a git repo.

PublishSourcesAndJavadocs

make publish and publish-local build/package/publish a -javadoc.jar and -sources.jar. Makes IDE users happy.

Ramdiskable

Provides the capability to compile to a ramdisk instead of the regular "target" subdirectory. If the environment SBT\_RAMDISK\_ROOT is set, a target-ramdisk directory will be softlinked to SBT\_RAMDISK\_ROOT and will be used as the output path.

ReleaseManagement

A helper for bumping versions and publishing artifacts. If you're releasing stable versions you should mix this in. If you mix it in you should only use this to bump versions in build.properties. It's better that way.

SourceControlledProject

Support for getting git shas into currentRevision

StandardManagedProject

Mixes in

  • SourceControlledProject
  • ReleaseManagement
  • Versions
  • Environmentalist

Also disables cross compiling, sets managed style to maven and clears your local repo list

StrictDependencies

Have Ivy resolve conflicts by failing the build.

SubversionPublisher

Publish to an SVN repository (which presumably then has some magic in place to get artifacts published to an actual publc repo). Typically used by overriding subversionRepository, e.g.

override def subversionRepository = Some("http://svn.me.com/repo")

ArtifactoryPublisher

publish to a standard ibiblio resolver. This has odd interactions with SubversionPublisher for historical reasons. Be careful: you must mix this in after SubversionPublisher if you use both.

There are two additional environment variables that control the actual resolver used to publish.

  1. if SBT_PROXY_PUBLISH is set and proxyPublishRepo is defined, proxyPublishRepo is used
  2. if SBT_PROXY_PUBLISH_REPO is set, it is used as the root URL to publish to

Credentials are read from ~/.artifactory-credentials, and look like the following {code} realm=Artifactory Realm host= user= password= {code}

Settings of interest

  • proxyPublishRepo: Option[String] - the base url of the repo to publish to.
  • proxyQualifier: String - used to build up proxyRepoPublishTarget
  • proxySnapshotOrRelease: String - used to define the resolver type as well as build up proxyRepoPublishtarget
  • proxyRepoPublishTarget: String - the uri within proxyPublishRepo to publish to. Defaults to {code} "libs-%ss-%s".format(proxySnapshotOrRelease, proxyQualifier) {code}
  • proxyPublish: Boolean - whether or not to use the proxy to publish. Defaults to {code} environment.get("SBT_CI").isDefined {code}
  • repositories: Seq[Resolver] - adds the proxy resolver to repositories if it's defined

TartifactoryRepos

Sort of deprecated, more or less does what DefaultRepos does now. Use DefaultRepos instead.

TartifactoryPublisher

Deprecated. See ArtifactoryPublisher.

Publish to an artifactory instance. You'll need to enter credentials at the command line for each publish, or override publishtask yourself.

TemplateProject

Allow preprocessing of source files using fmpp?

UnpublishedProject

Overrides publish/deliver to do nothing

Versions

Adds tasks for bumping the major, minor and patch versions of a project.

More Repositories

1

snowflake

Snowflake is a network service for generating unique ID numbers at high scale with some simple guarantees.
Scala
7,648
star
2

diffy

Find potential bugs in your services with Diffy
Scala
3,825
star
3

flockdb

A distributed, fault-tolerant graph database
Scala
3,337
star
4

kestrel

simple, distributed message queue system (inactive)
Scala
2,774
star
5

twui

A UI framework for Mac based on Core Animation
Objective-C
2,740
star
6

CocoaSPDY

SPDY for iOS and OS X
Objective-C
2,389
star
7

gizzard

[Archived] A flexible sharding framework for creating eventually-consistent distributed datastores
Scala
2,256
star
8

distributedlog

A high performance replicated log service. (The development is moved to Apache Incubator)
Java
2,224
star
9

recess

A simple and attractive code quality tool for CSS built on top of LESS
CSS
2,187
star
10

commons

Twitter common libraries for python and the JVM (deprecated)
Java
2,099
star
11

iago

A load generator, built for engineers
Scala
1,347
star
12

twitter-text-js

A JavaScript implementation of Twitter's text processing library
1,211
star
13

ambrose

A platform for visualization and real-time monitoring of data workflows
Java
1,181
star
14

twitter-kit-android

Twitter Kit for Android
Java
831
star
15

ostrich

A stats collector & reporter for Scala servers (deprecated)
Scala
773
star
16

twitter-kit-ios

Twitter Kit is a native SDK to include Twitter content inside mobile apps.
Objective-C
690
star
17

twitter-text-rb

A library that does auto linking and extraction of usernames, lists and hashtags in tweets
613
star
18

mysos

Cotton (formerly known as Mysos)
590
star
19

twitter-text-objc

An Objective-C implementation of Twitter's text processing library
587
star
20

torch-autograd

Autograd automatically differentiates native Torch code
Lua
559
star
21

ospriet

An example audience moderation app built on Twitter
JavaScript
408
star
22

cloudhopper-smpp

Efficient, scalable, and flexible Java implementation of the Short Messaging Peer to Peer Protocol (SMPP)
Java
382
star
23

twitter-text-java

A Java implementation of Twitter's text processing library
364
star
24

jvmgcprof

A simple utility for profile allocation and garbage collection activity in the JVM
C
342
star
25

css-flip

A CSS BiDi flipper
JavaScript
313
star
26

clockworkraven

Human-Powered Data Analysis with Mechanical Turk
Ruby
300
star
27

torch-twrl

Torch-twrl is a package that enables reinforcement learning in Torch.
Lua
251
star
28

cassie

A Scala client for Cassandra
Scala
244
star
29

twemperf

A tool for measuring memcached server performance
C
242
star
30

hdfs-du

Visualize your HDFS cluster usage
JavaScript
230
star
31

pycascading

A Python wrapper for Cascading
Python
222
star
32

RTLtextarea

Automatically detects RTL and configures a text input
JavaScript
169
star
33

haplocheirus

A Redis-backed storage engine for timelines
Scala
133
star
34

torch-decisiontree

This project implements random forests and gradient boosted decision trees (GBDT). The latter uses gradient tree boosting. Both use ensemble learning to produce ensembles of decision trees (that is, forests).
Lua
129
star
35

elephant-twin

Elephant Twin is a framework for creating indexes in Hadoop
Java
96
star
36

torch-ipc

A set of primitives for parallel computation in Torch
C
95
star
37

torch-distlearn

A set of distributed learning algorithms for Torch
Lua
93
star
38

libcrunch

A lightweight mapping framework that maps data objects to a number of nodes, subject to constraints
Java
92
star
39

scribe

A Ruby client library for Scribe
Ruby
90
star
40

sbt-package-dist

sbt 11 plugin codifying best practices for building, packaging, and publishing
Scala
88
star
41

twisitor

A simple and spectacular photo-tweeting birdhouse
JavaScript
84
star
42

flockdb-client

A Ruby client library for FlockDB
Ruby
81
star
43

code-of-conduct

Open Source Code of Conduct at Twitter
80
star
44

twitter-text-conformance

Conformance testing data for the twitter-text-* repositories
77
star
45

torch-dataset

An extensible and high performance method of reading, sampling and processing data for Torch
Lua
76
star
46

cdk

CDK is a tool to quickly generate single-file html slide presentations from AsciiDoc
CSS
74
star
47

naggati2

Protocol builder for netty using scala (DEPRECATED)
Scala
74
star
48

twitter-kit-unity

Twitter Kit for Unity
C#
71
star
49

plumage.js

Batteries Included App Framework for Data Intensive UIs
JavaScript
66
star
50

gozer

Prototype mesos framework using new low-level API built in Go
Go
61
star
51

bookkeeper

Twitter's fork of Apache BookKeeper (will push changes upstream eventually)
Java
59
star
52

grabby-hands

A JVM Kestrel client that aggregates queues from multiple servers. Implemented in Scala with Java bindings. In use at Twitter for all JVM Search and Streaming Kestrel interactions.
Scala
56
star
53

gizzmo

A command-line client for Gizzard
Ruby
54
star
54

thrift

Twitter's out-of-date, forked thrift
C++
53
star
55

libkestrel

libkestrel
Scala
47
star
56

time_constants

Time constants, in seconds, so you don't have to use slow ActiveSupport helpers
Ruby
47
star
57

sbt-scrooge

An SBT plugin that adds a mixin for doing Thrift code auto-generation during your compile phase
Scala
44
star
58

cli-guide.js

CLI Guide JQuery Plugin
JavaScript
41
star
59

sbt-thrift

sbt rules for generating source stubs out of thrift IDLs, for java & scala
Ruby
38
star
60

jaqen

A type-safe heterogenous Map or a Named field Tuple
Scala
35
star
61

spitball

A very simple gem package generation tool built on bundler
Ruby
33
star
62

torch-thrift

A Thrift codec for Torch
C
29
star
63

jsr166e

JSR166e for Twitter
Java
27
star
64

unishark

Unishark: Another unittest extension for Python
Python
26
star
65

raggiana

A simple standalone Finagle stats viewer
JavaScript
21
star
66

sekhmet

foundational tools and building blocks for gaining insights and diagnosing system health in real-time
20
star
67

periscope-live-engagement-unity-sdk

Periscope Live Engagement Unity SDK
C#
20
star
68

twitterActors

Improved Scala actors library; used internally at Twitter
Scala
19
star
69

finatra-activator-http-seed

Typesafe activator template for constructing a Finatra HTTP server application:
Scala
18
star
70

killdeer

Killdeer is a simple server for replaying a sample of responses to sythentically recreate production response characteristics.
Scala
16
star
71

elephant-twin-lzo

Elephant Twin LZO uses Elephant Twin to create LZO block indexes
Java
15
star
72

bittern

Bittern Cache uses nvdimm to speed up block io operations
C
14
star
73

finatra-activator-thrift-seed

Typesafe activator template for constructing a Finatra Thrift server application: https://twitter.github.io/finatra/user-guide/ —
Scala
11
star
74

chainsaw

A thin Scala wrapper for SLF4J
Scala
10
star
75

PerfTracepoint

Perf tracepoint support for the JVM
Java
7
star
76

oscon-puzzles

OSCON 2014 Puzzle
JavaScript
7
star
77

scala-json

JSON in Scala (deprecated)
Scala
5
star
78

scala-csp-config

A Scala library for configuring Content Security Policy headers for HTTP responses.
Scala
4
star
79

.github

3
star
80

finatra-misc

Miscellaneous libraries and utils used by Finatra
Scala
3
star
81

autolog-clustering

USF Capstone Project for Auto-log Clustering
Python
1
star