mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 16:20:17 +02:00
add --fresh-auto-compile
* doc/ref/api-evaluation.texi (Compilation): Add discussion of --fresh-auto-compile. * doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile option. * NEWS: Add entry. * libguile/load.c: Define %fresh-auto-compile. (scm_primitive_load_path): Use it here. (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env var, with a value of "fresh". * module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is stale if %fresh-auto-compile is true. * module/ice-9/command-line.scm (compile-shell-switches): Parse out --fresh-auto-compile.
This commit is contained in:
parent
ee037cee3e
commit
1e56cff233
6 changed files with 53 additions and 4 deletions
5
NEWS
5
NEWS
|
@ -128,6 +128,11 @@ interpreted as starting an R6RS hex escape. This is backward compatible
|
||||||
because the symbol printer would never produce a "\x" before. The
|
because the symbol printer would never produce a "\x" before. The
|
||||||
printer also works better too.
|
printer also works better too.
|
||||||
|
|
||||||
|
** Added --force-auto-compile option
|
||||||
|
|
||||||
|
This allows a user to invalidate the auto-compilation cache. It's
|
||||||
|
usually not needed. See "Compilation" in the manual, for a discussion.
|
||||||
|
|
||||||
* Manual updates
|
* Manual updates
|
||||||
|
|
||||||
** GOOPS documentation updates
|
** GOOPS documentation updates
|
||||||
|
|
|
@ -586,6 +586,15 @@ computation are fulfilled by macros and closures. Of course one good
|
||||||
counterexample is the REPL itself, or any code that reads expressions
|
counterexample is the REPL itself, or any code that reads expressions
|
||||||
from a port.)
|
from a port.)
|
||||||
|
|
||||||
|
Automatic compilation generally works transparently, without any need
|
||||||
|
for user intervention. However Guile does not yet do proper dependency
|
||||||
|
tracking, so that if file @file{@var{a}.scm} uses macros from
|
||||||
|
@file{@var{b}.scm}, and @var{@var{b}.scm} changes, @code{@var{a}.scm}
|
||||||
|
would not be automatically recompiled. To forcibly invalidate the
|
||||||
|
auto-compilation cache, pass the @code{--fresh-auto-compile} option to
|
||||||
|
Guile, or set the @code{GUILE_AUTO_COMPILE} environment variable to
|
||||||
|
@code{fresh} (instead of to @code{0} or @code{1}).
|
||||||
|
|
||||||
For more information on the compiler itself, see @ref{Compiling to the
|
For more information on the compiler itself, see @ref{Compiling to the
|
||||||
Virtual Machine}. For information on the virtual machine, see @ref{A
|
Virtual Machine}. For information on the virtual machine, see @ref{A
|
||||||
Virtual Machine for Guile}.
|
Virtual Machine for Guile}.
|
||||||
|
|
|
@ -227,6 +227,11 @@ development.
|
||||||
@item --auto-compile
|
@item --auto-compile
|
||||||
Compile source files automatically (default behavior).
|
Compile source files automatically (default behavior).
|
||||||
|
|
||||||
|
@vnew{2.0.1}
|
||||||
|
|
||||||
|
@item --fresh-auto-compile
|
||||||
|
Treat the auto-compilation cache as invalid, forcing recompilation.
|
||||||
|
|
||||||
@vnew{2.0}
|
@vnew{2.0}
|
||||||
|
|
||||||
@item --no-auto-compile
|
@item --no-auto-compile
|
||||||
|
|
|
@ -210,6 +210,9 @@ static SCM *scm_loc_load_compiled_extensions;
|
||||||
/* Whether we should try to auto-compile. */
|
/* Whether we should try to auto-compile. */
|
||||||
static SCM *scm_loc_load_should_auto_compile;
|
static SCM *scm_loc_load_should_auto_compile;
|
||||||
|
|
||||||
|
/* Whether to treat all auto-compiled files as stale. */
|
||||||
|
static SCM *scm_loc_fresh_auto_compile;
|
||||||
|
|
||||||
/* The fallback path for auto-compilation */
|
/* The fallback path for auto-compilation */
|
||||||
static SCM *scm_loc_compile_fallback_path;
|
static SCM *scm_loc_compile_fallback_path;
|
||||||
|
|
||||||
|
@ -824,6 +827,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
|
||||||
if (scm_is_false (compiled_filename)
|
if (scm_is_false (compiled_filename)
|
||||||
&& scm_is_true (full_filename)
|
&& scm_is_true (full_filename)
|
||||||
&& scm_is_true (*scm_loc_compile_fallback_path)
|
&& scm_is_true (*scm_loc_compile_fallback_path)
|
||||||
|
&& scm_is_false (*scm_loc_fresh_auto_compile)
|
||||||
&& scm_is_pair (*scm_loc_load_compiled_extensions)
|
&& scm_is_pair (*scm_loc_load_compiled_extensions)
|
||||||
&& scm_is_string (scm_car (*scm_loc_load_compiled_extensions)))
|
&& scm_is_string (scm_car (*scm_loc_load_compiled_extensions)))
|
||||||
{
|
{
|
||||||
|
@ -857,6 +861,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
|
||||||
|
|
||||||
if (!compiled_is_fallback
|
if (!compiled_is_fallback
|
||||||
&& scm_is_true (*scm_loc_compile_fallback_path)
|
&& scm_is_true (*scm_loc_compile_fallback_path)
|
||||||
|
&& scm_is_false (*scm_loc_fresh_auto_compile)
|
||||||
&& scm_is_pair (*scm_loc_load_compiled_extensions)
|
&& scm_is_pair (*scm_loc_load_compiled_extensions)
|
||||||
&& scm_is_string (scm_car (*scm_loc_load_compiled_extensions)))
|
&& scm_is_string (scm_car (*scm_loc_load_compiled_extensions)))
|
||||||
{
|
{
|
||||||
|
@ -971,6 +976,8 @@ scm_init_load ()
|
||||||
= SCM_VARIABLE_LOC (scm_c_define ("%compile-fallback-path", SCM_BOOL_F));
|
= SCM_VARIABLE_LOC (scm_c_define ("%compile-fallback-path", SCM_BOOL_F));
|
||||||
scm_loc_load_should_auto_compile
|
scm_loc_load_should_auto_compile
|
||||||
= SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", SCM_BOOL_F));
|
= SCM_VARIABLE_LOC (scm_c_define ("%load-should-auto-compile", SCM_BOOL_F));
|
||||||
|
scm_loc_fresh_auto_compile
|
||||||
|
= SCM_VARIABLE_LOC (scm_c_define ("%fresh-auto-compile", SCM_BOOL_F));
|
||||||
|
|
||||||
the_reader = scm_make_fluid ();
|
the_reader = scm_make_fluid ();
|
||||||
scm_fluid_set_x (the_reader, SCM_BOOL_F);
|
scm_fluid_set_x (the_reader, SCM_BOOL_F);
|
||||||
|
@ -988,8 +995,24 @@ scm_init_load ()
|
||||||
void
|
void
|
||||||
scm_init_load_should_auto_compile ()
|
scm_init_load_should_auto_compile ()
|
||||||
{
|
{
|
||||||
*scm_loc_load_should_auto_compile =
|
char *auto_compile = getenv ("GUILE_AUTO_COMPILE");
|
||||||
scm_from_bool (scm_getenv_int ("GUILE_AUTO_COMPILE", 1));
|
|
||||||
|
if (auto_compile && strcmp (auto_compile, "0") == 0)
|
||||||
|
{
|
||||||
|
*scm_loc_load_should_auto_compile = SCM_BOOL_F;
|
||||||
|
*scm_loc_fresh_auto_compile = SCM_BOOL_F;
|
||||||
|
}
|
||||||
|
/* Allow "freshen" also. */
|
||||||
|
else if (auto_compile && strncmp (auto_compile, "fresh", 5) == 0)
|
||||||
|
{
|
||||||
|
*scm_loc_load_should_auto_compile = SCM_BOOL_T;
|
||||||
|
*scm_loc_fresh_auto_compile = SCM_BOOL_T;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*scm_loc_load_should_auto_compile = SCM_BOOL_T;
|
||||||
|
*scm_loc_fresh_auto_compile = SCM_BOOL_F;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3290,7 +3290,8 @@ module '(ice-9 q) '(make-q q-length))}."
|
||||||
(catch #t
|
(catch #t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let* ((scmstat (stat name))
|
(let* ((scmstat (stat name))
|
||||||
(gostat (stat go-path #f)))
|
(gostat (and (not %fresh-auto-compile)
|
||||||
|
(stat go-path #f))))
|
||||||
(if (and gostat
|
(if (and gostat
|
||||||
(or (> (stat:mtime gostat) (stat:mtime scmstat))
|
(or (> (stat:mtime gostat) (stat:mtime scmstat))
|
||||||
(and (= (stat:mtime gostat) (stat:mtime scmstat))
|
(and (= (stat:mtime gostat) (stat:mtime scmstat))
|
||||||
|
|
|
@ -127,7 +127,8 @@ If FILE begins with `-' the -s switch is mandatory.
|
||||||
Default is to enable debugging for interactive
|
Default is to enable debugging for interactive
|
||||||
use, but not for `-s' and `-c'.
|
use, but not for `-s' and `-c'.
|
||||||
--auto-compile compile source files automatically
|
--auto-compile compile source files automatically
|
||||||
--no-auto-compile disable automatic source file compilation
|
--fresh-auto-compile invalidate auto-compilation cache
|
||||||
|
--no-auto-compile disable automatic source file compilation
|
||||||
Default is to enable auto-compilation of source
|
Default is to enable auto-compilation of source
|
||||||
files.
|
files.
|
||||||
--listen[=P] Listen on a local port or a path for REPL clients.
|
--listen[=P] Listen on a local port or a path for REPL clients.
|
||||||
|
@ -295,6 +296,11 @@ If FILE begins with `-' the -s switch is mandatory.
|
||||||
(set! %load-should-auto-compile #t)
|
(set! %load-should-auto-compile #t)
|
||||||
(parse args out))
|
(parse args out))
|
||||||
|
|
||||||
|
((string=? arg "--fresh-auto-compile")
|
||||||
|
(set! %load-should-auto-compile #t)
|
||||||
|
(set! %fresh-auto-compile #t)
|
||||||
|
(parse args out))
|
||||||
|
|
||||||
((string=? arg "--no-auto-compile")
|
((string=? arg "--no-auto-compile")
|
||||||
(set! %load-should-auto-compile #f)
|
(set! %load-should-auto-compile #f)
|
||||||
(parse args out))
|
(parse args out))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue