PackageCompiler does not compile included Julia-files!


I developed a program with Julia that consists of a main file called MyProgram.jl and an additional file called MyAdditionalCode.jl. In MyProgram.jl I have this content:

… # Some libraries imported via import or using.
… # Some constants and variables declared.

function program_main() # My real main function.
… # Many lines of various source code.
… # Many lines of various source code.

function julia_main()::Cint # Used by PackageCompiler.jl
return 0

In MyAdditionalCode.jl I just have this line:
my_variable = “123”

When I execute MyProgram.jl traditionally with Julia.exe, it works without any problems and 123 is displayed on screen.
But when I compile it with PackageCompiler and I create all required things such as a project with a TOML project file, a julia_main() method etc., then the program MyProgram.jl is sucessfully compiled to MyProgramCompiled.exe and the system image is created, but MyAdditionalCode.jl is NOT compiled. When I try to execute MyProgramCompiled.exe, then I get this error message:

SystemError: opening file “C:\JuliaWorkspace\MyProgram\MyProgramCompiled\bin\MyAdditionalCode.jl”: No such file or directory

If I copy MyAdditionalCode.jl from C:\JuliaWorkspace to C:\JuliaWorkspace\MyProgram\MyProgramCompiled\bin\, then the program runs without any error messages.
However, I wonder why MyAdditionalCode.jl is not compiled?
I expected that everything will be compiled and not just MyProgram.jl.

I am using Julia v1.8.5, PackageCompiler v2.1.5 and Windows 10 64-Bit Version.

Thank you in advance for any answers!

Kind regards,
Miroslav Stimac