Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Sep 7, 2023
2 parents b23631f + 8ec414f commit 2ef2394
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 17 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.5.7] - 2023-09-07

### Fixed

- Fix relocation of JDK internals in `spreadsheet-standalone`

## [2.5.6] - 2023-09-05

### Fixed
Expand Down Expand Up @@ -156,7 +162,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- JDK11 cleanup

[Unreleased]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.6...HEAD
[Unreleased]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.7...HEAD
[2.5.7]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.6...v2.5.7
[2.5.6]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.5...v2.5.6
[2.5.5]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.4...v2.5.5
[2.5.4]: https://github.com/nbbrd/spreadsheet4j/compare/v2.5.3...v2.5.4
Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
<packaging>pom</packaging>

<name>spreadsheet4j</name>
Expand Down Expand Up @@ -126,6 +126,11 @@
<version>3.1.2</version>
</plugin>
<!-- Other plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-fastexcel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>spreadsheet-parent</artifactId>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-fastexcel</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-html/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-html</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-od/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-od</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-poi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-poi</artifactId>
Expand Down
63 changes: 56 additions & 7 deletions spreadsheet-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-standalone</artifactId>
Expand All @@ -17,6 +17,19 @@
<url>https://github.com/nbbrd/spreadsheet4j</url>

<dependencies>
<!-- compile only -->
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<!-- compile and runtime -->
<dependency>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-api</artifactId>
Expand Down Expand Up @@ -47,10 +60,42 @@
<artifactId>spreadsheet-xmlss</artifactId>
<version>${project.version}</version>
</dependency>

<!-- test only -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- List runtime dependencies for tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>list-runtime-dependencies</id>
<phase>generate-test-resources</phase>
<goals>
<goal>resolve</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputFile>${project.build.testOutputDirectory}/runtime-dependencies.txt</outputFile>
<outputScope>false</outputScope>
</configuration>
</execution>
</executions>
</plugin>

<!-- Generates a all-in-one executable jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -94,20 +139,24 @@
</transformers>
<relocations>
<relocation>
<pattern>internal</pattern>
<shadedPattern>standalone_spreadsheet.internal</shadedPattern>
<pattern>internal.io</pattern>
<shadedPattern>standalone_spreadsheet.internal.io</shadedPattern>
</relocation>
<relocation>
<pattern>nbbrd</pattern>
<shadedPattern>standalone_spreadsheet.nbbrd</shadedPattern>
</relocation>
<relocation>
<pattern>com</pattern>
<shadedPattern>standalone_spreadsheet.com</shadedPattern>
<pattern>com.github</pattern>
<shadedPattern>standalone_spreadsheet.com.github</shadedPattern>
</relocation>
<relocation>
<pattern>org.dhatim</pattern>
<shadedPattern>standalone_spreadsheet.org.dhatim</shadedPattern>
</relocation>
<relocation>
<pattern>org</pattern>
<shadedPattern>standalone_spreadsheet.org</shadedPattern>
<pattern>org.jsoup</pattern>
<shadedPattern>standalone_spreadsheet.org.jsoup</shadedPattern>
</relocation>
</relocations>
<createDependencyReducedPom>true</createDependencyReducedPom>
Expand Down
61 changes: 61 additions & 0 deletions spreadsheet-standalone/src/test/java/_test/DependencyResolver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package _test;

import lombok.NonNull;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@lombok.experimental.UtilityClass
public class DependencyResolver {

public static @NonNull List<GAV> parse(@NonNull Stream<String> lines) {
return lines
.filter(DependencyResolver::isValidLine)
.map(DependencyResolver::removeAnsiControlChars)
.map(DependencyResolver::extract)
.map(GAV::parse)
.collect(Collectors.toList());
}

private static final String PREFIX = " ";
private static final String SUFFIX = " -- module";

private static boolean isValidLine(String line) {
return line.startsWith(PREFIX);
}

private static String removeAnsiControlChars(String input) {
return input.replaceAll("\u001B\\[[;\\d]*m", "");
}

private static String extract(String input) {
int start = PREFIX.length();
int end = input.indexOf(SUFFIX, start);
return input.substring(start, end == -1 ? input.length() : end);
}

@lombok.Value
public static class GAV {

public static @NonNull GAV parse(@NonNull CharSequence input) {
String[] items = input.toString().split(":", -1);
if (items.length < 4) {
throw new IllegalArgumentException("Invalid GAV: '" + input + "'");
}
return new GAV(items[0], items[1], items[3]);
}

@NonNull String groupId;
@NonNull String artifactId;
@NonNull String version;

public static boolean haveSameVersion(@NonNull List<? extends GAV> list) {
return list
.stream()
.map(GAV::getVersion)
.distinct()
.count() == 1;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package spreadsheet4j.standalone;

import _test.DependencyResolver;
import nbbrd.io.text.TextParser;
import org.assertj.core.api.Condition;
import org.assertj.core.api.ListAssert;
import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.List;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;

public class RuntimeDependenciesTest {

@Test
public void testRuntimeDependencies() throws IOException {
assertThat(getRuntimeDependencies())
.describedAs("Check runtime dependencies")
.satisfies(RuntimeDependenciesTest::checkJavaIoUtil)
.satisfies(RuntimeDependenciesTest::checkSpreadsheet4j)
.satisfies(RuntimeDependenciesTest::checkFastExcel)
.satisfies(RuntimeDependenciesTest::checkSods)
.satisfies(RuntimeDependenciesTest::checkJsoup)
.hasSize(12);
}

private static void checkSpreadsheet4j(List<? extends DependencyResolver.GAV> coordinates) {
assertThatGroupId(coordinates, "com.github.nbbrd.spreadsheet4j")
.has(sameVersion())
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder(
"spreadsheet-api",
"spreadsheet-fastexcel",
"spreadsheet-html",
"spreadsheet-od",
"spreadsheet-xl",
"spreadsheet-xmlss");
}

private static void checkJavaIoUtil(List<? extends DependencyResolver.GAV> coordinates) {
assertThatGroupId(coordinates, "com.github.nbbrd.java-io-util")
.has(sameVersion())
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder("java-io-xml", "java-io-base");
}

private static void checkFastExcel(List<? extends DependencyResolver.GAV> coordinates) {
assertThatGroupId(coordinates, "org.dhatim")
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder("fastexcel");

assertThatGroupId(coordinates, "com.github.rzymek")
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder("opczip");
}

private static void checkSods(List<? extends DependencyResolver.GAV> coordinates) {
assertThatGroupId(coordinates, "com.github.miachm.sods")
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder("SODS");
}

private static void checkJsoup(List<? extends DependencyResolver.GAV> coordinates) {
assertThatGroupId(coordinates, "org.jsoup")
.extracting(DependencyResolver.GAV::getArtifactId)
.containsExactlyInAnyOrder("jsoup");
}

private static ListAssert<? extends DependencyResolver.GAV> assertThatGroupId(List<? extends DependencyResolver.GAV> coordinates, String groupId) {
return assertThat(coordinates)
.describedAs("Check " + groupId)
.filteredOn(DependencyResolver.GAV::getGroupId, groupId);
}

private static Condition<List<? extends DependencyResolver.GAV>> sameVersion() {
return new Condition<>(DependencyResolver.GAV::haveSameVersion, "same version");
}

private static List<DependencyResolver.GAV> getRuntimeDependencies() throws IOException {
return TextParser.onParsingReader(reader -> DependencyResolver.parse(asBufferedReader(reader).lines()))
.parseResource(RuntimeDependenciesTest.class, "/runtime-dependencies.txt", UTF_8);
}

private static BufferedReader asBufferedReader(Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
}
2 changes: 1 addition & 1 deletion spreadsheet-xl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-xl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion spreadsheet-xmlss/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.nbbrd.spreadsheet4j</groupId>
<artifactId>spreadsheet-parent</artifactId>
<version>2.5.6</version>
<version>2.5.7</version>
</parent>

<artifactId>spreadsheet-xmlss</artifactId>
Expand Down

0 comments on commit 2ef2394

Please sign in to comment.