You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/06/01 03:19:58 UTC
[1/7] git commit: Put in place a development-mode cache for compiled
resources
Updated Branches:
refs/heads/master 47c83bb83 -> 512ee3168
Put in place a development-mode cache for compiled resources
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/466f3dda
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/466f3dda
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/466f3dda
Branch: refs/heads/master
Commit: 466f3ddaef47b188a96a522f783cc14f9623af99
Parents: 47c83bb
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 16:54:52 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 16:54:52 2013 -0700
----------------------------------------------------------------------
.../internal/wro4j/ResourceTransformerFactory.java | 6 +-
.../wro4j/ResourceTransformerFactoryImpl.java | 128 ++++++++++++++-
.../tapestry5/wro4j/modules/WRO4JModule.java | 11 +-
3 files changed, 137 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/466f3dda/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactory.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactory.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactory.java
index 4016ebe..dde5c36 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactory.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactory.java
@@ -19,8 +19,8 @@ import org.apache.tapestry5.services.assets.ResourceTransformer;
/**
* Creates ResourceTransformer around a named {@link org.apache.tapestry5.wro4j.services.ResourceProcessor}.
*
- * @since 5.4
* @see org.apache.tapestry5.services.assets.StreamableResourceSource
+ * @since 5.4
*/
public interface ResourceTransformerFactory
{
@@ -36,8 +36,10 @@ public interface ResourceTransformerFactory
* for debugging: source name, e.g., "CoffeeScript"
* @param targetName
* for debugging: target name, e.g., "JavaScript"
+ * @param enableCache
+ * if true, the transformer will cache results (this is only used in development mode)
* @return transformer
* @see org.apache.tapestry5.wro4j.services.ResourceProcessorSource
*/
- ResourceTransformer createCompiler(String contentType, String processorName, String sourceName, String targetName);
+ ResourceTransformer createCompiler(String contentType, String processorName, String sourceName, String targetName, boolean enableCache);
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/466f3dda/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
index cd5005d..64e67a7 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
@@ -14,17 +14,23 @@
package org.apache.tapestry5.internal.wro4j;
+import org.apache.tapestry5.internal.TapestryInternalUtils;
+import org.apache.tapestry5.internal.services.assets.BytestreamCache;
import org.apache.tapestry5.ioc.IOOperation;
import org.apache.tapestry5.ioc.OperationTracker;
import org.apache.tapestry5.ioc.Resource;
+import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.services.assets.ResourceDependencies;
import org.apache.tapestry5.services.assets.ResourceTransformer;
import org.apache.tapestry5.wro4j.services.ResourceProcessor;
import org.apache.tapestry5.wro4j.services.ResourceProcessorSource;
import org.slf4j.Logger;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
+import java.util.zip.Adler32;
public class ResourceTransformerFactoryImpl implements ResourceTransformerFactory
{
@@ -43,10 +49,82 @@ public class ResourceTransformerFactoryImpl implements ResourceTransformerFactor
this.tracker = tracker;
}
- public ResourceTransformer createCompiler(final String contentType, String processorName, final String sourceName, final String targetName)
+
+ static class Compiled
+ {
+ /**
+ * Checksum of the raw source file.
+ */
+ final long checksum;
+
+ private final BytestreamCache bytestreamCache;
+
+
+ Compiled(long checksum, InputStream stream) throws IOException
+ {
+ this.checksum = checksum;
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ TapestryInternalUtils.copy(stream, bos);
+
+ stream.close();
+ bos.close();
+
+ this.bytestreamCache = new BytestreamCache(bos);
+ }
+
+ InputStream openStream()
+ {
+ return bytestreamCache.openStream();
+ }
+ }
+
+ private long toChecksum(Resource resource) throws IOException
+ {
+ Adler32 checksum = new Adler32();
+
+ byte[] buffer = new byte[1024];
+
+ InputStream is = null;
+
+ try
+ {
+ is = resource.openStream();
+
+ while (true)
+ {
+ int length = is.read(buffer);
+
+ if (length < 0)
+ {
+ break;
+ }
+
+ checksum.update(buffer, 0, length);
+ }
+
+ // Reduces it down to just 32 bits which we express in hex.'
+ return checksum.getValue();
+ } finally
+ {
+ is.close();
+ }
+ }
+
+ public ResourceTransformer createCompiler(final String contentType, String processorName, final String sourceName, final String targetName, boolean enableCache)
{
- final ResourceProcessor compiler = source.getProcessor(processorName);
+ // This does the real work:
+ ResourceProcessor resourceProcessor = source.getProcessor(processorName);
+ // And this adapts it to the API.
+ final ResourceTransformer coreCompiler = createCoreCompiler(contentType, sourceName, targetName, resourceProcessor);
+
+ return enableCache ? wrapWithCaching(coreCompiler, targetName) : coreCompiler;
+ }
+
+ private ResourceTransformer createCoreCompiler(final String contentType, final String sourceName, final String targetName, final ResourceProcessor resourceProcessor)
+ {
return new ResourceTransformer()
{
public String getTransformedContentType()
@@ -64,7 +142,7 @@ public class ResourceTransformerFactoryImpl implements ResourceTransformerFactor
{
final long startTime = System.nanoTime();
- InputStream result = compiler.process(description,
+ InputStream result = resourceProcessor.process(description,
source.toURL().toString(),
source.openStream(), contentType);
@@ -80,4 +158,48 @@ public class ResourceTransformerFactoryImpl implements ResourceTransformerFactor
}
};
}
+
+ /**
+ * Caching is not needed in production, because caching of streamable resources occurs at a higher level
+ * (possibly after sources have been aggregated and minimized and gzipped). However, in development, it is
+ * very important to avoid costly CoffeeScript compilation (or similar operations); Tapestry's caching is
+ * somewhat primitive: a change to *any* resource in a given domain results in the cache of all of those resources
+ * being discarded.
+ */
+ private ResourceTransformer wrapWithCaching(final ResourceTransformer core, final String targetName)
+ {
+ return new ResourceTransformer()
+ {
+ final Map<Resource, Compiled> cache = CollectionFactory.newConcurrentMap();
+
+ public String getTransformedContentType()
+ {
+ return core.getTransformedContentType();
+ }
+
+ public InputStream transform(Resource source, ResourceDependencies dependencies) throws IOException
+ {
+ long checksum = toChecksum(source);
+
+ Compiled compiled = cache.get(source);
+
+ if (compiled != null && compiled.checksum == checksum)
+ {
+ logger.info(String.format("Resource %s is unchanged; serving compiled %s content from cache",
+ source, targetName));
+
+ return compiled.openStream();
+ }
+
+ InputStream is = core.transform(source, dependencies);
+
+ // There's probably a race condition here if the source changes as we are compiling it.
+ compiled = new Compiled(checksum, is);
+
+ cache.put(source, compiled);
+
+ return compiled.openStream();
+ }
+ };
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/466f3dda/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
index 073d3aa..fa286ee 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
@@ -16,11 +16,13 @@ package org.apache.tapestry5.wro4j.modules;
import com.github.sommeri.less4j.core.parser.AntlrException;
import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.wro4j.*;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.ioc.annotations.Primary;
+import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.services.ObjectRenderer;
@@ -82,12 +84,15 @@ public class WRO4JModule
}
@Contribute(StreamableResourceSource.class)
- public static void provideCompilers(MappedConfiguration<String, ResourceTransformer> configuration, ResourceTransformerFactory factory)
+ public static void provideCompilers(MappedConfiguration<String, ResourceTransformer> configuration, ResourceTransformerFactory factory,
+ @Symbol(SymbolConstants.PRODUCTION_MODE)
+ boolean productionMode)
{
configuration.add("coffee",
- factory.createCompiler("text/javascript", "CoffeeScriptCompiler", "CoffeeScript", "JavaScript"));
+ factory.createCompiler("text/javascript", "CoffeeScriptCompiler", "CoffeeScript", "JavaScript", !productionMode));
- configuration.add("less", factory.createCompiler("text/css", "LessCompiler", "Less", "CSS"));
+ // We'll have to see how imports work in a Less file before we can get into whether we can enable development-mode caching.
+ configuration.add("less", factory.createCompiler("text/css", "LessCompiler", "Less", "CSS", false));
}
@Contribute(ResourceMinimizer.class)
[5/7] git commit: Use the common Problem base interface for reporting
Less compilation errors
Posted by hl...@apache.org.
Use the common Problem base interface for reporting Less compilation errors
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/795c38f1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/795c38f1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/795c38f1
Branch: refs/heads/master
Commit: 795c38f17e858caa39567ae3fa54be3039247e49
Parents: 650ddd5
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:35:40 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:35:40 2013 -0700
----------------------------------------------------------------------
.../tapestry5/wro4j/modules/WRO4JModule.java | 19 ++++++++-------
1 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/795c38f1/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
index fa286ee..ac02015 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
@@ -14,6 +14,7 @@
package org.apache.tapestry5.wro4j.modules;
+import com.github.sommeri.less4j.LessCompiler;
import com.github.sommeri.less4j.core.parser.AntlrException;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.SymbolConstants;
@@ -110,31 +111,31 @@ public class WRO4JModule
*/
@Contribute(ObjectRenderer.class)
@Primary
- public static void provideLessErrorRenderers(MappedConfiguration<Class, ObjectRenderer> configuration)
+ public static void provideLessCompilerProblemRenderer(MappedConfiguration<Class, ObjectRenderer> configuration)
{
- configuration.add(AntlrException.class, new ObjectRenderer<AntlrException>()
+ configuration.add(LessCompiler.Problem.class, new ObjectRenderer<LessCompiler.Problem>()
{
- public void render(AntlrException e, MarkupWriter writer)
+ public void render(LessCompiler.Problem problem, MarkupWriter writer)
{
List<String> strings = CollectionFactory.newList();
- if (InternalUtils.isNonBlank(e.getMessage()))
+ if (InternalUtils.isNonBlank(problem.getMessage()))
{
- strings.add(e.getMessage());
+ strings.add(problem.getMessage());
}
// Inside WRO4J we see that the LessSource is a StringSource with no useful toString(), so
// it is omitted. We may need to create our own processors, stripping away a couple of layers of
// WRO4J to get proper exception reporting!
- if (e.getLine() > 0)
+ if (problem.getLine() > 0)
{
- strings.add("line " + e.getLine());
+ strings.add("line " + problem.getLine());
}
- if (e.getCharacter() > 0)
+ if (problem.getCharacter() > 0)
{
- strings.add("position " + e.getCharacter());
+ strings.add("position " + problem.getCharacter());
}
writer.write(InternalUtils.join(strings, " - "));
[7/7] git commit: Improve Less support;
including ability to reference other Less files via @import
Posted by hl...@apache.org.
Improve Less support; including ability to reference other Less files via @import
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/512ee316
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/512ee316
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/512ee316
Branch: refs/heads/master
Commit: 512ee3168890efd00ffbb04efd277e35745ecb83
Parents: 1539066
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 18:19:41 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 18:19:41 2013 -0700
----------------------------------------------------------------------
.../internal/wro4j/LessResourceTransformer.java | 147 +++++++++++++++
.../internal/wro4j/ResourceTransformUtils.java | 28 +++
.../wro4j/ResourceTransformerFactoryImpl.java | 4 +-
.../tapestry5/wro4j/modules/WRO4JModule.java | 7 +-
.../src/test/resources/META-INF/assets/colors.less | 4 +-
5 files changed, 180 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
new file mode 100644
index 0000000..1b655f9
--- /dev/null
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
@@ -0,0 +1,147 @@
+// Copyright 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.wro4j;
+
+import com.github.sommeri.less4j.Less4jException;
+import com.github.sommeri.less4j.LessCompiler;
+import com.github.sommeri.less4j.LessSource;
+import com.github.sommeri.less4j.core.DefaultLessCompiler;
+import org.apache.commons.io.IOUtils;
+import org.apache.tapestry5.internal.services.assets.BytestreamCache;
+import org.apache.tapestry5.ioc.IOOperation;
+import org.apache.tapestry5.ioc.OperationTracker;
+import org.apache.tapestry5.ioc.Resource;
+import org.apache.tapestry5.services.assets.ResourceDependencies;
+import org.apache.tapestry5.services.assets.ResourceTransformer;
+import org.slf4j.Logger;
+
+import java.io.*;
+
+/**
+ * Direct wrapper around the LessCompiler, so that Less source files may use {@code @import}, which isn't
+ * supported by the normal WRO4J processor.
+ */
+public class LessResourceTransformer implements ResourceTransformer
+{
+ private final LessCompiler compiler = new DefaultLessCompiler();
+
+ private final OperationTracker tracker;
+
+ private final Logger logger;
+
+ public LessResourceTransformer(OperationTracker tracker, Logger logger)
+ {
+ this.tracker = tracker;
+ this.logger = logger;
+ }
+
+ public String getTransformedContentType()
+ {
+ return "text/css";
+ }
+
+ class ResourceLessSource extends LessSource
+ {
+ private final Resource resource;
+
+ private final ResourceDependencies dependencies;
+
+
+ ResourceLessSource(Resource resource, ResourceDependencies dependencies)
+ {
+ this.resource = resource;
+ this.dependencies = dependencies;
+ }
+
+ @Override
+ public LessSource relativeSource(String filename) throws FileNotFound, CannotReadFile, StringSourceException
+ {
+ Resource relative = resource.forFile(filename);
+
+ if (!relative.exists())
+ {
+ throw new FileNotFound();
+ }
+
+ dependencies.addDependency(relative);
+
+ return new ResourceLessSource(relative, dependencies);
+ }
+
+ @Override
+ public String getContent() throws FileNotFound, CannotReadFile
+ {
+ // Adapted from Less's URLSource
+ try
+ {
+ Reader input = new InputStreamReader(resource.openStream());
+ String content = IOUtils.toString(input).replace("\r\n", "\n");
+
+ input.close();
+
+ return content;
+ } catch (FileNotFoundException ex)
+ {
+ throw new FileNotFound();
+ } catch (IOException ex)
+ {
+ throw new CannotReadFile();
+ }
+ }
+ }
+
+
+ public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException
+ {
+ return tracker.perform(String.format("Compiling %s from Less to CSS", source), new IOOperation<InputStream>()
+ {
+ public InputStream perform() throws IOException
+ {
+ long start = System.nanoTime();
+
+ InputStream result = compile(source, dependencies);
+
+ long complete = System.nanoTime();
+
+ logger.info(String.format("Compiled %s to Less in %.2f ms",
+ source, ResourceTransformUtils.nanosToMillis(complete - start)));
+
+ return result;
+ }
+ });
+ }
+
+ private InputStream compile(Resource source, ResourceDependencies dependencies) throws IOException
+ {
+ try
+ {
+ LessSource lessSource = new ResourceLessSource(source, dependencies);
+
+ LessCompiler.CompilationResult result = compiler.compile(lessSource);
+
+ // Currently, ignoring any warnings.
+
+ BytestreamCache cache = new BytestreamCache(result.getCss().getBytes("utf-8"));
+
+ return cache.openStream();
+ } catch (Less4jException ex)
+ {
+ throw new IOException(ex);
+ } catch (UnsupportedEncodingException ex)
+ {
+ throw new IOException(ex);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
new file mode 100644
index 0000000..eed495f
--- /dev/null
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
@@ -0,0 +1,28 @@
+// Copyright 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.wro4j;
+
+/**
+ * @since 5.4
+ */
+public class ResourceTransformUtils
+{
+ private static final double NANOS_TO_MILLIS = 1.0d / 1000000.0d;
+
+ public static double nanosToMillis(long nanos)
+ {
+ return ((double) nanos) * NANOS_TO_MILLIS;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
index 64e67a7..99d438f 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
@@ -34,8 +34,6 @@ import java.util.zip.Adler32;
public class ResourceTransformerFactoryImpl implements ResourceTransformerFactory
{
- private static final double NANOS_TO_MILLIS = 1.0d / 1000000.0d;
-
private final Logger logger;
private final ResourceProcessorSource source;
@@ -150,7 +148,7 @@ public class ResourceTransformerFactoryImpl implements ResourceTransformerFactor
logger.info(String.format("Compiled %s to %s in %.2f ms",
source, targetName,
- ((double) elapsedTime) * NANOS_TO_MILLIS));
+ ResourceTransformUtils.nanosToMillis(elapsedTime)));
return result;
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
index ac02015..05b39a7 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
@@ -31,7 +31,6 @@ import org.apache.tapestry5.services.assets.ResourceMinimizer;
import org.apache.tapestry5.services.assets.ResourceTransformer;
import org.apache.tapestry5.services.assets.StreamableResourceSource;
import org.apache.tapestry5.wro4j.services.ResourceProcessorSource;
-import ro.isdc.wro.extensions.processor.css.Less4jProcessor;
import ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor;
import ro.isdc.wro.extensions.processor.js.RhinoCoffeeScriptProcessor;
import ro.isdc.wro.extensions.processor.support.coffeescript.CoffeeScript;
@@ -61,7 +60,6 @@ public class WRO4JModule
* <dt>JavaScriptMinimizer</dt>
* <dd>{@link GoogleClosureCompressorProcessor} configured for simple optimizations. Advanced optimizations assume that all code is loaded
* in a single bundle, not a given for Tapestry.</dd>
- * <dt>LessCompiler</dt> <dd>Compiles Less source files into CSS.</dd>
* </dl>
*/
@Contribute(ResourceProcessorSource.class)
@@ -81,7 +79,6 @@ public class WRO4JModule
configuration.addInstance("CSSMinimizer", CssCompressorProcessor.class);
configuration.add("JavaScriptMinimizer", new GoogleClosureCompressorProcessor());
- configuration.addInstance("LessCompiler", Less4jProcessor.class);
}
@Contribute(StreamableResourceSource.class)
@@ -92,8 +89,8 @@ public class WRO4JModule
configuration.add("coffee",
factory.createCompiler("text/javascript", "CoffeeScriptCompiler", "CoffeeScript", "JavaScript", !productionMode));
- // We'll have to see how imports work in a Less file before we can get into whether we can enable development-mode caching.
- configuration.add("less", factory.createCompiler("text/css", "LessCompiler", "Less", "CSS", false));
+ // Had to create our own wrapper around Less4J to handle @imports correctly.
+ configuration.addInstance("less", LessResourceTransformer.class);
}
@Contribute(ResourceMinimizer.class)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
index ebac95e..923c7c5 100644
--- a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
@@ -1,2 +1,2 @@
-@primary = "blue";
-@secondary = lighten(@primary, 25%);
\ No newline at end of file
+@primary: blue;
+@secondary: lighten(@primary, 25%);
\ No newline at end of file
[4/7] git commit: Have the Layout component import the core stack
Posted by hl...@apache.org.
Have the Layout component import the core stack
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/650ddd50
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/650ddd50
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/650ddd50
Branch: refs/heads/master
Commit: 650ddd5047df702ae0c4324934078042179af7ba
Parents: fac32ff
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:22:35 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:22:35 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/components/Layout.groovy | 2 +-
.../src/test/groovy/t5/wro4j/pages/Index.groovy | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/650ddd50/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
index 3ce825a..6bb4523 100644
--- a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
@@ -4,7 +4,7 @@ import org.apache.tapestry5.annotations.Import
import org.apache.tapestry5.ioc.annotations.Inject
import org.apache.tapestry5.services.ComponentClassResolver
-@Import(module = "bootstrap")
+@Import(stack="core", module = "bootstrap")
class Layout {
@Inject
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/650ddd50/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
index 78b58da..e239108 100644
--- a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
@@ -2,7 +2,7 @@ package t5.wro4j.pages
import org.apache.tapestry5.annotations.Import
-@Import(stack = "core", module = "index", stylesheet = "index.less")
+@Import(module = "index", stylesheet = "index.less")
class Index {
[4/7] git commit: Have the Layout component import the core stack
Posted by hl...@apache.org.
Have the Layout component import the core stack
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/650ddd50
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/650ddd50
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/650ddd50
Branch: refs/heads/master
Commit: 650ddd5047df702ae0c4324934078042179af7ba
Parents: fac32ff
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:22:35 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:22:35 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/components/Layout.groovy | 2 +-
.../src/test/groovy/t5/wro4j/pages/Index.groovy | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/650ddd50/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
index 3ce825a..6bb4523 100644
--- a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
@@ -4,7 +4,7 @@ import org.apache.tapestry5.annotations.Import
import org.apache.tapestry5.ioc.annotations.Inject
import org.apache.tapestry5.services.ComponentClassResolver
-@Import(module = "bootstrap")
+@Import(stack="core", module = "bootstrap")
class Layout {
@Inject
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/650ddd50/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
index 78b58da..e239108 100644
--- a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/Index.groovy
@@ -2,7 +2,7 @@ package t5.wro4j.pages
import org.apache.tapestry5.annotations.Import
-@Import(stack = "core", module = "index", stylesheet = "index.less")
+@Import(module = "index", stylesheet = "index.less")
class Index {
[3/7] git commit: Add a Layout component
Posted by hl...@apache.org.
Add a Layout component
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fac32ffa
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fac32ffa
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fac32ffa
Branch: refs/heads/master
Commit: fac32ffa4373c598d989d5116d40065a067a6b8b
Parents: d71a6cb
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:20:38 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:20:38 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/components/Layout.groovy | 20 ++++++++
.../test/resources/t5/wro4j/components/Layout.tml | 36 +++++++++++++++
.../src/test/resources/t5/wro4j/pages/Index.tml | 21 +--------
3 files changed, 58 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
new file mode 100644
index 0000000..3ce825a
--- /dev/null
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
@@ -0,0 +1,20 @@
+package t5.wro4j.components
+
+import org.apache.tapestry5.annotations.Import
+import org.apache.tapestry5.ioc.annotations.Inject
+import org.apache.tapestry5.services.ComponentClassResolver
+
+@Import(module = "bootstrap")
+class Layout {
+
+ @Inject
+ private ComponentClassResolver resolver
+
+ String name
+
+ List<String> getPageNames() {
+ resolver.pageNames.findAll { !it.startsWith("core/") }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
new file mode 100644
index 0000000..04915e3
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
@@ -0,0 +1,36 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+<head>
+ <title>WRO4J Tests: ${componentResources.pageName}</title>
+</head>
+
+<div class="navbar navbar-inverse">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/">WRO4J Module Tests</a>
+ <ul class="nav">
+ <li><p class="navbar-text">${componentResources.pageName}</p></li>
+ </ul>
+ <ul class="pull-right nav">
+ <li class="divider-vertical"/>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ Pages <b class="caret"/>
+ </a>
+ <ul class="dropdown-menu">
+ <li t:type="loop" source="pageNames" value="name">
+ <t:pagelink page="prop:name">${name}</t:pagelink>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+
+<div class="container">
+
+ <t:body/>
+
+</div>
+
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
index 026e53d..26a47ee 100644
--- a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
@@ -1,24 +1,7 @@
-<html>
-<head>
- <title>WRO4J Tests</title>
-</head>
-
- <div class="navbar navbar-inverse">
- <div class="navbar-inner">
- <div class="container">
-
- <a class="brand" href="/">WRO4J Module Tests</a>
- </div>
- </div>
-</div>
-
-<div class="container">
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<p>This page is used to demonstrate the integration of WRO4J.</p>
-
<div class="alert alert-success" id="banner"/>
-</div>
-
-</html>
\ No newline at end of file
+</t:layout>
[3/7] git commit: Add a Layout component
Posted by hl...@apache.org.
Add a Layout component
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fac32ffa
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fac32ffa
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fac32ffa
Branch: refs/heads/master
Commit: fac32ffa4373c598d989d5116d40065a067a6b8b
Parents: d71a6cb
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:20:38 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:20:38 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/components/Layout.groovy | 20 ++++++++
.../test/resources/t5/wro4j/components/Layout.tml | 36 +++++++++++++++
.../src/test/resources/t5/wro4j/pages/Index.tml | 21 +--------
3 files changed, 58 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
new file mode 100644
index 0000000..3ce825a
--- /dev/null
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
@@ -0,0 +1,20 @@
+package t5.wro4j.components
+
+import org.apache.tapestry5.annotations.Import
+import org.apache.tapestry5.ioc.annotations.Inject
+import org.apache.tapestry5.services.ComponentClassResolver
+
+@Import(module = "bootstrap")
+class Layout {
+
+ @Inject
+ private ComponentClassResolver resolver
+
+ String name
+
+ List<String> getPageNames() {
+ resolver.pageNames.findAll { !it.startsWith("core/") }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
new file mode 100644
index 0000000..04915e3
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
@@ -0,0 +1,36 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+<head>
+ <title>WRO4J Tests: ${componentResources.pageName}</title>
+</head>
+
+<div class="navbar navbar-inverse">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/">WRO4J Module Tests</a>
+ <ul class="nav">
+ <li><p class="navbar-text">${componentResources.pageName}</p></li>
+ </ul>
+ <ul class="pull-right nav">
+ <li class="divider-vertical"/>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ Pages <b class="caret"/>
+ </a>
+ <ul class="dropdown-menu">
+ <li t:type="loop" source="pageNames" value="name">
+ <t:pagelink page="prop:name">${name}</t:pagelink>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+
+<div class="container">
+
+ <t:body/>
+
+</div>
+
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
index 026e53d..26a47ee 100644
--- a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
@@ -1,24 +1,7 @@
-<html>
-<head>
- <title>WRO4J Tests</title>
-</head>
-
- <div class="navbar navbar-inverse">
- <div class="navbar-inner">
- <div class="container">
-
- <a class="brand" href="/">WRO4J Module Tests</a>
- </div>
- </div>
-</div>
-
-<div class="container">
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<p>This page is used to demonstrate the integration of WRO4J.</p>
-
<div class="alert alert-success" id="banner"/>
-</div>
-
-</html>
\ No newline at end of file
+</t:layout>
[7/7] git commit: Improve Less support;
including ability to reference other Less files via @import
Posted by hl...@apache.org.
Improve Less support; including ability to reference other Less files via @import
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/512ee316
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/512ee316
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/512ee316
Branch: refs/heads/master
Commit: 512ee3168890efd00ffbb04efd277e35745ecb83
Parents: 1539066
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 18:19:41 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 18:19:41 2013 -0700
----------------------------------------------------------------------
.../internal/wro4j/LessResourceTransformer.java | 147 +++++++++++++++
.../internal/wro4j/ResourceTransformUtils.java | 28 +++
.../wro4j/ResourceTransformerFactoryImpl.java | 4 +-
.../tapestry5/wro4j/modules/WRO4JModule.java | 7 +-
.../src/test/resources/META-INF/assets/colors.less | 4 +-
5 files changed, 180 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
new file mode 100644
index 0000000..1b655f9
--- /dev/null
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/LessResourceTransformer.java
@@ -0,0 +1,147 @@
+// Copyright 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.wro4j;
+
+import com.github.sommeri.less4j.Less4jException;
+import com.github.sommeri.less4j.LessCompiler;
+import com.github.sommeri.less4j.LessSource;
+import com.github.sommeri.less4j.core.DefaultLessCompiler;
+import org.apache.commons.io.IOUtils;
+import org.apache.tapestry5.internal.services.assets.BytestreamCache;
+import org.apache.tapestry5.ioc.IOOperation;
+import org.apache.tapestry5.ioc.OperationTracker;
+import org.apache.tapestry5.ioc.Resource;
+import org.apache.tapestry5.services.assets.ResourceDependencies;
+import org.apache.tapestry5.services.assets.ResourceTransformer;
+import org.slf4j.Logger;
+
+import java.io.*;
+
+/**
+ * Direct wrapper around the LessCompiler, so that Less source files may use {@code @import}, which isn't
+ * supported by the normal WRO4J processor.
+ */
+public class LessResourceTransformer implements ResourceTransformer
+{
+ private final LessCompiler compiler = new DefaultLessCompiler();
+
+ private final OperationTracker tracker;
+
+ private final Logger logger;
+
+ public LessResourceTransformer(OperationTracker tracker, Logger logger)
+ {
+ this.tracker = tracker;
+ this.logger = logger;
+ }
+
+ public String getTransformedContentType()
+ {
+ return "text/css";
+ }
+
+ class ResourceLessSource extends LessSource
+ {
+ private final Resource resource;
+
+ private final ResourceDependencies dependencies;
+
+
+ ResourceLessSource(Resource resource, ResourceDependencies dependencies)
+ {
+ this.resource = resource;
+ this.dependencies = dependencies;
+ }
+
+ @Override
+ public LessSource relativeSource(String filename) throws FileNotFound, CannotReadFile, StringSourceException
+ {
+ Resource relative = resource.forFile(filename);
+
+ if (!relative.exists())
+ {
+ throw new FileNotFound();
+ }
+
+ dependencies.addDependency(relative);
+
+ return new ResourceLessSource(relative, dependencies);
+ }
+
+ @Override
+ public String getContent() throws FileNotFound, CannotReadFile
+ {
+ // Adapted from Less's URLSource
+ try
+ {
+ Reader input = new InputStreamReader(resource.openStream());
+ String content = IOUtils.toString(input).replace("\r\n", "\n");
+
+ input.close();
+
+ return content;
+ } catch (FileNotFoundException ex)
+ {
+ throw new FileNotFound();
+ } catch (IOException ex)
+ {
+ throw new CannotReadFile();
+ }
+ }
+ }
+
+
+ public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException
+ {
+ return tracker.perform(String.format("Compiling %s from Less to CSS", source), new IOOperation<InputStream>()
+ {
+ public InputStream perform() throws IOException
+ {
+ long start = System.nanoTime();
+
+ InputStream result = compile(source, dependencies);
+
+ long complete = System.nanoTime();
+
+ logger.info(String.format("Compiled %s to Less in %.2f ms",
+ source, ResourceTransformUtils.nanosToMillis(complete - start)));
+
+ return result;
+ }
+ });
+ }
+
+ private InputStream compile(Resource source, ResourceDependencies dependencies) throws IOException
+ {
+ try
+ {
+ LessSource lessSource = new ResourceLessSource(source, dependencies);
+
+ LessCompiler.CompilationResult result = compiler.compile(lessSource);
+
+ // Currently, ignoring any warnings.
+
+ BytestreamCache cache = new BytestreamCache(result.getCss().getBytes("utf-8"));
+
+ return cache.openStream();
+ } catch (Less4jException ex)
+ {
+ throw new IOException(ex);
+ } catch (UnsupportedEncodingException ex)
+ {
+ throw new IOException(ex);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
new file mode 100644
index 0000000..eed495f
--- /dev/null
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformUtils.java
@@ -0,0 +1,28 @@
+// Copyright 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.wro4j;
+
+/**
+ * @since 5.4
+ */
+public class ResourceTransformUtils
+{
+ private static final double NANOS_TO_MILLIS = 1.0d / 1000000.0d;
+
+ public static double nanosToMillis(long nanos)
+ {
+ return ((double) nanos) * NANOS_TO_MILLIS;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
index 64e67a7..99d438f 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/internal/wro4j/ResourceTransformerFactoryImpl.java
@@ -34,8 +34,6 @@ import java.util.zip.Adler32;
public class ResourceTransformerFactoryImpl implements ResourceTransformerFactory
{
- private static final double NANOS_TO_MILLIS = 1.0d / 1000000.0d;
-
private final Logger logger;
private final ResourceProcessorSource source;
@@ -150,7 +148,7 @@ public class ResourceTransformerFactoryImpl implements ResourceTransformerFactor
logger.info(String.format("Compiled %s to %s in %.2f ms",
source, targetName,
- ((double) elapsedTime) * NANOS_TO_MILLIS));
+ ResourceTransformUtils.nanosToMillis(elapsedTime)));
return result;
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
index ac02015..05b39a7 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
@@ -31,7 +31,6 @@ import org.apache.tapestry5.services.assets.ResourceMinimizer;
import org.apache.tapestry5.services.assets.ResourceTransformer;
import org.apache.tapestry5.services.assets.StreamableResourceSource;
import org.apache.tapestry5.wro4j.services.ResourceProcessorSource;
-import ro.isdc.wro.extensions.processor.css.Less4jProcessor;
import ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor;
import ro.isdc.wro.extensions.processor.js.RhinoCoffeeScriptProcessor;
import ro.isdc.wro.extensions.processor.support.coffeescript.CoffeeScript;
@@ -61,7 +60,6 @@ public class WRO4JModule
* <dt>JavaScriptMinimizer</dt>
* <dd>{@link GoogleClosureCompressorProcessor} configured for simple optimizations. Advanced optimizations assume that all code is loaded
* in a single bundle, not a given for Tapestry.</dd>
- * <dt>LessCompiler</dt> <dd>Compiles Less source files into CSS.</dd>
* </dl>
*/
@Contribute(ResourceProcessorSource.class)
@@ -81,7 +79,6 @@ public class WRO4JModule
configuration.addInstance("CSSMinimizer", CssCompressorProcessor.class);
configuration.add("JavaScriptMinimizer", new GoogleClosureCompressorProcessor());
- configuration.addInstance("LessCompiler", Less4jProcessor.class);
}
@Contribute(StreamableResourceSource.class)
@@ -92,8 +89,8 @@ public class WRO4JModule
configuration.add("coffee",
factory.createCompiler("text/javascript", "CoffeeScriptCompiler", "CoffeeScript", "JavaScript", !productionMode));
- // We'll have to see how imports work in a Less file before we can get into whether we can enable development-mode caching.
- configuration.add("less", factory.createCompiler("text/css", "LessCompiler", "Less", "CSS", false));
+ // Had to create our own wrapper around Less4J to handle @imports correctly.
+ configuration.addInstance("less", LessResourceTransformer.class);
}
@Contribute(ResourceMinimizer.class)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/512ee316/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
index ebac95e..923c7c5 100644
--- a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
@@ -1,2 +1,2 @@
-@primary = "blue";
-@secondary = lighten(@primary, 25%);
\ No newline at end of file
+@primary: blue;
+@secondary: lighten(@primary, 25%);
\ No newline at end of file
[2/7] git commit: Clarify return value of method
Posted by hl...@apache.org.
Clarify return value of method
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d71a6cbc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d71a6cbc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d71a6cbc
Branch: refs/heads/master
Commit: d71a6cbc3373f336c13da51d22b4a3e2acdcbf15
Parents: 466f3dd
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:20:26 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:20:26 2013 -0700
----------------------------------------------------------------------
.../tapestry5/services/ComponentClassResolver.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d71a6cbc/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
index f7018a1..f6e8a1f 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
@@ -62,7 +62,7 @@ public interface ComponentClassResolver
boolean isPageName(String pageName);
/**
- * Returns a list of all page names, in sorted order.
+ * Returns a list of all page names, in sorted order. These are the "canonical" page names.
*/
List<String> getPageNames();
[5/7] git commit: Use the common Problem base interface for reporting
Less compilation errors
Posted by hl...@apache.org.
Use the common Problem base interface for reporting Less compilation errors
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/795c38f1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/795c38f1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/795c38f1
Branch: refs/heads/master
Commit: 795c38f17e858caa39567ae3fa54be3039247e49
Parents: 650ddd5
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:35:40 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:35:40 2013 -0700
----------------------------------------------------------------------
.../tapestry5/wro4j/modules/WRO4JModule.java | 19 ++++++++-------
1 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/795c38f1/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
index fa286ee..ac02015 100644
--- a/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
+++ b/tapestry-wro4j/src/main/java/org/apache/tapestry5/wro4j/modules/WRO4JModule.java
@@ -14,6 +14,7 @@
package org.apache.tapestry5.wro4j.modules;
+import com.github.sommeri.less4j.LessCompiler;
import com.github.sommeri.less4j.core.parser.AntlrException;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.SymbolConstants;
@@ -110,31 +111,31 @@ public class WRO4JModule
*/
@Contribute(ObjectRenderer.class)
@Primary
- public static void provideLessErrorRenderers(MappedConfiguration<Class, ObjectRenderer> configuration)
+ public static void provideLessCompilerProblemRenderer(MappedConfiguration<Class, ObjectRenderer> configuration)
{
- configuration.add(AntlrException.class, new ObjectRenderer<AntlrException>()
+ configuration.add(LessCompiler.Problem.class, new ObjectRenderer<LessCompiler.Problem>()
{
- public void render(AntlrException e, MarkupWriter writer)
+ public void render(LessCompiler.Problem problem, MarkupWriter writer)
{
List<String> strings = CollectionFactory.newList();
- if (InternalUtils.isNonBlank(e.getMessage()))
+ if (InternalUtils.isNonBlank(problem.getMessage()))
{
- strings.add(e.getMessage());
+ strings.add(problem.getMessage());
}
// Inside WRO4J we see that the LessSource is a StringSource with no useful toString(), so
// it is omitted. We may need to create our own processors, stripping away a couple of layers of
// WRO4J to get proper exception reporting!
- if (e.getLine() > 0)
+ if (problem.getLine() > 0)
{
- strings.add("line " + e.getLine());
+ strings.add("line " + problem.getLine());
}
- if (e.getCharacter() > 0)
+ if (problem.getCharacter() > 0)
{
- strings.add("position " + e.getCharacter());
+ strings.add("position " + problem.getCharacter());
}
writer.write(InternalUtils.join(strings, " - "));
[6/7] git commit: Create a page to demonstrate using Less with
@import statements
Posted by hl...@apache.org.
Create a page to demonstrate using Less with @import statements
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/15390667
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/15390667
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/15390667
Branch: refs/heads/master
Commit: 153906673c71ffadb2a86a7892ca666a109fa10c
Parents: 795c38f
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:39:13 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:39:13 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/pages/MultiLess.groovy | 7 ++++++
.../src/test/resources/META-INF/assets/colors.less | 2 +
.../src/test/resources/META-INF/assets/multi.less | 11 ++++++++++
.../test/resources/t5/wro4j/pages/MultiLess.tml | 16 +++++++++++++++
4 files changed, 36 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
new file mode 100644
index 0000000..ca9a68d
--- /dev/null
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
@@ -0,0 +1,7 @@
+package t5.wro4j.pages
+
+import org.apache.tapestry5.annotations.Import
+
+@Import(stylesheet = "multi.less")
+class MultiLess {
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
new file mode 100644
index 0000000..ebac95e
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
@@ -0,0 +1,2 @@
+@primary = "blue";
+@secondary = lighten(@primary, 25%);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less b/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
new file mode 100644
index 0000000..f89379a
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
@@ -0,0 +1,11 @@
+@import "colors.less";
+
+.demo {
+
+ background-color: @secondary;
+
+ h3 {
+ color: @primary;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
new file mode 100644
index 0000000..86559e8
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
@@ -0,0 +1,16 @@
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+
+ <p>This page is used to demonstrate Less that uses @import.</p>
+
+
+
+<div class="demo">
+
+ <h3>Primary: should be dark blue.</h3>
+
+ <p>Background color should be a lighter blue.</p>
+
+</div>
+
+
+</t:layout>
[6/7] git commit: Create a page to demonstrate using Less with
@import statements
Posted by hl...@apache.org.
Create a page to demonstrate using Less with @import statements
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/15390667
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/15390667
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/15390667
Branch: refs/heads/master
Commit: 153906673c71ffadb2a86a7892ca666a109fa10c
Parents: 795c38f
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:39:13 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:39:13 2013 -0700
----------------------------------------------------------------------
.../test/groovy/t5/wro4j/pages/MultiLess.groovy | 7 ++++++
.../src/test/resources/META-INF/assets/colors.less | 2 +
.../src/test/resources/META-INF/assets/multi.less | 11 ++++++++++
.../test/resources/t5/wro4j/pages/MultiLess.tml | 16 +++++++++++++++
4 files changed, 36 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
new file mode 100644
index 0000000..ca9a68d
--- /dev/null
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/pages/MultiLess.groovy
@@ -0,0 +1,7 @@
+package t5.wro4j.pages
+
+import org.apache.tapestry5.annotations.Import
+
+@Import(stylesheet = "multi.less")
+class MultiLess {
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
new file mode 100644
index 0000000..ebac95e
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/colors.less
@@ -0,0 +1,2 @@
+@primary = "blue";
+@secondary = lighten(@primary, 25%);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less b/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
new file mode 100644
index 0000000..f89379a
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/META-INF/assets/multi.less
@@ -0,0 +1,11 @@
+@import "colors.less";
+
+.demo {
+
+ background-color: @secondary;
+
+ h3 {
+ color: @primary;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/15390667/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
new file mode 100644
index 0000000..86559e8
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/MultiLess.tml
@@ -0,0 +1,16 @@
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+
+ <p>This page is used to demonstrate Less that uses @import.</p>
+
+
+
+<div class="demo">
+
+ <h3>Primary: should be dark blue.</h3>
+
+ <p>Background color should be a lighter blue.</p>
+
+</div>
+
+
+</t:layout>
[2/7] git commit: Clarify return value of method
Posted by hl...@apache.org.
Clarify return value of method
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d71a6cbc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d71a6cbc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d71a6cbc
Branch: refs/heads/master
Commit: d71a6cbc3373f336c13da51d22b4a3e2acdcbf15
Parents: 466f3dd
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri May 31 17:20:26 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri May 31 17:20:26 2013 -0700
----------------------------------------------------------------------
.../tapestry5/services/ComponentClassResolver.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d71a6cbc/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
index f7018a1..f6e8a1f 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassResolver.java
@@ -62,7 +62,7 @@ public interface ComponentClassResolver
boolean isPageName(String pageName);
/**
- * Returns a list of all page names, in sorted order.
+ * Returns a list of all page names, in sorted order. These are the "canonical" page names.
*/
List<String> getPageNames();