flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject git commit: FLUME-2054: Support Version Info on Windows and fix failure of TestVersionInfo
Date Wed, 29 May 2013 16:05:24 GMT
Updated Branches:
  refs/heads/trunk 669e5d327 -> 8594feba3


FLUME-2054: Support Version Info on Windows and fix failure of TestVersionInfo

(Roshan Naik via Brock Noland)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/8594feba
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/8594feba
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/8594feba

Branch: refs/heads/trunk
Commit: 8594feba3bca657887957613910dffe42b0f9221
Parents: 669e5d3
Author: Brock Noland <brock@apache.org>
Authored: Wed May 29 11:04:49 2013 -0500
Committer: Brock Noland <brock@apache.org>
Committed: Wed May 29 11:04:49 2013 -0500

----------------------------------------------------------------------
 flume-ng-core/pom.xml                 |   58 ++++++++++++++++++++++++++
 flume-ng-core/scripts/saveVersion.ps1 |   61 ++++++++++++++++++++++++++++
 pom.xml                               |    8 ++++
 3 files changed, 127 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/8594feba/flume-ng-core/pom.xml
----------------------------------------------------------------------
diff --git a/flume-ng-core/pom.xml b/flume-ng-core/pom.xml
index 20e975f..e37de5b 100644
--- a/flume-ng-core/pom.xml
+++ b/flume-ng-core/pom.xml
@@ -183,6 +183,64 @@ limitations under the License.
         </plugins>
       </build>
     </profile>
+
+    <profile>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>Windows</family>
+        </os>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>1.7</version>
+            <executions>
+              <execution>
+                <id>generate-version</id>
+                <phase>generate-sources</phase>
+                <configuration>
+                  <target>
+                    <mkdir dir="${project.build.directory}/generated-sources/java/org/apache/flume"/>
+                    <exec executable="powershell">
+                      <arg
+                              line = "-executionpolicy unrestricted -file ${basedir}\scripts\saveVersion.ps1
 ${project.version} ${project.build.directory}" />
+                    </exec>
+                  </target>
+                </configuration>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <version>1.7</version>
+            <executions>
+              <execution>
+                <id>add-source</id>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>add-source</goal>
+                </goals>
+                <configuration>
+                  <sources>
+                    <source>target/generated-sources/java</source>
+                  </sources>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+
+        </plugins>
+      </build>
+    </profile>
+
   </profiles>
 
 

http://git-wip-us.apache.org/repos/asf/flume/blob/8594feba/flume-ng-core/scripts/saveVersion.ps1
----------------------------------------------------------------------
diff --git a/flume-ng-core/scripts/saveVersion.ps1 b/flume-ng-core/scripts/saveVersion.ps1
new file mode 100644
index 0000000..dff8813
--- /dev/null
+++ b/flume-ng-core/scripts/saveVersion.ps1
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+# This script is used to generate the annotation of package info that
+# records the version, revision, branch, url, user and timestamp.
+
+$version=$args[0]
+$buildDirectory=$args[1]
+$outputFile= "$buildDirectory\generated-sources\java\org\apache\flume\package-info.java"
+$user = $Env:username
+$date = Get-Date
+
+cmd /c svn info 2>&1 | Out-Null
+if ( $LastExitCode -eq 0 ) {
+  $revision=svn info  | % { if( $_ -match "Last Changed Rev: (?<rev>.*)" ) { $matches['rev'];}
}
+  $url=svn info  | % { if( $_ -match "URL: (?<url>.*)" ) { $matches['url'];} }
+  $branch=  if( $url -match ".*(?<branch>(branches.*)|(tags.*)|(trunk.*))" ) { $matches['branch'];
} else { "Unknown"; }
+}
+else {
+    cmd /c git rev-parse HEAD  2>&1 | Out-Null
+    if ( $LastExitCode -eq 0 ) {
+      $revision=$(git log -1 --pretty=format:"%H")
+      $branch=$(git name-rev --name-only HEAD)
+      $remote=$(git config branch.$branch.remote)
+      $url=$(git config remote.$remote.url)
+    }
+    else {
+      revision="Unknown"
+      branch="Unknown"
+      url="file://$cwd"
+    }
+}
+
+$srcChecksum="N/A"
+
+
+$fileContent = @"
+/*
+ * Generated by scripts/saveVersion.ps1
+ */
+@VersionAnnotation(version="$version", revision="$revision", branch="$branch",
+                         user="$user", date="$date", url="$url",
+                         srcChecksum="$srcChecksum")
+package org.apache.flume;
+"@
+
+New-Item $outputFile -value $fileContent -force -type file
+

http://git-wip-us.apache.org/repos/asf/flume/blob/8594feba/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a6992f6..5b6679c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,6 +163,14 @@ limitations under the License.
       </activation>
     </profile>
 
+    <profile>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>Windows</family>
+        </os>
+      </activation>
+    </profile>
 
     <profile>
       <id>sign</id>


Mime
View raw message