Skip to content

Commit

Permalink
Add 'zinc/' from commit '609ee645c61dc7970b008c25c7a7dd94c21be865'
Browse files Browse the repository at this point in the history
git-subtree-dir: zinc
git-subtree-mainline: 85fd6a4
git-subtree-split: 609ee64
  • Loading branch information
Tom Howland committed Apr 21, 2015
2 parents 85fd6a4 + 609ee64 commit a833e89
Show file tree
Hide file tree
Showing 118 changed files with 5,138 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zinc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project/project
project/local.sbt
target
.idea
*.jar
*.iml
10 changes: 10 additions & 0 deletions zinc/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: scala
script:
- sbt scriptit
jdk:
- openjdk6
notifications:
email:
# TODO: change to [email protected] once permissions to send emails from
# Travis to zinc group are sorted out
- [email protected]
99 changes: 99 additions & 0 deletions zinc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Typesafe Project & Developer Guidelines

These guidelines are meant to be a living document that should be changed and adapted as needed. We encourage changes that makes it easier to achieve our goals in an efficient way.

These guidelines mainly applies to Typesafe’s “mature” projects - not necessarily to projects of the type ‘collection of scripts’ etc.

## General Workflow

This is the process for committing code into master. There are of course exceptions to these rules, for example minor changes to comments and documentation, fixing a broken build etc.

1. Make sure you have signed the [Typesafe CLA](http://www.typesafe.com/contribute/cla), if not, sign it online.
2. Before starting to work on a feature or a fix, you have to make sure that:
1. There is a ticket for your work in the project's issue tracker. If not, create it first.
2. The ticket has been scheduled for the current milestone.
3. The ticket is estimated by the team.
4. The ticket have been discussed and prioritized by the team.
3. You should always perform your work in a Git feature branch. The branch should be given a descriptive name that explains its intent. Some teams also like adding the ticket number and/or the [GitHub](http://github.com) user ID to the branch name, these details is up to each of the individual teams.
4. When the feature or fix is completed you should open a [Pull Request](https://help.github.com/articles/using-pull-requests) on GitHub.
5. The Pull Request should be reviewed by other maintainers (as many as feasible/practical). Note that the maintainers can consist of outside contributors, both within and outside Typesafe. Outside contributors (for example from EPFL or independent committers) are encouraged to participate in the review process, it is not a closed process.
6. After the review you should fix the issues as needed (pushing a new commit for new review etc.), iterating until the reviewers give their thumbs up.
7. Once the code has passed review the Pull Request can be merged into the master branch.

## Pull Request Requirements

For a Pull Request to be considered at all it has to meet these requirements:

1. Live up to the current code standard:
- Not violate [DRY](http://programmer.97things.oreilly.com/wiki/index.php/Don%27t_Repeat_Yourself).
- [Boy Scout Rule](http://programmer.97things.oreilly.com/wiki/index.php/The_Boy_Scout_Rule) needs to have been applied.
2. Regardless if the code introduces new features or fixes bugs or regressions, it must have comprehensive tests.
3. The code must be well documented in the Typesafe's standard documentation format (see the ‘Documentation’ section below).

If these requirements are not met then the code should **not** be merged into master, or even reviewed - regardless of how good or important it is. No exceptions.

## Continuous Integration

Each project should be configured to use a continuous integration (CI) tool (i.e. a build server ala Jenkins). Typesafe has a Jenkins server farm that can be used. The CI tool should, on each push to master, build the **full** distribution and run **all** tests, and if something fails it should email out a notification with the failure report to the committer and the core team. The CI tool should also be used in conjunction with Typesafe’s Pull Request Validator (discussed below).

## Documentation

All documentation should be generated using the sbt-site-plugin, *or* publish artifacts to a repository that can be consumed by the typesafe stack.

All documentation must abide by the following maxims:

- Example code should be run as part of an automated test suite.
- Version should be **programmatically** specifiable to the build.
- Generation should be **completely automated** and available for scripting.
- Artifacts that must be included in the Typesafe Stack should be published to a maven “documentation” repository as documentation artifacts.

All documentation is preferred to be in Typesafe's standard documentation format [reStructuredText](http://doc.akka.io/docs/akka/snapshot/dev/documentation.html) compiled using Typesafe's customized [Sphinx](http://sphinx.pocoo.org/) based documentation generation system, which among other things allows all code in the documentation to be externalized into compiled files and imported into the documentation.

For more info, or for a starting point for new projects, look at the [Typesafe Documentation Template project](https://github.com/typesafehub/doc-template)

For larger projects that have invested a lot of time and resources into their current documentation and samples scheme (like for example Play), it is understandable that it will take some time to migrate to this new model. In these cases someone from the project needs to take the responsibility of manual QA and verifier for the documentation and samples.

## Work In Progress

It is ok to work on a public feature branch in the GitHub repository. Something that can sometimes be useful for early feedback etc. If so then it is preferable to name the branch accordingly. This can be done by either prefix the name with ``wip-`` as in ‘Work In Progress’, or use hierarchical names like ``wip/..``, ``feature/..`` or ``topic/..``. Either way is fine as long as it is clear that it is work in progress and not ready for merge. This work can temporarily have a lower standard. However, to be merged into master it will have to go through the regular process outlined above, with Pull Request, review etc..

Also, to facilitate both well-formed commits and working together, the ``wip`` and ``feature``/``topic`` identifiers also have special meaning. Any branch labelled with ``wip`` is considered “git-unstable” and may be rebased and have its history rewritten. Any branch with ``feature``/``topic`` in the name is considered “stable” enough for others to depend on when a group is working on a feature.

## Creating Commits And Writing Commit Messages

Follow these guidelines when creating public commits and writing commit messages.

1. If your work spans multiple local commits (for example; if you do safe point commits while working in a feature branch or work in a branch for long time doing merges/rebases etc.) then please do not commit it all but rewrite the history by squashing the commits into a single big commit which you write a good commit message for (like discussed in the following sections). For more info read this article: [Git Workflow](http://sandofsky.com/blog/git-workflow.html). Every commit should be able to be used in isolation, cherry picked etc.
2. First line should be a descriptive sentence what the commit is doing. It should be possible to fully understand what the commit does by just reading this single line. It is **not ok** to only list the ticket number, type "minor fix" or similar. Include reference to ticket number, prefixed with #, at the end of the first line. If the commit is a small fix, then you are done. If not, go to 3.
3. Following the single line description should be a blank line followed by an enumerated list with the details of the commit.
4. Add keywords for your commit (depending on the degree of automation we reach, the list may change over time):
* ``Review by @gituser`` - if you want to notify someone on the team. The others can, and are encouraged to participate.
* ``Fix/Fixing/Fixes/Close/Closing/Refs #ticket`` - if you want to mark the ticket as fixed in the issue tracker (Assembla understands this).
* ``backport to _branch name_`` - if the fix needs to be cherry-picked to another branch (like 2.9.x, 2.10.x, etc)

Example:

Adding monadic API to Future. Fixes #2731

* Details 1
* Details 2
* Details 3

## How To Enforce These Guidelines?

### Make Use Of Typesafe’s Pull Request Validator
It is recommended to set up the project to use Typesafe’s [Pull Request Validator](https://github.com/typesafehub/ghpullrequest-validator) that automatically merges the code, builds it, runs the tests and comments on the Pull Request in GitHub.

### Add A CONTRIBUTING.md File To GitHub

It is recommended that each project add a ``CONTRIBUTING.md`` file (preferably this document) to their project on GitHub. This makes people get a notice about it when they try to open a Pull Request. Read more about it [here](https://github.com/blog/1184-contributing-guidelines).

## Misc Topics

### SIPs (only applies to Scala project)
A SIP (Scala Improvement Process) needs an implementation, including cross-feature testing before we can accept it. There should be a clear distinction between "Approved To Develop" vs. "Accepted For Release X".

# Future Goals

* Using a single Issue Tracker for all projects.
* Get all projects to use the documentation scheme and generation as outlined above
155 changes: 155 additions & 0 deletions zinc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
Zinc
====

Zinc is a stand-alone version of [sbt]'s incremental compiler.

Download the [latest stable version][download].

[sbt]: http://github.com/sbt/sbt
[download]: http://downloads.typesafe.com/zinc/0.3.5.3/zinc-0.3.5.3.tgz


Build
-----

Zinc is built using sbt 0.13. To create the full distribution:

sbt universal:packageZipTarball

Previously published distributions up to 0.3.1-M1 relase can be found in the [old zinc repo].
Newer distributions are hosted under [Typesafe downloads].

[old zinc repo]: http://repo.typesafe.com/typesafe/zinc/com/typesafe/zinc/dist/
[Typesafe downloads]: http://downloads.typesafe.com/zinc/

Here's the table of final releases in 0.3.x series:

| zinc version | sbt version | Download |
|--------------|-------------|---------------------------------------------------------------------------------|
| 0.3.0 | 0.13.0 | [zinc-0.3.0.tgz](http://downloads.typesafe.com/zinc/0.3.0/zinc-0.3.0.tgz) |
| 0.3.1 | 0.13.1 | [zinc-0.3.1.tgz](http://downloads.typesafe.com/zinc/0.3.1/zinc-0.3.1.tgz) |
| 0.3.2 | 0.13.2 | [zinc-0.3.2.tgz](http://downloads.typesafe.com/zinc/0.3.1/zinc-0.3.2.tgz) |
| 0.3.5 | 0.13.5 | [zinc-0.3.5.tgz](http://downloads.typesafe.com/zinc/0.3.5/zinc-0.3.5.tgz) |
| 0.3.5.1 | 0.13.5 | [zinc-0.3.5.1.tgz](http://downloads.typesafe.com/zinc/0.3.5.1/zinc-0.3.5.1.tgz) |
| 0.3.5.2 | 0.13.5 | [zinc-0.3.5.2.tgz](http://downloads.typesafe.com/zinc/0.3.5.2/zinc-0.3.5.2.tgz) |
| 0.3.5.3 | 0.13.5 | [zinc-0.3.5.3.tgz](http://downloads.typesafe.com/zinc/0.3.5.3/zinc-0.3.5.3.tgz) |


Options
-------

To get information about options run `zinc -help`.

### Compile

As for `scalac` the main options for compiling are `-classpath` for specifying
the classpath elements, and `-d` for selecting the output directory. Anything
passed on the command-line that is not an option is considered to be a source
file.

### Scala

Zinc needs to locate the Scala compiler jar, Scala library jar, and any extra
Scala jars (like Scala reflect). There are three alternative ways to specify the
Scala jars.

Using `-scala-home` point to the base directory of a Scala distribution (which
needs to contain a `lib` directory with the Scala jars).

Using `-scala-path` the compiler, library, and any extra jars (like scala
reflect) can be listed directly as a path.

Using `-scala-library` to directly specify the Scala library, `-scala-compiler`
to specify the Scala compiler, and `-scala-extra` to specify any extra Scala
jars.

If no options are passed to locate a version of Scala then Scala 2.9.2 is used
by default (which is bundled with zinc).

To pass options to scalac simply prefix with `-S`. For example, deprecation
warnings can be enabled with `-S-deprecation`. For multi-part options add the
`-S` prefix to all parts. For example, the sourcepath option can be specified
with `-S-sourcepath -S/the/source/path`.

### Java

To select a different `javac` to compile Java sources, use the `-java-home`
option. To pass options to javac, prefix with `-C`.

If mixed Java and Scala sources are being compiled then the compile order can be
specified with `-compile-order`, where the available orders are `Mixed`,
`JavaThenScala`, or `ScalaThenJava`. The default order is `Mixed`.

If only Java sources are being compiled then the `-java-only` option can be
added to avoid the Scala library jar being automatically added to the classpath.

### Nailed

Zinc comes with built-in [Nailgun] integration. Running with Nailgun provides
zinc as a server, communicating commands via a client, keeping cached compilers
in a warm running JVM and avoiding startup and load times.

To run zinc as a build daemon add the `-nailed` option to all commands, or
`alias zinc="zinc -nailed"`.

Nailgun client binaries for common platforms are bundled with zinc. If an `ng`
client is on the current path then this will be used instead.

To shutdown the zinc server run `zinc -shutdown`. To list currently cached zinc
compilers use `zinc -status`.

[Nailgun]: http://www.martiansoftware.com/nailgun

### Logging

The log level can be set directly with `-log-level debug|info|warn|error`. Or to
set to debug use `-debug`. To silence all logging use `-quiet`.

### Analysis

The analysis used to determine which files to incrementally recompile is stored
in a file. The default location for the analysis cache is relative to the output
directory. To specify a different location for the analysis cache use the
`-analysis-cache` option. When compiling multiple projects, and the analysis
cache is not at the default location, then a mapping from output directory to
cache file for any upstreams projects should also be provided with the
`-analysis-map` option.

### Incremental Compiler

There are options for configuring the incremental compiler. One useful option is
`-transactional`, which will restore the previous class files on compilation
failure. This allows fixes to be made before retrying incremental compilation,
rather than forcing recompilation of larger parts of the source tree due to the
error and deleted class files.

See `zinc -help` for information about all options.


Contributions
-------------------

Contributions via GitHub pull requests are gladly accepted from their original
author. Before we can accept pull requests, you will need to agree to the
[Typesafe Contributor License Agreement][cla] online, using your GitHub account.

[cla]: http://www.typesafe.com/contribute/cla


License
-------

Copyright 2012 Typesafe, Inc.

Licensed under the [Apache License, Version 2.0][apache2] (the "License"); you
may not use this software except in compliance with the License. You may obtain
a copy of the License at:

[http://www.apache.org/licenses/LICENSE-2.0][apache2]

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

[apache2]: http://www.apache.org/licenses/LICENSE-2.0
81 changes: 81 additions & 0 deletions zinc/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Development Notes
=================

Information for developers.


Build
-----

To build everything:

sbt> dist/create

This will create a runnable zinc command at `dist/target/zinc-<VERSION>/bin/zinc`
that can be used for command-line based testing.


Publish Locally
---------------

The zinc libraries can also be published locally to the local ivy or maven
repositories.

Publish to `~/.ivy2/local`:

sbt> publish-local

Publish to `~/.m2/repository`:

sbt> set Publish.publishLocally := true
sbt> publish


Test
----

The build also has its own simple testing framework. Tests are in `src/scriptit`.
To run all the tests:

sbt> scriptit

You can run individual tests. For example:

sbt> scriptit analysis/rebase

Or groups of tests:

sbt> scriptit analysis/*

Tab completion available.

The default output from tests is minimal. You can show the full output of the
previous test run with:

sbt> last scriptit

Failures in tests will automatically show the full debug output.


Local sbt
---------

To build zinc against a locally published version of sbt, the sbt jars need to
be republished for maven under `com.typesafe.sbt`.

First publish [sbt] itself locally with:

sbt> publish-local

Use the [sbt-republish] project to publish sbt to the local maven repository
with:

sbt> set every publishLocally := true
sbt> publish

In the zinc project use only the local version of sbt with this setting:

sbt> set resolveSbtLocally := true

[sbt]: https://github.com/harrah/xsbt
[sbt-republish]: https://github.com/typesafehub/sbt-republish
33 changes: 33 additions & 0 deletions zinc/nailgun/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This Makefile has only been tested on linux. It uses
# MinGW32 to cross-compile for windows. To install and
# configure MinGW32 on linux, see http://www.mingw.org

# mingw32 compiler
# On Ubuntu 8.04 this is at:
# WIN32_CC=/usr/bin/i586-mingw32msvc-gcc
WIN32_CC=mingw32-gcc

CC=gcc
CFLAGS=-Wall -pedantic -s -O3
SRCDIR=src/c

ng: ${SRCDIR}/ng.c
@echo "Building ng client. To build a Windows binary, type 'make ng.exe'"
${CC} ${CFLAGS} -o ng ${SRCDIR}/ng.c

install: ng
install ng /usr/local/bin

ng.exe: ${SRCDIR}/ng.c
${WIN32_CC} -o ng.exe ${SRCDIR}/ng.c -lwsock32 -O3 ${CFLAGS}
# any idea why the command line is so sensitive to the order of
# the arguments? If CFLAGS is at the beginning, it won't link.

clean:
@echo ""
@echo "If you have a Windows binary, 'make clean' won't delete it."
@echo "You must remove this manually. Most users won't have MinGW"
@echo "installed - so I'd rather not delete something you can't rebuild."
@echo ""
rm -f ng
# rm -f ng.exe
Loading

0 comments on commit a833e89

Please sign in to comment.