Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Classpath entry merging for IntelliJ IDEA 2017.2.3
Browse files Browse the repository at this point in the history
(cherry picked from commit 771cb3ff6bce814b33e37aaec314d2ac87cf3412)

# Conflicts:
#	changelog.txt
  • Loading branch information
Alex Stockinger committed Sep 13, 2017
1 parent 4cce6a6 commit 9cb6366
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
@@ -1,6 +1,9 @@
Version 0.7.0
- Added websocket support to testeefi-rest

Version 0.6.1
- Classpath entry merging for IntelliJ IDEA 2017.2.3

Version 0.6.0
- Hibernate support
- Custom params for @TestData methods can be contributed via TestDataSetupAccessorFactories now
Expand Down
31 changes: 31 additions & 0 deletions core/src/main/java/fi/testee/classpath/ClasspathTransform.java
Expand Up @@ -84,6 +84,37 @@ private static URL getBuildDir(final DirectoryJavaArchive it) {
}

private static URL getBuildDir(final String path) {
{
final URL url = getBuildDirGradle(path);
if (url != null) {
return url;
}
}
{
final URL url = getBuildDirIntellij(path);
if (url != null) {
return url;
}
}
return null;
}

private static URL getBuildDirIntellij(final String path) {
final Pattern pattern = Pattern.compile("(.*/out/)((production)|(test))/((classes)|(resources))/?");
final Matcher matcher = pattern.matcher(path);
if (!matcher.matches()) {
return null;
}
final String url = matcher.group(1) + matcher.group(2) + "/[any]";
LOG.trace("{} -> {}", path, url);
try {
return new URL(url);
} catch (final MalformedURLException e) {
throw new TestEEfiException("Failed to build composite java archive URL", e);
}
}

private static URL getBuildDirGradle(final String path) {
final Pattern pattern = Pattern.compile("(.*/build/)(([^/]+)|([^/]+/[^/]+))/((main)|(test))/?");
final Matcher matcher = pattern.matcher(path);
if (!matcher.matches()) {
Expand Down

0 comments on commit 9cb6366

Please sign in to comment.