Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

LPS-26987 Allow user to override settings via command line

  • Loading branch information...
commit 9872fe8e313d12b2ead145a62b0eca34160f0937 1 parent 56d3065
@brianchandotcom brianchandotcom authored
View
4 build-common.xml
@@ -360,10 +360,10 @@ Please set the environment variable ANT_OPTS to the recommended value of
newenvironment="true"
>
<jvmarg value="-Xmx512m" />
- <arg value="javadoc.base.dir=${basedir}" />
<arg value="javadoc.init=${init}" />
+ <arg value="javadoc.input.dir=${input.dir}" />
<arg value="javadoc.limit=${limit}" />
- <arg value="javadoc.output.file.prefix=javadocs" />
+ <arg value="javadoc.output.file.prefix=${output.file.prefix}" />
<arg value="javadoc.update=${update}" />
</java>
</target>
View
35 portal-impl/src/com/liferay/portal/tools/JavadocFormatter.java
@@ -77,21 +77,32 @@ public static void main(String[] args) {
public JavadocFormatter(String[] args) throws Exception {
Map<String, String> arguments = ArgumentsUtil.parseArguments(args);
- _basedir = arguments.get("javadoc.base.dir");
-
- if (!_basedir.endsWith("/")) {
- _basedir += "/";
- }
-
String init = arguments.get("javadoc.init");
if (Validator.isNotNull(init) && !init.startsWith("$")) {
_initializeMissingJavadocs = GetterUtil.getBoolean(init);
}
+ _inputDir = GetterUtil.getString(arguments.get("javadoc.input.dir"));
+
+ if (_inputDir.startsWith("$")) {
+ _inputDir = "./";
+ }
+
+ if (!_inputDir.endsWith("/")) {
+ _inputDir += "/";
+ }
+
+ System.out.println("Input directory is " + _inputDir);
+
String limit = arguments.get("javadoc.limit");
- _outputFilePrefix = arguments.get("javadoc.output.file.prefix");
+ _outputFilePrefix = GetterUtil.getString(
+ arguments.get("javadoc.output.file.prefix"));
+
+ if (_outputFilePrefix.startsWith("$")) {
+ _outputFilePrefix = "javadocs";
+ }
String update = arguments.get("javadoc.update");
@@ -101,7 +112,7 @@ public JavadocFormatter(String[] args) throws Exception {
DirectoryScanner directoryScanner = new DirectoryScanner();
- directoryScanner.setBasedir(_basedir);
+ directoryScanner.setBasedir(_inputDir);
directoryScanner.setExcludes(
new String[] {"**\\classes\\**", "**\\portal-client\\**"});
@@ -654,7 +665,7 @@ private void _detachUnnecessaryTypes(Element rootElement) {
}
private void _format(String fileName) throws Exception {
- InputStream inputStream = new FileInputStream(_basedir + fileName);
+ InputStream inputStream = new FileInputStream(_inputDir + fileName);
byte[] bytes = new byte[inputStream.available()];
@@ -934,7 +945,7 @@ private Document _getJavadocDocument(JavaClass javaClass) throws Exception {
}
private Tuple _getJavadocsXmlTuple(String fileName) throws Exception {
- File file = new File(fileName);
+ File file = new File(_inputDir + fileName);
String absolutePath = file.getAbsolutePath();
@@ -1519,7 +1530,7 @@ private void _updateJavaFromDocument(
String formattedContent = sb.toString().trim();
if (!originalContent.equals(formattedContent)) {
- File file = new File(_basedir + fileName);
+ File file = new File(_inputDir + fileName);
_fileUtil.write(file, formattedContent.getBytes(StringPool.UTF8));
@@ -1571,8 +1582,8 @@ private String _wrapText(String text, String indent) {
private static SAXReaderImpl _saxReaderUtil = SAXReaderImpl.getInstance();
- private String _basedir;
private boolean _initializeMissingJavadocs;
+ private String _inputDir;
private Map<String, Tuple> _javadocxXmlTuples =
new HashMap<String, Tuple>();
private String _outputFilePrefix;
Please sign in to comment.
Something went wrong with that request. Please try again.