Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jbang devmode not honoring properties #44400

Closed
maxandersen opened this issue Nov 9, 2024 · 5 comments · Fixed by #44415
Closed

jbang devmode not honoring properties #44400

maxandersen opened this issue Nov 9, 2024 · 5 comments · Fixed by #44415
Labels
area/devmode area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Milestone

Comments

@maxandersen
Copy link
Member

Describe the bug

I think since #43160 jbang -Dquarkus.dev some.java does not honor Q:CONFIG.

///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus.platform:quarkus-bom:3.16.1@pom
//DEPS io.quarkus:quarkus-picocli

//Q:CONFIG quarkus.banner.enabled=false
//Q:CONFIG quarkus.log.level=ERROR
import io.quarkus.logging.Log;
import picocli.CommandLine.Command;

@Command
public class basicdev implements Runnable {
  


    @Override
    public void run() {
        System.out.println("You should see ERROR, but no WARN or INFO");
        Log.warn("This is a WARN message");
        Log.info("This is an INFO message");
        Log.error("This is an ERROR message");
    }
}

run above using jbang --fresh basicdev.java and it will only print ERROR logging, but run it with jbang --fresh -Dquarkus.dev basicdev.java it prints warn,info and error. As if it completely ignores Q:CONFIG

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@maxandersen maxandersen added the kind/bug Something isn't working label Nov 9, 2024
@quarkus-bot quarkus-bot bot added area/devmode area/jbang Issues related to when using jbang.dev with Quarkus labels Nov 9, 2024
Copy link

quarkus-bot bot commented Nov 9, 2024

/cc @quarkusio/devtools (jbang)

@radcortez
Copy link
Member

radcortez commented Nov 11, 2024

Ok, it seems that Dev Mode uses a different path:

if (Boolean.getBoolean("quarkus.dev")) {
System.clearProperty("quarkus.dev"); //avoid unknown config key warnings
HashMap<String, byte[]> files = new HashMap<>();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
//pom file contents
String pomContents = String.join("\n", Files.readAllLines(pomFile));
dataOutputStream.writeUTF(pomContents);
//Source file locations
dataOutputStream.writeUTF(System.getProperty("jbang.source"));
dataOutputStream.writeInt(originalDeps.size());
for (Map.Entry<String, Path> i : originalDeps) {
dataOutputStream.writeUTF(i.getKey());
dataOutputStream.writeUTF(i.getValue().toAbsolutePath().toString());
}
dataOutputStream.close();
files.put("jbang-dev.dat", outputStream.toByteArray());
HashMap<String, Object> ret = new HashMap<>();
ret.put("files", files);
ret.put("main-class", "io.quarkus.launcher.JBangDevModeLauncher");
return ret;
}

@maxandersen
Copy link
Member Author

well that for sure explains why its not honoring any config as it returns early.

Now I'm just wondering why it ever worked ...and how we can go about passing in Q:CONFIG properties in devmode...if at all.

@radcortez
Copy link
Member

It may have worked before that code?

I'm proposing a fix in #44415, which requires us to parse the source file again because we lose the comments section parameter.

Also, can you confirm that the hot reload is working? When I change the file, I get an error: Cannot initialize file manager.

@aloubyansky
Copy link
Member

I guess we are lacking some integration tests

@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Nov 12, 2024
@gsmet gsmet modified the milestones: 3.17 - main, 3.16.3 Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants