brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [22/50] [abbrv] git commit: Rework gzipping of jsgui resources
Date Fri, 23 May 2014 14:51:53 GMT
Rework gzipping of jsgui resources

Uses an ant gzip task rather than the custom bash script that breaks
the build on Windows.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/2f407ca6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/2f407ca6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/2f407ca6

Branch: refs/pull/1410/merge
Commit: 2f407ca6f497335088a13b88f6d557a4f2af87bb
Parents: e347267
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Thu May 22 16:13:20 2014 +0100
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Thu May 22 16:13:20 2014 +0100

----------------------------------------------------------------------
 usage/jsgui/build/gzip-with-redirect.sh | 23 --------------------
 usage/jsgui/pom.xml                     | 32 ++++++++++++----------------
 2 files changed, 14 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2f407ca6/usage/jsgui/build/gzip-with-redirect.sh
----------------------------------------------------------------------
diff --git a/usage/jsgui/build/gzip-with-redirect.sh b/usage/jsgui/build/gzip-with-redirect.sh
deleted file mode 100755
index ef0c68e..0000000
--- a/usage/jsgui/build/gzip-with-redirect.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env sh
-
-# This script is a fairly grim workaround for the following scenario:
-# * We'd like certain files to be compressed with gzip at build time so 
-#   Jersey can serve the compressed content when the Accept-Encoding:gzip
-#   header is given.
-# * We want to keep the input files given to gzip so that we serve files 
-#   correctly if a request's Accept-Encoding header is none.
-# * By default gzip replaces input files with its compressed output. This
-#   can be surpressed with the -k flag, but -k is a relatively new addition 
-#   to gzip and its presence can't be relied on. So we're stuck with -c
-#   and redirecting stdout.
-# * The exec-maven-plugin is a handy tool for executing arbitrary commands
-#   at build. Sadly, it does not produce valid .gz files when the outputFile
-#   parameter is given.
-# * Hence this script.
-
-# When exec-maven-plugin 1.3 is released we should revisit this file.
-
-for f in $@; do
-    gzip --best -c $f > $f.gz
-done
-

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2f407ca6/usage/jsgui/pom.xml
----------------------------------------------------------------------
diff --git a/usage/jsgui/pom.xml b/usage/jsgui/pom.xml
index 9afea51..2fcd1b3 100644
--- a/usage/jsgui/pom.xml
+++ b/usage/jsgui/pom.xml
@@ -30,7 +30,7 @@
 
         <!-- The maven-war-plugin 2.1+ and the replacer plugin don't work well together.
-->
         <maven-war-plugin.version>2.0.2</maven-war-plugin.version>
-        <exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
+        <maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
 
         <project.build.webapp>
             ${project.build.directory}/${project.build.finalName}
@@ -273,31 +273,27 @@
 
                     <!-- Compress the minified files. Jetty will serve the gzipped content
instead. -->
                     <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>${exec-maven-plugin.version}</version>
-                        <configuration>
-                            <executable>${project.basedir}/build/gzip-with-redirect.sh</executable>
-                        </configuration>
+                        <artifactId>maven-antrun-plugin</artifactId>
                         <executions>
-                            <!-- This section could be *way* simpler with `gzip -k`, but
-k is a new addition
-                                 to gzip and we can't assume its presence -->
                             <execution>
-                                <id>gzip-resources</id>
+                                <id>Compress resources</id>
                                 <phase>prepare-package</phase>
                                 <goals>
-                                    <goal>exec</goal>
+                                    <goal>run</goal>
                                 </goals>
                                 <configuration>
-                                    <arguments>
-                                        <argument>${project.build.webapp}/assets/css/styles.min.css</argument>
-                                        <argument>${project.build.webapp}/assets/css/brooklyn.css</argument>
-                                        <argument>${project.build.webapp}/assets/js/gui.min.js</argument>
-                                        <argument>${project.build.webapp}/assets/js/libs/require.js</argument>
-                                    </arguments>
+                                    <target>
+                                        <gzip src="${project.build.webapp}/assets/css/styles.min.css"
+                                              destfile="${project.build.webapp}/assets/css/styles.min.css.gz"/>
+                                        <gzip src="${project.build.webapp}/assets/css/brooklyn.css"
+                                              destfile="${project.build.webapp}/assets/css/brooklyn.css.gz"/>
+                                        <gzip src="${project.build.webapp}/assets/js/gui.min.js"
+                                              destfile="${project.build.webapp}/assets/js/gui.min.js.gz"/>
+                                        <gzip src="${project.build.webapp}/assets/js/libs/require.js"
+                                              destfile="${project.build.webapp}/assets/js/libs/require.js.gz"/>
+                                    </target>
                                 </configuration>
                             </execution>
-
                         </executions>
                     </plugin>
                 </plugins>


Mime
View raw message