File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
main/java/dev/jbang/source Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -262,8 +262,21 @@ public Project build(String resource) {
262262 return build (resourceRef );
263263 }
264264
265+ /**
266+ * Resolves the given resource, with property resolution and handles retry on caching.
267+ * @param resolver
268+ * @param resource
269+ * @return
270+ */
265271 private ResourceRef resolveChecked (ResourceResolver resolver , String resource ) {
266- Util .verboseMsg ("Resolving resource ref: " + resource );
272+ final String resolvedResource = PropertiesValueResolver .replaceProperties (resource , getContextProperties ());
273+
274+ if (!resource .equals (resolvedResource )) {
275+ Util .verboseMsg ("Resolving resource ref: " + resource + " -> " + resolvedResource );
276+ } else {
277+ Util .verboseMsg ("Resolving resource ref:" + resource );
278+ }
279+
267280 boolean retryCandidate = catalogFile == null && !Util .isFresh () && Settings .getCacheEvict () > 0
268281 && (Catalog .isValidName (resource ) || Catalog .isValidCatalogReference (resource )
269282 || Util .isRemoteRef (resource ));
@@ -618,6 +631,7 @@ private ResourceResolver getAliasResourceResolver(Alias alias) {
618631 if (alias != null ) {
619632 updateFromAlias (alias );
620633 }
634+
621635 return new CombinedResourceResolver (
622636 new RenamingScriptResourceResolver (forceType ),
623637 new LiteralScriptResourceResolver (forceType ),
Original file line number Diff line number Diff line change @@ -2101,6 +2101,31 @@ void testJavaFXMagicPropertyViaCommandline() throws IOException {
21012101
21022102 }
21032103
2104+ @ Test
2105+ void testMagicPropertyViaRun (@ TempDir Path tdir ) throws IOException {
2106+
2107+
2108+ String res = "https://github.com/HanSolo/jarkanoid/releases/download/17.0.17/jarkanoid-${os.detected.jfxname}-17.0.17.jar" ;
2109+ try {
2110+ TrustedSources .instance ().add (res , tdir .resolve ("test.trust" ).toFile ());
2111+ // todo fix so --deps can use system properties
2112+ CommandLine .ParseResult pr = JBang .getCommandLine ()
2113+ .parseArgs ("run" , res );
2114+
2115+ Run run = (Run ) pr .subcommand ().commandSpec ().userObject ();
2116+
2117+ ProjectBuilder pb = run .createProjectBuilderForRun ();
2118+
2119+ Project prj = pb .build (res );
2120+ String line = run .updateGeneratorForRun (CmdGenerator .builder (prj )).build ().generate ();
2121+
2122+ assertThat (line , containsString (" --module-path " ));
2123+ } finally {
2124+ TrustedSources .instance ().remove (Collections .singletonList (res ), tdir .resolve ("test.trust" ).toFile ());
2125+ }
2126+
2127+ }
2128+
21042129 @ Test
21052130 void testScriptCliReposAndDeps (@ TempDir File output ) throws IOException {
21062131 String base = "" +
You can’t perform that action at this time.
0 commit comments