Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Bazel: Make build tool chain forward compatible
  AccountIT: Add test that it is possible to delete all emails

Change-Id: I167f1dd776f91628e6bc00691e214982268a97b9
This commit is contained in:
David Ostrovsky
2019-06-12 22:35:57 +02:00
2 changed files with 53 additions and 28 deletions

View File

@@ -1098,6 +1098,27 @@ public class AccountIT extends AbstractDaemonTest {
assertThat(gApi.accounts().self().get().email).isNull();
}
@Test
@Sandboxed
public void deleteAllEmails() throws Exception {
EmailInput input = new EmailInput();
input.email = "foo.bar@example.com";
input.noConfirmation = true;
gApi.accounts().self().addEmail(input);
requestScopeOperations.resetCurrentApiUser();
Set<String> allEmails = getEmails();
assertThat(allEmails).hasSize(2);
for (String email : allEmails) {
gApi.accounts().self().deleteEmail(email);
}
requestScopeOperations.resetCurrentApiUser();
assertThat(getEmails()).isEmpty();
assertThat(gApi.accounts().self().get().email).isNull();
}
@Test
public void deleteEmailFromCustomExternalIdSchemes() throws Exception {
String email = "foo.bar@example.com";

View File

@@ -45,6 +45,8 @@ npm_binary = repository_rule(
implementation = _npm_binary_impl,
)
ComponentInfo = provider()
# for use in repo rules.
def _run_npm_binary_str(ctx, tarball, args):
python_bin = ctx.which("python")
@@ -133,31 +135,29 @@ bower_archive = repository_rule(
def _bower_component_impl(ctx):
transitive_zipfiles = depset(
direct = [ctx.file.zipfile],
transitive = [d.transitive_zipfiles for d in ctx.attr.deps],
transitive = [d[ComponentInfo].transitive_zipfiles for d in ctx.attr.deps],
)
transitive_licenses = depset(
direct = [ctx.file.license],
transitive = [d.transitive_licenses for d in ctx.attr.deps],
transitive = [d[ComponentInfo].transitive_licenses for d in ctx.attr.deps],
)
transitive_versions = depset(
direct = ctx.files.version_json,
transitive = [d.transitive_versions for d in ctx.attr.deps],
transitive = [d[ComponentInfo].transitive_versions for d in ctx.attr.deps],
)
return struct(
transitive_licenses = transitive_licenses,
transitive_versions = transitive_versions,
transitive_zipfiles = transitive_zipfiles,
)
return [
ComponentInfo(
transitive_licenses = transitive_licenses,
transitive_versions = transitive_versions,
transitive_zipfiles = transitive_zipfiles,
),
]
_common_attrs = {
"deps": attr.label_list(providers = [
"transitive_zipfiles",
"transitive_versions",
"transitive_licenses",
]),
"deps": attr.label_list(providers = [ComponentInfo]),
}
def _js_component(ctx):
@@ -187,11 +187,13 @@ def _js_component(ctx):
if ctx.file.license:
licenses.append(ctx.file.license)
return struct(
transitive_licenses = depset(licenses),
transitive_versions = depset(),
transitive_zipfiles = list([ctx.outputs.zip]),
)
return [
ComponentInfo(
transitive_licenses = depset(licenses),
transitive_versions = depset(),
transitive_zipfiles = list([ctx.outputs.zip]),
),
]
js_component = rule(
_js_component,
@@ -233,16 +235,16 @@ def _bower_component_bundle_impl(ctx):
"""A bunch of bower components zipped up."""
zips = depset()
for d in ctx.attr.deps:
files = d.transitive_zipfiles
files = d[ComponentInfo].transitive_zipfiles
# TODO(davido): Make sure the field always contains a depset
if type(files) == "list":
files = depset(files)
zips = depset(transitive = [zips, files])
versions = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
versions = depset(transitive = [d[ComponentInfo].transitive_versions for d in ctx.attr.deps])
licenses = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
licenses = depset(transitive = [d[ComponentInfo].transitive_versions for d in ctx.attr.deps])
out_zip = ctx.outputs.zip
out_versions = ctx.outputs.version_json
@@ -272,11 +274,13 @@ def _bower_component_bundle_impl(ctx):
command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions.to_list()]), out_versions.path),
)
return struct(
transitive_licenses = licenses,
transitive_versions = versions,
transitive_zipfiles = zips,
)
return [
ComponentInfo(
transitive_licenses = licenses,
transitive_versions = versions,
transitive_zipfiles = zips,
),
]
bower_component_bundle = rule(
_bower_component_bundle_impl,
@@ -304,7 +308,7 @@ def _bundle_impl(ctx):
else:
bundled = ctx.outputs.html
destdir = ctx.outputs.html.path + ".dir"
zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles.to_list()]
zips = [z for d in ctx.attr.deps for z in d[ComponentInfo].transitive_zipfiles.to_list()]
hermetic_npm_binary = " ".join([
"python",
@@ -404,7 +408,7 @@ _bundle_rule = rule(
),
"pkg": attr.string(mandatory = True),
"split": attr.bool(default = True),
"deps": attr.label_list(providers = ["transitive_zipfiles"]),
"deps": attr.label_list(providers = [ComponentInfo]),
"_bundler_archive": attr.label(
default = Label("@polymer-bundler//:%s" % _npm_tarball("polymer-bundler")),
allow_single_file = True,