Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/PackageCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,12 @@ runtime behavior.
- `include_transitive_dependencies::Bool=true`: If `true`, include transitive dependencies in the sysimage.
- `include_preferences::Bool=true`: Bundle package preferences into `share/julia/LocalPreferences.toml`.
- `script::Union{Nothing,String}=nothing`: Optional script executed while generating the sysimage.
- `copy_globs::Vector{String}=String[]`: Glob patterns for copying package files to the stdlib directory.
- `copy_globs::Vector=[]`: Patterns for copying package files to the stdlib directory.
Each element can be anything [`Glob.glob`](https://github.com/vtjnash/Glob.jl) accepts as a pattern:
a `String`, a `GlobMatch`, or a `Vector` of matchers (strings, `Regex`, `Glob.FilenameMatch`, etc.).
Patterns are relative to each package root and apply to all packages in the distribution.
Example: `["assets/**", "data/**"]` copies assets and data directories for all packages.
For case-insensitive matching, use `Glob.FilenameMatch` patterns: `[[fn"license*"i]]`.
"""
function create_distribution(project_dir::String,
dist_dir::String;
Expand All @@ -1037,7 +1040,7 @@ function create_distribution(project_dir::String,
include_transitive_dependencies::Bool=true,
include_preferences::Bool=true,
script::Union{Nothing, String}=nothing,
copy_globs::Vector{String}=String[],
copy_globs::Vector=[],
release_banner::Union{Nothing, String}=nothing)
ctx = create_pkg_context(project_dir)
Pkg.instantiate(ctx, verbose=true, allow_autoprecomp=false)
Expand Down Expand Up @@ -1572,7 +1575,7 @@ function bundle_default_stdlibs(dest_dir)
end

function bundle_custom_stdlibs(ctx, dest_dir, packages::Vector{Pkg.Types.PackageEntry},
copy_globs::Vector{String}=String[])
copy_globs::Vector=[])
isempty(packages) && return
version_dir = joinpath(dest_dir, "share", "julia", "stdlib", string('v', VERSION.major, '.', VERSION.minor))
mkpath(version_dir)
Expand All @@ -1593,8 +1596,8 @@ function bundle_custom_stdlibs(ctx, dest_dir, packages::Vector{Pkg.Types.Package
# Copy files matching glob patterns if specified
if !isempty(copy_globs)
for pattern in copy_globs
# For patterns ending with ** or **/*, copy entire directory tree recursively
if endswith(pattern, "**") || endswith(pattern, "**/*")
# For string patterns ending with ** or **/*, copy entire directory tree recursively
if pattern isa AbstractString && (endswith(pattern, "**") || endswith(pattern, "**/*"))
base_dir = replace(replace(pattern, "**/*" => ""), "**" => "")
base_dir = rstrip(base_dir, ['/', '\\'])
source_dir = joinpath(pkg_source_path, base_dir)
Expand All @@ -1614,7 +1617,7 @@ function bundle_custom_stdlibs(ctx, dest_dir, packages::Vector{Pkg.Types.Package
end
end
else
# Use glob for specific patterns
# Use glob for specific patterns (accepts String, GlobMatch, Vector of matchers, etc.)
matched_files = glob(pattern, pkg_source_path)
for src_file in matched_files
if isfile(src_file)
Expand Down
Loading