Skip to content

Commit dea18f2

Browse files
authored
add Base.isless for ordering ExecutableProduct vs LibraryProduct (#180)
* add Base.isless for ordering ExecutableProduct vs LibraryProduct * switch so that LibraryProducts come first and then ExecutableProducts * fix sorting tests
1 parent c213d27 commit dea18f2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Products.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ function locate(fp::FileProduct, prefix::Prefix; platform::AbstractPlatform = Ho
494494
end
495495

496496
# Necessary to get the products in the wrappers always sorted consistently
497+
Base.isless(x::LibraryProduct, y::ExecutableProduct) = true
498+
Base.isless(x::ExecutableProduct, y::LibraryProduct) = false
497499
Base.isless(x::Product, y::Product) = isless(variable_name(x), variable_name(y))
498500
Base.sort(d::Dict{Product}) = sort(collect(d), by = first)
499501

test/products.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const platform = HostPlatform()
2525

2626
# Test sorting of products....
2727
@test sort([LibraryProduct("libbar", :libbar), ExecutableProduct("foo", :foo), FrameworkProduct("buzz", :buzz)]) ==
28-
[FrameworkProduct("buzz", :buzz), ExecutableProduct("foo", :foo), LibraryProduct("libbar", :libbar)]
28+
[FrameworkProduct("buzz", :buzz), LibraryProduct("libbar", :libbar), ExecutableProduct("foo", :foo)]
2929
# ...and products info
3030
p1 = LibraryProduct(["libchafa"], :libchafa, ) => Dict("soname" => "libchafa.so.0","path" => "lib/libchafa.so")
3131
p2 = ExecutableProduct(["chafa"], :chafa, ) => Dict("path" => "bin/chafa")
3232
products_info = Dict{Product,Any}(p1, p2)
33-
@test sort(products_info) == [p2, p1]
33+
@test sort(products_info) == [p1, p2]
3434

3535
temp_prefix() do prefix
3636
# Test that basic satisfication is not guaranteed

0 commit comments

Comments
 (0)