Skip to content

Commit

Permalink
[GR-61581] Allow compile-time-only dependencies for java projects.
Browse files Browse the repository at this point in the history
PullRequest: mx/1871
  • Loading branch information
gilles-duboscq committed Jan 23, 2025
2 parents 30dbffb + eee642b commit a4fa264
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
],

"mx_version": "7.36.5",
"mx_version": "7.38.0",

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
Expand Down
14 changes: 7 additions & 7 deletions src/mx/_impl/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -7295,7 +7295,7 @@ def prepare(self, daemons):
sourceFiles=[_cygpathU2W(f) for f in sorted(javafiles.keys())],
project=self.subject,
outputDir=_cygpathU2W(outputDir),
classPath=_separatedCygpathU2W(classpath(self.subject.name, includeSelf=False, jdk=self.jdk, ignoreStripped=True)),
classPath=_separatedCygpathU2W(classpath(self.subject.name, includeSelf=False, jdk=self.jdk, ignoreStripped=True, forBuild=True)),
sourceGenDir=self.subject.source_gen_dir(),
jnigenDir=self.subject.jni_gen_dir(),
processorPath=_separatedCygpathU2W(self.subject.annotation_processors_path(self.jdk)),
Expand Down Expand Up @@ -12196,7 +12196,7 @@ def library(name, fatalIfMissing=True, context=None):
return l


def classpath_entries(names=None, includeSelf=True, preferProjects=False, excludes=None):
def classpath_entries(names=None, includeSelf=True, preferProjects=False, excludes=None, forBuild=False):
"""
Gets the transitive set of dependencies that need to be on the class path
given the root set of projects and distributions in `names`.
Expand Down Expand Up @@ -12247,7 +12247,7 @@ def _preVisit(dst, edge):
return False
if dst in roots:
return True
if edge and edge.src.isJARDistribution() and edge.kind == DEP_STANDARD:
if edge and edge.src.isJARDistribution() and edge.kind in (DEP_STANDARD, DEP_BUILD):
if isinstance(edge.src.suite, BinarySuite) or not preferProjects:
return dst.isJARDistribution()
else:
Expand All @@ -12261,7 +12261,7 @@ def _visit(dep, edge):
if dep.isPOMDistribution():
return
cpEntries.append(dep)
walk_deps(roots=roots, visit=_visit, preVisit=_preVisit, ignoredEdges=[DEP_ANNOTATION_PROCESSOR, DEP_BUILD])
walk_deps(roots=roots, visit=_visit, preVisit=_preVisit, ignoredEdges=[DEP_ANNOTATION_PROCESSOR] + ([] if forBuild else [DEP_BUILD]))
return cpEntries


Expand Down Expand Up @@ -12305,13 +12305,13 @@ def _appendUnique(cp_addition):
return os.pathsep.join(cp)


def classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=False, preferProjects=False, jdk=None, unique=False, ignoreStripped=False):
def classpath(names=None, resolve=True, includeSelf=True, includeBootClasspath=False, preferProjects=False, jdk=None, unique=False, ignoreStripped=False, forBuild=False):
"""
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.
"""
cpEntries = classpath_entries(names=names, includeSelf=includeSelf, preferProjects=preferProjects)
cpEntries = classpath_entries(names=names, includeSelf=includeSelf, preferProjects=preferProjects, forBuild=forBuild)
return _entries_to_classpath(cpEntries=cpEntries, resolve=resolve, includeBootClasspath=includeBootClasspath, jdk=jdk, unique=unique, ignoreStripped=ignoreStripped)


Expand Down Expand Up @@ -18367,7 +18367,7 @@ def alarm_handler(signum, frame):
_CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache'))

# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
version = VersionSpec("7.38.2") # GR-61461 - mx vscodeinit fails with Could not find a JDK 22
version = VersionSpec("7.39.0") # GR-61581 - Build dependencies for java projects.

_mx_start_datetime = datetime.utcnow()

Expand Down

0 comments on commit a4fa264

Please sign in to comment.