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

Add config option to have RuntimeRunner save generated classes to disk #1078

Closed
starksm64 opened this issue Feb 27, 2019 · 3 comments
Closed
Labels
kind/enhancement New feature or request
Milestone

Comments

@starksm64
Copy link
Contributor

It came up on zulip chat that several were having to augment the RuntimeRunner to output the classes it writes to disk for inspection. @gsmet had posted this code:

final Path wiringClassesDirectory = Files.createTempDirectory("wiring-classes-");
            ClassOutput classOutput = new ClassOutput() {
                @Override
                public void writeClass(boolean applicationClass, String className, byte[] data) throws IOException {
                    String location = className.replace('.', '/');
                    final Path p = wiringClassesDirectory.resolve(location + ".class");
                    Files.createDirectories(p.getParent());
                    try (OutputStream out = Files.newOutputStream(p)) {
                        out.write(data);
                    }
                }

                @Override
                public void writeResource(String name, byte[] data) throws IOException {
                    final Path p = wiringClassesDirectory.resolve(name);
                    Files.createDirectories(p.getParent());
                    try (OutputStream out = Files.newOutputStream(p)) {
                        out.write(data);
                    }
                }
            };

We should have a config option to enable this behavior.

@starksm64 starksm64 added the kind/enhancement New feature or request label Feb 27, 2019
@starksm64 starksm64 changed the title Add config option to have RuntimeRunner Add config option to have RuntimeRunner save generated classes to disk Feb 27, 2019
@gsmet
Copy link
Member

gsmet commented Feb 27, 2019

Apparently, it was there all along and we missed it:
https://github.com/jbossas/protean-shamrock/blob/master/core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java#L68

mvn clean install -Dio.quarkus.DEBUG_GENERATED_CLASSES_DIR=./target/my-generated-classes

@gsmet gsmet closed this as completed Feb 27, 2019
@gsmet gsmet added the triage/duplicate This issue or pull request already exists label Feb 27, 2019
@mkouba
Copy link
Contributor

mkouba commented Feb 28, 2019

Should we add a note to the Extension Authors Guide?

@gsmet gsmet added this to the 0.10.0 milestone Feb 28, 2019
@cescoffier cescoffier added triage/wontfix This will not be worked on and removed triage/duplicate This issue or pull request already exists triage/wontfix This will not be worked on labels Mar 1, 2019
@starksm64
Copy link
Contributor Author

I did create a PR to add this to the extension author guide.

gsmet added a commit that referenced this issue Mar 2, 2019
Document the io.quarkus.DEBUG_GENERATED_CLASSES_DIR property, #1078
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants