You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2013/08/25 21:23:28 UTC
svn commit: r1517371 -
/myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
Author: bommel
Date: Sun Aug 25 19:23:28 2013
New Revision: 1517371
URL: http://svn.apache.org/r1517371
Log:
(TOBAGO-1302)
Add support for a theme resources index file per theme
Modified:
myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
Modified: myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java?rev=1517371&r1=1517370&r2=1517371&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/IndexThemeMojo.java Sun Aug 25 19:23:28 2013
@@ -45,14 +45,14 @@ public class IndexThemeMojo extends Abst
private File outputDirectory;
/**
- * @parameter default-value="${project.build.outputDirectory}/META-INF/tobago-resources.properties"
+ * @parameter default-value="${project.build.outputDirectory}/META-INF/tobago-resources-index.txt"
* @required
*/
private File tobagoResourcesFile;
public void execute() throws MojoExecutionException, MojoFailureException {
if ("pom".equalsIgnoreCase(getProject().getPackaging())) {
- getLog().info("Not creating tobago-resources.properties as the project is a pom package");
+ getLog().info("Not creating " + tobagoResourcesFile.getName() + " as the project is a pom package");
return;
}
if (getLog().isDebugEnabled()) {
@@ -62,6 +62,10 @@ public class IndexThemeMojo extends Abst
if (!outputDirectory.isAbsolute()) {
outputDirectory = new File(getProject().getBasedir(), outputDirectory.getPath());
}
+ if (!outputDirectory.exists()) {
+ getLog().info("Not creating " + tobagoResourcesFile.getName() + " as the project has no outputDirectory");
+ return;
+ }
StaleCheckDirectoryScanner scanner = new StaleCheckDirectoryScanner(tobagoResourcesFile.lastModified());
scanner.setBasedir(outputDirectory);
scanner.setIncludes(getIncludes());
@@ -74,8 +78,7 @@ public class IndexThemeMojo extends Abst
return;
}
- if (scanner.isUp2date) {
- //tobagoResourcesFile.lastModified() == 0L || scanner.maxLastModified > tobagoResourcesFile.lastModified()) {
+ if (!scanner.isUp2date) {
File metaInf = tobagoResourcesFile.getParentFile();
if (!metaInf.exists()) {
if (!metaInf.mkdirs()) {
@@ -91,8 +94,7 @@ public class IndexThemeMojo extends Abst
bufferedWriter.newLine();
}
bufferedWriter.flush();
- // TODO encoding
- FileUtils.fileWrite(tobagoResourcesFile, stringWriter.toString());
+ FileUtils.fileWrite(tobagoResourcesFile, "utf-8", stringWriter.toString());
} catch (IOException e) {
getLog().error("Error creating resource file " + tobagoResourcesFile.getName(), e);
} finally {