Skip to content

Commit

Permalink
Merge pull request #15 from burtcorp/build-fixes
Browse files Browse the repository at this point in the history
Build fixes
  • Loading branch information
stenlarsson committed Apr 29, 2020
2 parents d1a5c85 + 44ffbb1 commit cc917ef
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
31 changes: 26 additions & 5 deletions pom.xml
Expand Up @@ -92,6 +92,12 @@
</distributionManagement>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -118,7 +124,7 @@
<pushChanges>false</pushChanges>
<tagNameFormat>athena-jdbc-@{project.version}</tagNameFormat>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<releaseProfiles>athena-jdbc-release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
Expand Down Expand Up @@ -147,9 +153,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<additionalOptions>-html5</additionalOptions>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -164,7 +167,7 @@

<profiles>
<profile>
<id>release</id>
<id>athena-jdbc-release</id>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -198,5 +201,23 @@
</plugins>
</build>
</profile>
<profile>
<id>javadoc-html5</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalOptions>-html5</additionalOptions>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
6 changes: 3 additions & 3 deletions src/main/java/io/burt/athena/AthenaDatabaseMetaData.java
Expand Up @@ -39,17 +39,17 @@ public String getDriverName() {

@Override
public String getDriverVersion() {
return "0.2.0";
return AthenaDriverInfo.getDriverVersion();
}

@Override
public int getDriverMajorVersion() {
return 0;
return AthenaDriverInfo.getDriverMajorVersion();
}

@Override
public int getDriverMinorVersion() {
return 2;
return AthenaDriverInfo.getDriverMinorVersion();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/burt/athena/AthenaDriver.java
Expand Up @@ -158,12 +158,12 @@ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {

@Override
public int getMajorVersion() {
return 0;
return AthenaDriverInfo.getDriverMajorVersion();
}

@Override
public int getMinorVersion() {
return 2;
return AthenaDriverInfo.getDriverMinorVersion();
}

@Override
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/io/burt/athena/AthenaDriverInfo.java
@@ -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;
}
}
1 change: 1 addition & 0 deletions src/main/resources/project.properties
@@ -0,0 +1 @@
project.version=${project.version}

0 comments on commit cc917ef

Please sign in to comment.