1
1
using Test
2
2
using Pkg, Base. BinaryPlatforms
3
3
using BinaryBuilderBase
4
- using BinaryBuilderBase: getname, getpkg, dependencify, destdir, PKG_VERSIONS, get_addable_spec
4
+ using BinaryBuilderBase: getname, getpkg, dependencify, destdir, PKG_VERSIONS, get_addable_spec, cached_git_clone
5
5
using JSON
6
+ using LibGit2
6
7
7
8
# Define equality between dependencies, in order to carry out the tests below
8
9
Base.:(== )(a:: AbstractDependency , b:: AbstractDependency ) = getpkg (a) == getpkg (b)
179
180
platform = Platform (" x86_64" , " linux" ; julia_version= v " 1.5" )
180
181
181
182
# Test that a particular version of GMP is installed
182
- ap = @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
183
+ @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
183
184
@test isfile (joinpath (destdir (dir, platform), " lib" , " libgmp.so.10.3.2" ))
184
185
end
185
186
190
191
platform = Platform (" x86_64" , " linux" ; julia_version= v " 1.6" )
191
192
192
193
# Test that a particular version of GMP is installed
193
- ap = @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
194
+ @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
194
195
@test isfile (joinpath (destdir (dir, platform), " lib" , " libgmp.so.10.4.0" ))
195
196
end
196
197
@@ -204,16 +205,53 @@ end
204
205
205
206
# Test that this is not instantiatable with either Julia v1.5 or v1.6
206
207
platform = Platform (" x86_64" , " linux" ; julia_version= v " 1.5" )
207
- ap = @test_throws Pkg. Resolve. ResolverError setup_dependencies (prefix, getpkg .(dependencies), platform)
208
+ @test_throws Pkg. Resolve. ResolverError setup_dependencies (prefix, getpkg .(dependencies), platform)
208
209
platform = Platform (" x86_64" , " linux" ; julia_version= v " 1.6" )
209
- ap = @test_throws Pkg. Resolve. ResolverError setup_dependencies (prefix, getpkg .(dependencies), platform)
210
+ @test_throws Pkg. Resolve. ResolverError setup_dependencies (prefix, getpkg .(dependencies), platform)
210
211
211
212
# If we don't give a `julia_version`, then we are FULLY UNSHACKLED.
212
213
platform = Platform (" x86_64" , " linux" )
213
- ap = @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
214
+ @test_logs setup_dependencies (prefix, getpkg .(dependencies), platform)
214
215
@test isfile (joinpath (destdir (dir, platform), " lib" , " libgmp.so.10.3.2" ))
215
216
@test isfile (joinpath (destdir (dir, platform), " lib" , " libmpfr.so.6.1.0" ))
216
217
end
218
+
219
+ # Dependency as a local directory
220
+ with_temp_project () do dir
221
+ mktempdir () do pkgdir
222
+ prefix = Prefix (dir)
223
+ # Clone if necessary the remote repository and check out its
224
+ # working directory in a temporary space.
225
+ cache_dir = cached_git_clone (" https://github.com/JuliaBinaryWrappers/HelloWorldC_jll.jl" )
226
+ LibGit2. with (LibGit2. clone (cache_dir, pkgdir)) do repo
227
+ LibGit2. checkout! (repo, " c7f2e95d9c04e218931c14954ecd31ebde72cca5" )
228
+ end
229
+ dependencies = [
230
+ PackageSpec (
231
+ name= " HelloWorldC_jll" ,
232
+ path= pkgdir,
233
+ ),
234
+ ]
235
+ platform = Platform (" x86_64" , " linux" ; libc= " glibc" )
236
+ @test_logs setup_dependencies (prefix, dependencies, platform)
237
+ @test readdir (joinpath (destdir (dir, platform), " bin" )) == [" hello_world" ]
238
+ end
239
+ end
240
+
241
+ # Dependency as a remote repository
242
+ with_temp_project () do dir
243
+ prefix = Prefix (dir)
244
+ dependencies = [
245
+ PackageSpec (
246
+ name= " HelloWorldC_jll" ,
247
+ url= " https://github.com/JuliaBinaryWrappers/HelloWorldC_jll.jl" ,
248
+ rev= " c7f2e95d9c04e218931c14954ecd31ebde72cca5" ,
249
+ ),
250
+ ]
251
+ platform = Platform (" x86_64" , " linux" ; libc= " glibc" )
252
+ @test_logs setup_dependencies (prefix, dependencies, platform)
253
+ @test readdir (joinpath (destdir (dir, platform), " bin" )) == [" hello_world" ]
254
+ end
217
255
end
218
256
end
219
257
0 commit comments