You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/03/14 18:20:31 UTC
svn commit: r1577616 -
/myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
Author: lofwyr
Date: Fri Mar 14 17:20:31 2014
New Revision: 1577616
URL: http://svn.apache.org/r1577616
Log:
TOBAGO-1376: tobago-theme-plugin puts backslashes in war file if build runs under Windows
TOBAGO-1377: Build fails on Windows systems
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java?rev=1577616&r1=1577615&r2=1577616&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java Fri Mar 14 17:20:31 2014
@@ -36,6 +36,9 @@ import java.io.StringWriter;
*/
public class IndexThemeMojo extends AbstractThemeMojo {
+ private static final char FILE_SEPARATOR = System.getProperty("file.separator").charAt(0);
+ private static final boolean FILE_SEPARATOR_IS_SLASH = (FILE_SEPARATOR == '/');
+
private static final String[] EXCLUDES = new String[]{
"META-INF/**/*",
"**/*.class"
@@ -78,7 +81,7 @@ public class IndexThemeMojo extends Abst
scanner.scan();
final String[] fileNames = scanner.getIncludedFiles();
- if (fileNames != null && fileNames.length == 0) {
+ if (fileNames == null || fileNames.length == 0) {
getLog().info("Skipping create resource file " + tobagoResourcesFile.getName() + ". No resources found");
return;
}
@@ -94,9 +97,13 @@ public class IndexThemeMojo extends Abst
try {
final StringWriter stringWriter = new StringWriter();
bufferedWriter = new BufferedWriter(stringWriter);
- for (final String file : scanner.getIncludedFiles()) {
+ for (final String file : fileNames) {
bufferedWriter.append('/');
- bufferedWriter.append(file);
+ if (FILE_SEPARATOR_IS_SLASH) {
+ bufferedWriter.append(file);
+ } else {
+ bufferedWriter.append(convertFileSeparatorToSlash(file));
+ }
bufferedWriter.newLine();
}
bufferedWriter.flush();
@@ -111,6 +118,10 @@ public class IndexThemeMojo extends Abst
}
}
+ private String convertFileSeparatorToSlash(String file) {
+ return file.replace(FILE_SEPARATOR, '/');
+ }
+
public String[] getExcludes() {
return EXCLUDES;
}