Skip to content

Commit

Permalink
Add and use GAP.Packages.build_recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Nov 22, 2024
1 parent 0338bed commit aa82d7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/CI-distro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ jobs:
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
- name: "Build GAP package"
run: julia --color=yes --project=. -e 'using GAP; GAP.Packages.build("${{ matrix.gap-package }}")'
run: julia --color=yes --project=. -e 'using GAP; GAP.Packages.build_recursive("${{ matrix.gap-package }}")'
- name: "Run GAP package tests"
run: julia --color=yes --project=. -e 'using GAP, Test; GAP.Packages.test("${{ matrix.gap-package }}")'
38 changes: 38 additions & 0 deletions src/packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,44 @@ function build(name::String; quiet::Bool = false,
return res
end

"""
build_recursive(name::String; quiet::Bool = false,
debug::Bool = false,
pkgdir::AbstractString = GAP.Packages.DEFAULT_PKGDIR[])
Build the GAP package with name `name` that is installed in the
`pkgdir` directory, as well as all of its (transitive) dependencies.
This is achieved by calling [`build`](@ref) for the package `name` and then
all of its `NeededOtherPackages`, recursively.
All keyword arguments are passed on to [`build`](@ref).
"""
function build_recursive(name::String; quiet::Bool = false,
debug::Bool = false,
pkgdir::AbstractString = DEFAULT_PKGDIR[])
# point PackageManager to the given pkg dir
Globals.PKGMAN_CustomPackageDir = GapObj(pkgdir)
mkpath(pkgdir)

todo = Set{String}((name,))
done = Set{String}()
while !isempty(todo)
dep = pop!(todo)
dep in done && continue

res = build(dep; quiet, debug, pkgdir)
res || return false
gdep = GapObj(dep)
allinfo = collect(Globals.PackageInfo(gdep))
userinfo = filter(info -> startswith(String(info.InstallationPath), pkgdir), allinfo)
info = only(userinfo)
for (needed, _) in info.Dependencies.NeededOtherPackages
push!(todo, String(needed))
end
end
return true
end

"""
test(name::String)
Expand Down

0 comments on commit aa82d7f

Please sign in to comment.