Permalink
Browse files

updated site

  • Loading branch information...
1 parent 72f53a4 commit 6cad0875885faf8b4908b62e0b6fda0cae813206 @harrah harrah committed Apr 5, 2012
Showing with 52 additions and 856 deletions.
  1. +51 −569 howto.html
  2. +0 −45 howto/generatefiles.html
  3. +0 −31 howto/interactive.html
  4. +0 −43 howto/logging.html
  5. +0 −43 howto/metadata.html
  6. +0 −38 howto/package.html
  7. +0 −54 howto/scala.html
  8. +0 −33 howto/triggered.html
  9. +1 −0 plugins.html
View
Oops, something went wrong.
@@ -56,31 +56,10 @@ <h4 id="sources">Generate sources</h4>
<p>A source generation task should generate sources in a subdirectory of <code>sourceManaged</code> and return a sequence of files generated. The key to add the task to is called <code>sourceGenerators</code>. It should be scoped according to whether the generated files are main (<code>Compile</code>) or test (<code>Test</code>) sources. This basic structure looks like:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">sourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span> <span class="o">&lt;</span><span class="n">your</span> <span class="nc">Task</span><span class="o">[</span><span class="kt">Seq</span><span class="o">[</span><span class="kt">File</span><span class="o">]]</span> <span class="n">here</span><span class="o">&gt;</span>
-</code></pre>
-</div>
-
-
<p>For example, assuming a method <code>def makeSomeSources(base: File): Seq[File]</code>,</p>
-<div class="highlight"><pre><code class="scala"><span class="n">sourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span> <span class="n">sourceManaged</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="n">map</span> <span class="o">{</span> <span class="n">outDir</span><span class="k">:</span> <span class="kt">File</span> <span class="o">=&gt;</span>
- <span class="n">makeSomeSources</span><span class="o">(</span><span class="n">outDir</span> <span class="o">/</span> <span class="s">&quot;demo&quot;</span><span class="o">)</span>
-<span class="o">}</span>
-</code></pre>
-</div>
-
-
<p>As a specific example, the following generates a hello world source file:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">sourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span> <span class="n">sourceManaged</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="n">map</span> <span class="o">{</span> <span class="n">dir</span> <span class="k">=&gt;</span>
- <span class="k">val</span> <span class="n">file</span> <span class="k">=</span> <span class="n">dir</span> <span class="o">/</span> <span class="s">&quot;demo&quot;</span> <span class="o">/</span> <span class="s">&quot;Test.scala&quot;</span>
- <span class="nc">IO</span><span class="o">.</span><span class="n">write</span><span class="o">(</span><span class="n">file</span><span class="o">,</span> <span class="s">&quot;&quot;&quot;object Test extends App { println(&quot;Hi&quot;) }&quot;&quot;&quot;</span><span class="o">)</span>
- <span class="nc">Seq</span><span class="o">(</span><span class="n">file</span><span class="o">)</span>
-<span class="o">}</span>
-</code></pre>
-</div>
-
-
<p>Executing 'run' will print "Hi". Change <code>Compile</code> to <code>Test</code> to make it a test source. For efficiency, you would only want to generate sources when necessary and not every run.</p>
<p>By default, generated sources are not included in the packaged source artifact. To do so, add them as you would other mappings. See <code>Adding files to a package</code>.</p>
@@ -90,34 +69,10 @@ <h4 id="resources">Generate resources</h4>
<p>A resource generation task should generate resources in a subdirectory of <code>resourceManaged</code> and return a sequence of files generated. The key to add the task to is called <code>resourceGenerators</code>. It should be scoped according to whether the generated files are main (<code>Compile</code>) or test (<code>Test</code>) resources. This basic structure looks like:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">resourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span> <span class="o">&lt;</span><span class="n">your</span> <span class="nc">Task</span><span class="o">[</span><span class="kt">Seq</span><span class="o">[</span><span class="kt">File</span><span class="o">]]</span> <span class="n">here</span><span class="o">&gt;</span>
-</code></pre>
-</div>
-
-
<p>For example, assuming a method <code>def makeSomeResources(base: File): Seq[File]</code>,</p>
-<div class="highlight"><pre><code class="scala"><span class="n">resourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span> <span class="n">resourceManaged</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="n">map</span> <span class="o">{</span> <span class="n">outDir</span><span class="k">:</span> <span class="kt">File</span> <span class="o">=&gt;</span>
- <span class="n">makeSomeResources</span><span class="o">(</span><span class="n">outDir</span> <span class="o">/</span> <span class="s">&quot;demo&quot;</span><span class="o">)</span>
-<span class="o">}</span>
-</code></pre>
-</div>
-
-
<p>As a specific example, the following generates a properties file containing the application name and version:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">resourceGenerators</span> <span class="n">in</span> <span class="nc">Compile</span> <span class="o">&lt;+=</span>
- <span class="o">(</span><span class="n">resourceManaged</span> <span class="n">in</span> <span class="nc">Compile</span><span class="o">,</span> <span class="n">name</span><span class="o">,</span> <span class="n">version</span><span class="o">)</span> <span class="n">map</span> <span class="o">{</span> <span class="o">(</span><span class="n">dir</span><span class="o">,</span> <span class="n">n</span><span class="o">,</span> <span class="n">v</span><span class="o">)</span> <span class="k">=&gt;</span>
- <span class="k">val</span> <span class="n">file</span> <span class="k">=</span> <span class="n">dir</span> <span class="o">/</span> <span class="s">&quot;demo&quot;</span> <span class="o">/</span> <span class="s">&quot;myapp.properties&quot;</span>
- <span class="k">val</span> <span class="n">contents</span> <span class="k">=</span> <span class="s">&quot;name=%s\nversion=%s&quot;</span><span class="o">.</span><span class="n">format</span><span class="o">(</span><span class="n">n</span><span class="o">,</span><span class="n">v</span><span class="o">)</span>
- <span class="nc">IO</span><span class="o">.</span><span class="n">write</span><span class="o">(</span><span class="n">file</span><span class="o">,</span> <span class="n">contents</span><span class="o">)</span>
- <span class="nc">Seq</span><span class="o">(</span><span class="n">file</span><span class="o">)</span>
- <span class="o">}</span>
-<span class="o">}</span>
-</code></pre>
-</div>
-
-
<p>Change <code>Compile</code> to <code>Test</code> to make it a test resource. Normally, you would only want to generate resources when necessary and not every run.</p>
<p>By default, generated resources are not included in the packaged source artifact. To do so, add them as you would other mappings. See the <code>Adding files to a package</code> section.</p>
@@ -142,17 +142,6 @@ <h4 id="prompt">Configure the prompt string</h4>
<p>Examples:</p>
-<div class="highlight"><pre><code class="scala"><span class="c1">// set the prompt (for this build) to include the project id.</span>
-<span class="n">shellPrompt</span> <span class="n">in</span> <span class="nc">ThisBuild</span> <span class="o">:=</span> <span class="o">{</span> <span class="n">state</span> <span class="k">=&gt;</span> <span class="nc">Project</span><span class="o">.</span><span class="n">extract</span><span class="o">(</span><span class="n">state</span><span class="o">).</span><span class="n">currentRef</span><span class="o">.</span><span class="n">project</span> <span class="o">+</span> <span class="s">&quot;&gt; &quot;</span> <span class="o">}</span>
-
-<span class="c1">// set the prompt (for the current project) to include the username</span>
-<span class="n">shellPrompt</span> <span class="o">:=</span> <span class="o">{</span> <span class="n">state</span> <span class="k">=&gt;</span> <span class="nc">System</span><span class="o">.</span><span class="n">getProperty</span><span class="o">(</span><span class="s">&quot;user.name&quot;</span><span class="o">)</span> <span class="o">+</span> <span class="s">&quot;&gt; &quot;</span> <span class="o">}</span>
-</code></pre>
-</div>
-
-
-
-
<h4 id="history">Using history</h4>
@@ -180,11 +169,6 @@ <h4 id="history_file">Changing the history file location</h4>
The location can be changed with the <code>historyPath</code> setting, which has type <code>Option[File]</code>.
For example, history can be stored in the root directory for the project instead of the output directory:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">historyPath</span> <span class="o">&lt;&lt;=</span> <span class="n">baseDirectory</span><span class="o">(</span><span class="n">t</span> <span class="k">=&gt;</span> <span class="nc">Some</span><span class="o">(</span><span class="n">t</span> <span class="o">/</span> <span class="s">&quot;.history&quot;</span><span class="o">))</span>
-</code></pre>
-</div>
-
-
<p>The history path needs to be set for each project, since sbt will use the value of <code>historyPath</code> for the current project (as selected by the <code>project</code> command).</p>
<h4 id="share_history">Use the same history for all projects</h4>
@@ -194,28 +178,13 @@ <h4 id="share_history">Use the same history for all projects</h4>
This setting can be used to share the interactive history among all projects in a build instead of using a different history for each project.
The way this is done is to set <code>historyPath</code> to be the same file, such as a file in the root project's <code>target/</code> directory:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">historyPath</span> <span class="o">&lt;&lt;=</span>
- <span class="o">(</span><span class="n">target</span> <span class="n">in</span> <span class="nc">LocalRootProject</span><span class="o">)</span> <span class="o">{</span> <span class="n">t</span> <span class="k">=&gt;</span>
- <span class="nc">Some</span><span class="o">(</span><span class="n">t</span> <span class="o">/</span> <span class="s">&quot;.history&quot;</span><span class="o">)</span>
- <span class="o">}</span>
-</code></pre>
-</div>
-
-
<p>The <code>in LocalRootProject</code> part means to get the output directory for the root project for the build.</p>
<h4 id="disable_history">Disable interactive history</h4>
<p>If, for whatever reason, you want to disable history, set <code>historyPath</code> to <code>None</code> in each project it should be disabled in:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">historyPath</span> <span class="o">:=</span> <span class="nc">None</span>
-</code></pre>
-</div>
-
-
-
-
<h4 id="pre_commands">Run commands before entering interactive mode</h4>
View
@@ -75,51 +75,8 @@ <h4 id="last">View logging output of the previously executed command</h4>
<p>For example, the output of <code>run</code> when the sources are uptodate is:</p>
-<div class="highlight"><pre><code class="console"><span class="gp">&gt;</span> run
-<span class="go">[info] Running A </span>
-<span class="go">Hi!</span>
-<span class="go">[success] Total time: 0 s, completed Feb 25, 2012 1:00:00 PM</span>
-</code></pre>
-</div>
-
-
<p>The details of this execution can be recalled by running <code>last</code>:</p>
-<div class="highlight"><pre><code class="console"><span class="gp">&gt;</span> last
-<span class="go">[debug] Running task... Cancelable: false, max worker threads: 4, check cycles: false</span>
-<span class="go">[debug] </span>
-<span class="go">[debug] Initial source changes: </span>
-<span class="go">[debug] removed:Set()</span>
-<span class="go">[debug] added: Set()</span>
-<span class="go">[debug] modified: Set()</span>
-<span class="go">[debug] Removed products: Set()</span>
-<span class="go">[debug] Modified external sources: Set()</span>
-<span class="go">[debug] Modified binary dependencies: Set()</span>
-<span class="go">[debug] Initial directly invalidated sources: Set()</span>
-<span class="go">[debug] </span>
-<span class="go">[debug] Sources indirectly invalidated by:</span>
-<span class="go">[debug] product: Set()</span>
-<span class="go">[debug] binary dep: Set()</span>
-<span class="go">[debug] external source: Set()</span>
-<span class="go">[debug] Initially invalidated: Set()</span>
-<span class="go">[debug] Copy resource mappings: </span>
-<span class="go">[debug] </span>
-<span class="go">[info] Running A </span>
-<span class="go">[debug] Starting sandboxed run...</span>
-<span class="go">[debug] Waiting for threads to exit or System.exit to be called.</span>
-<span class="go">[debug] Classpath:</span>
-<span class="go">[debug] /tmp/e/target/scala-2.9.1/classes</span>
-<span class="go">[debug] /tmp/e/.sbt/0.12.0/boot/scala-2.9.1/lib/scala-library.jar</span>
-<span class="go">[debug] Waiting for thread run-main to exit</span>
-<span class="go">[debug] Thread run-main exited.</span>
-<span class="go">[debug] Interrupting remaining threads (should be all daemons).</span>
-<span class="go">[debug] Sandboxed run complete..</span>
-<span class="go">[debug] Exited with code 0</span>
-<span class="go">[success] Total time: 0 s, completed Jan 1, 2012 1:00:00 PM</span>
-</code></pre>
-</div>
-
-
<p>Configuration of the logging level for the console and for the backing file are described in following sections.</p>
<h4 id="tasklast">View the logging output of a specific task</h4>
View
@@ -58,67 +58,24 @@
<h4 id="name">Set the project name</h4>
-
-
-<div class="highlight"><pre><code class="scala"><span class="n">name</span> <span class="o">:=</span> <span class="s">&quot;Your project name&quot;</span>
-</code></pre>
-</div>
-
-
<p>For published projects, this name is normalized to be suitable for use as an artifact name and dependency ID. This normalized name is stored in <code>normalizedName</code>.</p>
<h4 id="version">Set the project version</h4>
-<div class="highlight"><pre><code class="scala"><span class="n">version</span> <span class="o">:=</span> <span class="s">&quot;1.0&quot;</span>
-</code></pre>
-</div>
-
-
-
-
<h4 id="organization">Set the project organization</h4>
-
-
-<div class="highlight"><pre><code class="scala"><span class="n">organization</span> <span class="o">:=</span> <span class="s">&quot;org.example&quot;</span>
-</code></pre>
-</div>
-
-
<p>By convention, this is a reverse domain name that you own, typically one specific to your project. It is used as a namespace for projects.</p>
<p>A full/formal name can be defined in the <code>organizationName</code> setting. This is used in the generated pom.xml. If the organization has a web site, it may be set in the <code>organizationHomepage</code> setting. For example:</p>
-<div class="highlight"><pre><code class="scala"><span class="n">organization</span> <span class="o">:=</span> <span class="s">&quot;Example, Inc.&quot;</span>
-
-<span class="n">organizationHomepage</span> <span class="o">:=</span> <span class="s">&quot;org.example&quot;</span>
-</code></pre>
-</div>
-
-
-
-
<h4 id="other">Set the project's homepage and other metadata</h4>
-
-<div class="highlight"><pre><code class="scala"><span class="n">homepage</span> <span class="o">:=</span> <span class="nc">Some</span><span class="o">(</span><span class="n">url</span><span class="o">(</span><span class="s">&quot;http://scala-sbt.org&quot;</span><span class="o">))</span>
-
-<span class="n">startYear</span> <span class="o">:=</span> <span class="nc">Some</span><span class="o">(</span><span class="mi">2008</span><span class="o">)</span>
-
-<span class="n">description</span> <span class="o">:=</span> <span class="s">&quot;A build tool for Scala.&quot;</span>
-
-<span class="n">licenses</span> <span class="o">+=</span> <span class="s">&quot;GPLv2&quot;</span> <span class="o">-&gt;</span> <span class="s">&quot;http://www.gnu.org/licenses/gpl-2.0.html&quot;</span>
-</code></pre>
-</div>
-
-
-
</div>
</div>
Oops, something went wrong.

0 comments on commit 6cad087

Please sign in to comment.