Skip to content

Commit

Permalink
Create an ACL for Record Desugaring
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 679709319
Change-Id: I1794eef83ad03d22e8ffe13d3a1508be19a735f8
  • Loading branch information
ajsinclair authored and copybara-github committed Sep 27, 2024
1 parent 86c4fa9 commit 5a956d2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rules/acls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ load(
)
load("//rules/acls:proguard_apply_mapping.bzl", "ALLOW_PROGUARD_APPLY_MAPPING")
load("//rules/acls:r8.bzl", "USE_R8")
load("//rules/acls:record_desugaring.bzl", "RECORD_DESUGARING_FALLBACK", "RECORD_DESUGARING_ROLLOUT")
load("//rules/acls:shared_library_resource_linking.bzl", "SHARED_LIBRARY_RESOURCE_LINKING_ALLOWLIST")
load("//rules/acls:test_to_instrument_test_rollout.bzl", "TEST_TO_INSTRUMENT_TEST_FALLBACK", "TEST_TO_INSTRUMENT_TEST_ROLLOUT")

Expand Down Expand Up @@ -199,6 +200,9 @@ def _in_force_final_android_binary_resources(fqn):
def _in_resource_shrinking_in_optimizer(fqn):
return matches(fqn, RESOURCE_SHRINKING_IN_OPTIMIZER_ROLLOUT_DICT) and not matches(fqn, RESOURCE_SHRINKING_IN_OPTIMIZER_FALLBACK_DICT)

def _in_record_desugaring_rollout(fqn):
return matches(fqn, RECORD_DESUGARING_ROLLOUT_DICT) and not matches(fqn, RECORD_DESUGARING_FALLBACK_DICT)

def make_dict(lst):
"""Do not use this method outside of acls directory."""
return {t: True for t in lst}
Expand Down Expand Up @@ -263,6 +267,8 @@ RESOURCE_SHRINKING_IN_OPTIMIZER_ROLLOUT_DICT = make_dict(RESOURCE_SHRINKING_IN_O
RESOURCE_SHRINKING_IN_OPTIMIZER_FALLBACK_DICT = make_dict(RESOURCE_SHRINKING_IN_OPTIMIZER_FALLBACK)
DISABLE_OPTIMIZING_DEXER_DICT = make_dict(DISABLE_OPTIMIZING_DEXER)
FORCE_FINAL_ANDROID_BINARY_RESOURCES_DICT = make_dict(FORCE_FINAL_ANDROID_BINARY_RESOURCES)
RECORD_DESUGARING_FALLBACK_DICT = make_dict(RECORD_DESUGARING_FALLBACK)
RECORD_DESUGARING_ROLLOUT_DICT = make_dict(RECORD_DESUGARING_ROLLOUT)

def matches(fqn, dct):
# Labels with workspace names ("@workspace//pkg:target") are not supported.
Expand Down Expand Up @@ -355,6 +361,7 @@ acls = struct(
in_disable_optimizing_dexer = _in_disable_optimizing_dexer,
in_force_final_android_binary_resources = _in_force_final_android_binary_resources,
in_resource_shrinking_in_optimizer = _in_resource_shrinking_in_optimizer,
in_record_desugaring_rollout = _in_record_desugaring_rollout,
)

# Visible for testing
Expand Down
27 changes: 27 additions & 0 deletions rules/acls/record_desugaring.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Allowlist to enable Java 17 Record desugaring."""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")

visibility(PROJECT_VISIBILITY)

# keep sorted
RECORD_DESUGARING_ROLLOUT = [
]

# keep sorted
RECORD_DESUGARING_FALLBACK = [
"//:__subpackages__",
]

0 comments on commit 5a956d2

Please sign in to comment.