mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1444546 - Post: Remove add_java_jar and support. r=froydnj
MozReview-Commit-ID: J6E2ZOs9r3P --HG-- extra : rebase_source : 0e68f776e95e0fd2fec4607435d030acc68ca0ad
This commit is contained in:
parent
7df53b6508
commit
00dc996ad3
@ -1,67 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
ifndef INCLUDED_JAVA_BUILD_MK #{
|
||||
|
||||
default_bootclasspath_jars := \
|
||||
$(ANDROID_SDK)/android.jar \
|
||||
$(NULL)
|
||||
|
||||
default_classpath_jars := \
|
||||
$(NULL)
|
||||
|
||||
# Turn a possibly empty list of JAR files into a Java classpath, like a.jar:b.jar.
|
||||
# Arg 1: Possibly empty list of JAR files.
|
||||
define classpath_template
|
||||
$(subst $(NULL) ,:,$(strip $(1)))
|
||||
endef
|
||||
|
||||
ifdef JAVA_JAR_TARGETS #{
|
||||
# Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
|
||||
# Intermediate class files are generated in jars/jarfile-classes.
|
||||
# Arg 2: Java sources list. We use VPATH and $^ so sources can be
|
||||
# relative to $(srcdir) or $(CURDIR).
|
||||
# Arg 3: List of extra jars to link against. We do not use VPATH so
|
||||
# jars must be relative to $(CURDIR).
|
||||
# Arg 4: Additional JAVAC_FLAGS.
|
||||
|
||||
# Note: Proguard fails when stale .class files corresponding to
|
||||
# removed inner classes are present in the object directory. These
|
||||
# stale class files get packaged into the .jar file, which then gets
|
||||
# processed by Proguard. To work around this, we always delete any
|
||||
# existing jarfile-classes directory and start fresh.
|
||||
|
||||
define java_jar_template
|
||||
$(1): $(2) $(3) $(default_bootclasspath_jars) $(default_classpath_jars)
|
||||
$$(REPORT_BUILD)
|
||||
@$$(RM) -rf $(1:.jar=)-classes
|
||||
@$$(NSINSTALL) -D $(1:.jar=)-classes
|
||||
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
|
||||
$$(JAVAC) $$(JAVAC_FLAGS)\
|
||||
$(4)\
|
||||
-d $(1:.jar=)-classes\
|
||||
$(addprefix -bootclasspath ,$(call classpath_template,$(default_bootclasspath_jars)))\
|
||||
$(addprefix -classpath ,$(call classpath_template,$(default_classpath_jars) $(3)))\
|
||||
$$(filter %.java,$$^)
|
||||
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .
|
||||
|
||||
GARBAGE += $(1)
|
||||
|
||||
GARBAGE_DIRS += $(1:.jar=)-classes
|
||||
endef
|
||||
|
||||
$(foreach jar,$(JAVA_JAR_TARGETS),\
|
||||
$(if $($(jar)_DEST),,$(error Missing $(jar)_DEST))\
|
||||
$(if $($(jar)_JAVAFILES) $($(jar)_PP_JAVAFILES),,$(error Must provide at least one of $(jar)_JAVAFILES and $(jar)_PP_JAVAFILES))\
|
||||
$(eval $(call java_jar_template,$($(jar)_DEST),$($(jar)_JAVAFILES) $($(jar)_PP_JAVAFILES),$($(jar)_EXTRA_JARS),$($(jar)_JAVAC_FLAGS)))\
|
||||
)
|
||||
endif #} JAVA_JAR_TARGETS
|
||||
|
||||
|
||||
INCLUDED_JAVA_BUILD_MK := 1
|
||||
|
||||
endif #} INCLUDED_JAVA_BUILD_MK
|
@ -1178,13 +1178,6 @@ else
|
||||
normalizepath = $(1)
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# Java rules
|
||||
###############################################################################
|
||||
ifneq (,$(JAVA_JAR_TARGETS))
|
||||
include $(MOZILLA_DIR)/config/makefiles/java-build.mk
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# Bunch of things that extend the 'export' rule (in order):
|
||||
###############################################################################
|
||||
|
@ -35,7 +35,6 @@ from ..frontend.data import (
|
||||
ComputedFlags,
|
||||
ConfigFileSubstitution,
|
||||
ContextDerived,
|
||||
ContextWrapped,
|
||||
Defines,
|
||||
DirectoryTraversal,
|
||||
ExternalLibrary,
|
||||
@ -51,7 +50,6 @@ from ..frontend.data import (
|
||||
HostSources,
|
||||
InstallationTarget,
|
||||
JARManifest,
|
||||
JavaJarData,
|
||||
Library,
|
||||
Linkable,
|
||||
LocalInclude,
|
||||
@ -653,17 +651,6 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
elif isinstance(obj, InstallationTarget):
|
||||
self._process_installation_target(obj, backend_file)
|
||||
|
||||
elif isinstance(obj, ContextWrapped):
|
||||
# Process a rich build system object from the front-end
|
||||
# as-is. Please follow precedent and handle CamelCaseData
|
||||
# in a function named _process_camel_case_data. At some
|
||||
# point in the future, this unwrapping process may be
|
||||
# automated.
|
||||
if isinstance(obj.wrapped, JavaJarData):
|
||||
self._process_java_jar_data(obj.wrapped, backend_file)
|
||||
else:
|
||||
return False
|
||||
|
||||
elif isinstance(obj, RustLibrary):
|
||||
self.backend_input_files.add(obj.cargo_file)
|
||||
self._process_rust_library(obj, backend_file)
|
||||
|
@ -1532,13 +1532,6 @@ VARIABLES = {
|
||||
"""Name of target library generated when cross compiling.
|
||||
"""),
|
||||
|
||||
'JAVA_JAR_TARGETS': (dict, dict,
|
||||
"""Defines Java JAR targets to be built.
|
||||
|
||||
This variable should not be populated directly. Instead, it should
|
||||
populated by calling add_java_jar().
|
||||
"""),
|
||||
|
||||
'LIBRARY_DEFINES': (OrderedDict, dict,
|
||||
"""Dictionary of compiler defines to declare for the entire library.
|
||||
|
||||
@ -2251,19 +2244,6 @@ FUNCTIONS = {
|
||||
include('/elsewhere/foo.build')
|
||||
"""),
|
||||
|
||||
'add_java_jar': (lambda self: self._add_java_jar, (str,),
|
||||
"""Declare a Java JAR target to be built.
|
||||
|
||||
This is the supported way to populate the JAVA_JAR_TARGETS
|
||||
variable.
|
||||
|
||||
The parameters are:
|
||||
* dest - target name, without the trailing .jar. (required)
|
||||
|
||||
This returns a rich Java JAR type, described at
|
||||
:py:class:`mozbuild.frontend.data.JavaJarData`.
|
||||
"""),
|
||||
|
||||
'export': (lambda self: self._export, (str,),
|
||||
"""Make the specified variable available to all child directories.
|
||||
|
||||
@ -2429,7 +2409,7 @@ SPECIAL_VARIABLES = {
|
||||
"""),
|
||||
|
||||
'JS_PREFERENCE_FILES': (lambda context: context['FINAL_TARGET_FILES'].defaults.pref._strings, list,
|
||||
"""Exported javascript files.
|
||||
"""Exported JavaScript files.
|
||||
|
||||
A list of files copied into the dist directory for packaging and installation.
|
||||
Path will be defined for gre or application prefs dir based on what is building.
|
||||
|
@ -909,54 +909,6 @@ class JARManifest(ContextDerived):
|
||||
self.path = path
|
||||
|
||||
|
||||
class ContextWrapped(ContextDerived):
|
||||
"""Generic context derived container object for a wrapped rich object.
|
||||
|
||||
Use this wrapper class to shuttle a rich build system object
|
||||
completely defined in moz.build files through the tree metadata
|
||||
emitter to the build backend for processing as-is.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
'wrapped',
|
||||
)
|
||||
|
||||
def __init__(self, context, wrapped):
|
||||
ContextDerived.__init__(self, context)
|
||||
|
||||
self.wrapped = wrapped
|
||||
|
||||
|
||||
class JavaJarData(object):
|
||||
"""Represents a Java JAR file.
|
||||
|
||||
A Java JAR has the following members:
|
||||
* sources - strictly ordered list of input java sources
|
||||
* generated_sources - strictly ordered list of generated input
|
||||
java sources
|
||||
* extra_jars - list of JAR file dependencies to include on the
|
||||
javac compiler classpath
|
||||
* javac_flags - list containing extra flags passed to the
|
||||
javac compiler
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
'name',
|
||||
'sources',
|
||||
'generated_sources',
|
||||
'extra_jars',
|
||||
'javac_flags',
|
||||
)
|
||||
|
||||
def __init__(self, name, sources=[], generated_sources=[],
|
||||
extra_jars=[], javac_flags=[]):
|
||||
self.name = name
|
||||
self.sources = StrictOrderingOnAppendList(sources)
|
||||
self.generated_sources = StrictOrderingOnAppendList(generated_sources)
|
||||
self.extra_jars = list(extra_jars)
|
||||
self.javac_flags = list(javac_flags)
|
||||
|
||||
|
||||
class BaseSources(ContextDerived):
|
||||
"""Base class for files to be compiled during the build."""
|
||||
|
||||
|
@ -28,7 +28,6 @@ from .data import (
|
||||
ChromeManifestEntry,
|
||||
ComputedFlags,
|
||||
ConfigFileSubstitution,
|
||||
ContextWrapped,
|
||||
Defines,
|
||||
DirectoryTraversal,
|
||||
Exports,
|
||||
@ -1282,9 +1281,6 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
for obj in self._process_jar_manifests(context):
|
||||
yield obj
|
||||
|
||||
for name, jar in context.get('JAVA_JAR_TARGETS', {}).items():
|
||||
yield ContextWrapped(context, jar)
|
||||
|
||||
computed_as_flags.resolve_flags('MOZBUILD',
|
||||
context.get('ASFLAGS'))
|
||||
|
||||
|
@ -53,10 +53,6 @@ from mozbuild.backend.configenvironment import ConfigEnvironment
|
||||
from mozpack.files import FileFinder
|
||||
import mozpack.path as mozpath
|
||||
|
||||
from .data import (
|
||||
JavaJarData,
|
||||
)
|
||||
|
||||
from .sandbox import (
|
||||
default_finder,
|
||||
SandboxError,
|
||||
@ -248,22 +244,6 @@ class MozbuildSandbox(Sandbox):
|
||||
|
||||
Sandbox.exec_file(self, path)
|
||||
|
||||
def _add_java_jar(self, name):
|
||||
"""Add a Java JAR build target."""
|
||||
if not name:
|
||||
raise Exception('Java JAR cannot be registered without a name')
|
||||
|
||||
if '/' in name or '\\' in name or '.jar' in name:
|
||||
raise Exception('Java JAR names must not include slashes or'
|
||||
' .jar: %s' % name)
|
||||
|
||||
if name in self['JAVA_JAR_TARGETS']:
|
||||
raise Exception('Java JAR has already been registered: %s' % name)
|
||||
|
||||
jar = JavaJarData(name)
|
||||
self['JAVA_JAR_TARGETS'][name] = jar
|
||||
return jar
|
||||
|
||||
def _export(self, varname):
|
||||
"""Export the variable to all subdirectories of the current path."""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user