Closed sormuras closed 7 years ago
It was implemented and then removed because it has been replaced by derive() see https://github.com/forax/pro/commit/799b123e16db2b44cbc208ca3410bbc2399e07c8
Can you give me more context why you want change listener ?
Sure. Here's my ./pro/build.pro
file that resides inside local .pro
directory. I want the resolver to store downloaded artifacts to ../dependencies
. All other plugins should use that folder for module dependency resolution, too.
import static com.github.forax.pro.Pro.*
//
// TODO only first line needed, after https://github.com/forax/pro/issues/41 is solved
//
set("convention.moduleDependencyPath", path("../dependencies"))
set("resolver.moduleDependencyPath", path("../dependencies"))
set("modulefixer.moduleDependencyPath", path("../dependencies"))
set("compiler.moduleDependencyPath", path("../dependencies"))
set("packager.moduleDependencyPath", path("../dependencies"))
set("tester.moduleDependencyPath", path("../dependencies"))
set("runner.moduleDependencyPath", path("../dependencies"))
set("resolver.dependencies", list(
"org.junit.jupiter.api=org.junit.jupiter:junit-jupiter-api:5.0.0-M4",
"org.junit.platform.commons=org.junit.platform:junit-platform-commons:1.0.0-M4",
"org.opentest4j=org.opentest4j:opentest4j:1.0.0-M2"
))
set("compiler.lint", "all,-exports")
set("compiler.rawArguments", list("-encoding", "UTF8"))
set("packager.moduleMetadata", list(
"de.sormuras.beethoven@1.0-SNAPSHOT",
"de.sormuras.beethoven.type@1.0-SNAPSHOT",
"de.sormuras.beethoven.unit@1.0-SNAPSHOT",
"de.sormuras.beethoven.composer@1.0-SNAPSHOT"
))
set("runner.module", "de.sormuras.beethoven/de.sormuras.beethoven.Beethoven")
//
// TODO refactor "prepare.pro" script into a "preparer" plugin
//
/open prepare.pro
prepare(location("..", "modules"))
run("resolver", "modulefixer", "compiler", "packager", "tester", "runner")
/exit
If I only use set("convention.moduleDependencyPath", path("../dependencies"))
, pro creates the deps
directory (in .pro
, which is the current directory).
It's the wrong name, the right one is convention.javaModuleDependencyPath
I should modify the code of Config to not allow to set a property that does not exist.
True²
...it'd be cool, if one could use the real plugin objects in the JShell script. With that (not so nice syntax) we'd get syntax and type checks for free. Like:
((ConventionConf)plugin("convention")).javaModuleDependencyPath(List.of(Paths.get("..", "deps")))
You can already do that, it's how the ConventionFacade works inside a plugin. You can create an interface TesterAccess, and do a get("tester", TesterAccess.class).
Because the way the plugins are sandboxed, it's not possible to directly use the TesterConf but an interface with the same methods will work.
Implement configuration change listeners as mentioned here: https://github.com/forax/pro/issues/19#issuecomment-294613646