Skip to content

Commit

Permalink
renaming build.properties file to more specific to hadoop-lzo
Browse files Browse the repository at this point in the history
  • Loading branch information
cevaris committed Dec 9, 2016
1 parent 97184ef commit 88ebb48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
<goal>run</goal>
</goals>
<configuration>
<target name="build-info-non-win" description="generates build.properties" if="non-windows">
<target name="build-info-non-win" description="generates hadoop-lzo-build.properties" if="non-windows">
<tstamp>
<format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT"/>
</tstamp>
Expand All @@ -227,7 +227,7 @@
<exec executable="uname" outputproperty="build_os">
<arg value="-a"/>
</exec>
<propertyfile file="${project.build.outputDirectory}/build.properties"
<propertyfile file="${project.build.outputDirectory}/hadoop-lzo-build.properties"
comment="This file is automatically generated - DO NOT EDIT">
<entry key="build_time" value="${build_time}"/>
<entry key="build_revision" value="${build_revision}"/>
Expand All @@ -245,14 +245,14 @@
<goal>run</goal>
</goals>
<configuration>
<target name="build-info-win" description="generates build.properties" if="windows">
<target name="build-info-win" description="generates hadoop-lzo-build.properties" if="windows">
<tstamp>
<format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT"/>
</tstamp>
<exec executable="sh" outputproperty="build_revision">
<arg value="scripts/get_build_revision.sh" />
</exec>
<propertyfile file="${project.build.outputDirectory}/build.properties"
<propertyfile file="${project.build.outputDirectory}/hadoop-lzo-build.properties"
comment="This file is automatically generated - DO NOT EDIT">
<entry key="build_time" value="${build_time}"/>
<entry key="build_revision" value="${build_revision}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/hadoop/compression/lzo/LzoCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public static boolean isNativeLzoLoaded(Configuration conf) {
public static String getRevisionHash() {
try {
Properties p = new Properties();
p.load(LzoCodec.class.getResourceAsStream("/build.properties"));
p.load(LzoCodec.class.getResourceAsStream("/hadoop-lzo-build.properties"));
return p.getProperty("build_revision");
} catch (IOException e) {
LOG.error("Could not find build properties file with revision hash");
LOG.error("Could not find /hadoop-lzo-build.properties resource file with revision hash");
return "UNKNOWN";
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/com/hadoop/compression/lzo/TestLzoCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,9 @@ public void testCodecPoolReuseWithoutConf() throws Exception {
assertEquals(LzoCompressor.CompressionStrategy.LZO1X_1,
((LzoCompressor)c2).getStrategy());
}

public void testGetRevisionHash() throws Exception {
// should always return a revision hash
assertFalse(LzoCodec.getRevisionHash().equalsIgnoreCase("UNKNOWN"));
}
}

0 comments on commit 88ebb48

Please sign in to comment.