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

Extension writing guide does not mention how to add a resource for inclusion in native image #542

Closed
emmanuelbernard opened this issue Jan 16, 2019 · 8 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@emmanuelbernard
Copy link
Member

@Sanne mentioned to me that resource files that should be ready by the native image should be enlisted via Shamrock. I looked at the guide and found no reference to resources. Let's complete the doc.

Also I'm interested in an example :)

@emmanuelbernard emmanuelbernard added the kind/bug Something isn't working label Jan 16, 2019
@emmanuelbernard
Copy link
Member Author

HotDeploymentConfigFileBuildItem seems to be part of it.

so is UndertowBuildStep

@BuildStep
    SubstrateResourceBuildItem registerSubstrateResources(ArchiveRootBuildItem root,
                                                          ApplicationArchivesBuildItem applicationArchivesBuildItem) throws IOException {
        List<String> res = new ArrayList<>();
        Path resources = applicationArchivesBuildItem.getRootArchive().getChildPath("META-INF/resources");
        if (resources != null) {
            Files.walk(resources).forEach(new Consumer<Path>() {
                @Override
                public void accept(Path path) {
                    if (!Files.isDirectory(path)) {
                        res.add(root.getPath().relativize(path).toString());
                    }
                }
            });
        }
        return new SubstrateResourceBuildItem(res);
    }

@Sanne
Copy link
Member

Sanne commented Jan 16, 2019

I take it the purpose of this issue is "How end users include their own resources" right? ( +1 we definitely need to help users with that)

When it comes to - for example - ORM's import.sql we automate this.

@Sanne
Copy link
Member

Sanne commented Jan 16, 2019

Relates to #388

@emmanuelbernard
Copy link
Member Author

No the question was how do I as an extension developer add resources.

For end user, do we need more than the automated addition of META-INF/resources that I see in undertow?

@Sanne
Copy link
Member

Sanne commented Jan 17, 2019

Yeah I believe we need to make a choice.

Either:

  • offer some easy way for end users to add their own resources as well
  • be nasty and recommend nobody ever adds custom resources?

@emmanuelbernard
Copy link
Member Author

@Sanne OK. Open a different issue so we don't lose it.

@stuartwdouglas
Copy link
Member

HotDeploymentConfigFileBuildItem is not related, it is used to indicate that when a file is modified it should cause a hot deployment.

@emmanuelbernard
Copy link
Member Author

Yes but both make sense in a how to deal with resources in extensions section.

cescoffier added a commit that referenced this issue Jan 22, 2019
Fixes #542, add some docs on the substrate build items
@cescoffier cescoffier added this to the 0.7.0 milestone Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants