Adding processed artefacts to a package

Hi, I found an old package with an internal data dependency that breaks the use of an executable binary built with PackageCompiler.

In this package there is an explicit dependency for a file calculated during the package build stage.

const DATA_PATH = @path joinpath(@__DIR__, "../data", "html.dat")

The package has deps/build.jl logic with creation of this html.dat file.

I haven’t found an example in the documentation of how to add a processed artifact. And added this logic to the end of build.jl. But this explicit copy of the file is a bit odd.

Is any way to do it better?

if isfile(savfile)
    artifact_toml = joinpath(@__DIR__, "..", "Artifacts.toml")
    hash = artifact_hash("htmlnames", artifact_toml)
    path = artifact_path(hash)
    isdir(path) || mkpath(path)
    cp(savfile, joinpath(path, basename(savfile)), force=true)

    println("Artifact had created at ", path)
end

I created the PR added artifact for html.dat by rssdev10 · Pull Request #19 · JuliaString/HTML_Entities.jl · GitHub