JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.42k stars 190 forks source link

compile_incremental overwrites #201

Closed daviehh closed 4 years ago

daviehh commented 5 years ago

If run in separate commands, the latter compile_incremental will overwrite the sysimg e.g.

  1. run julia without the -J /path/to/sysimg switch, do compile_incremental(:Plots)
  2. add the -J switch, go to the pkg prompt ] do st:

(PackagesPrecompile) pkg> st Project PackagesPrecompile v0.0.0 Status ~/.julia/packages/PackageCompiler/oT98U/packages/Project.toml [d38c429a] Contour v0.5.1 [5789e2e9] FileIO v1.0.5 [53c48c17] FixedPointNumbers v0.5.3 [28b8d3ca] GR v0.38.1 [6218d12a] ImageMagick v0.7.1 [916415d5] Images v0.17.2 [682c06a0] JSON v0.20.0 [b964fa9f] LaTeXStrings v1.0.3 [442fdcdd] Measures v0.3.0 [77ba4419] NaNMath v0.3.2 [9b87118b] PackageCompiler v0.6.3 [c5e800db] PlotReferenceImages v0.0.0 #master (https://github.com/JuliaPlots/PlotReferenceImages.jl.git) [ccf2f8ad] PlotThemes v0.3.0 [995b91a9] PlotUtils v0.5.5+ #master (https://github.com/JuliaPlots/PlotUtils.jl.git) [91a5bcdd] Plots v0.23.1 [dca85d43] QuartzImageIO v0.5.2 [ce6b1742] RDatasets v0.6.1 [3cdcf5f2] RecipesBase v0.6.0+ #master (https://github.com/JuliaPlots/RecipesBase.jl.git) [189a3867] Reexport v0.2.0 [ae029012] Requires v0.5.2 [992d4aef] Showoff v0.2.1 [90137ffa] StaticArrays v0.10.3 [2913bbd2] StatsBase v0.29.0 [f3b207a7] StatsPlots v0.10.2 [b8865327] UnicodePlots v1.1.0 [34922c18] VisualRegressionTests v0.3.0 [2a0f44e3] Base64 [ade2ca70] Dates [37e2e46d] LinearAlgebra [44cfe95a] Pkg [de0858da] Printf [3fa0cd96] REPL [9a3f8284] Random [2f01184e] SparseArrays [10745b16] Statistics [8dfed614] Test [cf7118a7] UUIDs

  1. return to julia without the -J switch, compile another package, e.g. compile_incremental(:Makie), exit, add the -J switch, and pkg>st returns

(PackagesPrecompile) pkg> st Project PackagesPrecompile v0.0.0 Status ~/.julia/packages/PackageCompiler/oT98U/packages/Project.toml [537997a7] AbstractPlotting v0.9.6 [5789e2e9] FileIO v1.0.5 [f7f18e0c] GLFW v2.3.0 [e9467ef8] GLMakie v0.0.5 [a09fc81d] ImageCore v0.7.4 [6218d12a] ImageMagick v0.7.1 [02fcd773] ImageTransformations v0.7.2 [66fc600b] ModernGL v1.0.0 [9b87118b] PackageCompiler v0.6.3 [dca85d43] QuartzImageIO v0.5.2 [44cfe95a] Pkg

Looks like the precompiled Plots is overwritten. Is this the expected behavior/is there an option to add to existing sysimg without overwriting? Thanks!

asinghvi17 commented 5 years ago

This is expected as far as I am aware, since PackageCompiler will compile the system image into its directory. One thing you can do is refer to the following code:

https://github.com/JuliaLang/PackageCompiler.jl/blob/54c0c1255227c8a94de402b41e05d22ea98b5013/src/incremental.jl#L114-L145

and change it manually (essentially, replicate the compile_incremental method with whatever output directory you want).

A PR could be made to amend sysimg_folder

https://github.com/JuliaLang/PackageCompiler.jl/blob/8987c26461e69a3d10d21e196a7c56608391d42b/src/PackageCompiler.jl#L62-L66

perhaps with a keyword argument to change the parent directory?