Skip to content

Commit 27325f7

Browse files
authored
Merge pull request #212 from JuliaPOMDP/0.6-better_add
adding appears to work; added some adds to Travis
2 parents 6ad87bd + 025c196 commit 27325f7

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ before_script:
1212
script:
1313
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
1414
- julia --check-bounds=yes -e 'Pkg.clone(pwd())'
15+
- julia --check-bounds=yes -e 'using POMDPs; POMDPs.add("QMDP")'
16+
- julia --check-bounds=yes -e 'using POMDPs; POMDPs.add("BasicPOMCP")'
1517
- julia --check-bounds=yes -e 'Pkg.test("POMDPs")'
1618
after_success:
1719
- julia -e 'Pkg.add("Documenter")'

src/utils.jl

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ julia> POMDPs.add("MCTS")
1212
"""
1313
function add(solver_name::AbstractString, v::Bool=true)
1414
@assert solver_name in SUPPORTED_PACKAGES string("The JuliaPOMDP package: ", solver_name, " is not supported")
15-
full_url = string(REMOTE_URL, solver_name, ".jl")
1615
if solver_name in REGISTERED_PACKAGES
1716
Pkg.add(solver_name)
1817
else
1918
try
20-
Pkg.clone(full_url)
21-
Pkg.checkout(solver_name, BRANCH06)
19+
Pkg.cd(clone_without_resolving, solver_name)
20+
try
21+
Pkg.checkout(solver_name, BRANCH06)
22+
catch
23+
warn("could not checkout 0.6-version of $solver_name")
24+
end
25+
Pkg.resolve()
2226
Pkg.build(solver_name)
2327
catch ex
2428
if isa(ex, Base.Pkg.PkgError) && ex.msg == "$solver_name already exists"
@@ -123,6 +127,23 @@ function available()
123127
end
124128
end
125129

130+
131+
function clone_without_resolving(pkg::AbstractString)
132+
# copied from Pkg.clone
133+
url = string(REMOTE_URL, pkg, ".jl")
134+
info("Cloning $pkg from $url")
135+
ispath(pkg) && throw(Pkg.PkgError("$pkg already exists"))
136+
try
137+
Base.LibGit2.with(Base.LibGit2.clone(url, pkg)) do repo
138+
Base.LibGit2.set_remote_url(repo, url)
139+
end
140+
catch err
141+
isdir(pkg) && Base.rm(pkg, recursive=true)
142+
rethrow(err)
143+
end
144+
end
145+
146+
126147
# This does not appear to work
127148
#=
128149
"""

0 commit comments

Comments
 (0)