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

trying to use artifacts #49

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

trying to use artifacts #49

wants to merge 6 commits into from

Conversation

ig-or
Copy link

@ig-or ig-or commented May 8, 2024

A few very simple changes are proposed, the purpose is to be able to use a PackageCompiler.jl / make pptx file from inside the Julia app on Windows. It also addresses #15 at some point. In short, all the templates are part of the artifact now. The exact location of the artifact is an open question, though.. https://julialang.slack.com/archives/C67EFTEF3/p1715193409165059

@matthijscox-asml
Copy link
Collaborator

Thanks for this contribution!

I think you forgot to add using Artifacts in src/PPTX.jl, which is causing the currently failing build pipelines.

May I also ask how you uploaded the artifact to github?

@nhz2
Copy link
Contributor

nhz2 commented May 9, 2024

Because ZipReader works on Vector{UInt8} you could also bake in the data from the default template instead of using artifacts.

include_dependency(joinpath(TEMPLATE_DIR, "no-slides.pptx"))
include_dependency(joinpath(TEMPLATE_DIR, "tableStyles.xml"))
const default_template_data = read(joinpath(TEMPLATE_DIR, "no-slides.pptx"))
const default_table_style_data = read(joinpath(TEMPLATE_DIR, "tableStyles.xml"))

This way reading the template files would happen during precompile.

@ig-or
Copy link
Author

ig-or commented May 9, 2024

@nhz2 , this might be possible but I'm not sure how this will work with package compiler. When I tried PPTX as a part of the compiled app, TEMPLATE_DIR was pointing on the folder were the PPTX "was compiled". IMHO package compiler is not very good with "assets" but it's OK with artifacts.

@ig-or
Copy link
Author

ig-or commented May 9, 2024

@matthijscox-asml , about "how you uploaded the artifact to github?" As I was told in Julia Slack channel, I made a fake package release (on my Github account) and added the artifact file as an assert to this release. You probably would like to change the artifact file location.

@nhz2
Copy link
Contributor

nhz2 commented May 9, 2024

This should work with package compiler because the reading from the path won't happen at run time. Though you will also need to edit

template_path::String=joinpath(TEMPLATE_DIR, "no-slides.pptx"),
and
default_table_style_file = joinpath(TEMPLATE_DIR, table_style_filename)
to accept Vector{UInt8}

@ig-or
Copy link
Author

ig-or commented May 9, 2024

@nhz2 thanks for the explanation!

@matthijscox-asml
Copy link
Collaborator

This should work with package compiler because the reading from the path won't happen at run time.

But as I understand it, when you define the path at compile time, the compiled library won't be relocatable anymore, right?

@nhz2
Copy link
Contributor

nhz2 commented May 13, 2024

Yes, a package isn't relocatable if it uses a string path at runtime that was defined at compile time. One solution is to use https://github.com/JuliaPackaging/RelocatableFolders.jl or Artifacts to allow the path to change to point to the correct folder. The other option is to not read the template files at runtime.

@ig-or
Copy link
Author

ig-or commented May 13, 2024

Can somebody have a look at the conflicts?

@matthijscox-asml
Copy link
Collaborator

Can somebody have a look at the conflicts?
@ig-or you can just take the new changes, @nhz2 made a small update where he already included one template file during compilation

@ig-or
Copy link
Author

ig-or commented May 22, 2024

Sorry for the delay. Lets see how it goes now..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants