Skip to content

Commit

Permalink
new_includer_file using os vector
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 16, 2020
1 parent d2fb8dc commit 2bba93c
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/bot/precompile_include.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,36 @@ end
"""
new_includer_file(package_path::String, precompile_path::String)
Creates a "precompile_includer.jl" file if it doesn't exist.
Creates a "precompile_includer.jl" file.
"""
function new_includer_file(package_path::String, precompile_path::String, overwrite::Bool)
function new_includer_file(package_name::String, package_path::String, precompile_path::String, os::Union{Vector{String}, Nothing})
includer_file = joinpath(dirname(package_path), "precompile_includer.jl")
if isfile(includer_file) && !overwrite
@info "$includer_file already exists"
return nothing

if isnothing(os)
multiosstr = ""
else
@info """$includer_file file will be $(!overwrite ? "created" : "overwritten")"""
enclusure = """
# precompile_enclusre (don't edit the following!)
should_precompile = true
ismultios = false
@static if should_precompile
@static if !ismultios
include($precompile_path)
end
end # precompile_enclusure
_precompile_()
"""
Base.write(includer_file, enclusure)
multiosstr = ""
for eachos in os
multiosstr = multiosstr * """elseif Sys.is$eachos
include("../deps/SnoopCompile/precompile/$eachos/precompile_$package_name.jl")
"""
end
end

@info "$includer_file file will be created/overwritten"
enclusure = """
# precompile_enclusre (don't edit the following!)
should_precompile = true
ismultios = false
@static if should_precompile
@static if !ismultios
include($precompile_path)
$multiosstr
end
end # precompile_enclusure
_precompile_()
"""
Base.write(includer_file, enclusure)
end
################################################################
"""
Expand Down

0 comments on commit 2bba93c

Please sign in to comment.