Added documentation for delombok.

This commit is contained in:
Reinier Zwitserloot
2009-11-27 15:22:43 +01:00
parent 3aa55579cc
commit 2caddc3c2a
2 changed files with 86 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../logi/reset.css" />
<link rel="stylesheet" type="text/css" href="features.css" />
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta name="description" content="Spice up your java" />
<title>delombok</title>
</head><body><div id="pepper">
<div class="minimumHeight"></div>
<div class="meat">
<div class="header"><a href="../index.html">Project Lombok</a></div>
<h1>delombok</h1>
<div class="overview">
<h3>Overview</h3>
<p>
Normally, lombok adds support for all the lombok features directly to your IDE and compiler by plugging into them.<br />
However, lombok doesn't cover all tools. For example, lombok cannot plug into javadoc, nor can it plug into the Google Widget Toolkit, both of which
run on java sources. Delombok still allows you to use lombok with these tools by preprocessing your java code into java code with all of lombok's
transformations already applied.
</p><p>
Delombok can of course also help understand what's happening with your source by letting you look at exactly what lombok is doing 'under the hood'.
</p><p>
Delombok's standard mode of operation is that it copies an entire directory into another directory, recursively, skipping class files, and applying
lombok transformations to any java source files it encounters.
</p>
<h3>Running delombok on the command line</h3>
<p>
Delombok is included in <code>lombok.jar</code>. To use it, all you need to run on the command line is:
<div class="snippet"><pre>java -jar lombok.jar delombok src -d src-delomboked</pre></div>
<br />
Which will duplicate the contents of the <code>src</code> directory into the <code>src-delomboked</code> directory, which will be created if it
doesn't already exist, but delomboked of course. Delombok on the command line has a few more options; use the <code>--help</code> parameter to see more options.
</p><p>
To let delombok print the transformation result of a single java file directly to standard output, you can use:
<div class="snippet"><pre>java -jar lombok.jar delombok -p MyJavaFile.java</pre></div>
</p>
<h3>Running delombok in ant</h3>
<code>lombok.jar</code> includes an ant task which can apply delombok for you. For example, to create javadoc for your project, your <code>build.xml</code> file
would look something like:
<div class="snippet"><pre>&lt;target name="javadoc"&gt;
&lt;taskdef classname="lombok.delombok.ant.DelombokTask" classpath="lib/lombok.jar" name="delombok" /&gt;
&lt;mkdir dir="build/src-delomboked" /&gt;
<strong>&lt;delombok verbose="true" encoding="UTF-8" to="build/src-delomboked" from="src" /&gt;</strong>
&lt;mkdir dir="build/api" /&gt;
&lt;javadoc sourcepath="build/src-delomboked" defaultexcludes="yes" destdir="build/api" /&gt;
&lt;/target&gt;</pre></div>
<br />
Instead of a <code>from</code> attribute, you can also nest <code>&lt;fileset&gt;</code> nodes.
<h3>Running delombok in maven</h3>
We don't have a maven plugin for delombok (yet). You'll have to make do with either making maven running an ant script, or letting maven execute
delombok directly as an application. If you'd like to contribute a plugin, do get in touch with us!
<h3>Limitations</h3>
Delombok tries to preserve your code as much as it can, but comments may move around a little bit, especially comments that are in the middle of
a syntax node. For example, any comments appearing in the middle of a list of method modifiers, such as <code>public /*comment*/ static ...</code> will
move towards the front of the list of modifiers. In practice, any java source parsing tool will not be affected.<br />
To keep any changes to your code style to a minimum, delombok just copies a source file directly without changing any of it if the source file contains
no lombok transformations.
</div>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9884254-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body></html>
+14
View File
@@ -35,6 +35,20 @@
The documentation above is a lot easier to follow, but if you want to build your own transformations,
or you want to add javadoc to <code>lombok.jar</code> in your IDE, you can also check out <a href="../api/index.html">the javadoc</a>.
</div>
<h1>Running Lombok</h1>
<h3>On eclipse</h3>
Execute lombok.jar (doubleclick it, or run java -jar lombok.jar). Follow instructions.
<h3>On javac (and maven, ant, and other build tools)</h3>
Include lombok.jar on the classpath as you compile. That's all there is to it!<br />
Lombok hosts its own maven repository, so adding lombok to maven is very simple. <a href="/mavenrepo/index.html">full instructions are here</a>.
<h3>On GWT (Google Widget Toolkit), javadoc, and other source-based tools</h3>
Use <a href="delombok.html">delombok</a> first, then run javadoc or GWT on the delombok-ed code.
<h1>Running delombok</h1>
<div>Delombok copies your source files to another directory, replacing all lombok annotations with their desugared form. So, it'll turn <code>@Getter</code>
back into the actual getter. It then removes the annotation. This is useful for all sorts of reasons; you can check out what's happening under the hood,
if the unthinkable happens and you want to stop using lombok, you can easily remove all traces of it in your source, and you can use delombok to preprocess
your source files for source-level tools such as javadoc and GWT. More information about how to run delombok, including instructions for build tools
can be found at the <a href="delombok.html">delombok page</a>.</div>
<div class="footer">
<a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright &copy; 2009 Reinier Zwitserloot and Roel Spilker, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span>
</div>