Skip to content

Commit ec26174

Browse files
committed
updated
1 parent fbdb488 commit ec26174

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
[Full changelog](https://github.com/raydac/java-comment-preprocessor/blob/master/changelog.txt)
3232

3333
# Introduction
34-
Initially the preprocessor was developed for automation of mobile game development process and it was in very active use for several years for J2ME development. Since 2011 the preprocessor is OSS project.
35-
On start the preprocessor was implemented as a CLI tool but then Maven, ANT and Gradle plug-ins were injected in the uber-jar.
34+
Since 2001 I was strongly involved in development for J2ME mobile devices, it was too expensive to support the same sources for different devices if to use standard Java OOP approach, so that I choosed C/C++ approach and developed preprocessor which made my life much easier. Inintially it was a proprietary project but since 2011 it became OSS project.
35+
I guess at present it is the most powerful Java preprocessor with support of two-pass preprocessing, document part support, loops and even XML file processing ([I generated static files with it](jcp-tests/jcp-test-static-site)). Now it is implemented as a Fat-Jar and includes Maven, ANT and Gradle interfaces and can be used with these tools.
3636

3737
# Documap
3838

3939
![Documap](assets/documap.png)
4040

4141
# How to use
42-
[The Full list of the preprocessor directives can be found in the wiki.](https://github.com/raydac/java-comment-preprocessor/wiki/PreprocessorDirectives)
43-
44-
The Preprocessor can be used by different ways:
45-
- as ANT task
46-
- as Maven plugin
47-
- [with Gradle](https://github.com/raydac/java-comment-preprocessor/wiki/AndroidGradlePreprocessing)
48-
- as Java framework with direct class calls
49-
- as external utility through CLI (command line interface)
50-
The Preprocessor is published in the Maven Central so that can be added in Maven projects without any problems
42+
43+
The Preprocessor can work as:
44+
- a CLI tool
45+
- a Java library
46+
- [a Maven goal](jcp-tests/jcp-test-maven)
47+
- [an ANT task](jcp-tests/jcp-test-ant)
48+
- [a Gradle task](jcp-tests/jcp-test-gradle)
49+
50+
The Preprocessor is published in the Maven Central (it is not published in Gradle central, so that use the Maven central)
5151
```
5252
<build>
5353
<plugins>
@@ -93,9 +93,13 @@ java -jar jcp-7.0.1.jar --c --r --v --f:java,xml --ef:none --i:./test --o:./res
9393
- --z turn on checking of file content before replacement, if the same content then preprocessor will not replace the file
9494
- --es allow whitespace between comment and directive (by default it is turned off)
9595

96-
# The Main idea
97-
The Java language was born without any preprocessor in creator's mind and even now there are not any plans to include preprocessing into Java. It was good until mass usage Java on mobile and TV devices where we have bunches of half-compatible devices with (sometime) very bizarre standard framework implementations. In the case, preprocessing allows to decrease support of sources dramatically.
98-
The only possible way to include preprocessing directives into Java and to not break standard processes and Java tool chain is to inject them into comments, take a look at the example below:
96+
# Internal test examples
97+
- [Prepare sources for Javassist](jcp-tests/jcp-test-javassist)
98+
- [Make multi-versioned JAR for JEP-238](jcp-tests/jcp-test-jep238)
99+
- [Generate static file from XML sources](jcp-tests/jcp-test-static-site)
100+
101+
# Example of Java sources with directives
102+
In Java the only allowed way to inject directives and to not break work of tools and conpilers - is to use commented space, so that the preprocessor uses it.
99103
```Java
100104
//#local TESTVAR="TEST LOCAL VARIABLE"
101105
//#echo TESTVAR=/*$TESTVAR$*/
@@ -119,7 +123,7 @@ public static final void testproc()
119123
```
120124

121125
# Multi-sectioned documents
122-
Java sources usually have sections, there are the import section and the main section thus JCP has support for such case and there are three section where the preprocessor can write results - the prefix, the middle part and the postfix. Usually I use the prefix to form the import section for Java files. You can switch the text output for sections with //#prefix[+|-] and //#postfix[+|-] directives.
126+
In opposite a regular document, a Java document has as minimum two sections - prefix (where situated import and special information) and body. For access to such sections there are special preprocessing directives `//#prefix[-|+]`, `//#postfix[-|+]`. They allow to turn on or turn off output into prefix and postfix sections.
123127
```Java
124128
//#prefix+
125129
import java.lang.*;
@@ -132,7 +136,7 @@ Java sources usually have sections, there are the import section and the main se
132136
}
133137
```
134138
# How to remove all coments from sources
135-
Sometime it is very useful to remove all comments from my sources at all, JCP has such feature which can be turned on by special flag or command line switcher (see wiki). The Example of use for comment removing through CLI interface
139+
Sometime it is very useful to remove totally all comments from sources, such possiblitiy was included into JCP and can be activated through special flag or command line switcher. The Example of use for comment removing through CLI interface
136140
```
137141
java -jar ./jcp-7.0.1.jar --i:/sourceFolder --o:/resultFolder -ef:none --r
138142
```

0 commit comments

Comments
 (0)