[ 
https://issues.apache.org/jira/browse/HADOOP-8924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alejandro Abdelnur updated HADOOP-8924:
---------------------------------------

    Attachment: HADOOP-8924.patch

Thanks Chris.

(not setting as patch avail because the plugin is not avail in a Maven repo, 
details follow).

Attached is patch that uses a maven plugin to generate the version information.

The patch changes the VersionInfo class to read all the info from a properties 
file instead of the package-info.java and the HadoopVersionInfoAnnotation.

The HadoopVersionInfoAnnotation.java and the saveVersion.sh files are deleted.

A new properties file 'common-version-info.properties' with ${} variables is 
available in src/main/resources:

{code}
version=${pom.version}
revision=${version-info.scm.commit}
branch=${version-info.scm.branch}
user=${user.name}
date=${version-info.build.time}
url=${version-info.scm.uri}
srcChecksum=${version-info.source.md5}
{code}

This file is copied into target using filtering and the variables are resolved 
at copy time.

All the variables that start with version-info are resolved and injected into 
the project by the new plugin hadoop-maven-plugins using the goal version-info:

{code}
...
      <plugin>
        <groupId>org.apache.hadoop.maven.plugin</groupId>
        <artifactId>hadoop-maven-plugins</artifactId>
        <executions>
          <execution>
            <id>version-info</id>
            <goals>
              <goal>version-info</goal>
            </goals>
            <configuration>
              <source>
                <directory>${basedir}/src/main/java</directory>
                <includes>
                  <include>**/*.java</include>
                </includes>
              </source>
            </configuration>
          </execution>
        </executions>
      </plugin>
...
{code}


Because the plugin is not yet available, to test it you'll have to build and 
install it locally. The plugin source is avail at:

   https://github.com/tucu00/hadoop-maven-plugins

After cloning it, running 'mvn install' will install it locally.

You'll need to apply HADOOP-9116 before this patch in order to get things to 
work otherwise the sources JAR ends up in the classpath with the unresolved 
properties files and it may be first in the classpath.

I've tested in OSX and Windows and seems to be working as expected.

I still need to verify the MD5 generated is correct.

I think the current way VersionInfo works (only getting the md5 of common is 
not correct), but this is out of scope from this JIRA. Also, the YARN variant 
seems not be used from the command line when doing 'yarn version'.

Regarding the maven plugins, we have to figure how we'll build/publish them to 
a Maven repo in order to use them. I personally think they should be a 
sub-project of Hadoop to allow us to release new ones independent of Hadoop. 
Why a Hadoop sub-project and not a general project? IMO, the focus of these 
plugins (including HADOOP-8887 for cmake and the protoc that is already avail 
in the GH repo, another JIRA coming soon) is to solve Hadoop build problems.

                
> Hadoop Common creating package-info.java must not depend on sh, at least for 
> Windows
> ------------------------------------------------------------------------------------
>
>                 Key: HADOOP-8924
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8924
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: build
>    Affects Versions: trunk-win
>            Reporter: Chris Nauroth
>            Assignee: Alejandro Abdelnur
>             Fix For: trunk-win
>
>         Attachments: HADOOP-8924-branch-trunk-win.patch, HADOOP-8924.patch
>
>
> Currently, the build process relies on saveVersion.sh to generate 
> package-info.java with a version annotation.  The sh binary may not be 
> available on all developers' machines (e.g. Windows without Cygwin). This 
> issue tracks removal of that dependency in Hadoop Common.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to