From Joseph Brill:
- Verify that a user specified msvc script (via MSVC_USE_SCRIPT) exists and raise an exception
when the user specified msvc script does not exist.
- Fix issue where if you only had mingw installed on a Windows system and no MSVC compiler, and
did not explicitly request the mingw tool, mingw tool initialization would fail and set the
default compiler to MSVC which wasn't installed, yielding broken build.
Updated mingw tool so that the generate and exists methods use the same mingw search paths
(issue 4134).
- Update the debug output written to stdout for MSVC initialization which is enabled by setting
SCONS_MSCOMMON_DEBUG=- to use the logging module. Also changed the debug output format
written to stdout to include more information about the source for each message of MSVC
initialization debugging output. A single space was added before the message for all
debugging output records written to stdout and to files.
- Refactor the data definitions for msvc configurations to allow derived data structures to be
constructed during initialization that removes the need for special case handling during
runtime execution. Special case handling of host/target combinations is eliminated and
replaced with pre-computed search lists that implicitly handle the differences between full
versions and express versions of msvc. This fixes an issue where Express versions of the MSVC
compiler were not detected due to differences in initial msvc detection and msvc batch file
determination when configuring the build environment. This could lead to build failures when
only an MSVC Express instance is installed and the MSVC version is not explicitly specified
(issue 2668 and issue 2697).
- Added MSVC_USE_SETTINGS construction variable to pass a dictionary to configure the msvc compiler
system environment as an alternative to bypassing Visual Studio autodetection entirely.
- Added MSVC_SDK_VERSION construction variable which allows building with a specific Microsoft
SDK version. This variable is used with the msvc batch file determined via autodetection subject
to validation constraints. Refer to the documentation for additional requirements and validation
details.
- Added MSVC_TOOLSET_VERSION construction variable which allows building with a specific toolset
version. This variable is used with the msvc batch file determined via autodetection subject to
validation constraints. This variable does not affect the autodetection and selection of msvc
instances. The toolset version is applied after an msvc instance is selected. This could be the
default version of msvc. Refer to the documentation for additional requirements and validation
details. Addresses issue 3265, issue 3664, and pull request 4149.
- Added MSVC_SPECTRE_LIBS construction variable which allows building with spectre-mitigated
Visual C++ libraries. This variable is used with the msvc batch file determined via autodetection
subject to validation constraints. Refer to the documentation for additional requirements and
validation details.
- Added MSVC_SCRIPT_ARGS construction variable which specifies command line arguments that are
passed to the msvc batch file determined via autodetection subject to validation constraints.
Refer to the documentation for additional requirements and validation details. Addresses
enhancement issue 4106.
- An exception is raised when MSVC_UWP_APP is enabled for Visual Studio 2013 and earlier.
Previous behavior was to silently ignore MSVC_UWP_APP when enabled for Visual Studio 2013
and earlier. Refer to the documentation for additional requirements and validation details.
MSVC_UWP_APP was extended to accept True, False, and None in addition to '1' and '0'.
- The imported system environment variable names for MSVC 7.0 and 6.0 have been changed to the
names set by their respective installers. Prior to this change, bypassing MSVC detection by
specifying the MSVC 7.0 batch file directly would fail due to using an erroneous environment
variable name. Arguments are no longer passed to the MSVC 6.0 to 7.1 batch files as no
arguments are required and could improve the effectiveness of the internal MSVC cache.
- Propagate the OS and windir environment variables from the system environment to the msvc
environment. The OS and windir environment variables are used in the MSVC 6.0 batch file
and the SDK 6.0-7.1 SetEnv.cmd batch files. Inclusion of the OS and windir environment
variables eliminates some partial paths and warnings generated by the MSVC 6.0 and SDK
6.0-7.1 batch files when the variables are not defined.
Note: Attempting to run the SDK 6.0-7.1 batch files directly via MSVC_USE_SCRIPT can lead to
build failures and/or incomplete build environments. The SDK 6.0-7.1 batch files
require delayed expansion to be enabled which is currently not supported and is
typically not enabled by default on the host system. The batch files may also require
environment variables that are not included by default in the msvc environment.
- Suppress issuing a warning when there are no installed Visual Studio instances for the default
tools configuration (issue 2813). When msvc is the default compiler because there are no
compilers installed, a build may fail due to the cl.exe command not being recognized. At
present, there is no easy way to detect during msvc initialization if the default environment
will be used later to build a program and/or library. There is no error/warning issued for the
default tools as there are legitimate SCons uses that do not require a c compiler.
- Added a global policy setting and an environment construction variable for specifying the
action to be taken when an msvc request cannot be satisfied. The available options are "error",
"exception", "warning", "warn", "ignore", and "suppress". The global policy variable may be
set and retrieved via the functions msvc_set_notfound_policy and msvc_get_notfound_policy,
respectively. These two methods may be imported from SCons.Tool.MSCommon. The environment
construction variable is MSVC_NOTFOUND_POLICY. When defined, the environment construction
variable overrides the global policy setting for a given environment. When the active policy
is "error" or "exception", an MSVCVersionNotFound exception is raised. When the active policy
is "warning" or "warn", a VisualCMissingWarning warning is issued and the constructed
environment is likely incomplete. When the active policy is "ignore" or "suppress", no action
is taken and the constructed environment is likely incomplete. As implemented, the default
global policy is "warning". The ability to set the global policy via an SCons command-line
option may be added in a future enhancement.
- Added a global policy setting and an environment construction variable for specifying the
action to be taken when msvc script errors are detected. The available options are "error",
"exception", "warning", "warn", "ignore", and "suppress". The global policy variable may be
set and retrieved via the functions msvc_set_scripterror_policy and msvc_get_scripterror_policy,
respectively. These two methods may be imported from SCons.Tool.MSCommon. The environment
construction variable is MSVC_SCRIPTERROR_POLICY. When defined, the environment construction
variable overrides the global policy setting for a given environment. When the active policy
is "error" or "exception", an MSVCScriptExecutionError exception is raised when msvc batch file
errors are detected. When the active policy is "warning" or "warn", an MSVCScriptExecutionWarning
warning is issued when msvc batch file errors are detected. When the active policy is "ignore" or
"suppress", msvc batch error messages are suppressed. As implemented, the default global policy
is "ignore". The ability to set the global policy via an SCons command-line option may be added
in a future enhancement.
- Added experimental function msvc_query_version_toolset to SCons.Tool.MSCommon. Given a version
specification, this function will return an msvc version and an msvc toolset version. The msvc
toolset version may be None. The msvc version and msvc toolset version can be used in the
environment construction variables MSVC_VERSION and MSVC_TOOLSET_VERSION, respectively. The
version specification may be an msvc version or an msvc toolset version. This is a proxy for
using an msvc toolset version to select an msvc instance. This function may be removed when an
msvc toolset version is used during msvc instance selection.
- Modify the MSCommon logger configuration to be independent of the root logger. This fixes an issue
when multiple loggers are created and the MSCommon logger added computed fields to the root logger
that are not present in other logging instances.
- Modify the MSVC_USE_SCRIPT_ARGS test fixture to disable the msvc cache. This fixes an issue where
the MSVC_USE_SCRIPT_ARGS test for success relied on a debug log message that was not produced when
the msvc cache file exists and the test keys are already in the cache as the msvc script invocation
was bypassed.
From William Deegan:
- Fix check for unsupported Python version. It was broken. Also now the error message
will include what is the minimum supported version of Python
- Fix ActionTests to work with python 3.10.1 (and higher)
NOTE: If you build with Python 3.10.0 and then rebuild with 3.10.1 (or higher), you may
see unexpected rebuilds. This is due to Python internals changing which changed
the signature of a Python Action Function.
- Fix a number of Python ResourceWarnings which are issued when running SCons and/or it's tests
with python 3.9 (or higher)
- Action._subproc() can now be used as a python context manager to ensure that the
POpen object is properly closed.
(Thanks to Mats Wichmann for catching that DummyPopen needed additional logic)
- Added project_url for mailing lists and Discord
- Updated project url in steup.cfg to be https instead of http
- Updated setup.cfg to remove Python 3.5 and add Python 3.10
- Added default values for source and target arguments to _defines() function. This
is used to expand CPPDEFINES (and others). Previous change added those arguments
with no defaults, so old usage where _defines() was called without source and target
arguments would yield an exception. This issue was found via qt4 and qt5 tools in
scons-contrib https://github.com/SCons/scons-contrib/issues/45
From David H:
- Add JavaScanner to include JAVACLASSPATH as a dependency when using the Java tool.
- Fix incorrect Java classpath generation when a NodeList is used as part of any JAVA*PATH variables.
From Daniel Moody:
- Add cache-debug messages for push failures.
- Ninja: Changed generated build.ninja file to run SCons only build Actions via
a SCons Deamon. Added logic for starting and connecting to SCons daemon (currently
only used for ninja)
- Ninja: Fix issue where Configure files weren't being properly processed when build run
via ninja.
- Ninja: Added ninja mingw support and improved ninja CommandGeneratorAction support.
- Ninja: Update ninja file generation to only create response files for build commands
which exceed MAXLINELENGTH
- Ninja: Added NINJA_GENERATED_SOURCE_ALIAS_NAME which allows user to specify an
Alias() which the ninja tool can use to determine which files are generated sources.
If this is not set by the user then the ninja tool will still dynamically determine
which files are generated sources based on NINJA_GENERATED_SOURCE_SUFFIXES, and create
a phony target _ninja_generated_sources. Generated sources will be built first by
ninja. This is needed because ninja cannot determine which generated sources are
required by other build targets. Code contributed by MongoDB
The downstream commit is here:
https://github.com/mongodb/mongo/commit/2fef432fa6e7cf3fd4f22ba3b193222c2887f14f
- Ninja: Added special case for ninja scons daemon to work in win32 python3.6 environments.
This particular environment does a bad job managing popen standard file handles, so
some special workarounds are needed.
- Ninja:Added user configurable setting of ninja depfile format via NINJA_DEPFILE_PARSE_FORMAT.
Now setting NINJA_DEPFILE_PARSE_FORMAT to [msvc,gcc,clang] can force the ninja expected
format. Compiler tools will also configure the variable automatically.
- Ninja: Made ninja tool force the ninja file as the only target.
- Ninja: Improved the default targets setup and made sure there is always a default target for
the ninja file, which excludes targets that start and stop the daemon.
- Ninja: Update ninja tool so targets passed to SCons are propagated to ninja when scons
automatically executes ninja.
- Small refactor of scons daemons using a shared StateInfo class for communication
between the scons interactive thread and the http server thread. Added error handling
for scons interactive failing to startup.
- Ninja: Updated ninja scons daemon scripts to output errors to stderr as well as the daemon log.
- Ninja: Fix typo in ninja scons daemon startup which causes ConnectionRefusedError to not retry
- Added SHELL_ENV_GENERATORS construction variable. This variable should be set to a list
(or an iterable) which contains functions to be called in order
when constructing the execution environment (Generally this is the shell environment
variables). This allows the user to customize how (for example) PATH is constructed.
Note that these are called for every build command run by SCons. It could have considerable
performance impact if not used carefully.
to connect to the server during start up.
- lex: Fixed an issue with the lex tool where file arguments specified to either "--header-file="
or "--tables-file=" which included a space in the path to the file would be processed incorrectly
- Ninja: added option "--skip-ninja-regen" to enable skipping regeneration of the ninja file
if scons can determine the ninja file doesnot need to be regenerated, which will also
skip restarting the scons daemon. Note this option is could result in incorrect rebuilds
if scons Glob or scons generated files are used in ninja build target's command lines.
- Ninja: Added new alias "shutdown-ninja-scons-daemon" to allow ninja to shutdown the daemon.
Also added cleanup to test framework to kill ninja scons daemons and clean ip daemon logs.
NOTE: Test for this requires python psutil module. It will be skipped if not present.
- Ninja: Added command line variable NINJA_CMD_ARGS that allows to pass through ninja command line args.
This can also be set in your Environment().
From Mats Wichmann:
- Tweak the way default site_scons paths on Windows are expressed to
conform to conventions (what they actually resolve to is unchanged),
drop a Py2 workaround, and pick a better "system" path, old one
remains supported (%AllUsersProfile%\scons\site_scons vs old
%AllUsersProfile%\Application Data\scons\site_scons).
- Fix testsuite to work on Windows systems where there is no usable
association for running .py files directly. There are a few tests where
we need to do this for internal reasons, those are skipped in that case.
Bad association could mean some other tool took it over (Visual
Studio Code is known to do this), or no association at all.
- Updated debug code in MSVC and MSVS tools to conform to the
suggested "lazy interpolation" use of the Python logging module.
Calls now look like 'debug("template %s", text)' rather than
'debug("template %s" % text)' so the logging system does the
interpolation only when/if needed (was a pylint warning).
- Update Help (-H) output a bit. Drop "ignored for compat" entry.
Pass window size to formatter so it formats for wider displays too.
- runtest.py now accepts -j 0 to auto-detect number of usable
processors for testing threads.
- Fixed crash in C scanner's dictify_CPPDEFINES() function which happens if
AppendUnique is called on CPPPATH. (Issue 4108).
- The MSVC script_env_cache now contains a sanity check: if the retrieved
tools path does not exist, the entry is invalidated so it will
be recomputed, in an attempt to avoid scons failing when certain
compiler version bumps have taken place. The dictionary key (uses
the name of a batch file and any arguments which may have been
passes), is now computed a bit differently: the dashes are left
off if there are no arguments. The default cachefile is changed
to have a .json suffix, for better recognition on Windows since
the contents are json.
- As "code modernization" all of SCons now uses the current super()
zero-argument syntax instead of direct calls to a parent class method
or the super() two-argument syntax.
- Renamed ParseFlag's internal data structure to "mapping" instead of
"dict" (avoid redefining builtin)
- Fix an old use-before-set bug in tex tool (issue 2888)
- Fix a test harness exception returning stderr if a wait_for timed out.
- ParseConfig now correctly passes the *unique* flag to a user-supplied
flag-merging function.
- Restore the ability of the content-timestamp decider to see that a
a source which is a symlink has changed if the file-system target of
that link has been modified (issue 3880)
- Modernize a few tests that use now-deprecated unittest.getTestCaseNames
and unittest.makeSuite - Python itself suggests the replacements.
- SCons.Tool.find_program_path now takes an optional add_path argument
to add a path to the execution environment if it was discovered in
default_paths. Previously, the routine, called by many tool modules,
never altered the execution environment, leaving it to the tools.
- A new construction variable FORTRANCOMMONFLAGS is added which is
applied to all Fortran dialects, in case someone needs to set some
flags globally. FORTRANFLAGS looked like it was intended for that,
but was not applied to other dialects, and e2e tests explicitly checked
that FORTRANFLAGS did not propagate outside the FORTRAN dialect,
so the conclusion is that behavior is intentional (issue 2257)
- SCons programmatic importing (tool modules and platform modules)
no longer uses the deprecated (since Py 3.10) importlib.load_module
routine, shifting to the preferred exec_module. Old Python 2 compatible
import fallback (using the imp module) in tool module loading is dropped.
Tool module loading no longer special-cases Jython, which is a dead
project as far as SCons (no timeline in sight for Python 3 support).
- Improvements to lex and yacc tools: better documentation of
extra-file options, add test for extra-file behavior.
- Two new construction variables are introduced for lex (LEX_HEADER_FILE
and LEX_TABLES_FILE) as the preferred way of specifying these extra-file
options.
- Two new construction variables are introduced for yacc
(YACC_HEADER_FILE and YACC_GRAPH_FILE) as the preferred way of
specifying these extra-file options.
From Zhichang Yu:
- Added MSVC_USE_SCRIPT_ARGS variable to pass arguments to MSVC_USE_SCRIPT.
- Added Configure.CheckMember() checker to check if struct/class has the specified member.
From Ivan Kravets, PlatformIO:
- Conditional C/C++ Preprocessor: Strip shell's backslashes from the computed include (-DFOO_H=\"foo.h\")