diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-13 13:38:57 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-13 13:38:57 +0100 |
commit | 38d185280e2cad4ed6673bb38f707f54dad4ded7 (patch) | |
tree | bbbb7df9a9f18c5fd3caf406d7f5bc9e13168d1f /python | |
parent | 7c68c5a22cfe8f83322836a1a6a76a8ae0415ec1 (diff) | |
download | uxp-38d185280e2cad4ed6673bb38f707f54dad4ded7.tar.gz |
Remove Rust from the tree.
Part 4 for #58
Diffstat (limited to 'python')
26 files changed, 4 insertions, 552 deletions
diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 132dcf9447..a314124f44 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -59,7 +59,6 @@ from ..frontend.data import ( ObjdirPreprocessedFiles, PerSourceFlag, Program, - RustLibrary, SharedLibrary, SimpleProgram, Sources, @@ -574,12 +573,6 @@ class RecursiveMakeBackend(CommonBackend): else: return False - elif isinstance(obj, RustLibrary): - self.backend_input_files.add(obj.cargo_file) - self._process_rust_library(obj, backend_file) - # No need to call _process_linked_libraries, because Rust - # libraries are self-contained objects at this point. - elif isinstance(obj, SharedLibrary): self._process_shared_library(obj, backend_file) self._process_linked_libraries(obj, backend_file) @@ -1172,10 +1165,6 @@ class RecursiveMakeBackend(CommonBackend): if libdef.no_expand_lib: backend_file.write('NO_EXPAND_LIBS := 1\n') - def _process_rust_library(self, libdef, backend_file): - backend_file.write_once('RUST_LIBRARY_FILE := %s\n' % libdef.import_name) - backend_file.write('CARGO_FILE := $(srcdir)/Cargo.toml') - def _process_host_library(self, libdef, backend_file): backend_file.write('HOST_LIBRARY_NAME = %s\n' % libdef.basename) @@ -1186,7 +1175,7 @@ class RecursiveMakeBackend(CommonBackend): def _process_linked_libraries(self, obj, backend_file): def write_shared_and_system_libs(lib): for l in lib.linked_libraries: - if isinstance(l, (StaticLibrary, RustLibrary)): + if isinstance(l, StaticLibrary): write_shared_and_system_libs(l) else: backend_file.write_once('SHARED_LIBS += %s/%s\n' @@ -1208,11 +1197,7 @@ class RecursiveMakeBackend(CommonBackend): self._build_target_for_obj(lib)) relpath = pretty_relpath(lib) if isinstance(obj, Library): - if isinstance(lib, RustLibrary): - # We don't need to do anything here; we will handle - # linkage for any RustLibrary elsewhere. - continue - elif isinstance(lib, StaticLibrary): + if isinstance(lib, StaticLibrary): backend_file.write_once('STATIC_LIBS += %s/%s\n' % (relpath, lib.import_name)) if isinstance(obj, SharedLibrary): @@ -1235,12 +1220,6 @@ class RecursiveMakeBackend(CommonBackend): backend_file.write_once('HOST_LIBS += %s/%s\n' % (relpath, lib.import_name)) - # We have to link any Rust libraries after all intermediate static - # libraries have been listed to ensure that the Rust libraries are - # searched after the C/C++ objects that might reference Rust symbols. - if isinstance(obj, SharedLibrary): - self._process_rust_libraries(obj, backend_file, pretty_relpath) - for lib in obj.linked_system_libs: if obj.KIND == 'target': backend_file.write_once('OS_LIBS += %s\n' % lib) @@ -1250,23 +1229,6 @@ class RecursiveMakeBackend(CommonBackend): # Process library-based defines self._process_defines(obj.lib_defines, backend_file) - def _process_rust_libraries(self, obj, backend_file, pretty_relpath): - assert isinstance(obj, SharedLibrary) - - # If this library does not depend on any Rust libraries, then we are done. - direct_linked = [l for l in obj.linked_libraries if isinstance(l, RustLibrary)] - if not direct_linked: - return - - # We should have already checked this in Linkable.link_library. - assert len(direct_linked) == 1 - - # TODO: see bug 1310063 for checking dependencies are set up correctly. - - direct_linked = direct_linked[0] - backend_file.write('RUST_STATIC_LIB_FOR_SHARED_LIB := %s/%s\n' % - (pretty_relpath(direct_linked), direct_linked.import_name)) - def _process_final_target_files(self, obj, files, backend_file): target = obj.install_target path = mozpath.basedir(target, ( @@ -1445,11 +1407,6 @@ class RecursiveMakeBackend(CommonBackend): self._makefile_out_count += 1 - def _handle_linked_rust_crates(self, obj, extern_crate_file): - backend_file = self._get_backend_file_for(obj) - - backend_file.write('RS_STATICLIB_CRATE_SRC := %s\n' % extern_crate_file) - def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources, unified_ipdl_cppsrcs_mapping): # Write out a master list of all IPDL source files. diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index fdf8cca172..fb0bf2405c 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -310,10 +310,6 @@ class LinkageWrongKindError(Exception): """Error thrown when trying to link objects of the wrong kind""" -class LinkageMultipleRustLibrariesError(Exception): - """Error thrown when trying to link multiple Rust libraries to an object""" - - class Linkable(ContextDerived): """Generic context derived container object for programs and libraries""" __slots__ = ( @@ -337,13 +333,6 @@ class Linkable(ContextDerived): 'Linkable.link_library() does not take components.') if obj.KIND != self.KIND: raise LinkageWrongKindError('%s != %s' % (obj.KIND, self.KIND)) - # Linking multiple Rust libraries into an object would result in - # multiple copies of the Rust standard library, as well as linking - # errors from duplicate symbols. - if isinstance(obj, RustLibrary) and any(isinstance(l, RustLibrary) - for l in self.linked_libraries): - raise LinkageMultipleRustLibrariesError("Cannot link multiple Rust libraries into %s", - self) self.linked_libraries.append(obj) if obj.cxx_link: self.cxx_link = True @@ -474,40 +463,6 @@ class StaticLibrary(Library): self.no_expand_lib = no_expand_lib -class RustLibrary(StaticLibrary): - """Context derived container object for a static library""" - __slots__ = ( - 'cargo_file', - 'crate_type', - 'dependencies', - 'deps_path', - ) - - def __init__(self, context, basename, cargo_file, crate_type, dependencies, **args): - StaticLibrary.__init__(self, context, basename, **args) - self.cargo_file = cargo_file - self.crate_type = crate_type - # We need to adjust our naming here because cargo replaces '-' in - # package names defined in Cargo.toml with underscores in actual - # filenames. But we need to keep the basename consistent because - # many other things in the build system depend on that. - assert self.crate_type == 'staticlib' - self.lib_name = '%s%s%s' % (context.config.lib_prefix, - basename.replace('-', '_'), - context.config.lib_suffix) - self.dependencies = dependencies - # cargo creates several directories and places its build artifacts - # in those directories. The directory structure depends not only - # on the target, but also what sort of build we are doing. - rust_build_kind = 'release' - if context.config.substs.get('MOZ_DEBUG'): - rust_build_kind = 'debug' - build_dir = mozpath.join(context.config.substs['RUST_TARGET'], - rust_build_kind) - self.import_name = mozpath.join(build_dir, self.lib_name) - self.deps_path = mozpath.join(build_dir, 'deps') - - class SharedLibrary(Library): """Context derived container object for a shared library""" __slots__ = ( diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 52f5718672..25c5826626 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -61,7 +61,6 @@ from .data import ( PreprocessedTestWebIDLFile, PreprocessedWebIDLFile, Program, - RustLibrary, SdkFiles, SharedLibrary, SimpleProgram, @@ -198,7 +197,7 @@ class TreeMetadataEmitter(LoggingMixin): def _emit_libs_derived(self, contexts): # First do FINAL_LIBRARY linkage. for lib in (l for libs in self._libs.values() for l in libs): - if not isinstance(lib, (StaticLibrary, RustLibrary)) or not lib.link_into: + if not isinstance(lib, StaticLibrary) or not lib.link_into: continue if lib.link_into not in self._libs: raise SandboxValidationError( @@ -408,66 +407,6 @@ class TreeMetadataEmitter(LoggingMixin): '%s %s of crate %s refers to a non-existent path' % (description, dep_crate_name, crate_name), context) - def _rust_library(self, context, libname, static_args): - # We need to note any Rust library for linking purposes. - cargo_file = mozpath.join(context.srcdir, 'Cargo.toml') - if not os.path.exists(cargo_file): - raise SandboxValidationError( - 'No Cargo.toml file found in %s' % cargo_file, context) - - config = self._parse_cargo_file(cargo_file) - crate_name = config['package']['name'] - - if crate_name != libname: - raise SandboxValidationError( - 'library %s does not match Cargo.toml-defined package %s' % (libname, crate_name), - context) - - # Check that the [lib.crate-type] field is correct - lib_section = config.get('lib', None) - if not lib_section: - raise SandboxValidationError( - 'Cargo.toml for %s has no [lib] section' % libname, - context) - - crate_type = lib_section.get('crate-type', None) - if not crate_type: - raise SandboxValidationError( - 'Can\'t determine a crate-type for %s from Cargo.toml' % libname, - context) - - crate_type = crate_type[0] - if crate_type != 'staticlib': - raise SandboxValidationError( - 'crate-type %s is not permitted for %s' % (crate_type, libname), - context) - - # Check that the [profile.{dev,release}.panic] field is "abort" - profile_section = config.get('profile', None) - if not profile_section: - raise SandboxValidationError( - 'Cargo.toml for %s has no [profile] section' % libname, - context) - - for profile_name in ['dev', 'release']: - profile = profile_section.get(profile_name, None) - if not profile: - raise SandboxValidationError( - 'Cargo.toml for %s has no [profile.%s] section' % (libname, profile_name), - context) - - panic = profile.get('panic', None) - if panic != 'abort': - raise SandboxValidationError( - ('Cargo.toml for %s does not specify `panic = "abort"`' - ' in [profile.%s] section') % (libname, profile_name), - context) - - dependencies = set(config.get('dependencies', {}).iterkeys()) - - return RustLibrary(context, libname, cargo_file, crate_type, - dependencies, **static_args) - def _handle_linkables(self, context, passthru, generated_files): linkables = [] host_linkables = [] @@ -688,11 +627,7 @@ class TreeMetadataEmitter(LoggingMixin): 'generate_symbols_file', lib.symbols_file, [symbols_file], defines) if static_lib: - is_rust_library = context.get('IS_RUST_LIBRARY') - if is_rust_library: - lib = self._rust_library(context, libname, static_args) - else: - lib = StaticLibrary(context, libname, **static_args) + lib = StaticLibrary(context, libname, **static_args) self._libs[libname].append(lib) self._linkage.append((context, lib, 'USE_LIBS')) linkables.append(lib) diff --git a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/Cargo.toml deleted file mode 100644 index 99d10b1a65..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[dependencies] -deep-crate = { version = "0.1.0", path = "the/depths" } - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/moz.build b/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/shallow/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/shallow/Cargo.toml deleted file mode 100644 index c347f8c08b..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/shallow/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "shallow-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] diff --git a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/the/depths/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/the/depths/Cargo.toml deleted file mode 100644 index 10a4ded0a8..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/crate-dependency-path-resolution/the/depths/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "deep-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[dependencies] -shallow-crate = { path = "../../shallow" } diff --git a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/moz.build b/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/moz.build deleted file mode 100644 index b493ec5b5b..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/moz.build +++ /dev/null @@ -1,27 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - -Library('test') - -DIRS += [ - 'rust1', - 'rust2', -] - -USE_LIBS += [ - 'rust1', - 'rust2', -] diff --git a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/Cargo.toml deleted file mode 100644 index 9037d8f65d..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "rust1" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/moz.build b/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/moz.build deleted file mode 100644 index 7418cca65b..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust1/moz.build +++ /dev/null @@ -1,4 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -RustLibrary('rust1') diff --git a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/Cargo.toml deleted file mode 100644 index f2001895e8..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "rust2" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/moz.build b/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/moz.build deleted file mode 100644 index abd34e7db9..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/multiple-rust-libraries/rust2/moz.build +++ /dev/null @@ -1,4 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -RustLibrary('rust2') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/Cargo.toml deleted file mode 100644 index fa122b7ce3..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-dash-folding/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/Cargo.toml deleted file mode 100644 index 26c653fdee..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["dylib"] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-invalid-crate-type/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/Cargo.toml deleted file mode 100644 index 41a9a7c8f6..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "deterministic-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-name-mismatch/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-cargo-toml/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-cargo-toml/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-cargo-toml/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/Cargo.toml deleted file mode 100644 index a20b19c628..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-lib-section/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/Cargo.toml deleted file mode 100644 index 2700849dbb..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[profile.release] -panic = "abort" diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/moz.build deleted file mode 100644 index 01b3a35a73..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-no-profile-section/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate') diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/Cargo.toml b/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/Cargo.toml deleted file mode 100644 index ccdd062431..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "random-crate" -version = "0.1.0" -authors = [ - "Nobody <nobody@mozilla.org>", -] - -[lib] -crate-type = ["staticlib"] - -[profile.dev] -panic = "unwind" - -[profile.release] diff --git a/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/moz.build b/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/moz.build deleted file mode 100644 index d3896deccf..0000000000 --- a/python/mozbuild/mozbuild/test/frontend/data/rust-library-non-abort-panic/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# Any copyright is dedicated to the Public Domain. -# http://creativecommons.org/publicdomain/zero/1.0/ - -@template -def Library(name): - '''Template for libraries.''' - LIBRARY_NAME = name - - -@template -def RustLibrary(name): - '''Template for Rust libraries.''' - Library(name) - - IS_RUST_LIBRARY = True - - -RustLibrary('random-crate')
\ No newline at end of file diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 6ac4e0aac6..191727381d 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -31,7 +31,6 @@ from mozbuild.frontend.data import ( LinkageMultipleRustLibrariesError, LocalInclude, Program, - RustLibrary, SdkFiles, SharedLibrary, SimpleProgram, @@ -1021,78 +1020,6 @@ class TestEmitterBasic(unittest.TestCase): 'Only source directory paths allowed in FINAL_TARGET_PP_FILES:'): self.read_topsrcdir(reader) - def test_rust_library_no_cargo_toml(self): - '''Test that defining a RustLibrary without a Cargo.toml fails.''' - reader = self.reader('rust-library-no-cargo-toml') - with self.assertRaisesRegexp(SandboxValidationError, - 'No Cargo.toml file found'): - self.read_topsrcdir(reader) - - def test_rust_library_name_mismatch(self): - '''Test that defining a RustLibrary that doesn't match Cargo.toml fails.''' - reader = self.reader('rust-library-name-mismatch') - with self.assertRaisesRegexp(SandboxValidationError, - 'library.*does not match Cargo.toml-defined package'): - self.read_topsrcdir(reader) - - def test_rust_library_no_lib_section(self): - '''Test that a RustLibrary Cargo.toml with no [lib] section fails.''' - reader = self.reader('rust-library-no-lib-section') - with self.assertRaisesRegexp(SandboxValidationError, - 'Cargo.toml for.* has no \\[lib\\] section'): - self.read_topsrcdir(reader) - - def test_rust_library_no_profile_section(self): - '''Test that a RustLibrary Cargo.toml with no [profile] section fails.''' - reader = self.reader('rust-library-no-profile-section') - with self.assertRaisesRegexp(SandboxValidationError, - 'Cargo.toml for.* has no \\[profile\\.dev\\] section'): - self.read_topsrcdir(reader) - - def test_rust_library_invalid_crate_type(self): - '''Test that a RustLibrary Cargo.toml has a permitted crate-type.''' - reader = self.reader('rust-library-invalid-crate-type') - with self.assertRaisesRegexp(SandboxValidationError, - 'crate-type.* is not permitted'): - self.read_topsrcdir(reader) - - def test_rust_library_non_abort_panic(self): - '''Test that a RustLibrary Cargo.toml has `panic = "abort" set''' - reader = self.reader('rust-library-non-abort-panic') - with self.assertRaisesRegexp(SandboxValidationError, - 'does not specify `panic = "abort"`'): - self.read_topsrcdir(reader) - - def test_rust_library_dash_folding(self): - '''Test that on-disk names of RustLibrary objects convert dashes to underscores.''' - reader = self.reader('rust-library-dash-folding', - extra_substs=dict(RUST_TARGET='i686-pc-windows-msvc')) - objs = self.read_topsrcdir(reader) - - self.assertEqual(len(objs), 1) - lib = objs[0] - self.assertIsInstance(lib, RustLibrary) - self.assertRegexpMatches(lib.lib_name, "random_crate") - self.assertRegexpMatches(lib.import_name, "random_crate") - self.assertRegexpMatches(lib.basename, "random-crate") - - def test_multiple_rust_libraries(self): - '''Test that linking multiple Rust libraries throws an error''' - reader = self.reader('multiple-rust-libraries', - extra_substs=dict(RUST_TARGET='i686-pc-windows-msvc')) - with self.assertRaisesRegexp(LinkageMultipleRustLibrariesError, - 'Cannot link multiple Rust libraries'): - self.read_topsrcdir(reader) - - def test_crate_dependency_path_resolution(self): - '''Test recursive dependencies resolve with the correct paths.''' - reader = self.reader('crate-dependency-path-resolution', - extra_substs=dict(RUST_TARGET='i686-pc-windows-msvc')) - objs = self.read_topsrcdir(reader) - - self.assertEqual(len(objs), 1) - self.assertIsInstance(objs[0], RustLibrary) - def test_android_res_dirs(self): """Test that ANDROID_RES_DIRS works properly.""" reader = self.reader('android-res-dirs') |