On this page
Kernel.ParallelCompiler
A module responsible for compiling and requiring files in parallel.
Summary
Functions
- async(fun)
-
Starts a task for parallel compilation.
- compile(files, options \\ [])
-
Compiles the given files.
- require(files, options \\ [])
-
Requires the given files in parallel.
Functions
async(fun)
Starts a task for parallel compilation.
If you have a file that needs to compile other modules in parallel, the spawned processes need to be aware of the compiler environment. This function allows a developer to create a task that is aware of those environments.
See Task.async/1 for more information. The task spawned must be always awaited on by calling Task.await/1
compile(files, options \\ [])
Compiles the given files.
Those files are compiled in parallel and can automatically detect dependencies between them. Once a dependency is found, the current file stops being compiled until the dependency is resolved.
It returns {:ok, modules, warnings} or {:error, errors, warnings}.
Both errors and warnings are a list of three-element tuples containing the file, line and the formatted error/warning.
Options
:each_file- for each file compiled, invokes the callback passing the file:each_long_compilation- for each file that takes more than a given timeout (see the:long_compilation_thresholdoption) to compile, invoke this callback passing the file as its argument:each_module- for each module compiled, invokes the callback passing the file, module and the module bytecode:each_cycle- after the given files are compiled, invokes this function that should return the following values:{:compile, modules}- to continue compilation with a list of further modules to compile{:runtime, modules}- to stop compilation and verify the list of modules because dependent modules have changed
:long_compilation_threshold- the timeout (in seconds) after the:each_long_compilationcallback is invoked; defaults to15:profile- if set to:timemeasure the compilation time of each compilation cycle and group pass checker:dest- the destination directory for the BEAM files. When usingcompile/2, this information is only used to properly annotate the BEAM files before they are loaded into memory. If you want a file to actually be written todest, usecompile_to_path/3instead.:beam_timestamp- the modification timestamp to give all BEAM files
compile_to_path(files, path, options \\ [])
require(files, options \\ [])
Requires the given files in parallel.
Opposite to compile, dependencies are not attempted to be automatically solved between files.
It returns {:ok, modules, warnings} or {:error, errors, warnings}.
Both errors and warnings are a list of three-element tuples containing the file, line and the formatted error/warning.
Options
:each_file- for each file compiled, invokes the callback passing the file:each_module- for each module compiled, invokes the callback passing the file, module and the module bytecode
© 2012 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/elixir/1.10.4/Kernel.ParallelCompiler.html