mx API documentation

mx is a command line tool for managing the development of Java code organized as suites of projects.

class mx.ArchivableBuildTask(subject, args, parallelism)[source]

Bases: mx.BuildTask

build()[source]
clean(forBuild=False)[source]
needsBuild(newestInput)[source]
newestOutput()[source]
class mx.ArchivableProject(suite, name, deps, workingSets, theLicense)[source]

Bases: mx.Project

A project that can be part of any distribution, native or not. Users should subclass this class and implement the nyi() methods. The files listed by getResults(), which must be under output_dir(), will be included in the archive under the prefix archive_prefix().

archive_prefix()[source]
getBuildTask(args)[source]
getResults()[source]
get_relpath(f, outputDir)[source]
output_dir()[source]
static walk(d)[source]

Convenience method to implement getResults() by including all files under a directory.

class mx.ArchiveTask(args, dist)[source]

Bases: mx.BuildTask

build()[source]
buildForbidden()[source]
cleanForbidden()[source]
needsBuild(newestInput)[source]
class mx.Archiver(path, kind='zip')[source]

Bases: mx.SafeFileCreation

Utility for creating and updating a zip or tar file atomically.

class mx.ArgParser(parents=None)[source]

Bases: argparse.ArgumentParser

format_help()[source]
class mx.BaseLibrary(suite, name, optional, theLicense)[source]

Bases: mx.Dependency

A library that has no structure understood by mx, typically a jar file. It is used “as is”.

resolveDeps()[source]
substVars(text)[source]

Return string where references to instance variables from given text string are replaced.

class mx.BinarySuite(mxDir, importing_suite, dynamicallyImported=False, load=True)[source]

Bases: mx.Suite

isDirty(abortOnError=True)[source]
release_version()[source]
reload_binary_suite()[source]
version(abortOnError=True)[source]

Return the current head changeset of this suite.

class mx.BinaryVC[source]

Bases: mx.VC

Emulates a VC system for binary suites, as far as possible, but particularly pull/tip

class Metadata(suiteName, repourl, snapshotVersion, snapshotTimestamp)[source]
active_branch(vcdir, abortOnError=True)[source]
check(abortOnError=True)[source]
clone(url, dest=None, rev=None, abortOnError=True, **extra_args)[source]

Downloads the mx-suitename.jar file. The caller is responsible for downloading the suite distributions. The actual version downloaded is written to the file mx-suitename.jar.<version>.

Parameters:extra_args – Additional args that must include suite_name which is a string denoting the suite name and result which is a dict for output values. If this method returns True, then there will be a adj_version entry in this dict containing the actual (adjusted) version
Returns:True if the clone was successful, Fazlse otherwise
Return type:bool
default_pull(vcdir, abortOnError=True)[source]
getDistribution(vcdir, distribution)[source]
isDirty(abortOnError=True)[source]
is_this_vc(vcdir)[source]
parent(vcdir, abortOnError=True)[source]
parent_info(vcdir, abortOnError=True)[source]
pull(vcdir, rev=None, update=True, abortOnError=True)[source]
root(directory, abortOnError=True)[source]
status(abortOnError=True)[source]
tip(vcdir, abortOnError=True)[source]
update(vcdir, rev=None, mayPull=False, clean=False, abortOnError=False)[source]
update_to_branch(vcdir, branch, abortOnError=True)[source]
class mx.BuildTask(subject, args, parallelism)[source]

Bases: object

build()[source]
buildForbidden()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
cleanSharedMemoryState()[source]
execute()[source]
initSharedMemoryState()[source]
logBuild(reason)[source]
logClean()[source]
logSkip(reason)[source]
needsBuild(newestInput)[source]

Returns True if the current artifacts of this task are out dated. The ‘newestInput’ argument is either None or a TimeStampFile denoting the artifact of a dependency with the most recent modification time. Apart from ‘newestInput’, this method does not inspect this task’s dependencies.

newestOutput()[source]

Gets a TimeStampFile representing the build output file for this task with the newest modification time or None if no build output file exists.

prepare(daemons)[source]

Perform any task initialization that must be done in the main process. This will be called just before the task is launched. The ‘daemons’ argument is a dictionary for storing any persistent state that might be shared between tasks.

pullSharedMemoryState()[source]
pushSharedMemoryState()[source]
class mx.ClasspathDependency[source]

Bases: mx.Dependency

classpath_repr(resolve=True)[source]

Gets this dependency as an element on a class path.

If ‘resolve’ is True, then this method aborts if the file or directory denoted by the class path element does not exist.

getJavaProperties(replaceVar=<mx_subst.SubstitutionEngine object>)[source]
isJar()[source]
class mx.CompilerDaemon(jdk, jvmArgs, mainClass, toolJar, buildArgs=None)[source]

Bases: mx.Daemon

compile(jdk, compilerArgs)[source]
shutdown()[source]
class mx.Daemon[source]
shutdown()[source]
class mx.DepEdge(src, kind, prev)[source]
path()[source]
path_len()[source]
class mx.Dependency(suite, name, theLicense)[source]

Bases: mx.SuiteConstituent

abort(msg)[source]

Aborts with given message prefixed by the origin of this dependency.

contains_dep(dep, includeAnnotationProcessors=False)[source]

Determines if the dependency graph rooted at this object contains ‘dep’. Returns the path from this object to ‘dep’ if so, otherwise returns None.

defined_java_packages()[source]
getBuildTask(args)[source]
getGlobalRegistry()[source]
getSuiteRegistry()[source]
isArchivableProject()[source]
isBaseLibrary()[source]
isDistribution()[source]
isJARDistribution()[source]
isJavaProject()[source]
isJdkLibrary()[source]
isJreLibrary()[source]
isLibrary()[source]
isMavenProject()[source]
isNativeProject()[source]
isProject()[source]
isProjectOrLibrary()[source]
isTARDistribution()[source]
qualifiedName()[source]
walk_deps(preVisit=None, visit=None, visited=None, ignoredEdges=None, visitEdge=None)[source]

Walk the dependency graph rooted at this object. See documentation for mx.walk_deps for more info.

warn(msg)[source]

Warns with given message prefixed by the origin of this dependency.

class mx.DisableJavaDebuggging(*args, **kwargs)[source]

Bases: mx.DisableJavaDebugging

class mx.DisableJavaDebugging[source]

Bases: object

Utility for temporarily disabling java remote debugging.

Should be used in conjunction with the with keywords, e.g. ``` with DisableJavaDebugging():

# call to JDKConfig.run_java

```

class mx.Distribution(suite, name, deps, excludedLibs, platformDependent, theLicense)[source]

Bases: mx.Dependency

A distribution is a file containing the output of one or more dependencies. It is a Dependency because a Project or another Distribution may express a dependency on it.

Parameters:
  • suite (Suite) – the suite in which the distribution is defined
  • name (str) – the name of the distribution which must be unique across all suites
  • deps (list) – the dependencies of the distribution. How these dependencies are consumed is defined by the Distribution subclasses.
  • excludedLibs (list) – libraries whose contents should be excluded from this distribution’s built artifact
  • platformDependent (bool) – specifies if the built artifact is platform dependent
  • theLicense (str) – license applicable when redistributing the built artifact of the distribution
add_update_listener(listener)[source]
archived_deps()[source]

Gets the projects and libraries whose artifacts are the contents of the archive created by make_archive.

Direct distribution dependencies are considered as _distDependencies_. Anything contained in the _distDependencies_ will not be included in the result. Libraries listed in excludedLibs will also be excluded. Otherwise, the result will contain everything this distribution depends on (including indirect distribution dependencies and libraries).

exists()[source]
localExtension()[source]
make_archive()[source]
maven_artifact_id()[source]
maven_group_id()[source]
needsUpdate(newestInput)[source]

Determines if this distribution needs updating taking into account the ‘newestInput’ TimeStampFile if ‘newestInput’ is not None. Returns the reason this distribution needs updating or None if it doesn’t need updating.

notify_updated()[source]
overlapped_distribution_names()[source]
overlapped_distributions()[source]
postPull(f)[source]
prePush(f)[source]
remoteExtension()[source]
remoteName()[source]
resolveDeps()[source]
class mx.DistributionTemplate(suite, name, attrs, parameters)[source]

Bases: mx.SuiteConstituent

class mx.DuplicateSuppressingStream(restrictTo=None, out=<open file '<stdout>', mode 'w'>)[source]

Creates an object that will suppress duplicate lines sent to out. The lines considered for suppression are those that contain one of the strings in restrictTo if it is not None.

isSuppressionCandidate(line)[source]
write(line)[source]
class mx.DynamicVar(initial_value)[source]

Bases: object

get()[source]
set_scoped(newvalue)[source]
class mx.DynamicVarScope(dynvar, newvalue)[source]

Bases: object

class mx.ECJCompiler(jdtJar, extraJavacArgs=None)[source]

Bases: mx.JavacLikeCompiler

compile(jdk, jdtArgs)[source]
name()[source]
prepareJavacLike(jdk, project, compliance, javacArgs, disableApiRestrictions, warningsAsErrors, forceDeprecationAsWarning, showTasks, hybridCrossCompilation, tempFiles)[source]
class mx.ECJDaemon(jdk, jvmArgs, jdtJar)[source]

Bases: mx.CompilerDaemon

name()[source]
class mx.ECJDaemonCompiler(jdtJar, extraJavacArgs=None)[source]

Bases: mx.ECJCompiler

compile(jdk, jdtArgs)[source]
name()[source]
prepare_daemon(jdk, daemons, jdtArgs)[source]
mx.EclipseLinkedResource

alias of LinkedResource

class mx.GitConfig[source]

Bases: mx.VC

active_branch(vcdir, abortOnError=True)[source]
add(vcdir, path, abortOnError=True)[source]
bookmark(vcdir, name, rev, abortOnError=True)[source]

Place a bookmark at a given revision

Parameters:
  • vcdir (str) – a valid repository path
  • name (str) – the name of the bookmark
  • rev (str) – the desired revision
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

can_push(vcdir, strict=True, abortOnError=True)[source]

Check if vcdir can be pushed.

Parameters:
  • vcdir (str) – a valid repository path
  • strict (bool) – if set no uncommitted changes or unadded are allowed
Returns:

True if we can push, False otherwise

Return type:

bool

check(abortOnError=True)[source]
check_for_git(abortOnError=True)[source]
clone(url, dest=None, rev='master', abortOnError=True, **extra_args)[source]

Clone the repo at url to dest using rev

Parameters:
  • url (str) – the repository url
  • dest (str) – the path to destination, if None the destination is chosen by the vcs
  • rev (str) – the desired revision, if None use tip
  • extra_args (dict) – for subclass-specific information in/out
Returns:

True if the operation is successful, False otherwise

Return type:

bool

commit(vcdir, msg, abortOnError=True)[source]
default_pull(vcdir, abortOnError=True)[source]

get the default pull target for this repo

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

default pull target for repo

Return type:

str

default_push(vcdir, abortOnError=True)[source]

get the default push target for this repo

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

default push target for repo

Return type:

str

exists(vcdir, rev)[source]

Check if a given revision exists in the repository.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the second revision
Returns:

True if revision exists, False otherwise

Return type:

bool

git_command(vcdir, args, abortOnError=False, quiet=True)[source]
has_git = None

Encapsulates access to Git (git)

hash_re = <_sre.SRE_Pattern object>
incoming(vcdir, abortOnError=True)[source]

list incoming changesets

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

init(vcdir, abortOnError=True, bare=False)[source]
isDirty(vcdir, abortOnError=True)[source]

check whether the working directory is dirty

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

True of the working directory is dirty, False otherwise

Return type:

bool

is_this_vc(vcdir)[source]
latest(vcdir, rev1, rev2, abortOnError=True)[source]

Returns the latest of 2 revisions (in chronological order). The revisions should be related in the DAG.

Parameters:
  • vcdir (str) – a valid repository path
  • rev1 (str) – the first revision
  • rev2 (str) – the second revision
  • abortOnError (bool) – if True abort on mx error
Returns:

the latest of the 2 revisions

Return type:

str or None

locate(vcdir, patterns=None, abortOnError=True)[source]

Return a list of paths under vc control that match patterns

Parameters:
  • vcdir (str) – a valid repository path
  • patterns (str or list or None) – a list of patterns
  • abortOnError (bool) – if True abort on mx error
Returns:

a list of paths under vc control

Return type:

list

metadir()[source]
outgoing(vcdir, dest=None, abortOnError=True)[source]

llist outgoing changesets to ‘dest’ or default-push if None

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

parent(vcdir, abortOnError=True)[source]

Get the parent changeset of the working directory for repo at vcdir.

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

parent_info(vcdir, abortOnError=True)[source]
pull(vcdir, rev=None, update=False, abortOnError=True)[source]

Pull a given changeset (the head if rev is None), optionally updating the working directory. Updating is only done if something was pulled. If there were no new changesets or rev was already known locally, no update is performed.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision, if None use tip
  • abortOnError (bool) – if True abort on mx error
Returns:

True if the operation is successful, False otherwise

Return type:

bool

push(vcdir, dest=None, rev=None, abortOnError=False)[source]

Push vcdir at rev rev to default if dest is None, else push to dest.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision
  • dest (str) – the path to destination
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

release_version_from_tags(vcdir, prefix, snapshotSuffix='dev', abortOnError=True)[source]

Returns a release version derived from VC tags that match the pattern <prefix>-<number>(.<number>)* or None if no such tags exist.

Parameters:
  • vcdir (str) – a valid repository path
  • prefix (str) – the prefix
  • snapshotSuffix (str) – the snapshot suffix
  • abortOnError (bool) – if True abort on mx error
Returns:

a release version

Return type:

str

root(directory, abortOnError=True)[source]
run(*args, **kwargs)[source]
status(vcdir, abortOnError=True)[source]

report the status of the repository

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

tip(vcdir, abortOnError=True)[source]

Get the most recent changeset for repo at vcdir.

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

update(vcdir, rev=None, mayPull=False, clean=False, abortOnError=False)[source]

update the vcdir working directory. If rev is not specified, update to the tip of the current branch. If rev is specified, mayPull controls whether a pull will be attempted if rev can not be found locally. If clean is True, uncommitted changes will be discarded (no backup!).

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision
  • mayPull (bool) – flag to controll whether to pull or not
  • clean (bool) – discard uncommitted changes without backing up
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

update_to_branch(vcdir, branch, abortOnError=True)[source]
class mx.HgConfig[source]

Bases: mx.VC

active_branch(vcdir, abortOnError=True)[source]
add(vcdir, path, abortOnError=True)[source]
bookmark(vcdir, name, rev, abortOnError=True)[source]
can_push(vcdir, strict=True, abortOnError=True)[source]
check(abortOnError=True)[source]
check_for_hg(abortOnError=True)[source]
clone(url, dest=None, rev=None, abortOnError=True, **extra_args)[source]
commit(vcdir, msg, abortOnError=True)[source]
default_pull(vcdir, abortOnError=True)[source]
default_push(vcdir, abortOnError=True)[source]
exists(vcdir, rev)[source]
has_hg = None

Encapsulates access to Mercurial (hg)

incoming(vcdir, abortOnError=True)[source]
init(vcdir, abortOnError=True)[source]
isDirty(vcdir, abortOnError=True)[source]
is_this_vc(vcdir)[source]
latest(vcdir, rev1, rev2, abortOnError=True)[source]
locate(vcdir, patterns=None, abortOnError=True)[source]
metadir()[source]
outgoing(vcdir, dest=None, abortOnError=True)[source]
parent(vcdir, abortOnError=True)[source]
parent_info(vcdir, abortOnError=True)[source]
pull(vcdir, rev=None, update=False, abortOnError=True)[source]
push(vcdir, dest=None, rev=None, abortOnError=False)[source]
release_version_from_tags(vcdir, prefix, snapshotSuffix='dev', abortOnError=True)[source]
root(directory, abortOnError=True)[source]
run(*args, **kwargs)[source]
status(vcdir, abortOnError=True)[source]
tip(vcdir, abortOnError=True)[source]
update(vcdir, rev=None, mayPull=False, clean=False, abortOnError=False)[source]
update_to_branch(vcdir, branch, abortOnError=True)[source]
class mx.InternalSuite(mxDir)[source]

Bases: mx.SourceSuite

class mx.JARArchiveTask(args, dist)[source]

Bases: mx.ArchiveTask

buildForbidden()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
newestOutput()[source]
class mx.JARDistribution(suite, name, subDir, path, sourcesPath, deps, mainClass, excludedLibs, distDependencies, javaCompliance, platformDependent, theLicense, javadocType='implementation', allowsJavadocWarnings=False, maven=True, stripConfigFileNames=None)[source]

Bases: mx.Distribution, mx.ClasspathDependency

A distribution represents a jar file built from the class files and resources defined by a set of `JavaProject`s and Java libraries plus an optional zip containing the Java source files corresponding to the class files.

Parameters:
  • suite (Suite) – the suite in which the distribution is defined
  • name (str) – the name of the distribution which must be unique across all suites
  • stripConfigFileNames (list) – names of stripping configurations that are located in <mx_dir>/proguard/ and suffixed with .proguard
  • subDir (str) – a path relative to suite.dir in which the IDE project configuration for this distribution is generated
  • path (str) – the path of the jar file created for this distribution. If this is not an absolute path, it is interpreted to be relative to suite.dir.
  • sourcesPath (str) – the path of the zip file created for the source files corresponding to the class files of this distribution. If this is not an absolute path, it is interpreted to be relative to suite.dir.
  • deps (list) – the JavaProject and Library dependencies that are the root sources for this distribution’s jar
  • mainClass (str) – the class name representing application entry point for this distribution’s executable jar. This value (if not None) is written to the Main-Class header in the jar’s manifest.
  • excludedLibs (list) – libraries whose contents should be excluded from this distribution’s jar
  • distDependencies (list) – the JARDistribution dependencies that must be on the class path when this distribution is on the class path (at compile or run time)
  • javaCompliance (str) –
  • platformDependent (bool) – specifies if the built artifact is platform dependent
  • theLicense (str) – license applicable when redistributing the built artifact of the distribution
  • javadocType (str) – specifies if the javadoc generated for this distribution should include implementation documentation or only API documentation. Accepted values are “implementation” and “API”.
  • allowsJavadocWarnings (bool) – specifies whether warnings are fatal when javadoc is generated
  • maven (bool) –
classpath_repr(resolve=True)[source]
exists()[source]
getBuildTask(args)[source]
get_ide_project_dir()[source]

Gets the directory in which the IDE project configuration for this distribution is generated.

is_stripped()[source]
localExtension()[source]
make_archive()[source]

Creates the jar file(s) defined by this JARDistribution.

needsUpdate(newestInput)[source]
origin()[source]
original_path()[source]
path
paths_to_clean()[source]
remoteExtension()[source]
remoteName()[source]
set_archiveparticipant(archiveparticipant)[source]

Adds an object that participates in the make_archive method of this distribution.

Parameters:archiveparticipant

an object for which the following methods, if defined, will be called by make_archive:

__opened__(arc, srcArc, services)
Called when archiving starts. The arc and srcArc Archiver objects are for writing to the binary and source jars for the distribution. The services dict is for collating the files that will be written to META-INF/services in the binary jar. It is a map from service names to a list of providers for the named service.
__add__(arcname, contents)
Submits an entry for addition to the binary archive (via the zf ZipFile field of the arc object). Returns True if this object claims responsibility for adding/eliding contents to/from the archive, False otherwise (i.e., the caller must take responsibility for the entry).
__addsrc__(arcname, contents)
Same as __add__ except that it targets the source archive.
__closing__()
Called just before the services are written to the binary archive and both archives are written to their underlying files.
strip_jar()[source]
strip_mapping_file()[source]
class mx.JDKConfig(home, tag=None)[source]
bootclasspath(filtered=True)[source]

Gets the value of the sun.boot.class.path system property. This will be the empty string if this JDK is version 9 or later.

Parameters:filtered (bool) – specifies whether to exclude non-existant paths from the returned value
getKnownJavacLints()[source]

Gets the lint warnings supported by this JDK.

get_automatic_module_name(modulejar)[source]

Derives the name of an automatic module from an automatic module jar according to specification of java.lang.module.ModuleFinder.of(Path... entries).

Parameters:modulejar (str) – the path to a jar file treated as an automatic module
Returns:the name of the automatic module derived from modulejar
get_boot_layer_modules()[source]

Gets the modules in the boot layer of this JDK.

Returns:a list of JavaModuleDescriptor objects for boot layer modules in this JDK
Return type:list
get_modules()[source]

Gets the modules in this JDK.

Returns:a list of JavaModuleDescriptor objects for modules in this JDK
Return type:list
get_transitive_requires_keyword()[source]

Gets the keyword used to denote transitive dependencies. This can also effectively be used to determine if this is JDK contains the module changes made by https://bugs.openjdk.java.net/browse/JDK-8169069.

hasJarOnClasspath(jar)[source]

Determines if jar is available on the boot class path or in the extension/endorsed directories of this JDK.

Parameters:jar (str) – jar file name (without directory component)
Returns:the absolute path to the jar file in this JDK matching jar or None
javacLibOptions(args)[source]

Adds javac style options for the library paths of this JDK.

javadocLibOptions(args)[source]

Adds javadoc style options for the library paths of this JDK.

processArgs(args, addDefaultArgs=True)[source]

Returns a list composed of the arguments specified by the -P, -J and -A options (in that order) prepended to args if addDefaultArgs is true otherwise just return args.

run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None, addDefaultArgs=True)[source]
exception mx.JDKConfigException(value)[source]

Bases: exceptions.Exception

class mx.JDKFactory[source]

Bases: object

description()[source]
getJDKConfig()[source]
class mx.JavaBuildTask(args, project, jdk, requiredCompliance)[source]

Bases: mx.ProjectBuildTask

build()[source]
buildForbidden()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
cleanSharedMemoryState()[source]
initSharedMemoryState()[source]
needsBuild(newestInput)[source]
newestOutput()[source]
prepare(daemons)[source]

Prepares the compilation that will be performed if build is called.

Parameters:daemons (dict) – map from keys to Daemon objects into which any daemons created to assist this task when build is called should be placed.
pullSharedMemoryState()[source]
pushSharedMemoryState()[source]
class mx.JavaCompiler[source]
compile(jdk, args)[source]

Executes the compilation that was prepared by a previous call to prepare.

Parameters:
  • jdk (JDKConfig) – the JDK used to execute this compiler
  • args (list) – the value returned by a call to prepare
name()[source]
prepare(sourceFiles, project, jdk, compliance, outputDir, classPath, processorPath, sourceGenDir, disableApiRestrictions, warningsAsErrors, forceDeprecationAsWarning, showTasks, postCompileActions)[source]

Prepares for a compilation with this compiler. This done in the main process.

Parameters:
  • sourceFiles (list) – list of Java source files to compile
  • project (JavaProject) – the project containing the source files
  • jdk (JDKConfig) – the JDK used to execute this compiler
  • compliance (JavaCompliance) –
  • outputDir (str) – where to place generated class files
  • classpath (str) – where to find user class files
  • processorPath (str) – where to find annotation processors
  • sourceGenDir (str) – where to place generated source files
  • disableApiRestrictions (bool) – specifies if the compiler should not warning about accesses to restricted API
  • warningsAsErrors (bool) – specifies if the compiler should treat warnings as errors
  • forceDeprecationAsWarning (bool) – never treat deprecation warnings as errors irrespective of warningsAsErrors
  • showTasks (bool) – specifies if the compiler should show tasks tags as warnings (JDT only)
  • postCompileActions (list) – list into which callable objects can be added for performing post-compile actions
Returns:

the value to be bound to args when calling compile to perform the compilation

prepare_daemon(jdk, daemons, compileArgs)[source]

Initializes any daemons used when compile is called with compileArgs.

Parameters:
  • jdk (JDKConfig) – the JDK used to execute this compiler
  • daemons (dict) – map from name to CompilerDaemon into which new daemons should be registered
  • compileArgs (list) – the value bound to the args parameter when calling compile
class mx.JavaCompliance(ver)[source]
exactMatch(version)[source]
to_str(compliance)[source]
class mx.JavaProject(suite, name, subDir, srcDirs, deps, javaCompliance, workingSets, d, theLicense=None, isTestProject=False)[source]

Bases: mx.Project, mx.ClasspathDependency

annotation_processors()[source]

Gets the list of dependencies defining the annotation processors that will be applied when compiling this project.

annotation_processors_path(jdk)[source]

Gets the class path composed of this project’s annotation processor jars and the jars they depend upon.

check_current_annotation_processors_file()[source]
classpath_repr(resolve=True)[source]
defined_java_packages()[source]

Get the immutable set of Java packages defined by the Java sources of this project

eclipse_config_up_to_date(configZip)[source]
eclipse_settings_sources()[source]

Gets a dictionary from the name of an Eclipse settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

extended_java_packages()[source]

Get the immutable set of Java packages extended by the Java sources of this project

find_classes_with_annotations(pkgRoot, annotations, includeInnerClasses=False)[source]

Scan the sources of this project for Java source files containing a line starting with ‘annotation’ (ignoring preceding whitespace) and return a dict mapping fully qualified class names to a tuple consisting of the source file and line number of a match.

find_classes_with_matching_source_line(pkgRoot, function, includeInnerClasses=False)[source]

Scan the sources of this project for Java source files containing a line for which ‘function’ returns true. A map from class name to source file path for each existing class corresponding to a matched source file is returned.

getBuildTask(args)[source]
get_concealed_imported_packages(jdk=None, modulepath=None)[source]

Gets the concealed packages imported by this Java project.

Parameters:
  • jdk (JDKConfig) – the JDK whose modules are to be searched for concealed packages
  • modulepath (list) – extra modules to be searched for concealed packages
Returns:

a map from a module to its concealed packages imported by this project

get_javac_lint_overrides()[source]
imported_java_packages(projectDepsOnly=True)[source]

Gets the immutable set of Java packages imported by the Java sources of this project.

Parameters:projectDepsOnly (bool) – only include packages defined by other Java projects in the result
Returns:the packages imported by this Java project, filtered as per projectDepsOnly
Return type:frozenset
make_archive(path=None)[source]
netbeans_config_up_to_date(configZip)[source]
netbeans_settings_sources()[source]

Gets a dictionary from the name of an NetBeans settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

output_dir(relative=False)[source]

Get the directory in which the class files of this project are found/placed.

resolveDeps()[source]
source_gen_dir(relative=False)[source]

Get the absolute path to the directory in which source files generated by the annotation processor are found/placed.

source_gen_dir_name()[source]

Get the directory name in which source files generated by the annotation processor are found/placed.

update_current_annotation_processors_file()[source]
class mx.JavacCompiler(altJavac=None, extraJavacArgs=None)[source]

Bases: mx.JavacLikeCompiler

compile(jdk, args)[source]
name()[source]
prepareJavacLike(jdk, project, compliance, javacArgs, disableApiRestrictions, warningsAsErrors, forceDeprecationAsWarning, showTasks, hybridCrossCompilation, tempFiles)[source]
class mx.JavacDaemon(jdk, jvmArgs)[source]

Bases: mx.CompilerDaemon

name()[source]
class mx.JavacDaemonCompiler(extraJavacArgs=None)[source]

Bases: mx.JavacCompiler

compile(jdk, args)[source]
name()[source]
prepare_daemon(jdk, daemons, compileArgs)[source]
class mx.JavacLikeCompiler(extraJavacArgs)[source]

Bases: mx.JavaCompiler

prepare(sourceFiles, project, jdk, compliance, outputDir, classPath, processorPath, sourceGenDir, disableApiRestrictions, warningsAsErrors, forceDeprecationAsWarning, showTasks, postCompileActions)[source]
prepareJavacLike(jdk, project, compliance, javacArgs, disableApiRestrictions, warningsAsErrors, forceDeprecationAsWarning, showTasks, hybridCrossCompilation, tempFiles)[source]

hybridCrossCompilation is true if the -source compilation option denotes a different JDK version than the JDK libraries that will be compiled against.

class mx.JdkLibrary(suite, name, path, deps, optional, theLicense, sourcePath=None, jdkStandardizedSince=None, module=None)[source]

Bases: mx.BaseLibrary, mx.ClasspathDependency

A library that will be provided by the JDK but may be absent. Any project or normal library that depends on an optional missing library will be removed from the global project and library registry.

Parameters:
  • suite (Suite) – the suite defining this library
  • name (str) – the name of this library
  • path – path relative to a JDK home directory where the jar file for this library is located
  • deps – the dependencies of this library (which can only be other `JdkLibrary`s)
  • optional (bool) – a missing non-optional library will cause mx to abort when resolving a reference to this library
  • theLicense (str) – the license under which this library can be redistributed
  • sourcePath – a path where the sources for this library are located. A relative path is resolved against a JDK.
  • jdkStandardizedSince (JavaCompliance) – the JDK version in which the resources represented by this library are automatically available at compile and runtime without augmenting the class path. If not provided, 1.2 is used.
  • module – If this JAR has been transferred to a module since JDK 9, the name of the module that contains the same classes as the JAR used to.
classpath_repr(jdk, resolve=True)[source]

Gets the absolute path of this library in jdk or None if this library is available on the default class path of jdk. This method will abort if this library is not provided by jdk.

Parameters:jdk (JDKConfig) – the JDK from which to retrieve this library’s jar file
Returns:the absolute path of this library’s jar file in jdk
getBuildTask(args)[source]
get_jdk_path(jdk, path)[source]
get_source_path(jdk)[source]

Gets the path where the sources for this library are located.

Parameters:jdk (JDKConfig) – the JDK against which a relative path is resolved
Returns:the absolute path where the sources of this library are located
isJar()[source]
is_provided_by(jdk)[source]

Determines if this library is provided by jdk.

Parameters:jdk (JDKConfig) – the JDK to test
resolveDeps()[source]

Resolves symbolic dependency references to be Dependency objects.

class mx.JreLibrary(suite, name, jar, optional, theLicense)[source]

Bases: mx.BaseLibrary, mx.ClasspathDependency

A library jar provided by the Java Runtime Environment (JRE).

This mechanism exists primarily to be able to support code that may use functionality in one JRE (e.g., Oracle JRE) that is not present in another JRE (e.g., OpenJDK). A motivating example is the Java Flight Recorder library found in the Oracle JRE.

classpath_repr(jdk, resolve=True)[source]

Gets the absolute path of this library in jdk. This method will abort if this library is not provided by jdk.

Parameters:jdk (JDKConfig) – the JDK to test
Returns:whether this library is available in jdk
getBuildTask(args)[source]
isJar()[source]
is_provided_by(jdk)[source]

Determines if this library is provided by jdk.

Parameters:jdk (JDKConfig) – the JDK to test
Returns:whether this library is available in jdk
class mx.Library(suite, name, path, optional, urls, sha1, sourcePath, sourceUrls, sourceSha1, deps, theLicense)[source]

Bases: mx.BaseLibrary, mx.ClasspathDependency

A library that is provided (built) by some third-party and made available via a URL. A Library may have dependencies on other Library’s as expressed by the “deps” field. A Library can only depend on another Library, and not a Project or Distribution Additional attributes are an SHA1 checksum, location of (assumed) matching sources. A Library is effectively an “import” into the suite since, unlike a Project or Distribution it is not built by the Suite. N.B. Not obvious but a Library can be an annotationProcessor

classpath_repr(resolve=True)[source]
getBuildTask(args)[source]
get_path(resolve)[source]
get_source_path(resolve)[source]
get_urls()[source]
resolveDeps()[source]

Resolves symbolic dependency references to be Dependency objects.

class mx.LibraryDownloadTask(args, lib)[source]

Bases: mx.BuildTask

build()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
logBuild(reason)[source]
logSkip(reason)[source]
needsBuild(newestInput)[source]
newestOutput()[source]
class mx.License(suite, name, fullname, url)[source]

Bases: mx.SuiteConstituent

class mx.LinesOutputCapture[source]
class mx.MXSuite[source]

Bases: mx.InternalSuite

class mx.MXTestsSuite[source]

Bases: mx.InternalSuite

class mx.MavenArtifactVersions(latestVersion, releaseVersion, versions)[source]
class mx.MavenConfig[source]
check(abortOnError=True)[source]
class mx.MavenProject(suite, name, deps, workingSets, theLicense=None, **args)[source]

Bases: mx.Project, mx.ClasspathDependency

A project producing a single jar file. Users should subclass this class and implement getBuildTask(). Additional attributes:

jar: path to the jar sourceDirs: list of directories containing the sources
classpath_repr(resolve=True)[source]
get_path(resolve)[source]
get_source_path(resolve)[source]
class mx.MavenRepo(repourl)[source]
getArtifactVersions(groupId, artifactId)[source]
getSnapshot(groupId, artifactId, version)[source]
getSnapshotUrl(groupId, artifactId, version)[source]
class mx.MavenSnapshotArtifact(groupId, artifactId, version, snapshotBuildVersion, repo)[source]
exception NonUniqueSubArtifactException[source]

Bases: exceptions.Exception

class SubArtifact(extension, classifier)[source]
addSubArtifact(extension, classifier)[source]
getSubArtifact(extension, classifier=None)[source]
getSubArtifactByClassifier(classifier)[source]
class mx.MavenSnapshotBuilds(currentTime, currentBuildNumber, snapshots)[source]
getCurrentSnapshotBuild()[source]
class mx.NativeBuildTask(args, project)[source]

Bases: mx.ProjectBuildTask

build()[source]
buildForbidden()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
needsBuild(newestInput)[source]
newestOutput()[source]
class mx.NativeProject(suite, name, subDir, srcDirs, deps, workingSets, results, output, d, theLicense=None, isTestProject=False)[source]

Bases: mx.Project

getBuildEnv(replaceVar=<mx_subst.SubstitutionEngine object>)[source]
getBuildTask(args)[source]
getOutput(replaceVar=<mx_subst.SubstitutionEngine object>)[source]
getResults(replaceVar=<mx_subst.SubstitutionEngine object>)[source]
class mx.NativeTARDistribution(suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath, output)[source]

Bases: mx.Distribution

A distribution dependencies are only NativeProject`s. It packages all the resources specified by `NativeProject.getResults and NativeProject.headers for each constituent project.

Parameters:
  • suite (Suite) – the suite in which the distribution is defined
  • name (str) – the name of the distribution which must be unique across all suites
  • deps (list) – the NativeProject dependencies of the distribution
  • platformDependent (bool) – specifies if the built artifact is platform dependent
  • theLicense (str) – license applicable when redistributing the built artifact of the distribution
  • relpath (str) – specifies if the names of tar file entries should be relative to the output directories of the constituent native projects’ output directories
  • output (str) – specifies where the content of the distribution should be copied upon creation or extracted after pull
Attributes:
path: suite-local path to where the tar file will be placed
exists()[source]
getBuildTask(args)[source]
localExtension()[source]
make_archive()[source]
needsUpdate(newestInput)[source]
postPull(f)[source]
prePush(f)[source]
remoteExtension()[source]
class mx.NestedImportsSuiteModel(primaryDir, option)[source]

Bases: mx.SuiteModel

Imported suites are all siblings in an ‘mx.imports/source’ directory of the primary suite

find_suite_dir(suite_import)[source]
importee_dir(importer_dir, suite_import, check_alternate=True)[source]
nestedsuites_dirname()[source]
class mx.NoOpTask(subject, args)[source]

Bases: mx.BuildTask

build()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
logBuild(reason)[source]
logSkip(reason)[source]
needsBuild(newestInput)[source]
newestOutput()[source]
class mx.OutputCapture[source]
class mx.Project(suite, name, subDir, srcDirs, deps, workingSets, d, theLicense, isTestProject=False)[source]

Bases: mx.Dependency

canonical_deps()[source]

Get the dependencies of this project that are not recursive (i.e. cannot be reached via other dependencies).

eclipse_config_up_to_date(configZip)[source]

Determines if the zipped up Eclipse configuration

eclipse_settings_sources()[source]

Gets a dictionary from the name of an Eclipse settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

get_javac_lint_overrides()[source]

Gets a string to be added to the -Xlint javac option.

get_output_root()[source]

Gets the root of the directory hierarchy under which generated artifacts for this project such as class files and annotation generated sources should be placed.

is_test_project()[source]
max_depth()[source]

Get the maximum canonical distance between this project and its most distant dependency.

netbeans_config_up_to_date(configZip)[source]

Determines if the zipped up NetBeans configuration

netbeans_settings_sources()[source]

Gets a dictionary from the name of an NetBeans settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

resolveDeps()[source]

Resolves symbolic dependency references to be Dependency objects.

source_dirs()[source]

Get the directories in which the sources of this project are found.

class mx.ProjectBuildTask(args, parallelism, project)[source]

Bases: mx.BuildTask

class mx.RelevantResource(path, type)

Bases: tuple

path

Alias for field number 0

type

Alias for field number 1

class mx.Repository(suite, name, url, licenses)[source]

Bases: mx.SuiteConstituent

A Repository is a remote binary repository that can be used to upload binaries with deploy_binary.

resolveLicenses()[source]
class mx.ResourceLibrary(suite, name, path, optional, urls, sha1)[source]

Bases: mx.BaseLibrary

A library that is just a resource and therefore not a ClasspathDependency.

getBuildTask(args)[source]
get_path(resolve)[source]
class mx.SCMMetadata(url, read, write)[source]

Bases: object

class mx.SafeFileCreation(path)[source]

Bases: object

Context manager for creating a file that tries hard to handle races between processes/threads creating the same file. It tries to ensure that the file is created with the content provided by exactly one process/thread but makes no guarantee about which process/thread wins.

Note that truly atomic file copying is hard (http://stackoverflow.com/a/28090883/6691595)

Example:
with SafeFileCreation(dst) as sfc:
shutil.copy(src, sfc.tmpPath)
class mx.SiblingSuiteModel(suiteRootDir, option)[source]

Bases: mx.SuiteModel

All suites are siblings in the same parent directory, recorded as _suiteRootDir

find_suite_dir(suite_import)[source]
importee_dir(importer_dir, suite_import, check_alternate=True)[source]
set_primary_dir(d)[source]
class mx.SourceSuite(mxDir, primary=False, load=True, internal=False, importing_suite=None, dynamicallyImported=False)[source]

Bases: mx.Suite

create_mx_binary_distribution_jar()[source]

Creates a jar file named name-mx.jar that contains the metadata for another suite to import this suite as a BinarySuite. TODO check timestamps to avoid recreating this repeatedly, or would the check dominate anyway? TODO It would be cleaner for subsequent loading if we actually wrote a transformed suite.py file that only contained distribution info, to detect access to private (non-distribution) state

eclipse_settings_sources()[source]

Gets a dictionary from the name of an Eclipse settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

isDirty(abortOnError=True)[source]

Check whether there are pending changes in the source.

is_release()[source]

Returns True if the release tag from VC is known and is not a snapshot

mx_binary_distribution_jar_path()[source]

returns the absolute path of the mx binary distribution jar.

netbeans_settings_sources()[source]

Gets a dictionary from the name of an NetBeans settings file to the list of files providing its generated content, in overriding order (i.e., settings from files later in the list override settings from files earlier in the list). A new dictionary is created each time this method is called so it’s safe for the caller to modify it.

projects_recursive()[source]

return all projects including those in imported suites

release_version(snapshotSuffix='dev')[source]

Gets the release tag from VC or create a time based once if VC is unavailable

scm_metadata(abortOnError=False)[source]
version(abortOnError=True)[source]

Return the current head changeset of this suite.

class mx.Suite(mxDir, primary, internal, importing_suite, load, vc, vc_dir, dynamicallyImported=False)[source]

Bases: object

Command state and methods for all suite subclasses

binary_imports_dir()[source]
binary_suite_dir(name)[source]

Returns the mxDir for an imported BinarySuite, creating the parent if necessary

getMxCompatibility()[source]
get_import(suite_name)[source]
get_mx_output_dir()[source]

Gets the directory into which mx bookkeeping artifacts should be placed.

get_output_root()[source]

Gets the root of the directory hierarchy under which generated artifacts for this suite such as class files and annotation generated sources should be placed.

import_suite(name, version=None, urlinfos=None, kind=None)[source]

Dynamic import of a suite. Returns None if the suite cannot be found

imports_dir(kind)[source]
isBinarySuite()[source]
isDirty(abortOnError=True)[source]
isSourceSuite()[source]
re_init_imports()[source]

If a suite is updated, e.g. by sforceimports, we must re-initialize the potentially stale import data from the updated suite.py file

recursive_post_init()[source]

depth first _post_init driven by imports graph

scm_metadata(abortOnError=False)[source]
source_imports_dir()[source]
suite_py()[source]
suite_py_mtime()[source]
version(abortOnError=True)[source]
visit_imports(visitor, **extra_args)[source]

Visitor support for the suite imports list For each entry the visitor function is called with this suite, a SuiteImport instance created from the entry and any extra args passed to this call. N.B. There is no built-in support for avoiding visiting the same suite multiple times, as this function only visits the imports of a single suite. If a (recursive) visitor function wishes to visit a suite exactly once, it must manage that through extra_args.

class mx.SuiteConstituent(suite, name)[source]

Bases: object

origin()[source]

Gets a 2-tuple (file, line) describing the source file where this constituent is defined or None if the location cannot be determined.

class mx.SuiteImport(name, version, urlinfos, kind=None, dynamicImport=False, in_subdir=False, version_from=None, suite_dir=None)[source]
static get_source_urls(source, kind=None)[source]

Returns a list of SourceImportURLInfo instances If source is a string (dir) determine kind, else search the list of urlinfos and return the values for source repos

static parse_specification(import_dict, context, importer, dynamicImport=False)[source]
class mx.SuiteImportURLInfo(url, kind, vc)[source]
abs_kind()[source]

Maps vc kinds to ‘source’

class mx.SuiteModel[source]

Defines how to locate a URL/path for a suite, including imported suites. Conceptually a SuiteModel is defined a primary suite URL/path, and a map from suite name to URL/path for imported suites. Subclasses define a specfic implementation.

static create_suitemodel(opts)[source]
find_suite_dir(suite_import)[source]

locates the URL/path for suite_import or None if not found

importee_dir(importer_dir, suite_import, check_alternate=True)[source]

returns the directory path for an import of suite_import.name, given importer_dir. For a “src” suite model, if check_alternate == True and if suite_import specifies an alternate URL, check whether path exists and if not, return the alternate.

nestedsuites_dirname()[source]

Returns the dirname that contains any nested suites if the model supports that

set_primary_dir(d)[source]

informs that d is the primary suite directory

static siblings_dir(suite_dir)[source]
class mx.TARArchiveTask(args, dist)[source]

Bases: mx.ArchiveTask

buildForbidden()[source]
clean(forBuild=False)[source]
cleanForbidden()[source]
newestOutput()[source]
class mx.TagCompliance(tag, compliance)

Bases: tuple

compliance

Alias for field number 1

tag

Alias for field number 0

class mx.TeeOutputCapture(underlying)[source]
class mx.TimeStampFile(path, followSymlinks=True)[source]
exists()[source]
isNewerThan(arg)[source]
isOlderThan(arg)[source]
static newest(paths)[source]

Creates a TimeStampFile for the file in paths with the most recent modification time. Entries in paths that do not correspond to an existing file are ignored.

touch()[source]
class mx.Timer(name)[source]
class mx.VC(kind, proper_name)[source]

Bases: object

active_branch(vcdir, abortOnError=True)[source]

Returns the active branch of the repository

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on error
Returns:

name of the branch

Return type:

str

add(vcdir, path, abortOnError=True)[source]

Add path to repo

bookmark(vcdir, name, rev, abortOnError=True)[source]

Place a bookmark at a given revision

Parameters:
  • vcdir (str) – a valid repository path
  • name (str) – the name of the bookmark
  • rev (str) – the desired revision
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

can_push(vcdir, strict=True)[source]

Check if vcdir can be pushed.

Parameters:
  • vcdir (str) – a valid repository path
  • strict (bool) – if set no uncommitted changes or unadded are allowed
Returns:

True if we can push, False otherwise

Return type:

bool

check(abortOnError=True)[source]

Lazily check whether a particular VC system is available. Return None if fails and abortOnError=False

clone(url, dest=None, rev=None, abortOnError=True, **extra_args)[source]

Clone the repo at url to dest using rev

Parameters:
  • url (str) – the repository url
  • dest (str) – the path to destination, if None the destination is chosen by the vcs
  • rev (str) – the desired revision, if None use tip
  • extra_args (dict) – for subclass-specific information in/out
Returns:

True if the operation is successful, False otherwise

Return type:

bool

commit(vcdir, msg, abortOnError=True)[source]

commit with msg

default_pull(vcdir, abortOnError=True)[source]

get the default pull target for this repo

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

default pull target for repo

Return type:

str

default_push(vcdir, abortOnError=True)[source]

get the default push target for this repo

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

default push target for repo

Return type:

str

exists(vcdir, rev)[source]

Check if a given revision exists in the repository.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the second revision
Returns:

True if revision exists, False otherwise

Return type:

bool

static get_vc(vcdir, abortOnError=True)[source]

Given that vcdir is a repository directory, attempt to determine what kind of VCS is it managed by. Return None if it cannot be determined.

Parameters:
  • vcdir (str) – a valid path to a version controlled directory
  • abortOnError (bool) – if an error occurs, abort mx operations
Returns:

an instance of VC or None if it cannot be determined

Return type:

VC

static get_vc_root(directory, abortOnError=True)[source]

Attempt to determine what kind of VCS is associated with directory. Return the VC and its root directory or (None, None) if it cannot be determined.

If directory is contained in multiple VCS, the one with the deepest nesting is returned.

Parameters:
  • directory (str) – a valid path to a potentially version controlled directory
  • abortOnError (bool) – if an error occurs, abort mx operations
Returns:

a tuple containing an instance of VC or None if it cannot be

determined followed by the root of the repository or None. :rtype: VC, str

incoming(vcdir, abortOnError=True)[source]

list incoming changesets

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

init(vcdir, abortOnError=True)[source]

Intialize ‘vcdir’ for vc control

isDirty(vcdir, abortOnError=True)[source]

check whether the working directory is dirty

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

True of the working directory is dirty, False otherwise

Return type:

bool

is_release_from_tags(vcdir, prefix)[source]

Returns True if the release version derived from VC tags matches the pattern <number>(.<number>)*.

Parameters:
  • vcdir (str) – a valid repository path
  • prefix (str) – the prefix
Returns:

True if release

Return type:

bool

is_this_vc(vcdir)[source]

Check whether vcdir is managed by this vc. Return None if not, True if so

static is_valid_kind(kind)[source]

tests if the given VCS kind is valid or not

Parameters:kind (str) – the VCS kind
Returns:True if a valid VCS kind
Return type:bool
latest(vcdir, rev1, rev2, abortOnError=True)[source]

Returns the latest of 2 revisions. The revisions should be related in the DAG.

Parameters:
  • vcdir (str) – a valid repository path
  • rev1 (str) – the first revision
  • rev2 (str) – the second revision
  • abortOnError (bool) – if True abort on mx error
Returns:

the latest of the 2 revisions

Return type:

str or None

locate(vcdir, patterns=None, abortOnError=True)[source]

Return a list of paths under vc control that match patterns

Parameters:
  • vcdir (str) – a valid repository path
  • patterns (str or None or list) – a list of patterns
  • abortOnError (bool) – if True abort on mx error
Returns:

a list of paths under vc control

Return type:

list

metadir()[source]

Return name of metadata directory

outgoing(vcdir, dest=None, abortOnError=True)[source]

llist outgoing changesets to ‘dest’ or default-push if None

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

parent(vcdir, abortOnError=True)[source]

Get the parent changeset of the working directory for repo at vcdir.

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

parent_info(vcdir, abortOnError=True)[source]

Get the dict with common commit information.

The following fields are provided in the dict:

  • author: name <e-mail> (best-effort, might only contain a name)
  • author-ts: unix timestamp (int)
  • committer: name <e-mail> (best-effort, might only contain a name)
  • committer-ts: unix timestamp (int)
Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on error
Returns:

dictionary with information key-value pairs

Return type:

dict

pull(vcdir, rev=None, update=False, abortOnError=True)[source]

Pull a given changeset (the head if rev is None), optionally updating the working directory. Updating is only done if something was pulled. If there were no new changesets or rev was already known locally, no update is performed.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision, if None use tip
  • abortOnError (bool) – if True abort on mx error
Returns:

True if the operation is successful, False otherwise

Return type:

bool

push(vcdir, dest=None, rev=None, abortOnError=False)[source]

Push vcdir at rev rev to default if dest is None, else push to dest.

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision
  • dest (str) – the path to destination
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

release_version_from_tags(vcdir, prefix, snapshotSuffix='dev', abortOnError=True)[source]

Returns a release version derived from VC tags that match the pattern <prefix>-<number>(.<number>)* or None if no such tags exist.

Parameters:
  • vcdir (str) – a valid repository path
  • prefix (str) – the prefix
  • snapshotSuffix (str) – the snapshot suffix
  • abortOnError (bool) – if True abort on mx error
Returns:

a release version

Return type:

str

root(directory, abortOnError=True)[source]

Returns the path to the root of the repository that contains dir.

Parameters:
  • dir (str) – a path to a directory contained in a repository.
  • abortOnError (bool) – if True abort on mx error
Returns:

The path to the repository’s root

Return type:

str or None

status(vcdir, abortOnError=True)[source]

report the status of the repository

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

tip(vcdir, abortOnError=True)[source]

Get the most recent changeset for repo at vcdir.

Parameters:
  • vcdir (str) – a valid repository path
  • abortOnError (bool) – if True abort on error
Returns:

most recent changeset for specified repository, None if failure and abortOnError is False

Return type:

str

update(vcdir, rev=None, mayPull=False, clean=False, abortOnError=False)[source]

update the vcdir working directory. If rev is not specified, update to the tip of the current branch. If rev is specified, mayPull controls whether a pull will be attempted if rev can not be found locally. If clean is True, uncommitted changes will be discarded (no backup!).

Parameters:
  • vcdir (str) – a valid repository path
  • rev (str) – the desired revision
  • mayPull (bool) – flag to controll whether to pull or not
  • clean (bool) – discard uncommitted changes without backing up
  • abortOnError (bool) – if True abort on mx error
Returns:

True on success, False otherwise

Return type:

bool

update_to_branch(vcdir, branch, abortOnError=True)[source]

Update to a branch a make it active.

Parameters:
  • vcdir (str) – a valid repository path
  • branch (str) – a branch name
  • abortOnError (bool) – if True abort on error
class mx.VersionSpec(versionString)[source]
class mx.XMLDoc[source]

Bases: xml.dom.minidom.Document

close(tag)[source]
comment(txt)[source]
createElement(tagName)[source]
element(tag, attributes=None, data=None)[source]
open(tag, attributes=None, data=None)[source]
xml(indent='', newl='', escape=False, standalone=None)[source]
class mx.XMLElement(tagName, namespaceURI=None, prefix=None, localName=None)[source]

Bases: xml.dom.minidom.Element

writexml(writer, indent='', addindent='', newl='')[source]
mx.abort(codeOrMessage, context=None, killsig=15)[source]

Aborts the program with a SystemExit exception. If codeOrMessage is a plain integer, it specifies the system exit status; if it is None, the exit status is zero; if it has another type (such as a string), the object’s value is printed and the exit status is 1.

The context argument can provide extra context for an error message. If context is callable, it is called and the returned value is printed. If context defines a __abort_context__ method, the latter is called and its return value is printed. Otherwise str(context) is printed.

mx.addJDKFactory(tag, compliance, factory)[source]
mx.add_argument(*args, **kwargs)[source]

Defines a single command-line argument.

mx.add_debug_lib_suffix(name)[source]

Adds the platform specific library suffix to a name

mx.add_ide_envvar(name, value=None)[source]

Adds a given name to the set of environment variables that will be captured in generated IDE configurations. If value is not None, then it will be the captured value. Otherwise the result of get_env(name) is not None as capturing time, it will be used. Otherwise no value is captured.

mx.add_lib_prefix(name)[source]

Adds the platform specific library prefix to a name

mx.add_lib_suffix(name)[source]

Adds the platform specific library suffix to a name

mx.annotation_processors()[source]

Get the list of all loaded projects that define an annotation processor.

mx.archive(args)[source]
mx.ask_persist_env(varName, value, valueSeparator=None)[source]
mx.ask_question(question, options, default=None, answer=None)[source]
mx.ask_yes_no(question, default=None)[source]
mx.build(args, parser=None)[source]

builds the artifacts of one or more dependencies

mx.build_suite(s)[source]

build all projects in suite (for dynamic import)

mx.canonicalizeprojects(args)[source]

check all project specifications for canonical dependencies

The exit code of this command reflects how many projects have non-canonical dependencies.

mx.check_get_env(key)[source]

Gets an environment variable, aborting with a useful message if it is not set.

mx.check_output(*popenargs, **kwargs)[source]
mx.checkcopyrights(args)[source]

run copyright check on the sources

mx.checkoverlap(args)[source]

check all distributions for overlap

The exit code of this command reflects how many projects are included in more than one distribution.

mx.checkstyle(args)[source]

run Checkstyle on the Java sources

Run Checkstyle over the Java sources. Any errors or warnings produced by Checkstyle result in a non-zero exit code.

mx.classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=False, preferProjects=False, jdk=None, unique=False, ignoreStripped=False)[source]

Get the class path for a list of named projects and distributions, resolving each entry in the path (e.g. downloading a missing library) if ‘resolve’ is true. If ‘names’ is None, then all registered dependencies are used.

mx.classpath_entries(names=None, includeSelf=True, preferProjects=False)[source]

Gets the transitive set of dependencies that need to be on the class path given the root set of projects and distributions in names.

Parameters:
  • names (list or Dependency or str) – a Dependency, str or list containing Dependency/str objects
  • includeSelf (bool) – whether to include any of the dependencies in names in the returned list
  • preferProjects (bool) – for a JARDistribution dependency, specifies whether to include it in the returned list (False) or to instead put its constituent dependencies on the the return list (True)
Returns:

a list of Dependency objects representing the transitive set of dependencies that should be on the class path for something depending on names

mx.classpath_walk(names=None, resolve=True, includeSelf=True, includeBootClasspath=False, jdk=None)[source]

Walks the resources available in a given classpath, yielding a tuple for each resource where the first member of the tuple is a directory path or ZipFile object for a classpath entry and the second member is the qualified path of the resource relative to the classpath entry.

mx.clean(args, parser=None)[source]

remove all class files, images, and executables

Removes all files created by a build, including Java class files, executables, and generated images.

mx.colorize(msg, color='red', bright=True, stream=<open file '<stderr>', mode 'w'>)[source]

Wraps msg in ANSI escape sequences to make it print to stream with foreground font color color and brightness bright. This method returns msg unchanged if it is None, if it already starts with the designated escape sequence or the execution environment does not support color printing on stream.

mx.command_function(name, fatalIfMissing=True)[source]

Return the function for the (possibly overridden) command named name. If no such command, abort if fatalIsMissing is True, else return None

mx.cpu_count()[source]
mx.dependencies(opt_limit_to_suite=False)[source]

Gets an iterable over all the registered dependencies. If changes are made to the registered dependencies during iteration, the behavior of the iterator is undefined. If ‘types’ is not None, only dependencies of a type in ‘types

mx.dependency(name, fatalIfMissing=True, context=None)[source]

Get the project, library or dependency for a given name. This will abort if the dependency not exist for ‘name’ and ‘fatalIfMissing’ is true.

mx.deploy_binary(args)[source]

deploy binaries for the primary suite to remote maven repository

All binaries must be built first using mx build.

mx.distribution(name, fatalIfMissing=True, context=None)[source]

Get the distribution for a given name. This will abort if the named distribution does not exist and ‘fatalIfMissing’ is true.

mx.dot_mx_dir()[source]
mx.download(path, urls, verbose=False, abortOnError=True, verifyOnly=False)[source]

Attempts to downloads content for each URL in a list, stopping after the first successful download. If the content cannot be retrieved from any URL, the program is aborted, unless abortOnError=False. The downloaded content is written to the file indicated by path.

mx.download_file_exists(urls)[source]

Returns true if one of the given urls denotes an existing resource.

mx.download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False, canSymlink=True)[source]

Downloads an entity from a URL in the list ‘urls’ (tried in order) to ‘path’, checking the sha1 digest of the result against ‘sha1’ (if not ‘NOCHECK’) Manages an internal cache of downloads and will link path to the cache entry unless ‘canSymLink=False’ in which case it copies the cache entry.

mx.eclipseformat(args)[source]

run the Eclipse Code Formatter on the Java sources

The exit code 1 denotes that at least one file was modified.

mx.eclipseinit(args, buildProcessorJars=True, refreshOnly=False, logToConsole=False, doFsckProjects=True, force=False, absolutePaths=False)[source]

(re)generate Eclipse project configurations and working sets

mx.eclipseinit_cli(args)[source]

(re)generate Eclipse project configurations and working sets

mx.ensure_dir_exists(path, mode=None)[source]

Ensures all directories on ‘path’ exists, creating them first if necessary with os.makedirs().

mx.exe_suffix(name)[source]

Gets the platform specific suffix for an executable

mx.expand_project_in_args(args, insitu=True, jdk=None)[source]

Looks for the first -cp or -classpath argument in args and calls expand_project_in_class_path_arg on it. If insitu is true, then args is updated in place otherwise a copy of args is modified. The updated object is returned.

mx.expand_project_in_class_path_arg(cpArg, jdk=None)[source]

Replaces each “@” prefixed element in the class path cpArg with the class path for the dependency named by the element without the “@” prefix.

mx.expandvars_in_property(value)[source]
mx.exportlibs(args)[source]

export libraries to an archive file

mx.extract_VM_args(args, useDoubleDash=False, allowClasspath=False, defaultAllVMArgs=True)[source]

Partitions args into a leading sequence of HotSpot VM options and the rest. If useDoubleDash then args is partititioned by the first instance of “–”. If not allowClasspath then mx aborts if “-cp” or “-classpath” is in args.

mx.find_classpath_arg(vmArgs)[source]

Searches for the last class path argument in vmArgs and returns its index and value as a tuple. If no class path argument is found, then the tuple (None, None) is returned.

mx.findclass(args, logToConsole=True, resolve=True, matcher=<function <lambda>>)[source]

find all classes matching a given substring

mx.fsckprojects(args)[source]

find directories corresponding to deleted Java projects and delete them

mx.generate_eclipse_workingsets()[source]

Populate the workspace’s working set configuration with working sets generated from project data for the primary suite If the workspace already contains working set definitions, the existing ones will be retained and extended. In case mx/env does not contain a WORKSPACE definition pointing to the workspace root directory, a parent search from the primary suite directory is performed. If no workspace root directory can be identified, the primary suite directory is used and the user has to place the workingsets.xml file by hand.

mx.get_arch()[source]
mx.get_eclipse_project_rel_locationURI(path, eclipseProjectDir)[source]

Gets the URI for a resource relative to an Eclipse project directory (i.e., the directory containing the .project file for the project). The URI returned is based on the builtin PROJECT_LOC Eclipse variable. See http://stackoverflow.com/a/7585095

mx.get_env(key, default=None)[source]

Gets an environment variable.

mx.get_jdk(versionCheck=None, purpose=None, cancel=None, versionDescription=None, tag=None, versionPreference=None, **kwargs)[source]

Get a JDKConfig object matching the provided criteria.

The JDK is selected by consulting the –jdk option, the –java-home option, the JAVA_HOME environment variable, the –extra-java-homes option and the EXTRA_JAVA_HOMES enviroment variable in that order.

mx.get_jdk_option()[source]

Gets the tag and compliance (as a TagCompliance object) derived from the –jdk option. If the –jdk option was not specified, both fields of the returned tuple are None.

mx.get_jython_os()[source]
mx.get_license(names, fatalIfMissing=True, context=None)[source]
mx.get_opts()[source]

Gets the parsed command line options.

mx.get_os()[source]

Get a canonical form of sys.platform.

mx.get_runtime_jvm_args(names=None, cp_prefix=None, cp_suffix=None, jdk=None)[source]

Get the VM arguments (e.g. classpath and system properties) for a list of named projects and distributions. If ‘names’ is None, then all registered dependencies are used.

mx.gmake_cmd()[source]
mx.help_(args)[source]

show detailed help for mx or a given command

With no arguments, print a list of commands and short help for each command.

Given a command name, print help for that command.

mx.hg_command(args)[source]

Run a Mercurial command in every suite

mx.ideclean(args)[source]

remove all IDE project configurations

mx.ideinit(args, refreshOnly=False, buildProcessorJars=True)[source]

(re)generate IDE project configurations

mx.instantiateDistribution(templateName, args, fatalIfMissing=True, context=None)[source]
mx.instantiatedDistributionName(name, args, context)[source]
mx.intellijinit(args, refreshOnly=False, doFsckProjects=True)[source]

(re)generate Intellij project configurations

mx.is_debug_disabled()[source]
mx.is_debug_lib_file(fn)[source]
mx.is_interactive()[source]
mx.is_jython()[source]
mx.java_command(args)[source]

run the java executable in the selected JDK

The JDK is selected by consulting the –jdk option, the –java-home option, the JAVA_HOME environment variable, the –extra-java-homes option and the EXTRA_JAVA_HOMES enviroment variable in that order.

mx.javadoc(args, parser=None, docDir='javadoc', includeDeps=True, stdDoclet=True, mayBuild=True, quietForNoPackages=False)[source]

generate javadoc for some/all Java projects

mx.javap(args)[source]

disassemble classes matching given pattern with javap

mx.library(name, fatalIfMissing=True, context=None)[source]

Gets the library for a given name. This will abort if the named library does not exist and ‘fatalIfMissing’ is true.

mx.list_commands(l)[source]
mx.log(msg=None)[source]

Write a message to the console. All script output goes through this method thus allowing a subclass to redirect it.

mx.log_error(msg=None)[source]

Write an error message to the console. All script output goes through this method thus allowing a subclass to redirect it.

mx.logv(msg=None)[source]
mx.logvv(msg=None)[source]
mx.main()[source]
mx.make_eclipse_attach(suite, hostname, port, name=None, deps=None, jdk=None)[source]

Creates an Eclipse launch configuration file for attaching to a Java process.

mx.make_eclipse_launch(suite, javaArgs, jre, name=None, deps=None)[source]

Creates an Eclipse launch configuration file for running/debugging a Java command.

mx.maven_deploy(args)[source]

deploy jars for the primary suite to remote maven repository

All binaries must be built first using ‘mx build’.

mx.maven_install(args)[source]

install the primary suite in a local maven repository for testing

This is mainly for testing as it only actually does the install if –local is set.

mx.mvn_local_install(suite_name, dist_name, path, version, repo=None)[source]
mx.netbeansinit(args, refreshOnly=False, buildProcessorJars=True, doFsckProjects=True)[source]

(re)generate NetBeans project configurations

mx.no_suite_discovery(func)[source]

Decorator for commands that need a primary suite but don’t need suites to be discovered.

mx.no_suite_loading(func)[source]

Decorator for commands that need a primary suite but don’t need suites to be loaded.

mx.nyi(name, obj)[source]
mx.open(name, mode='r')[source]

Wrapper for builtin open function that handles long path names on Windows.

mx.optional_suite_context(func)[source]

Decorator for commands that don’t need a primary suite but will use one if it can be found.

mx.primary_suite()[source]
mx.print_simple_help()[source]
mx.processorjars()[source]
mx.project(name, fatalIfMissing=True, context=None)[source]

Get the project for a given name. This will abort if the named project does not exist and ‘fatalIfMissing’ is true.

mx.projectgraph(args, suite=None)[source]

create graph for project structure (“mx projectgraph | dot -Tpdf -oprojects.pdf” or “mx projectgraph –igv”)

mx.projects(opt_limit_to_suite=False, limit_to_primary=False)[source]

Get the list of all loaded projects limited by –suite option if opt_limit_to_suite == True and by primary suite if limit_to_primary == True

mx.projects_from_names(projectNames)[source]

Get the list of projects corresponding to projectNames; all projects if None

mx.projects_opt_limit_to_suites()[source]

Get the list of all loaded projects optionally limited by –suite option

mx.pylint(args)[source]

run pylint (if available) over Python source files (found by ‘<vc> locate’ or by tree walk with -walk)

mx.reInstantiateDistribution(templateName, oldArgs, newArgs)[source]
mx.read_annotation_processors(path)[source]

Reads the META-INF/services/javax.annotation.processing.Processor file based in the directory or zip file located at ‘path’. Returns the list of lines in the file or None if the file does not exist at ‘path’.

From http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html:

A service provider is identified by placing a provider-configuration file in the resource directory META-INF/services. The file’s name is the fully-qualified binary name of the service’s type. The file contains a list of fully-qualified binary names of concrete provider classes, one per line. Space and tab characters surrounding each name, as well as blank lines, are ignored. The comment character is ‘#’ (‘u0023’, NUMBER SIGN); on each line all characters following the first comment character are ignored. The file must be encoded in UTF-8.

mx.remove_doubledash(args)[source]
mx.repository(name, fatalIfMissing=True, context=None)[source]
mx.rmtree(dirPath)[source]
mx.run(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None, **kwargs)[source]

Run a command in a subprocess, wait for it to complete and return the exit status of the process. If the command times out, it kills the subprocess and returns ERROR_TIMEOUT if nonZeroIsFatal is false, otherwise it kills all subprocesses and raises a SystemExit exception. If the exit status of the command is non-zero, mx is exited with the same exit status if nonZeroIsFatal is true, otherwise the exit status is returned. Each line of the standard output and error streams of the subprocess are redirected to out and err if they are callable objects.

mx.run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None, addDefaultArgs=True, jdk=None)[source]

Runs a Java program by executing the java executable in a JDK.

mx.run_java_min_heap(args, benchName='# MinHeap:', overheadFactor=1.5, minHeap=0, maxHeap=2048, repetitions=1, out=None, err=None, cwd=None, timeout=None, env=None, addDefaultArgs=True, jdk=None)[source]

computes the minimum heap size required to run a Java program within a certain overhead factor

mx.run_maven(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, env=None)[source]
mx.run_mx(args, suite=None, mxpy=None, nonZeroIsFatal=True, out=None, err=None, timeout=None, env=None)[source]

Recursively runs mx.

Parameters:
  • args (list) – the command line arguments to pass to the recusive mx execution
  • suite – the primary suite or primary suite directory to use
  • mxpy (str) – path the mx module to run (None to use the current mx module)
mx.sbookmarkimports(args)[source]

place bookmarks on the imported versions of suites in version control

mx.scheckimports(args)[source]

check that suite import versions are up to date

mx.sclone(args)[source]

clone a suite repository, and its imported suites

mx.scloneimports(args)[source]

clone the imports of an existing suite

mx.select_items(items, descriptions=None, allowMultiple=True)[source]

Presents a command line interface for selecting one or more (if allowMultiple is true) items.

mx.set_java_command_default_jdk_tag(tag)[source]
mx.sforceimports(args)[source]

force working directory revision of imported suites to match primary suite imports

mx.sha1(args)[source]

generate sha1 digest for given file

mx.sha1OfFile(path)[source]
mx.show_envs(args)[source]

print environment variables and their values

By default only variables starting with “MX” are shown. The –all option forces all variables to be printed

mx.show_projects(args)[source]

show all projects

mx.show_suites(args)[source]

show all suites

usage: mx suites [-h] [–locations] [–licenses]

optional arguments:
-h, --help show this help message and exit
--locations show element locations on disk
--licenses show element licenses
mx.show_version(args)[source]

print mx version

mx.sincoming(args)[source]

check incoming for primary suite and all imports

mx.site(args)[source]

creates a website containing javadoc and the project dependency graph

mx.sorted_dists()[source]

Gets distributions sorted such that each distribution comes after any distributions it depends upon.

mx.splitqualname(name)[source]
mx.spull(args)[source]

pull primary suite and all its imports

mx.stip(args)[source]

check tip for primary suite and all imports

mx.suite(name, fatalIfMissing=True, context=None)[source]

Get the suite for a given name.

mx.suite_context_free(func)[source]

Decorator for commands that don’t need a primary suite.

mx.suite_init_cmd(args)[source]

create a suite

usage: mx init [-h] [–repository REPOSITORY] [–subdir]
[–repository-kind REPOSITORY_KIND] name
positional arguments:
name the name of the suite
optional arguments:
-h, --help show this help message and exit
--repository REPOSITORY
 directory for the version control repository
--subdir creates the suite in a sub-directory of the repository (requires –repository)
--repository-kind REPOSITORY_KIND
 The kind of repository to create (‘hg’, ‘git’ or ‘none’). Defaults to ‘git’
mx.suites(opt_limit_to_suite=False, includeBinary=True)[source]

Get the list of all loaded suites.

mx.supdate(args)[source]

update primary suite and all its imports

mx.sversions(args)[source]

print working directory revision for primary suite and all imports

mx.unstrip(args)[source]
mx.update(args)[source]

update mx to the latest version

mx.update_commands(suite, new_commands)[source]
mx.update_file(path, content, showDiff=False)[source]

Updates a file with some given content if the content differs from what’s in the file already. The return value indicates if the file was updated.

mx.user_home()[source]
mx.vc_system(kind, abortOnError=True)[source]
mx.verify_library_urls(args)[source]

verify that all suite libraries are reachable from at least one of the URLs

usage: mx verifylibraryurls [–include-mx]

mx.verifysourceinproject(args)[source]

find any Java source files that are outside any known Java projects

Returns the number of suites with requireSourceInProjects == True that have Java sources not in projects.

mx.waitOn(p)[source]
mx.walk_deps(roots=None, preVisit=None, visit=None, ignoredEdges=None, visitEdge=None)[source]

Walks a spanning tree of the dependency graph. The first time a dependency graph node is seen, if the preVisit function is not None, it is called with two arguments. The first is a Dependency object representing the node being visited. The second is a DepEdge object representing the last element in the path of dependencies walked to arrive at dep or None if dep is a leaf. If preVisit is None or returns a true condition, then the unvisited dependencies of dep are walked. Once all the dependencies of dep have been visited, if visit is not None, it is applied with the same arguments as for preVisit and the return value is ignored. Note that visit is not called if preVisit returns a false condition.

mx.warn(msg, context=None)[source]

Indices and tables