Skip to content

Commit

Permalink
Moved to PrecompileTools precompilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
James.Hester committed Sep 18, 2023
1 parent 8073a01 commit daee1ac
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824"
Lerche = "d42ef402-04e6-4356-9f73-091573ea58dc"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
URIParser = "30578b45-9adc-5946-b283-645ec420af67"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
cif_api_jll = "6fcef0ae-1c05-5fc1-b206-1cf994addbad"

[compat]
DataFrames = "^1.1.0"
FilePaths = "^0.8.0"
Lerche = "^0.5.0"
URIParser = "^0.4.0"
URIs = "1.5.0"
cif_api_jll = "^0.4.2"
julia = "^1.4.0"
8 changes: 7 additions & 1 deletion src/CrystalInfoFramework.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@

module CrystalInfoFramework
using DataFrames
using URIs
using FilePaths #easy cross-platform URI
using URIParser
using Lerche # for native parser
using cif_api_jll # for cif API parser
using PrecompileTools #for fast startup

# **Exports**

Expand Down Expand Up @@ -73,7 +74,12 @@ import Base: isless
include("DataContainer/Types.jl")
include("DataContainer/DataSource.jl")
include("DataContainer/Relations.jl")
end

#
@compile_workload begin
c = Cif(joinpath(@__PATH__,"../test/nick1.cif"), native=true)
d = DDLm_Dictionary(joinpath(@__PATH__,"../test/ddl.dic"), ignore_imports=true)
end

end
26 changes: 26 additions & 0 deletions src/ddlm_dictionary_ng.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,32 @@ fix_url(s::String,parent) = begin
return URI(s)
end

# Following code copied from URIs/uris.jl. For some reason
# this function was not recognised during precompilation

const absent = SubString("absent", 1, 0)

function URIs.URI(p::AbstractPath; query=absent, fragment=absent)
if isempty(p.root)
throw(ArgumentError("$p is not an absolute path"))
end

b = IOBuffer()
print(b, "file://")

if !isempty(p.drive)
print(b, "/")
print(b, p.drive)
end

for s in p.segments
print(b, "/")
print(b, URIs.escapeuri(s))
end

return URIs.URI(URIs.URI(String(take!(b))); query=query, fragment=fragment)
end

"""
to_path(::URI)
Expand Down

0 comments on commit daee1ac

Please sign in to comment.