diff --git a/src/main/java/com/google/devtools/build/lib/packages/BuildGlobals.java b/src/main/java/com/google/devtools/build/lib/packages/BuildGlobals.java index 72097be48f9846..03c87efcd1ca1c 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/BuildGlobals.java +++ b/src/main/java/com/google/devtools/build/lib/packages/BuildGlobals.java @@ -121,7 +121,7 @@ public NoneType licenses( PackageContext context = PackageFactory.getContext(thread); try { License license = BuildType.LICENSE.convert(licensesList, "'licenses' operand"); - context.pkgBuilder.setDefaultLicense(license); + context.pkgBuilder.mergePackageArgsFrom(PackageArgs.builder().setLicense(license)); } catch (ConversionException e) { context.eventHandler.handle( Package.error(thread.getCallerLocation(), e.getMessage(), Code.LICENSE_PARSE_FAILURE)); @@ -144,7 +144,7 @@ public NoneType distribs(Object object, StarlarkThread thread) throws EvalExcept try { Set distribs = BuildType.DISTRIBUTIONS.convert(object, "'distribs' operand"); - context.pkgBuilder.setDefaultDistribs(distribs); + context.pkgBuilder.mergePackageArgsFrom(PackageArgs.builder().setDistribs(distribs)); } catch (ConversionException e) { context.eventHandler.handle( Package.error( diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java index da4a12308ab4ab..a46dafde605ae6 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Package.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java @@ -44,7 +44,6 @@ import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable; -import com.google.devtools.build.lib.packages.License.DistributionType; import com.google.devtools.build.lib.packages.Package.Builder.PackageSettings; import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions; import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; @@ -66,7 +65,6 @@ import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -171,11 +169,7 @@ private NameConflictException(String message) { /** The collection of all targets defined in this package, indexed by name. */ private ImmutableSortedMap targets; - /** - * Default visibility for rules that do not specify it. - */ - private RuleVisibility defaultVisibility; - private boolean defaultVisibilitySet; + private PackageArgs packageArgs = PackageArgs.DEFAULT; /** * How to enforce config_setting visibility settings. @@ -195,16 +189,6 @@ public enum ConfigSettingVisibilityPolicy { private ConfigSettingVisibilityPolicy configSettingVisibilityPolicy; - /** - * Default package-level 'testonly' value for rules that do not specify it. - */ - private boolean defaultTestOnly = false; - - /** - * Default package-level 'deprecation' value for rules that do not specify it. - */ - private String defaultDeprecation; - /** * Default header strictness checking for rules that do not specify it. */ @@ -232,18 +216,6 @@ public enum ConfigSettingVisibilityPolicy { */ @Nullable private FailureDetail failureDetail; - /** The package's default "package_metadata" attribute. */ - private ImmutableList