-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from burtcorp/build-fixes
Build fixes
- Loading branch information
Showing
5 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.burt.athena; | ||
|
||
import java.io.IOException; | ||
import java.util.Properties; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
class AthenaDriverInfo { | ||
private static final String driverVersion; | ||
private static final int driverMajorVersion; | ||
private static final int driverMinorVersion; | ||
|
||
static { | ||
final Properties properties = new Properties(); | ||
try { | ||
properties.load(AthenaDatabaseMetaData.class.getClassLoader().getResourceAsStream("project.properties")); | ||
} catch (IOException e) { | ||
throw new RuntimeException("Could not load driver version: " + e.getMessage(), e); | ||
} | ||
driverVersion = properties.getProperty("project.version"); | ||
final Pattern versionComponentsPattern = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-\\w+)?"); | ||
final Matcher matcher = versionComponentsPattern.matcher(driverVersion); | ||
if (matcher.matches()) { | ||
driverMajorVersion = Integer.parseInt(matcher.group(1)); | ||
driverMinorVersion = Integer.parseInt(matcher.group(2)); | ||
} else { | ||
throw new RuntimeException("Could not parse driver version: " + driverVersion); | ||
} | ||
} | ||
|
||
static String getDriverVersion() { | ||
return driverVersion; | ||
} | ||
|
||
static int getDriverMajorVersion() { | ||
return driverMajorVersion; | ||
} | ||
|
||
static int getDriverMinorVersion() { | ||
return driverMinorVersion; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
project.version=${project.version} |