This commit is contained in:
Patrik Nordwall 2011-05-10 09:59:35 +02:00
commit bfd3f22fb2
32 changed files with 663 additions and 246 deletions

View file

@ -46,6 +46,12 @@ object Supervision {
if (maxNrOfRetries < 0) None else Some(maxNrOfRetries), if (withinTimeRange < 0) None else Some(withinTimeRange))
}
/**
* Restart all actors linked to the same supervisor when one fails,
* trapExit = which Throwables should be intercepted
* maxNrOfRetries = the number of times an actor is allowed to be restarted
* withinTimeRange = millisecond time window for maxNrOfRetries, negative means no window
*/
case class AllForOneStrategy(override val trapExit: List[Class[_ <: Throwable]],
maxNrOfRetries: Option[Int] = None,
withinTimeRange: Option[Int] = None) extends FaultHandlingStrategy(trapExit) {
@ -68,6 +74,12 @@ object Supervision {
if (maxNrOfRetries < 0) None else Some(maxNrOfRetries), if (withinTimeRange < 0) None else Some(withinTimeRange))
}
/**
* Restart an actor when it fails
* trapExit = which Throwables should be intercepted
* maxNrOfRetries = the number of times an actor is allowed to be restarted
* withinTimeRange = millisecond time window for maxNrOfRetries, negative means no window
*/
case class OneForOneStrategy(override val trapExit: List[Class[_ <: Throwable]],
maxNrOfRetries: Option[Int] = None,
withinTimeRange: Option[Int] = None) extends FaultHandlingStrategy(trapExit) {

View file

@ -5,7 +5,6 @@
package akka.routing
import akka.actor.{Actor, ActorRef, PoisonPill}
import java.util.concurrent.TimeUnit
/**
* Actor pooling
@ -47,7 +46,6 @@ trait ActorPool {
*/
trait DefaultActorPool extends ActorPool { this: Actor =>
import ActorPool._
import collection.mutable.LinkedList
import akka.actor.MaximumNumberOfRestartsWithinTimeRangeReached
protected var _delegates = Vector[ActorRef]()

View file

@ -43,31 +43,51 @@ class AkkaLoader {
}
private def printBanner() {
println("==================================================")
println(" t")
println(" t t t")
println(" t t tt t")
println(" tt t t tt t")
println(" t ttttttt t ttt t")
println(" t tt ttt t ttt t")
println(" t t ttt t ttt t t")
println(" tt t ttt ttt ttt t")
println(" t t ttt ttt t tt t")
println(" t ttt ttt t t")
println(" tt ttt ttt t")
println(" ttt ttt")
println(" tttttttt ttt ttt ttt ttt tttttttt")
println(" ttt tt ttt ttt ttt ttt ttt ttt")
println(" ttt ttt ttt ttt ttt ttt ttt ttt")
println(" ttt ttt ttt ttt ttt tt ttt ttt")
println(" tttt ttttttttt tttttttt tttt")
println(" ttttttttt ttt ttt ttt ttt ttttttttt")
println(" ttt ttt ttt ttt ttt ttt ttt ttt")
println(" ttt ttt ttt ttt ttt ttt ttt ttt")
println(" ttt tt ttt ttt ttt ttt ttt ttt")
println(" tttttttt ttt ttt ttt ttt tttttttt")
println("==================================================")
println(" Running version " + Config.VERSION)
println("==================================================")
println("""
==============================================================================
ZZ:
ZZZZ
ZZZZZZ
ZZZ' ZZZ
~7 7ZZ' ZZZ
:ZZZ: IZZ' ZZZ
,OZZZZ.~ZZ? ZZZ
ZZZZ' 'ZZZ$ ZZZ
. $ZZZ ~ZZ$ ZZZ
.=Z?. .ZZZO ~ZZ7 OZZ
.ZZZZ7..:ZZZ~ 7ZZZ ZZZ~
.$ZZZ$Z+.ZZZZ ZZZ: ZZZ$
.,ZZZZ?' =ZZO= .OZZ 'ZZZ
.$ZZZZ+ .ZZZZ IZZZ ZZZ$
.ZZZZZ' .ZZZZ' .ZZZ$ ?ZZZ
.ZZZZZZ' .OZZZ? ?ZZZ 'ZZZ$
.?ZZZZZZ' .ZZZZ? .ZZZ? 'ZZZO
.+ZZZZZZ?' .7ZZZZ' .ZZZZ :ZZZZ
.ZZZZZZ$' .?ZZZZZ' .~ZZZZ 'ZZZZ.
NNNNN $NNNN+
NNNNN $NNNN+
NNNNN $NNNN+
NNNNN $NNNN+
NNNNN $NNNN+
=NNNNNNNNND$ NNNNN DDDDDD: $NNNN+ DDDDDN NDDNNNNNNNN,
NNNNNNNNNNNNND NNNNN DNNNNN $NNNN+ 8NNNNN= :NNNNNNNNNNNNNN
NNNNN$ DNNNNN NNNNN $NNNNN~ $NNNN+ NNNNNN NNNNN, :NNNNN+
?DN~ NNNNN NNNNN MNNNNN $NNNN+:NNNNN7 $ND =NNNNN
DNNNNN NNNNNDNNNN$ $NNNNDNNNNN :DNNNNN
ZNDNNNNNNNNND NNNNNNNNNND, $NNNNNNNNNNN DNDNNNNNNNNNN
NNNNNNNDDINNNNN NNNNNNNNNNND $NNNNNNNNNNND ONNNNNNND8+NNNNN
:NNNND NNNNN NNNNNN DNNNN, $NNNNNO 7NNNND NNNNNO :NNNNN
DNNNN NNNNN NNNNN DNNNN $NNNN+ 8NNNNN NNNNN $NNNNN
DNNNNO NNNNNN NNNNN NNNNN $NNNN+ NNNNN$ NNNND, ,NNNNND
NNNNNNDDNNNNNNNN NNNNN =NNNNN $NNNN+ DNNNN? DNNNNNNDNNNNNNNND
NNNNNNNNN NNNN$ NNNNN 8NNNND $NNNN+ NNNNN= ,DNNNNNNND NNNNN$
==============================================================================
Running version %s
==============================================================================
""".format(Config.VERSION))
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Before After
Before After

View file

@ -38,11 +38,11 @@
</a>
{%- else %}
{%- if logo -%}
<img class="rightlogo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
<img class="leftlogo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
{%- endif -%}
<h1 class="heading"><a href="{{ pathto('index') }}">
<span>{{ shorttitle|e }}</span></a></h1>
<h2 class="heading"><span>{{ title|striptags|e }}</span></h2>
<h1 class="heading"><a href="{{ pathto('index') }}">
<span>{{ shorttitle|e }}</span></a></h1>
<h2 class="heading"><span>Version {{ version|e }}</span></h2>
{%- endif %}
{%- endblock %}
</div>

View file

@ -112,13 +112,16 @@ div.header h2 {
font-size: 1.3em;
font-weight: normal;
letter-spacing: 1px;
text-transform: uppercase;
color: #aaa;
color: {{ theme_headingcolor }};
border: 0;
margin-top: -3px;
padding: 0;
}
div.header img.leftlogo {
float: left;
}
div.header img.rightlogo {
float: right;
}

View file

@ -7,7 +7,7 @@ Additional Information
add-on-modules
articles
benchmarks
recipes
recipies
external-sample-projects
companies-using-akka
third-party-integrations

View file

@ -28,9 +28,6 @@ show_authors = True
# -- Options for HTML output ---------------------------------------------------
html_theme = 'akka'
html_theme_options = {
'full_logo': 'true'
}
html_theme_path = ['_sphinx/themes']
html_title = 'Akka Documentation'

View file

@ -37,7 +37,7 @@ To check out the code using Git invoke the following::
$ git clone git://github.com/jboner/akka.git
Then you can navigate down to the tutorial::
Then you can navigate down to the tutorial::
$ cd akka/akka-tutorials/akka-tutorial-first
@ -58,39 +58,49 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka
-------------------------------
To build and run the tutorial sample from the command line, you have to download Akka. If you prefer to use SBT to build and run the sample then you can skip this section and jump to the next one.
To build and run the tutorial sample from the command line, you have to download
Akka. If you prefer to use SBT to build and run the sample then you can skip
this section and jump to the next one.
Let's get the ``akka-1.1`` distribution of Akka core (not Akka Modules) from `http://akka.io/downloads <http://akka.io/downloads/>`_. Once you have downloaded the distribution unzip it in the folder you would like to have Akka installed in, in my case I choose to install it in ``/Users/jboner/tools/``, simply by unzipping it to this directory.
Let's get the ``akka-actors-1.1.zip`` distribution of Akka from
http://akka.io/downloads/ which includes everything we need for this
tutorial. Once you have downloaded the distribution unzip it in the folder you
would like to have Akka installed in. In my case I choose to install it in
``/Users/jboner/tools/``, simply by unzipping it to this directory.
You need to do one more thing in order to install Akka properly: set the ``AKKA_HOME`` environment variable to the root of the distribution. In my case I'm opening up a shell, navigating down to the distribution, and setting the ``AKKA_HOME`` variable::
You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable::
$ cd /Users/jboner/tools/akka-1.1
$ cd /Users/jboner/tools/akka-actors-1.1
$ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME
/Users/jboner/tools/akka-1.1
/Users/jboner/tools/akka-actors-1.1
The distribution looks like this::
$ ls -l
total 16944
drwxr-xr-x 7 jboner staff 238 Apr 6 11:15 .
drwxr-xr-x 28 jboner staff 952 Apr 6 11:16 ..
drwxr-xr-x 17 jboner staff 578 Apr 6 11:16 deploy
drwxr-xr-x 26 jboner staff 884 Apr 6 11:16 dist
drwxr-xr-x 3 jboner staff 102 Apr 6 11:15 lib_managed
-rwxr-xr-x 1 jboner staff 8674105 Apr 6 11:15 scala-library.jar
drwxr-xr-x 4 jboner staff 136 Apr 6 11:16 scripts
$ ls -1
config
doc
lib
src
- In the ``dist`` directory we have the Akka JARs, including sources and docs.
- In the ``lib_managed/compile`` directory we have Akka's dependency JARs.
- In the ``deploy`` directory we have the sample JARs.
- In the ``scripts`` directory we have scripts for running Akka.
- Finally ``scala-library.jar`` is the JAR for the latest Scala distribution that Akka depends on.
- In the ``config`` directory we have the Akka conf files.
- In the ``doc`` directory we have the documentation, API, doc JARs, and also
the source files for the tutorials.
- In the ``lib`` directory we have the Scala and Akka JARs.
- In the ``src`` directory we have the source JARs for Akka.
The only JAR we will need for this tutorial (apart from the ``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``dist`` directory. This is a self-contained JAR with zero dependencies and contains everything we need to write a system using Actors.
The only JAR we will need for this tutorial (apart from the
``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``lib/akka``
directory. This is a self-contained JAR with zero dependencies and contains
everything we need to write a system using Actors.
Akka is very modular and has many JARs for containing different features. The core distribution has seven modules:
@ -115,6 +125,7 @@ information the module JARs are these:
- ``akka-spring-1.1.jar`` -- Spring framework integration
- ``akka-osgi-dependencies-bundle-1.1.jar`` -- OSGi support
Downloading and installing Maven
--------------------------------
@ -181,7 +192,7 @@ We also need to edit the ``pom.xml`` build file. Let's add the dependency we nee
<repository>
<id>Akka</id>
<name>Akka Maven2 Repository</name>
<url>http://www.scalablesolutions.se/akka/repository/</url>
<url>http://akka.io/repository/</url>
</repository>
</repositories>
@ -698,35 +709,42 @@ Before we package it up and run it, let's take a look at the full code now, with
}
}
Run it as a command line application
------------------------------------
To build and run the tutorial from the command line, you need to have the Scala library JAR on the classpath.
If you have not typed in (or copied) the code for the tutorial as
``$AKKA_HOME/tutorial/akka/tutorial/first/java/Pi.java`` then now is the
time. When that's done open up a shell and step in to the Akka distribution
(``cd $AKKA_HOME``).
Scala can be downloaded from `http://www.scala-lang.org/downloads <http://www.scala-lang.org/downloads>`_. Browse there and download the Scala 2.9.0.RC1 release. If you pick the ``tgz`` or ``zip`` distribution then just unzip it where you want it installed. If you pick the IzPack Installer then double click on it and follow the instructions.
First we need to compile the source file. That is done with Java's compiler
``javac``. Our application depends on the ``akka-actor-1.1.jar`` and the
``scala-library.jar`` JAR files, so let's add them to the compiler classpath
when we compile the source::
The ``scala-library.jar`` resides in the ``scala-2.9.0.RC1/lib`` directory. Copy that to your project directory.
$ javac -cp lib/scala-library.jar:lib/akka/akka-actor-1.1.jar tutorial/akka/tutorial/first/java/Pi.java
If you have not typed in (or copied) the code for the tutorial as ``$AKKA_HOME/tutorial/akka/tutorial/first/java/Pi.java`` then now is the time. When that's done open up a shell and step in to the Akka distribution (``cd $AKKA_HOME``).
First we need to compile the source file. That is done with Java's compiler ``javac``. Our application depends on the ``akka-actor-1.1.jar`` and the ``scala-library.jar`` JAR files, so let's add them to the compiler classpath when we compile the source::
$ javac -cp dist/akka-actor-1.1.jar:scala-library.jar tutorial/Pi.scala
When we have compiled the source file we are ready to run the application. This is done with ``java`` but yet again we need to add the ``akka-actor-1.1.jar`` and the ``scala-library.jar`` JAR files to the classpath as well as the classes we compiled ourselves::
When we have compiled the source file we are ready to run the application. This
is done with ``java`` but yet again we need to add the ``akka-actor-1.1.jar``
and the ``scala-library.jar`` JAR files to the classpath as well as the classes
we compiled ourselves::
$ java \
-cp dist/akka-actor-1.1.jar:scala-library.jar:tutorial \
-cp lib/scala-library.jar:lib/akka/akka-actor-1.1.jar:tutorial \
akka.tutorial.java.first.Pi
AKKA_HOME is defined as [/Users/jboner/src/akka-stuff/akka-core]
loading config from [/Users/jboner/src/akka-stuff/akka-core/config/akka.conf].
AKKA_HOME is defined as [/Users/jboner/tools/akka-actors-1.1]
loading config from [/Users/jboner/tools/akka-actors-1.1/config/akka.conf].
Pi estimate: 3.1435501812459323
Calculation time: 822 millis
Yippee! It is working.
If you have not defined the ``AKKA_HOME`` environment variable then Akka can't find the ``akka.conf`` configuration file and will print out a ``Cant load akka.conf`` warning. This is ok since it will then just use the defaults.
If you have not defined the ``AKKA_HOME`` environment variable then Akka can't
find the ``akka.conf`` configuration file and will print out a ``Cant load
akka.conf`` warning. This is ok since it will then just use the defaults.
Run it inside Maven
-------------------

View file

@ -43,39 +43,49 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka
-------------------------------
To build and run the tutorial sample from the command line, you have to download Akka. If you prefer to use SBT to build and run the sample then you can skip this section and jump to the next one.
To build and run the tutorial sample from the command line, you have to download
Akka. If you prefer to use SBT to build and run the sample then you can skip
this section and jump to the next one.
Let's get the ``akka-1.1`` distribution of Akka core (not Akka Modules) from `http://akka.io/downloads <http://akka.io/downloads/>`_. Once you have downloaded the distribution unzip it in the folder you would like to have Akka installed in, in my case I choose to install it in ``/Users/jboner/tools/``, simply by unzipping it to this directory.
Let's get the ``akka-actors-1.1.zip`` distribution of Akka from
http://akka.io/downloads/ which includes everything we need for this
tutorial. Once you have downloaded the distribution unzip it in the folder you
would like to have Akka installed in. In my case I choose to install it in
``/Users/jboner/tools/``, simply by unzipping it to this directory.
You need to do one more thing in order to install Akka properly: set the ``AKKA_HOME`` environment variable to the root of the distribution. In my case I'm opening up a shell, navigating down to the distribution, and setting the ``AKKA_HOME`` variable::
You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable::
$ cd /Users/jboner/tools/akka-1.1
$ cd /Users/jboner/tools/akka-actors-1.1
$ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME
/Users/jboner/tools/akka-1.1
/Users/jboner/tools/akka-actors-1.1
The distribution looks like this::
$ ls -l
total 16944
drwxr-xr-x 7 jboner staff 238 Apr 6 11:15 .
drwxr-xr-x 28 jboner staff 952 Apr 6 11:16 ..
drwxr-xr-x 17 jboner staff 578 Apr 6 11:16 deploy
drwxr-xr-x 26 jboner staff 884 Apr 6 11:16 dist
drwxr-xr-x 3 jboner staff 102 Apr 6 11:15 lib_managed
-rwxr-xr-x 1 jboner staff 8674105 Apr 6 11:15 scala-library.jar
drwxr-xr-x 4 jboner staff 136 Apr 6 11:16 scripts
$ ls -1
config
doc
lib
src
- In the ``dist`` directory we have the Akka JARs, including sources and docs.
- In the ``lib_managed/compile`` directory we have Akka's dependency JARs.
- In the ``deploy`` directory we have the sample JARs.
- In the ``scripts`` directory we have scripts for running Akka.
- Finally ``scala-library.jar`` is the JAR for the latest Scala distribution that Akka depends on.
- In the ``config`` directory we have the Akka conf files.
- In the ``doc`` directory we have the documentation, API, doc JARs, and also
the source files for the tutorials.
- In the ``lib`` directory we have the Scala and Akka JARs.
- In the ``src`` directory we have the source JARs for Akka.
The only JAR we will need for this tutorial (apart from the ``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``dist`` directory. This is a self-contained JAR with zero dependencies and contains everything we need to write a system using Actors.
The only JAR we will need for this tutorial (apart from the
``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``lib/akka``
directory. This is a self-contained JAR with zero dependencies and contains
everything we need to write a system using Actors.
Akka is very modular and has many JARs for containing different features. The core distribution has seven modules:
@ -84,7 +94,7 @@ Akka is very modular and has many JARs for containing different features. The co
- ``akka-remote-1.1.jar`` -- Remote Actors
- ``akka-stm-1.1.jar`` -- STM (Software Transactional Memory), transactors and transactional datastructures
- ``akka-http-1.1.jar`` -- Akka Mist for continuation-based asynchronous HTTP and also Jersey integration
- ``akka-slf4j-1.1.jar`` -- SLF4J Event Handler Listener
- ``akka-slf4j-1.1.jar`` -- SLF4J Event Handler Listener for logging with SLF4J
- ``akka-testkit-1.1.jar`` -- Toolkit for testing Actors
We also have Akka Modules containing add-on modules outside the core of
@ -100,6 +110,7 @@ information the module JARs are these:
- ``akka-spring-1.1.jar`` -- Spring framework integration
- ``akka-osgi-dependencies-bundle-1.1.jar`` -- OSGi support
Downloading and installing the Scala IDE for Eclipse
----------------------------------------------------

View file

@ -58,39 +58,49 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka
-------------------------------
To build and run the tutorial sample from the command line, you have to download Akka. If you prefer to use SBT to build and run the sample then you can skip this section and jump to the next one.
To build and run the tutorial sample from the command line, you have to download
Akka. If you prefer to use SBT to build and run the sample then you can skip
this section and jump to the next one.
Let's get the ``akka-1.1`` distribution of Akka core (not Akka Modules) from `http://akka.io/downloads <http://akka.io/downloads/>`_. Once you have downloaded the distribution unzip it in the folder you would like to have Akka installed in, in my case I choose to install it in ``/Users/jboner/tools/``, simply by unzipping it to this directory.
Let's get the ``akka-actors-1.1.zip`` distribution of Akka from
http://akka.io/downloads/ which includes everything we need for this
tutorial. Once you have downloaded the distribution unzip it in the folder you
would like to have Akka installed in. In my case I choose to install it in
``/Users/jboner/tools/``, simply by unzipping it to this directory.
You need to do one more thing in order to install Akka properly: set the ``AKKA_HOME`` environment variable to the root of the distribution. In my case I'm opening up a shell, navigating down to the distribution, and setting the ``AKKA_HOME`` variable::
You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable::
$ cd /Users/jboner/tools/akka-1.1
$ cd /Users/jboner/tools/akka-actors-1.1
$ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME
/Users/jboner/tools/akka-1.1
/Users/jboner/tools/akka-actors-1.1
The distribution looks like this::
$ ls -l
total 16944
drwxr-xr-x 7 jboner staff 238 Apr 6 11:15 .
drwxr-xr-x 28 jboner staff 952 Apr 6 11:16 ..
drwxr-xr-x 17 jboner staff 578 Apr 6 11:16 deploy
drwxr-xr-x 26 jboner staff 884 Apr 6 11:16 dist
drwxr-xr-x 3 jboner staff 102 Apr 6 11:15 lib_managed
-rwxr-xr-x 1 jboner staff 8674105 Apr 6 11:15 scala-library.jar
drwxr-xr-x 4 jboner staff 136 Apr 6 11:16 scripts
$ ls -1
config
doc
lib
src
- In the ``dist`` directory we have the Akka JARs, including sources and docs.
- In the ``lib_managed/compile`` directory we have Akka's dependency JARs.
- In the ``deploy`` directory we have the sample JARs.
- In the ``scripts`` directory we have scripts for running Akka.
- Finally ``scala-library.jar`` is the JAR for the latest Scala distribution that Akka depends on.
- In the ``config`` directory we have the Akka conf files.
- In the ``doc`` directory we have the documentation, API, doc JARs, and also
the source files for the tutorials.
- In the ``lib`` directory we have the Scala and Akka JARs.
- In the ``src`` directory we have the source JARs for Akka.
The only JAR we will need for this tutorial (apart from the ``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``dist`` directory. This is a self-contained JAR with zero dependencies and contains everything we need to write a system using Actors.
The only JAR we will need for this tutorial (apart from the
``scala-library.jar`` JAR) is the ``akka-actor-1.1.jar`` JAR in the ``lib/akka``
directory. This is a self-contained JAR with zero dependencies and contains
everything we need to write a system using Actors.
Akka is very modular and has many JARs for containing different features. The core distribution has seven modules:
@ -99,7 +109,7 @@ Akka is very modular and has many JARs for containing different features. The co
- ``akka-remote-1.1.jar`` -- Remote Actors
- ``akka-stm-1.1.jar`` -- STM (Software Transactional Memory), transactors and transactional datastructures
- ``akka-http-1.1.jar`` -- Akka Mist for continuation-based asynchronous HTTP and also Jersey integration
- ``akka-slf4j-1.1.jar`` -- SLF4J Event Handler Listener
- ``akka-slf4j-1.1.jar`` -- SLF4J Event Handler Listener for logging with SLF4J
- ``akka-testkit-1.1.jar`` -- Toolkit for testing Actors
We also have Akka Modules containing add-on modules outside the core of
@ -115,6 +125,7 @@ information the module JARs are these:
- ``akka-spring-1.1.jar`` -- Spring framework integration
- ``akka-osgi-dependencies-bundle-1.1.jar`` -- OSGi support
Downloading and installing Scala
--------------------------------
@ -174,9 +185,7 @@ Now we need to create a project definition using our Akka SBT plugin. We do that
import sbt._
class TutorialOneProject(info: ProjectInfo) extends DefaultProject(info) with AkkaProject {
val akkaRepo = "Akka Repo" at "http://akka.io/repository"
}
class TutorialOneProject(info: ProjectInfo) extends DefaultProject(info) with AkkaProject
The magic is in mixing in the ``AkkaProject`` trait.
@ -510,15 +519,15 @@ If you have not typed in (or copied) the code for the tutorial as ``$AKKA_HOME/t
First we need to compile the source file. That is done with Scala's compiler ``scalac``. Our application depends on the ``akka-actor-1.1.jar`` JAR file, so let's add that to the compiler classpath when we compile the source::
$ scalac -cp dist/akka-actor-1.1.jar tutorial/Pi.scala
$ scalac -cp lib/akka/akka-actor-1.1.jar tutorial/Pi.scala
When we have compiled the source file we are ready to run the application. This is done with ``java`` but yet again we need to add the ``akka-actor-1.1.jar`` JAR file to the classpath, and this time we also need to add the Scala runtime library ``scala-library.jar`` and the classes we compiled ourselves::
$ java \
-cp dist/akka-actor-1.1.jar:scala-library.jar:tutorial \
-cp lib/scala-library.jar:lib/akka/akka-actor-1.1.jar:. \
akka.tutorial.first.scala.Pi
AKKA_HOME is defined as [/Users/jboner/src/akka-stuff/akka-core]
loading config from [/Users/jboner/src/akka-stuff/akka-core/config/akka.conf].
AKKA_HOME is defined as [/Users/jboner/tools/akka-actors-1.1]
loading config from [/Users/jboner/tools/akka-actors-1.1/config/akka.conf].
Pi estimate: 3.1435501812459323
Calculation time: 858 millis

View file

@ -0,0 +1,52 @@
Guice Integration
=================
Module stability: **STABLE**
All Typed Actors support dependency injection using `Guice <http://code.google.com/p/google-guice/>`_ annotations (such as @Inject etc.).
The TypedActorManager class understands Guice and will do the wiring for you.
External Guice modules
----------------------
You can also plug in external Guice modules and have not-actors wired up as part of the configuration.
Here is an example:
.. code-block:: java
import static akka.config.Supervision.*;
import static akka.config.SupervisorConfig.*;
TypedActorConfigurator manager = new TypedActorConfigurator();
manager.configure(
new AllForOneStrategy(new Class[]{Exception.class}, 3, 1000),
new SuperviseTypedActor[] {
new SuperviseTypedActor(
Foo.class,
FooImpl.class,
temporary(),
1000),
new SuperviseTypedActor(
Bar.class,
BarImpl.class,
permanent(),
1000)
})
.addExternalGuiceModule(new AbstractModule() {
protected void configure() {
bind(Ext.class).to(ExtImpl.class).in(Scopes.SINGLETON);
}})
.configure()
.inject()
.supervise();
Retrieve the external Guice dependency
--------------------------------------
The external dependency can be retrieved like this:
.. code-block:: java
Ext ext = manager.getExternalDependency(Ext.class);

View file

@ -17,3 +17,4 @@ Java API
fault-tolerance
dispatchers
routing
guice-integration

View file

@ -0,0 +1,7 @@
================
First Tutorial
================
This is the source code for the first tutorial.
See the Akka Documentation for information about this tutorial.

View file

@ -8,7 +8,7 @@
<groupId>akka.tutorial.first.java</groupId>
<artifactId>akka-tutorial-first-java</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.2-SNAPSHOT</version>
<url>http://akka.io</url>
<dependencies>
@ -23,7 +23,7 @@
<repository>
<id>Akka</id>
<name>Akka Maven2 Repository</name>
<url>http://www.scalablesolutions.se/akka/repository/</url>
<url>http://akka.io/repository/</url>
</repository>
</repositories>

View file

@ -0,0 +1,5 @@
project.organization=se.scalablesolutions.akka
project.name=akka-tutorial-first
project.version=1.2-SNAPSHOT
build.scala.versions=2.9.0.RC3
sbt.version=0.7.6.RC0

View file

@ -0,0 +1,3 @@
import sbt._
class TutorialOneProject(info: ProjectInfo) extends DefaultProject(info) with AkkaProject

View file

@ -0,0 +1,6 @@
import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
val akkaRepo = "Akka Repo" at "http://akka.io/repository"
val akkaPlugin = "se.scalablesolutions.akka" % "akka-sbt-plugin" % "1.2-SNAPSHOT"
}

View file

@ -18,31 +18,6 @@ import akka.routing.UntypedLoadBalancer;
import java.util.concurrent.CountDownLatch;
/**
* First part in Akka tutorial for Java.
* <p/>
* Calculates Pi.
* <p/>
* Run on command line:
* <pre>
* $ cd akka-1.1
* $ export AKKA_HOME=`pwd`
* $ javac -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar akka/tutorial/first/java/Pi.java
* $ java -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar:. akka.tutorial.first.java.Pi
* $ ...
* </pre>
* <p/>
* Run it in Maven:
* <pre>
* $ mvn
* > scala:console
* > val pi = new akka.tutorial.first.java.Pi
* > pi.calculate(4, 10000, 10000)
* > ...
* </pre>
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
public class Pi {
public static void main(String[] args) throws Exception {

View file

@ -12,32 +12,6 @@ import Routing._
import System.{currentTimeMillis => now}
import java.util.concurrent.CountDownLatch
/**
* First part in Akka tutorial.
* <p/>
* Calculates Pi.
* <p/>
* Run on command line:
* <pre>
* $ cd akka-1.1
* $ export AKKA_HOME=`pwd`
* $ scalac -cp dist/akka-actor-1.2-SNAPSHOT.jar Pi.scala
* $ java -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar:. akka.tutorial.first.scala.Pi
* $ ...
* </pre>
* <p/>
* Run it in SBT:
* <pre>
* $ sbt
* > update
* > console
* > akka.tutorial.first.scala.Pi.calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)
* > ...
* > :quit
* </pre>
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
object Pi extends App {
calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)

View file

@ -0,0 +1,7 @@
=================
Second Tutorial
=================
This is the source code for the second tutorial.
See the Akka Documentation for information about this tutorial.

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>akka-tutorial-second-java</name>
<groupId>akka.tutorial.second.java</groupId>
<artifactId>akka-tutorial-second-java</artifactId>
<packaging>jar</packaging>
<version>1.2-SNAPSHOT</version>
<url>http://akka.io</url>
<dependencies>
<dependency>
<groupId>se.scalablesolutions.akka</groupId>
<artifactId>akka-actor</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Akka</id>
<name>Akka Maven2 Repository</name>
<url>http://akka.io/repository/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,5 @@
project.organization=se.scalablesolutions.akka
project.name=akka-tutorial-second
project.version=1.2-SNAPSHOT
build.scala.versions=2.9.0.RC3
sbt.version=0.7.6.RC0

View file

@ -0,0 +1,3 @@
import sbt._
class TutorialTwoProject(info: ProjectInfo) extends DefaultProject(info) with AkkaProject

View file

@ -0,0 +1,6 @@
import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
val akkaRepo = "Akka Repo" at "http://akka.io/repository"
val akkaPlugin = "se.scalablesolutions.akka" % "akka-sbt-plugin" % "1.2-SNAPSHOT"
}

View file

@ -20,31 +20,6 @@ import akka.routing.InfiniteIterator;
import akka.routing.Routing.Broadcast;
import akka.routing.UntypedLoadBalancer;
/**
* Second part in Akka tutorial for Java.
* <p/>
* Calculates Pi.
* <p/>
* Run on command line:
* <pre>
* $ cd akka-1.1
* $ export AKKA_HOME=`pwd`
* $ javac -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar akka/tutorial/java/second/Pi.java
* $ java -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar:. akka.tutorial.java.second.Pi
* $ ...
* </pre>
* <p/>
* Run it in Maven:
* <pre>
* $ mvn
* > scala:console
* > val pi = new akka.tutorial.java.second.Pi
* > pi.calculate(4, 10000, 10000)
* > ...
* </pre>
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
public class Pi {
public static void main(String[] args) throws Exception {

View file

@ -13,32 +13,6 @@ import akka.dispatch.Future
import System.{currentTimeMillis => now}
/**
* Second part in Akka tutorial.
* <p/>
* Calculates Pi.
* <p/>
* Run on command line:
* <pre>
* $ cd akka-1.1
* $ export AKKA_HOME=`pwd`
* $ scalac -cp dist/akka-actor-1.2-SNAPSHOT.jar Pi.scala
* $ java -cp dist/akka-actor-1.2-SNAPSHOT.jar:scala-library.jar:. akka.tutorial.second.Pi
* $ ...
* </pre>
* <p/>
* Run it in SBT:
* <pre>
* $ sbt
* > update
* > console
* > akka.tutorial.second.Pi.calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)
* > ...
* > :quit
* </pre>
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
object Pi extends App {
calculate(nrOfWorkers = 4, nrOfElements = 10000, nrOfMessages = 10000)

View file

@ -10,7 +10,7 @@ import sbt._
import sbt.CompileOrder._
import spde._
class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with ExecProject with DocParentProject {
class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with ExecProject with DocParentProject { akkaParent =>
// -------------------------------------------------------------------------------------------------------------------
// Compile settings
@ -165,7 +165,7 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
// Scaladocs
// -------------------------------------------------------------------------------------------------------------------
override def docProjectDependencies = dependencies.toList - akka_samples
override def apiProjectDependencies = dependencies.toList - akka_samples
// -------------------------------------------------------------------------------------------------------------------
// Publishing
@ -204,7 +204,10 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
override def artifacts = Set(Artifact(artifactID, "pom", "pom"))
override def deliverProjectDependencies = super.deliverProjectDependencies.toList - akka_samples.projectID - akka_tutorials.projectID
override def deliverProjectDependencies = (super.deliverProjectDependencies.toList
- akka_samples.projectID
- akka_tutorials.projectID
- akkaDist.projectID)
// -------------------------------------------------------------------------------------------------------------------
// Build release
@ -212,7 +215,6 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
val localReleasePath = outputPath / "release" / version.toString
val localReleaseRepository = Resolver.file("Local Release", localReleasePath / "repository" asFile)
val localReleaseDownloads = localReleasePath / "downloads"
override def otherRepositories = super.otherRepositories ++ Seq(localReleaseRepository)
@ -221,7 +223,39 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom)
}
lazy val buildRelease = task { None } dependsOn publishRelease
lazy val buildRelease = task {
log.info("Built release.")
None
} dependsOn (publishRelease, releaseApi, releaseDocs, releaseDownloads, releaseDist)
lazy val releaseApi = task {
val apiSources = ((apiOutputPath ##) ***)
val apiPath = localReleasePath / "api" / "akka" / version.toString
FileUtilities.copy(apiSources.get, apiPath, log).left.toOption
} dependsOn (api)
lazy val releaseDocs = task {
val docsBuildPath = docsPath / "_build"
val docsHtmlSources = ((docsBuildPath / "html" ##) ***)
val docsPdfSources = (docsBuildPath / "latex" ##) ** "*.pdf"
val docsOutputPath = localReleasePath / "docs" / "akka" / version.toString
FileUtilities.copy(docsHtmlSources.get, docsOutputPath, log).left.toOption orElse
FileUtilities.copy(docsPdfSources.get, docsOutputPath, log).left.toOption
} dependsOn (docs)
lazy val releaseDownloads = task {
val distArchives = akkaDist.akkaActorsDist.distArchive +++ akkaDist.akkaCoreDist.distArchive
val downloadsPath = localReleasePath / "downloads"
FileUtilities.copy(distArchives.get, downloadsPath, log).left.toOption
} dependsOn (dist)
lazy val releaseDist = task {
val distArchives = akkaDist.akkaActorsDist.distExclusiveArchive +++ akkaDist.akkaCoreDist.distExclusiveArchive
val distPath = localReleasePath / "dist"
FileUtilities.copy(distArchives.get, distPath, log).left.toOption
} dependsOn (dist)
lazy val dist = task { None } // dummy task
// -------------------------------------------------------------------------------------------------------------------
// akka-actor subproject
@ -444,6 +478,53 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom)
}
}
// -------------------------------------------------------------------------------------------------------------------
// Distribution
// -------------------------------------------------------------------------------------------------------------------
lazy val akkaDist = project("dist", "akka-dist", new AkkaDistParentProject(_))
class AkkaDistParentProject(info: ProjectInfo) extends ParentProject(info) {
lazy val akkaActorsDist = project("actors", "akka-dist-actors", new AkkaActorsDistProject(_), akka_actor)
lazy val akkaCoreDist = project("core", "akka-dist-core", new AkkaCoreDistProject(_),
akkaActorsDist, akka_remote, akka_http, akka_slf4j, akka_testkit, akka_actor_tests)
def doNothing = task { None }
override def publishLocalAction = doNothing
override def deliverLocalAction = doNothing
override def publishAction = doNothing
override def deliverAction = doNothing
class AkkaActorsDistProject(info: ProjectInfo) extends DefaultProject(info) with DistDocProject {
def distName = "akka-actors"
override def distDocName = "akka"
override def distConfigSources = (akkaParent.info.projectPath / "config" ##) * "*"
override def distAction = super.distAction dependsOn (distTutorials)
val distTutorialsPath = distDocPath / "tutorials"
lazy val distTutorials = task {
val tutorials = Set(akka_tutorials.akka_tutorial_first,
akka_tutorials.akka_tutorial_second)
tutorials.map { tutorial =>
val tutorialPath = (tutorial.info.projectPath ##)
val tutorialFilterOut = ((tutorial.outputPath ##) ***)
val tutorialSources = (tutorialPath ***) --- tutorialFilterOut
val tutorialOutputPath = distTutorialsPath / tutorial.name
copyPaths(tutorialSources, tutorialOutputPath)
}.foldLeft(None: Option[String])(_ orElse _)
} dependsOn (distBase)
}
class AkkaCoreDistProject(info: ProjectInfo)extends DefaultProject(info) with DistProject {
def distName = "akka-core"
}
}
}
trait OsgiProject extends BNDPlugin { self: DefaultProject =>

View file

@ -0,0 +1,215 @@
/**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
import sbt._
trait DistBaseProject extends DefaultProject {
def distOutputPath: Path
def distLibPath: Path
def distSrcPath: Path
def distDocPath: Path
def dist: Task
}
trait DistProject extends DistBaseProject {
def distName: String
val distFullName = distName + "-" + version
val distOutputBasePath = outputPath / "dist"
val distOutputPath = (distOutputBasePath ##) / distFullName
val distScalaLibPath = distOutputPath / "lib"
val distBinPath = distOutputPath / "bin"
val distConfigPath = distOutputPath / "config"
val distDeployPath = distOutputPath / "deploy"
val distLibPath = distOutputPath / "lib" / "akka"
val distSrcPath = distOutputPath / "src" / "akka"
val distDocPath = distOutputPath / "doc" / "akka"
val distDocJarsPath = distDocPath / "api" / "jars"
val distSharePath = Path.userHome / ".ivy2" / "dist" / distFullName
val distArchiveName = distFullName + ".zip"
val distArchive = (distOutputBasePath ##) / distArchiveName
val distExclusiveOutputBasePath = distOutputBasePath / "exclusive"
val distExclusiveOutputPath = (distExclusiveOutputBasePath ##) / distFullName
val distExclusiveArchive = (distExclusiveOutputBasePath ##) / distArchiveName
def distConfigSources = ((info.projectPath / "config" ##) ***)
def distScriptSources = ((info.projectPath / "scripts" ##) ***)
def distAlwaysExclude(path: Path) = path.name == "scala-library.jar"
def distAlwaysInclude(path: Path) = distConfigSources.get.toList.map(_.name).contains(path.name)
def scalaDependency = buildLibraryJar
def allProjectDependencies = topologicalSort.dropRight(1)
def distDependencies = {
allProjectDependencies.flatMap( p => p match {
case adp: DistBaseProject => Some(adp)
case _ => None
})
}
def distClasspath = runClasspath
def dependencyJars(filter: Path => Boolean) = distClasspath.filter(filter)
def isJar(path: Path) = path.name.endsWith(".jar")
def isSrcJar(path: Path) = isJar(path) && path.name.contains("-sources")
def isDocJar(path: Path) = isJar(path) && path.name.contains("-docs")
def isClassJar(path: Path) = isJar(path) && !isSrcJar(path) && !isDocJar(path)
def projectDependencies = allProjectDependencies -- distDependencies
def projectDependencyJars(f: PackagePaths => Path) = {
Path.lazyPathFinder {
projectDependencies.flatMap( p => p match {
case pp: PackagePaths => Some(f(pp))
case _ => None
})
}
}
def distLibs = dependencyJars(isClassJar) +++ projectDependencyJars(_.jarPath)
def distSrcJars = dependencyJars(isSrcJar) +++ projectDependencyJars(_.packageSrcJar)
def distDocJars = dependencyJars(isDocJar) +++ projectDependencyJars(_.packageDocsJar)
def distShareSources = ((distOutputPath ##) ***)
lazy val dist = (distAction dependsOn (distBase, `package`, packageSrc, packageDocs)
describedAs("Create a distribution."))
def distAction = task {
def exclusiveDist = {
val excludePaths = (distDependencies.map(p => ((p.distOutputPath ##) ***))
.foldLeft(Path.emptyPathFinder)(_ +++ _))
val excludeRelativePaths = excludePaths.get.toList.map(_.relativePath)
val allDistPaths = ((distOutputPath ##) ***)
val includePaths = allDistPaths.filter(path => {
distAlwaysInclude(path) || !(distAlwaysExclude(path) || excludeRelativePaths.contains(path.relativePath))
})
copyPaths(includePaths, distExclusiveOutputPath) orElse
FileUtilities.zip(List(distExclusiveOutputPath), distExclusiveArchive, true, log)
}
copyFiles(scalaDependency, distScalaLibPath) orElse
copyFiles(distLibs, distLibPath) orElse
copyFiles(distSrcJars, distSrcPath) orElse
copyFiles(distDocJars, distDocJarsPath) orElse
copyPaths(distConfigSources, distConfigPath) orElse
copyScripts(distScriptSources, distBinPath) orElse
copyPaths(distShareSources, distSharePath) orElse
FileUtilities.zip(List(distOutputPath), distArchive, true, log) orElse
exclusiveDist
}
lazy val distBase = distBaseAction dependsOn (distClean) describedAs "Create the dist base."
def distBaseAction = task {
distDependencies.map( dist => {
val allFiles = ((dist.distOutputPath ##) ***)
copyPaths(allFiles, distOutputPath)
}).foldLeft(None: Option[String])(_ orElse _)
}
def distDependencyTasks: Seq[ManagedTask] = distDependencies.map(_.dist)
lazy val distClean = (distCleanAction dependsOn (distDependencyTasks: _*)
describedAs "Clean the dist target dir.")
def distCleanAction = task {
FileUtilities.clean(distOutputPath, log) orElse
FileUtilities.clean(distSharePath, log)
}
def copyFiles(from: PathFinder, to: Path): Option[String] = {
if (from.get.isEmpty) None
else FileUtilities.copyFlat(from.get, to, log).left.toOption
}
def copyPaths(from: PathFinder, to: Path): Option[String] = {
if (from.get.isEmpty) None
else FileUtilities.copy(from.get, to, true, log).left.toOption
}
def copyScripts(from: PathFinder, to: Path): Option[String] = {
from.get.map { script =>
val target = to / script.name
FileUtilities.copyFile(script, target, log) orElse
setExecutable(target, script.asFile.canExecute)
}.foldLeft(None: Option[String])(_ orElse _)
}
def setExecutable(target: Path, executable: Boolean): Option[String] = {
val success = target.asFile.setExecutable(executable, false)
if (success) None else Some("Couldn't set permissions of " + target)
}
override def disableCrossPaths = true
def doNothing = task { None }
override def compileAction = doNothing
override def testCompileAction = doNothing
override def testAction = doNothing
override def packageAction = doNothing
override def publishLocalAction = doNothing
override def deliverLocalAction = doNothing
override def publishAction = doNothing
override def deliverAction = doNothing
}
trait DistDocProject extends DistProject {
def distDocName = distName
def findDocParent(project: Project): DocParentProject = project.info.parent match {
case Some(dpp: DocParentProject) => dpp
case Some(p: Project) => findDocParent(p)
case _ => error("Parent project is not a DocParentProject")
}
def docParent = findDocParent(this)
override def distAction = super.distAction dependsOn (distApi, distDocs)
val apiSources = ((docParent.apiOutputPath ##) ***)
val apiPath = distDocPath / "api" / "html" / distDocName
lazy val distApi = task {
copyPaths(apiSources, apiPath)
} dependsOn (distBase, docParent.api)
val docsBuildPath = docParent.docsPath / "_build"
val docsHtmlSources = ((docsBuildPath / "html" ##) ***)
val docsPdfSources = (docsBuildPath / "latex" ##) ** "*.pdf"
val docsOutputPath = distDocPath / "docs"
val docsHtmlPath = docsOutputPath / "html" / distDocName
val docsPdfPath = docsOutputPath / "pdf"
lazy val distDocs = task {
copyPaths(docsHtmlSources, docsHtmlPath) orElse
copyPaths(docsPdfSources, docsPdfPath)
} dependsOn (distBase, docParent.docs)
}
/*
* For wiring together akka and akka-modules.
*/
trait DistSharedProject extends DistBaseProject {
def distName: String
val distFullName = distName + "-" + version
val distOutputPath = Path.userHome / ".ivy2" / "dist" / distFullName
val distLibPath = distOutputPath / "lib" / "akka"
val distSrcPath = distOutputPath / "src" / "akka"
val distDocPath = distOutputPath / "doc" / "akka"
lazy val dist = task { None }
}

View file

@ -1,32 +1,49 @@
/**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
import sbt._
trait DocParentProject extends ParentProject {
def docOutputPath = outputPath / "doc" / "main" / "api"
def apiOutputPath = outputPath / "doc" / "main" / "api"
def docProjectDependencies = topologicalSort.dropRight(1)
def apiProjectDependencies = topologicalSort.dropRight(1)
def docMainSources =
docProjectDependencies.map {
def apiMainSources =
apiProjectDependencies.map {
case sp: ScalaPaths => sp.mainSources
case _ => Path.emptyPathFinder
}.foldLeft(Path.emptyPathFinder)(_ +++ _)
def docCompileClasspath =
docProjectDependencies.map {
def apiCompileClasspath =
apiProjectDependencies.map {
case bsp: BasicScalaProject => bsp.compileClasspath
case _ => Path.emptyPathFinder
}.foldLeft(Path.emptyPathFinder)(_ +++ _)
def docLabel = "main"
def apiLabel = "main"
def docMaxErrors = 100
def apiMaxErrors = 100
def docOptions: Seq[String] = Seq.empty
def apiOptions: Seq[String] = Seq.empty
lazy val doc = docAction describedAs ("Create combined scaladoc for all subprojects")
lazy val api = apiAction dependsOn (doc) describedAs ("Create combined scaladoc for all subprojects.")
def docAction = task {
val scaladoc = new Scaladoc(docMaxErrors, buildCompiler)
scaladoc(docLabel, docMainSources.get, docCompileClasspath.get, docOutputPath, docOptions, log)
def apiAction = task {
val scaladoc = new Scaladoc(apiMaxErrors, buildCompiler)
scaladoc(apiLabel, apiMainSources.get, apiCompileClasspath.get, apiOutputPath, apiOptions, log)
}
lazy val doc = task { None } // dummy task
val docsPath = info.projectPath / "akka-docs"
lazy val docs = docsAction describedAs ("Create the reStructuredText documentation.")
def docsAction = task {
import Process._
log.info("Building docs...")
val exitCode = ((new java.lang.ProcessBuilder("make", "clean", "html", "pdf")) directory docsPath.asFile) ! log
if (exitCode > 0) Some("Failed to build docs.") else None
}
}

View file

@ -1,4 +1,4 @@
sh git checkout -b release-{{release.arg1}}
sh git checkout -b releasing-{{release.arg1}}
clean
script find-replace.sh {{project.version}} {{release.arg1}}
script find-replace.sh //[[:space:]]*release:[[:space:]]*