You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/10/15 13:41:29 UTC

[2/3] git commit: Work around for archetype:generate forcing OS line endings.

Work around for archetype:generate forcing OS line endings.

When processing template resources (filtered="true") the archetype plugin forces all content to use the current OS specific line endings. Treat shell scripts as binary files in the archetype plugin and instead move the shell script variable replacement to the build phase of the resulting project.

Shell scripts don't work when they contain Windows style line breaks, so it is important to preserve the original line breaks even when building 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/208aeea1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/208aeea1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/208aeea1

Branch: refs/heads/master
Commit: 208aeea161bbaab5aa97c86087a978b3ed93e982
Parents: 0d775db
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Oct 9 21:52:37 2014 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Oct 9 21:52:37 2014 +0300

----------------------------------------------------------------------
 usage/archetypes/quickstart/pom.xml             |  8 +++++--
 .../quickstart/src/brooklyn-sample/pom.xml      |  2 ++
 .../src/main/assembly/assembly.xml              | 24 ++++++++++++++------
 .../src/main/assembly/scripts/start.sh          |  4 ++--
 .../META-INF/maven/archetype-metadata.xml       |  4 +++-
 5 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/208aeea1/usage/archetypes/quickstart/pom.xml
----------------------------------------------------------------------
diff --git a/usage/archetypes/quickstart/pom.xml b/usage/archetypes/quickstart/pom.xml
index d0a6c7a..035e685 100644
--- a/usage/archetypes/quickstart/pom.xml
+++ b/usage/archetypes/quickstart/pom.xml
@@ -149,7 +149,8 @@
                 <exclude>.*</exclude> 
                 <exclude>**/*.png</exclude> 
                 <exclude>.*/**</exclude> 
-                <exclude>*.log</exclude> 
+                <exclude>*.log</exclude>
+                <exclude>**/*.sh</exclude>
               </excludes>
               <replacements>
                 <!-- special chars in velocity have to be escaped.
@@ -178,7 +179,10 @@
               <basedir>${basedir}/src/brooklyn-sample/</basedir>
               <outputBasedir>${basedir}</outputBasedir>
               <outputDir>src/main/resources/archetype-resources/</outputDir>
-              <includes> <include>**/*.png</include> </includes>
+              <includes>
+                <include>**/*.png</include>
+                <include>**/*.sh</include>
+              </includes>
               <excludes> 
                 <exclude>target/**</exclude> 
                 <exclude>test-output/**</exclude> 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/208aeea1/usage/archetypes/quickstart/src/brooklyn-sample/pom.xml
----------------------------------------------------------------------
diff --git a/usage/archetypes/quickstart/src/brooklyn-sample/pom.xml b/usage/archetypes/quickstart/src/brooklyn-sample/pom.xml
index 8b4117e..cf03dac 100644
--- a/usage/archetypes/quickstart/src/brooklyn-sample/pom.xml
+++ b/usage/archetypes/quickstart/src/brooklyn-sample/pom.xml
@@ -58,6 +58,8 @@
   -->
 
   <properties>
+    <project.entry>com.acme.sample.SampleMain</project.entry>
+
     <!-- Compilation -->
     <java.version>1.6</java.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/208aeea1/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml b/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml
index beb6f70..2875a8a 100644
--- a/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml
+++ b/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/assembly.xml
@@ -40,12 +40,20 @@
         </dependencySet>
     </dependencySets>
 
+    <!--
+       Adds startup scripts to the root directory of zip package. The startup
+       scripts are located to src/main/scripts directory as stated by Maven
+       conventions.
+    -->
+    <files>
+        <file>
+            <source>src/main/assembly/scripts/start.sh</source>
+            <outputDirectory></outputDirectory>
+            <fileMode>0755</fileMode>
+            <filtered>true</filtered>
+        </file>
+    </files>
     <fileSets>
-        <!--
-           Adds startup scripts to the root directory of zip package. The startup
-           scripts are located to src/main/scripts directory as stated by Maven
-           conventions.
-        -->
         <fileSet>
             <directory>src/main/assembly/scripts</directory>
             <outputDirectory></outputDirectory>
@@ -53,8 +61,11 @@
             <includes>
                 <include>*</include>
             </includes>
+            <excludes>
+                <exclude>start.sh</exclude>
+            </excludes>
         </fileSet>
-	   <!-- add additional files (but not marked executable) -->
+        <!--  add additional files (but not marked executable) -->
         <fileSet>
             <directory>src/main/assembly/files</directory>
             <outputDirectory></outputDirectory>
@@ -75,4 +86,3 @@
         </fileSet>
     </fileSets>
 </assembly>
-

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/208aeea1/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh
----------------------------------------------------------------------
diff --git a/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh b/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh
index 5f93b5b..2879b6d 100755
--- a/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh
+++ b/usage/archetypes/quickstart/src/brooklyn-sample/src/main/assembly/scripts/start.sh
@@ -29,12 +29,12 @@ if [ ! -x "$JAVA" ] ; then
   exit 1
 fi
 
-if [[ ! `ls brooklyn-sample-*.jar 2> /dev/null` ]] ; then
+if [[ ! `ls ${project.artifactId}-*.jar 2> /dev/null` ]] ; then
   echo Command must be run from the directory where the JAR is installed.
   exit 4
 fi
 
 $JAVA -Xms256m -Xmx1024m -XX:MaxPermSize=1024m \
     -classpath "conf/:patch/*:*:lib/*" \
-    com.acme.sample.brooklyn.SampleMain \
+    ${project.entry} \
     "$@"

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/208aeea1/usage/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/usage/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml b/usage/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
index 8059d86..4768945 100644
--- a/usage/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/usage/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -43,6 +43,7 @@
       <directory></directory>
       <includes>
         <include>**/*.png</include>
+        <include>**/*.sh</include>
       </includes>
     </fileSet>
     <fileSet filtered="true" packaged="false">
@@ -55,7 +56,8 @@
         <exclude>src/main/java/**</exclude> 
         <exclude>src/test/java/**</exclude> 
         <exclude>pom.xml</exclude>
-        <exclude>**.png</exclude> 
+        <exclude>**.png</exclude>
+        <exclude>**.sh</exclude>
       </excludes>
     </fileSet>
   </fileSets>