Skip to content

Commit

Permalink
Merge pull request #654 from mP1/feature/J2clSourcesKind-Paths-isAbso…
Browse files Browse the repository at this point in the history
…lute-rather-than-leading-slash-test

J2clSourcesKind Paths.isAbsolute rather than leading slash test
  • Loading branch information
mP1 authored Jul 3, 2023
2 parents 8d1cb8f + 35e5816 commit e86358c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/walkingkooka/j2cl/maven/J2clSourcesKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.maven.project.MavenProject;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -93,18 +94,18 @@ private static <T> List<J2clPath> concat(final Function<T, String> mapper,
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.map(mapper)
.map(p -> p.startsWith(SEPARATOR) ?
p :
base + SEPARATOR + p
).map(Paths::get)
.map(p -> {
final Path path = Paths.get(p);
return path.isAbsolute() ?
path :
Paths.get(base.toString(), p);
})
.filter(Files::exists)
.map(J2clPath::with)
.distinct()
.collect(Collectors.toList());
}

private final static String SEPARATOR = "/";

@SafeVarargs
private static List<J2clPath> concat(final List<J2clPath>... sources) {
return Arrays.stream(sources)
Expand Down

0 comments on commit e86358c

Please sign in to comment.