forax / pro

A Java build tool that works seamlessly with modules
GNU General Public License v3.0
103 stars 15 forks source link

[WIP] Upgrade to JUnit 5.3-M1 #61

Closed sormuras closed 6 years ago

sormuras commented 6 years ago

Needs a polishing pass...

sormuras commented 6 years ago

@forax I wanted to pass TesterConf via a constructor parameter but due to the different class loaders the type looks different at run-time. Had to resort to generic map... do you see a more elegant and type-safe way passing arguments to the TestRunner instance?

forax commented 6 years ago

Plugins like the packager makes the difference between the parameters of the plugin PackagerConf and the parameters of the underlying command (jar) by using a simple POJO named Jar.

So instead of using a Map, you can declare a non public immutable class with all the fields you need, if it is created in the same package as the runner it should work because this package is visible by both classloaders (i hope).

sormuras commented 6 years ago

Compiling it works, running not.

Caused by: java.lang.NoSuchMethodException: com.github.forax.pro.plugin.tester.TesterRunner.<init>(com.github.forax.pro.plugin.tester.TesterFixture)
        at java.base/java.lang.Class.getConstructor0(Class.java:3326)
        at java.base/java.lang.Class.getConstructor(Class.java:2128)
        at com.github.forax.pro.plugin.tester@0.11/com.github.forax.pro.plugin.tester.TesterPlugin.execute(TesterPlugin.java:94)

with TesterFixture.java as:

class TesterFixture {
  final Path path;
  final boolean parallel;

  TesterFixture(Path path, boolean parallel) {
    this.path = path;
    this.parallel = parallel;
  }
}
sormuras commented 6 years ago

Trying to load the fixture class with the new class loader now...

sormuras commented 6 years ago

...looks good so far. Next commit is almost done.

sormuras commented 6 years ago

Remove the SlowNoopTests.java show-casing the effect of parallel execution before merge?

sormuras commented 6 years ago

I'll rebase and merge to master this PR as-is. Then you may tune it to your likings locally. This includes leaving the SlowNoopTests.java demo in place or pruning it. Same goes for the changes in test.pro. Methinks, setting tester.parallel(true) is always a good idea.

D'accord?

forax commented 6 years ago

yes, i agree.

for parallel, tester is not the only plugin to have that option, i will perhaps promote it to the convention to have a way to disable parallel build for all plugins.