Skip to content

Commit

Permalink
Move BinaryProvider out of src/: only used in test/
Browse files Browse the repository at this point in the history
BinaryProvider is not meant to be loaded at runtime. It does lots of
things that aren't acceptable at runtime, which is why it goes through
the care of generating a `deps.jl` file that doesn't import it.

This commit takes BinaryProvider out of `src/CxxWrap.jl` so that code
using CxxWrap doesn't wind up with BinaryProvider in its runtime
dependencies.

Since it's only used in that one test/build.jl file anyway, this is
fine.
  • Loading branch information
NHDaly authored and barche committed May 9, 2019
1 parent a2a2d08 commit 001ea81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/CxxWrap.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module CxxWrap

import BinaryProvider
import Libdl

export @wrapmodule, @readmodule, @wraptypes, @wrapfunctions, @safe_cfunction, @initcxx, load_module, ptrunion, CppEnum, ConstPtr, ConstArray, gcprotect, gcunprotect, isnull, nullptr
Expand All @@ -25,8 +24,6 @@ end
include(depsfile)
const jlcxx_path = libcxxwrap_julia

prefix() = BinaryProvider.Prefix(dirname(dirname(jlcxx_path)))

# Trait type to indicate a type is a C++-wrapped type
struct IsCxxType end
struct IsNormalType end
Expand Down
6 changes: 4 additions & 2 deletions test/build.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using BinaryProvider
using CxxWrap

prefix() = BinaryProvider.Prefix(dirname(dirname(jlcxx_path)))

products = Product[]
for basename in ["jlcxx_containers", "except", "extended", "functions", "hello", "inheritance", "parametric", "pointer_modification", "types"]
fullname = "lib"*basename
push!(products, LibraryProduct(CxxWrap.prefix(), fullname, Symbol(fullname)))
push!(products, LibraryProduct(prefix(), fullname, Symbol(fullname)))
end

if any(!satisfied(p; verbose=true) for p in products)
error("libcxxwrap-julia was not built with the example libraries required for testing")
end

write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)

0 comments on commit 001ea81

Please sign in to comment.