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

Support merging of XMLs with UberJarMergedResourceBuildItem #17196

Closed
wants to merge 1 commit into from

Conversation

gastaldi
Copy link
Contributor

@gastaldi gastaldi commented May 12, 2021

JarResultBuildStep combines XML files using XmlCombiner

This is a potential solution for quarkiverse/quarkus-cxf#194

@quarkus-bot quarkus-bot bot added area/core area/dependencies Pull requests that update a dependency file labels May 12, 2021
@gastaldi
Copy link
Contributor Author

/cc @shumonsharif

@gastaldi
Copy link
Contributor Author

gastaldi commented May 12, 2021

I am not sure I like this solution TBH. I think I prefer enhancing UberJarMergedResourceBuildItem to specify the contents to be replaced instead of letting JarResultBuildStep do this job for each special file format (think JSON for example).

I'll provide another PR and we can choose which strategy to choose

@gastaldi
Copy link
Contributor Author

Actually I think GeneratedResourceBuildItem should be the build item that extension authors should use to replace files in the Uber JAR, like the following:

    @BuildStep
    GeneratedResourceBuildItem uberJarMergedResourceBuildItem() {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos, true);
        try {
            List<URL> resources = Collections
                    .list(getClass().getClassLoader().getResources("META-INF/cxf/bus-extensions.txt"));
            for (URL resource : resources) {
                try (InputStream is = resource.openStream();
                     BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
                    reader.lines().forEach(ps::println);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new GeneratedResourceBuildItem("META-INF/cxf/bus-extensions.txt", baos.toByteArray());
    }

@gastaldi
Copy link
Contributor Author

Closing this as I didn't like this approach and JarResultStep should honor the GeneratedResourceBuildItems. See #17199 for more detail

@gastaldi gastaldi closed this May 13, 2021
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label May 13, 2021
@gastaldi gastaldi deleted the xml_merge branch May 13, 2021 01:12
@quarkus-bot
Copy link

quarkus-bot bot commented May 13, 2021

🚫 This workflow run has been cancelled.

Failing Jobs - Building 8509a2e

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Test failures Logs Raw logs
JVM Tests - JDK 11 Build ⚠️ Check → Logs Raw logs
JVM Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs
JVM Tests - JDK 16 Build ⚠️ Check → Logs Raw logs

@gastaldi gastaldi removed request for gsmet and geoand May 13, 2021 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/dependencies Pull requests that update a dependency file triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant