diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-16 01:13:11 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-02-16 01:13:11 +0000 |
commit | c571c9966fa0fcb4bcece10705e6941ab1ac86e9 (patch) | |
tree | 613c753ae994024818340b70e5e143b313a442c2 | |
parent | 5c282b36b2b28e1ab58755b8e4c1b8dfc49e579a (diff) | |
parent | b0257719697b95ff00a8aa3e087abc0a7fe5bd4a (diff) | |
download | base64-c571c9966fa0fcb4bcece10705e6941ab1ac86e9.tar.gz |
Snap for 8188146 from b0257719697b95ff00a8aa3e087abc0a7fe5bd4a to tm-frc-media-release
Change-Id: Ifa0eef49d79f9566d346cf1e013ca65455e82dfd
-rw-r--r-- | Android.bp | 104 | ||||
-rw-r--r-- | TEST_MAPPING | 40 | ||||
-rw-r--r-- | cargo2android.json | 22 | ||||
-rw-r--r-- | cargo2android_tests.bp | 62 | ||||
-rw-r--r-- | patches/encoder.patch | 13 | ||||
-rw-r--r-- | src/write/encoder.rs | 2 |
6 files changed, 121 insertions, 122 deletions
@@ -1,47 +1,29 @@ // This file is generated by cargo2android.py --config cargo2android.json. // Do not modify this file as changes will be overridden on upgrade. -package { - default_applicable_licenses: ["external_rust_crates_base64_license"], -} -// Added automatically by a large-scale-change that took the approach of -// 'apply every license found to every target'. While this makes sure we respect -// every license restriction, it may not be entirely correct. -// -// e.g. GPL in an MIT project might only apply to the contrib/ directory. -// -// Please consider splitting the single license below into multiple licenses, -// taking care not to lose any license_kind information, and overriding the -// default license using the 'licenses: [...]' property on targets as needed. -// -// For unused files, consider creating a 'fileGroup' with "//visibility:private" -// to attach the license to, and including a comment whether the files may be -// used in the current project. -// -// large-scale-change included anything that looked like it might be a license -// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. -// -// Please consider removing redundant or irrelevant files from 'license_text:'. -// See: http://go/android-license-faq -license { - name: "external_rust_crates_base64_license", - visibility: [":__subpackages__"], - license_kinds: [ - "SPDX-license-identifier-Apache-2.0", - "SPDX-license-identifier-MIT", + +rust_library { + name: "libbase64_rust", + stem: "libbase64", + host_supported: true, + crate_name: "base64", + srcs: ["src/lib.rs"], + edition: "2018", + features: [ + "default", + "std", ], - license_text: [ - "LICENSE-APACHE", - "LICENSE-MIT", + apex_available: [ + "//apex_available:platform", + "com.android.resolv", ], + min_sdk_version: "29", } rust_defaults { - name: "base64_test_defaults", + name: "base64_defaults_base64", crate_name: "base64", - cargo_env_compat: true, - cargo_pkg_version: "0.13.0", test_suites: ["general-tests"], auto_gen_config: true, edition: "2018", @@ -57,42 +39,48 @@ rust_defaults { ], } +rust_test_host { + name: "base64_host_test_tests_decode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/decode.rs"], + test_options: { + unit_test: true, + }, +} + rust_test { - name: "base64_test_tests_decode", - defaults: ["base64_test_defaults"], - host_supported: true, + name: "base64_device_test_tests_decode", + defaults: ["base64_defaults_base64"], srcs: ["tests/decode.rs"], +} + +rust_test_host { + name: "base64_host_test_tests_encode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/encode.rs"], test_options: { unit_test: true, }, } rust_test { - name: "base64_test_tests_encode", - defaults: ["base64_test_defaults"], - host_supported: true, + name: "base64_device_test_tests_encode", + defaults: ["base64_defaults_base64"], srcs: ["tests/encode.rs"], +} + +rust_test_host { + name: "base64_host_test_tests_helpers", + defaults: ["base64_defaults_base64"], + srcs: ["tests/helpers.rs"], test_options: { unit_test: true, }, } -rust_library { - name: "libbase64_rust", - stem: "libbase64", - host_supported: true, - crate_name: "base64", - cargo_env_compat: true, - cargo_pkg_version: "0.13.0", - srcs: ["src/lib.rs"], - edition: "2018", - features: [ - "default", - "std", - ], - apex_available: [ - "//apex_available:platform", - "com.android.resolv", - ], - min_sdk_version: "29", +rust_test { + name: "base64_device_test_tests_helpers", + defaults: ["base64_defaults_base64"], + srcs: ["tests/helpers.rs"], } + diff --git a/TEST_MAPPING b/TEST_MAPPING index de2964d..768046f 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -1,48 +1,14 @@ // Generated by update_crate_tests.py for tests that depend on this crate. { - "imports": [ - { - "path": "external/rust/crates/webpki" - } - ], "presubmit": [ { - "name": "base64_test_tests_decode" - }, - { - "name": "base64_test_tests_encode" - }, - { - "name": "doh_unit_test" - }, - { - "name": "libapkverify.integration_test" - }, - { - "name": "libapkverify.test" - }, - { - "name": "microdroid_manager_test" - } - ], - "presubmit-rust": [ - { - "name": "base64_test_tests_decode" - }, - { - "name": "base64_test_tests_encode" - }, - { - "name": "doh_unit_test" - }, - { - "name": "libapkverify.integration_test" + "name": "base64_device_test_tests_decode" }, { - "name": "libapkverify.test" + "name": "base64_device_test_tests_encode" }, { - "name": "microdroid_manager_test" + "name": "base64_device_test_tests_helpers" } ] } diff --git a/cargo2android.json b/cargo2android.json index d2d1ca1..6d85f2f 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -1,14 +1,10 @@ { - "apex-available": [ - "//apex_available:platform", - "com.android.resolv" - ], - "device": true, - "min-sdk-version": "29", - "run": true, - "test-blocklist": [ - "src/lib.rs", - "tests/tests.rs" - ], - "tests": true -}
\ No newline at end of file + "add-toplevel-block": "cargo2android_tests.bp", + "apex-available": [ + "//apex_available:platform", + "com.android.resolv" + ], + "min_sdk_version": "29", + "device": true, + "run": true + }
\ No newline at end of file diff --git a/cargo2android_tests.bp b/cargo2android_tests.bp new file mode 100644 index 0000000..1213c14 --- /dev/null +++ b/cargo2android_tests.bp @@ -0,0 +1,62 @@ +rust_defaults { + name: "base64_defaults_base64", + crate_name: "base64", + test_suites: ["general-tests"], + auto_gen_config: true, + edition: "2018", + features: [ + "default", + "std", + ], + rustlibs: [ + "libbase64_rust", + "libcriterion", + "librand", + "libstructopt", + ], +} + +rust_test_host { + name: "base64_host_test_tests_decode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/decode.rs"], + test_options: { + unit_test: true, + }, +} + +rust_test { + name: "base64_device_test_tests_decode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/decode.rs"], +} + +rust_test_host { + name: "base64_host_test_tests_encode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/encode.rs"], + test_options: { + unit_test: true, + }, +} + +rust_test { + name: "base64_device_test_tests_encode", + defaults: ["base64_defaults_base64"], + srcs: ["tests/encode.rs"], +} + +rust_test_host { + name: "base64_host_test_tests_helpers", + defaults: ["base64_defaults_base64"], + srcs: ["tests/helpers.rs"], + test_options: { + unit_test: true, + }, +} + +rust_test { + name: "base64_device_test_tests_helpers", + defaults: ["base64_defaults_base64"], + srcs: ["tests/helpers.rs"], +} diff --git a/patches/encoder.patch b/patches/encoder.patch deleted file mode 100644 index ac1cd73..0000000 --- a/patches/encoder.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/write/encoder.rs b/src/write/encoder.rs -index 8a48f43..4bb57eb 100644 ---- a/src/write/encoder.rs -+++ b/src/write/encoder.rs -@@ -223,7 +223,7 @@ impl<W: Write> Write for EncoderWriter<W> { - /// Under non-error circumstances, this returns `Ok` with the value being the number of bytes - /// of `input` consumed. The value may be `0`, which interacts poorly with `write_all`, which - /// interprets `Ok(0)` as an error, despite it being allowed by the contract of `write`. See -- /// https://github.com/rust-lang/rust/issues/56889 for more on that. -+ /// <https://github.com/rust-lang/rust/issues/56889> for more on that. - /// - /// If the previous call to `write` provided more (encoded) data than the delegate writer could - /// accept in a single call to its `write`, the remaining data is buffered. As long as buffered diff --git a/src/write/encoder.rs b/src/write/encoder.rs index 4bb57eb..8a48f43 100644 --- a/src/write/encoder.rs +++ b/src/write/encoder.rs @@ -223,7 +223,7 @@ impl<W: Write> Write for EncoderWriter<W> { /// Under non-error circumstances, this returns `Ok` with the value being the number of bytes /// of `input` consumed. The value may be `0`, which interacts poorly with `write_all`, which /// interprets `Ok(0)` as an error, despite it being allowed by the contract of `write`. See - /// <https://github.com/rust-lang/rust/issues/56889> for more on that. + /// https://github.com/rust-lang/rust/issues/56889 for more on that. /// /// If the previous call to `write` provided more (encoded) data than the delegate writer could /// accept in a single call to its `write`, the remaining data is buffered. As long as buffered |