Skip to content

Commit

Permalink
3.x: Fix source locator code to support GitHub Actions folder layout (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
akarnokd committed Nov 20, 2020
1 parent 78b29f7 commit 5b408f6
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/test/java/io/reactivex/rxjava3/testsupport/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3503,18 +3503,26 @@ public static File findSource(String baseClassName, String parentPackage) throws
parentPackage = parentPackage.replace(".", "/");
// System.out.println(path);

int i = path.toLowerCase().indexOf("/rxjava");
if (i < 0) {
System.out.println("Can't find the base RxJava directory");
return null;
}

// find end of any potential postfix to /RxJava
int j = path.indexOf("/", i + 6);
// Locate the src/main/java directory
String p = null;
while (true) {
int idx = path.lastIndexOf("/");
if (idx < 0) {
break;
}
path = path.substring(0, idx);
String check = path + "/src/main/java";

String basePackage = path.substring(0, j + 1) + "src/main/java";
if (new File(check).exists()) {
p = check + "/" + parentPackage + "/" + baseClassName + ".java";
break;
}
}

String p = basePackage + "/" + parentPackage + "/" + baseClassName + ".java";
if (p == null) {
System.err.println("Unable to locate the RxJava sources");
return null;
}

File f = new File(p);

Expand Down

0 comments on commit 5b408f6

Please sign in to comment.