Fixed some more eol issues. genservice and gendobj work for me now.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6605 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -154,8 +154,8 @@ public class GenDObjectTask extends GenTask
|
|||||||
|
|
||||||
// append the merged templates as appropriate to the string buffers
|
// append the merged templates as appropriate to the string buffers
|
||||||
if (ii > 0) {
|
if (ii > 0) {
|
||||||
fsection.append("\n");
|
fsection.append(EOL);
|
||||||
msection.append("\n");
|
msection.append(EOL);
|
||||||
}
|
}
|
||||||
fsection.append(mergeTemplate(NAME_TMPL, data));
|
fsection.append(mergeTemplate(NAME_TMPL, data));
|
||||||
msection.append(mergeTemplate(BASE_TMPL + tname, data));
|
msection.append(mergeTemplate(BASE_TMPL + tname, data));
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public abstract class GenTask extends Task
|
|||||||
{
|
{
|
||||||
String output = mergeTemplate(templatePath, data);
|
String output = mergeTemplate(templatePath, data);
|
||||||
if (_header != null) {
|
if (_header != null) {
|
||||||
output = _header + output;
|
output = convertEols(_header) + output;
|
||||||
}
|
}
|
||||||
writeFile(outputPath, output);
|
writeFile(outputPath, output);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ public abstract class GenTask extends Task
|
|||||||
protected boolean wouldProduceSameFile (String generated, File existing)
|
protected boolean wouldProduceSameFile (String generated, File existing)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Iterator<String> generatedLines = Splitter.on('\n').split(generated).iterator();
|
Iterator<String> generatedLines = Splitter.on(EOL).split(generated).iterator();
|
||||||
for (String prev : Files.readLines(existing, UTF_8)) {
|
for (String prev : Files.readLines(existing, UTF_8)) {
|
||||||
if (!generatedLines.hasNext()) {
|
if (!generatedLines.hasNext()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -207,7 +207,7 @@ public abstract class GenTask extends Task
|
|||||||
{
|
{
|
||||||
Reader reader =
|
Reader reader =
|
||||||
new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8);
|
new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8);
|
||||||
return Mustache.compiler().escapeHTML(false).compile(reader).execute(data);
|
return convertEols(Mustache.compiler().escapeHTML(false).compile(reader).execute(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, Object> createMap (Object... data)
|
protected Map<String, Object> createMap (Object... data)
|
||||||
@@ -253,6 +253,13 @@ public abstract class GenTask extends Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static String convertEols (String str)
|
||||||
|
{
|
||||||
|
return str.replace("\n", EOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static String EOL = System.getProperty("line.separator");
|
||||||
|
|
||||||
/** A list of filesets that contain java source to be processed. */
|
/** A list of filesets that contain java source to be processed. */
|
||||||
protected List<FileSet> _filesets = Lists.newArrayList();
|
protected List<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user