brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 1 | // Copyright 2017 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package com.google.devtools.build.lib.packages; |
| 16 | |
| 17 | import static com.google.common.truth.Truth.assertThat; |
| 18 | |
plf | 7e41f9b | 2018-08-03 01:47:22 -0700 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableList; |
shahan | fae34b9 | 2018-02-13 10:08:47 -0800 | [diff] [blame] | 20 | import com.google.common.collect.ImmutableMap; |
| 21 | import com.google.devtools.build.lib.skyframe.serialization.DeserializationContext; |
plf | 504a6d2 | 2018-07-31 08:41:20 -0700 | [diff] [blame] | 22 | import com.google.devtools.build.lib.skyframe.serialization.DynamicCodec; |
shahan | fae34b9 | 2018-02-13 10:08:47 -0800 | [diff] [blame] | 23 | import com.google.devtools.build.lib.skyframe.serialization.SerializationContext; |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 24 | import com.google.devtools.build.lib.skyframe.serialization.testutils.TestUtils; |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 25 | import com.google.devtools.build.lib.syntax.StarlarkSemantics; |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 26 | import com.google.devtools.common.options.Options; |
| 27 | import com.google.devtools.common.options.OptionsParser; |
| 28 | import java.util.Arrays; |
| 29 | import java.util.Random; |
| 30 | import org.junit.Test; |
| 31 | import org.junit.runner.RunWith; |
| 32 | import org.junit.runners.JUnit4; |
| 33 | |
| 34 | /** |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 35 | * Tests for the flow of flags from {@link StarlarkSemanticsOptions} to {@link StarlarkSemantics}, |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 36 | * and to and from {@code StarlarkSemantics}' serialized representation. |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 37 | * |
| 38 | * <p>When adding a new option, it is trivial to make a transposition error or a copy/paste error. |
| 39 | * These tests guard against such errors. The following possible bugs are considered: |
plf | 7e41f9b | 2018-08-03 01:47:22 -0700 | [diff] [blame] | 40 | * |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 41 | * <ul> |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 42 | * <li>If a new option is added to {@code StarlarkSemantics} but not to {@code |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 43 | * StarlarkSemanticsOptions}, or vice versa, then the programmer will either be unable to |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 44 | * implement its behavior, or unable to test it from the command line and add user |
| 45 | * documentation. We hope that the programmer notices this on their own. |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 46 | * <li>If {@link StarlarkSemanticsOptions#toSkylarkSemantics} is not updated to set all fields of |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 47 | * {@code StarlarkSemantics}, then it will fail immediately because all fields of {@link |
| 48 | * StarlarkSemantics.Builder} are mandatory. |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 49 | * <li>To catch a copy/paste error where the wrong field's data is threaded through {@code |
| 50 | * toSkylarkSemantics()} or {@code deserialize(...)}, we repeatedly generate matching random |
| 51 | * instances of the input and expected output objects. |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 52 | * <li>The {@link #checkDefaultsMatch} test ensures that there is no divergence between the |
| 53 | * default values of the two classes. |
plf | 7e41f9b | 2018-08-03 01:47:22 -0700 | [diff] [blame] | 54 | * <li>There is no test coverage for failing to update the non-generated webpage documentation. So |
| 55 | * don't forget that! |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 56 | * </ul> |
| 57 | */ |
| 58 | @RunWith(JUnit4.class) |
| 59 | public class SkylarkSemanticsConsistencyTest { |
| 60 | |
| 61 | private static final int NUM_RANDOM_TRIALS = 10; |
| 62 | |
| 63 | /** |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 64 | * Checks that a randomly generated {@link StarlarkSemanticsOptions} object can be converted to a |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 65 | * {@link StarlarkSemantics} object with the same field values. |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 66 | */ |
| 67 | @Test |
| 68 | public void optionsToSemantics() throws Exception { |
| 69 | for (int i = 0; i < NUM_RANDOM_TRIALS; i++) { |
| 70 | long seed = i; |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 71 | StarlarkSemanticsOptions options = buildRandomOptions(new Random(seed)); |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 72 | StarlarkSemantics semantics = buildRandomSemantics(new Random(seed)); |
| 73 | StarlarkSemantics semanticsFromOptions = options.toSkylarkSemantics(); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 74 | assertThat(semanticsFromOptions).isEqualTo(semantics); |
| 75 | } |
| 76 | } |
| 77 | |
brandjon | 6ac92f9 | 2017-12-06 13:57:15 -0800 | [diff] [blame] | 78 | /** |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 79 | * Checks that a randomly generated {@link StarlarkSemantics} object can be serialized and |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 80 | * deserialized to an equivalent object. |
| 81 | */ |
| 82 | @Test |
| 83 | public void serializationRoundTrip() throws Exception { |
plf | 504a6d2 | 2018-07-31 08:41:20 -0700 | [diff] [blame] | 84 | DynamicCodec codec = new DynamicCodec(buildRandomSemantics(new Random(2)).getClass()); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 85 | for (int i = 0; i < NUM_RANDOM_TRIALS; i++) { |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 86 | StarlarkSemantics semantics = buildRandomSemantics(new Random(i)); |
| 87 | StarlarkSemantics deserialized = |
| 88 | (StarlarkSemantics) |
| 89 | TestUtils.fromBytes( |
| 90 | new DeserializationContext(ImmutableMap.of()), |
| 91 | codec, |
| 92 | TestUtils.toBytes(new SerializationContext(ImmutableMap.of()), codec, semantics)); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 93 | assertThat(deserialized).isEqualTo(semantics); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | @Test |
| 98 | public void checkDefaultsMatch() { |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 99 | StarlarkSemanticsOptions defaultOptions = Options.getDefaults(StarlarkSemanticsOptions.class); |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 100 | StarlarkSemantics defaultSemantics = StarlarkSemantics.DEFAULT_SEMANTICS; |
| 101 | StarlarkSemantics semanticsFromOptions = defaultOptions.toSkylarkSemantics(); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 102 | assertThat(semanticsFromOptions).isEqualTo(defaultSemantics); |
| 103 | } |
| 104 | |
brandjon | 6ac92f9 | 2017-12-06 13:57:15 -0800 | [diff] [blame] | 105 | @Test |
| 106 | public void canGetBuilderFromInstance() { |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 107 | StarlarkSemantics original = StarlarkSemantics.DEFAULT_SEMANTICS; |
brandjon | 6ac92f9 | 2017-12-06 13:57:15 -0800 | [diff] [blame] | 108 | assertThat(original.internalSkylarkFlagTestCanary()).isFalse(); |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 109 | StarlarkSemantics modified = original.toBuilder().internalSkylarkFlagTestCanary(true).build(); |
brandjon | 6ac92f9 | 2017-12-06 13:57:15 -0800 | [diff] [blame] | 110 | assertThat(modified.internalSkylarkFlagTestCanary()).isTrue(); |
| 111 | } |
| 112 | |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 113 | /** |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 114 | * Constructs a {@link StarlarkSemanticsOptions} object with random fields. Must access {@code |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 115 | * rand} using the same sequence of operations (for the same fields) as {@link |
| 116 | * #buildRandomSemantics}. |
| 117 | */ |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 118 | private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws Exception { |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 119 | return parseOptions( |
| 120 | // <== Add new options here in alphabetic order ==> |
Googler | 137019f | 2019-04-23 02:23:37 -0700 | [diff] [blame] | 121 | "--experimental_allow_incremental_repository_updates=" + rand.nextBoolean(), |
juliexxia | 1f332e0 | 2018-10-31 14:20:55 -0700 | [diff] [blame] | 122 | "--experimental_build_setting_api=" + rand.nextBoolean(), |
plf | 7e41f9b | 2018-08-03 01:47:22 -0700 | [diff] [blame] | 123 | "--experimental_cc_skylark_api_enabled_packages=" |
| 124 | + rand.nextDouble() |
| 125 | + "," |
| 126 | + rand.nextDouble(), |
Googler | c2cd957 | 2018-10-02 14:38:15 -0700 | [diff] [blame] | 127 | "--experimental_enable_android_migration_apis=" + rand.nextBoolean(), |
cparsons | ed6bfbe | 2019-04-19 10:17:03 -0700 | [diff] [blame] | 128 | "--experimental_google_legacy_api=" + rand.nextBoolean(), |
elenairina | e679d02 | 2019-01-07 07:49:27 -0800 | [diff] [blame] | 129 | "--experimental_java_common_create_provider_enabled_packages=" |
| 130 | + rand.nextDouble() |
| 131 | + "," |
| 132 | + rand.nextDouble(), |
cparsons | 140c076 | 2018-10-05 14:07:19 -0700 | [diff] [blame] | 133 | "--experimental_platforms_api=" + rand.nextBoolean(), |
cparsons | e0efc14 | 2018-10-17 09:39:10 -0700 | [diff] [blame] | 134 | "--experimental_starlark_config_transitions=" + rand.nextBoolean(), |
Googler | 5736381 | 2019-05-28 07:24:13 -0700 | [diff] [blame] | 135 | "--experimental_starlark_unused_inputs_list=" + rand.nextBoolean(), |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 136 | "--incompatible_bzl_disallow_load_after_statement=" + rand.nextBoolean(), |
plf | 0d40b7f | 2019-04-29 08:09:11 -0700 | [diff] [blame] | 137 | "--incompatible_depset_for_libraries_to_link_getter=" + rand.nextBoolean(), |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 138 | "--incompatible_depset_is_not_iterable=" + rand.nextBoolean(), |
laurentlb | 2bbda4a | 2017-12-07 10:38:46 -0800 | [diff] [blame] | 139 | "--incompatible_depset_union=" + rand.nextBoolean(), |
cparsons | e506858 | 2018-07-16 13:33:33 -0700 | [diff] [blame] | 140 | "--incompatible_disable_deprecated_attr_params=" + rand.nextBoolean(), |
cparsons | 99be8b4 | 2018-03-01 15:16:46 -0800 | [diff] [blame] | 141 | "--incompatible_disable_objc_provider_resources=" + rand.nextBoolean(), |
gregce | 4aa059a | 2019-02-26 13:20:47 -0800 | [diff] [blame] | 142 | "--incompatible_disable_third_party_license_checking=" + rand.nextBoolean(), |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 143 | "--incompatible_disallow_dict_plus=" + rand.nextBoolean(), |
laurentlb | 9bc841e | 2019-05-28 05:59:35 -0700 | [diff] [blame] | 144 | "--incompatible_disallow_empty_glob=" + rand.nextBoolean(), |
laurentlb | 707acfe | 2018-04-13 06:09:30 -0700 | [diff] [blame] | 145 | "--incompatible_disallow_filetype=" + rand.nextBoolean(), |
tomlu | e374970 | 2018-05-02 09:38:00 -0700 | [diff] [blame] | 146 | "--incompatible_disallow_legacy_javainfo=" + rand.nextBoolean(), |
elenairina | 2fe38c1 | 2019-01-10 00:49:13 -0800 | [diff] [blame] | 147 | "--incompatible_disallow_legacy_java_provider=" + rand.nextBoolean(), |
nharmata | d86b509 | 2018-10-16 15:50:21 -0700 | [diff] [blame] | 148 | "--incompatible_disallow_load_labels_to_cross_package_boundaries=" + rand.nextBoolean(), |
laurentlb | 64e833c | 2019-02-22 09:50:34 -0800 | [diff] [blame] | 149 | "--incompatible_disallow_native_in_build_file=" + rand.nextBoolean(), |
tomlu | beafd7e | 2018-04-05 15:03:19 -0700 | [diff] [blame] | 150 | "--incompatible_disallow_old_style_args_add=" + rand.nextBoolean(), |
cparsons | 5d53171 | 2019-02-05 13:31:03 -0800 | [diff] [blame] | 151 | "--incompatible_disallow_struct_provider_syntax=" + rand.nextBoolean(), |
John Cater | 5688793 | 2019-04-26 05:27:07 -0700 | [diff] [blame] | 152 | "--incompatible_disallow_rule_execution_platform_constraints_allowed=" + rand.nextBoolean(), |
plf | 0d40b7f | 2019-04-29 08:09:11 -0700 | [diff] [blame] | 153 | "--incompatible_do_not_split_linking_cmdline=" + rand.nextBoolean(), |
tomlu | 774bfe0 | 2018-08-24 14:15:44 -0700 | [diff] [blame] | 154 | "--incompatible_expand_directories=" + rand.nextBoolean(), |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 155 | "--incompatible_new_actions_api=" + rand.nextBoolean(), |
laurentlb | d8d3776 | 2018-10-26 14:08:33 -0700 | [diff] [blame] | 156 | "--incompatible_no_attr_license=" + rand.nextBoolean(), |
laurentlb | de41cf8 | 2019-04-12 13:47:58 -0700 | [diff] [blame] | 157 | "--incompatible_no_kwargs_in_build_files=" + rand.nextBoolean(), |
cparsons | fbc828b | 2018-10-04 14:38:50 -0700 | [diff] [blame] | 158 | "--incompatible_no_output_attr_default=" + rand.nextBoolean(), |
cparsons | 36c70a6 | 2019-06-07 09:31:14 -0700 | [diff] [blame^] | 159 | "--incompatible_no_rule_outputs_param=" + rand.nextBoolean(), |
tomlu | aaf11e9 | 2018-06-02 10:20:16 -0700 | [diff] [blame] | 160 | "--incompatible_no_support_tools_in_action_inputs=" + rand.nextBoolean(), |
cparsons | 3cb3a5d | 2018-10-01 10:36:08 -0700 | [diff] [blame] | 161 | "--incompatible_no_target_output_group=" + rand.nextBoolean(), |
laurentlb | 9d179e1 | 2018-09-27 08:15:42 -0700 | [diff] [blame] | 162 | "--incompatible_no_transitive_loads=" + rand.nextBoolean(), |
Googler | f8e87fb | 2019-04-12 19:13:28 -0700 | [diff] [blame] | 163 | "--incompatible_objc_framework_cleanup=" + rand.nextBoolean(), |
dannark | ed87463 | 2019-01-17 14:01:15 -0800 | [diff] [blame] | 164 | "--incompatible_remap_main_repo=" + rand.nextBoolean(), |
Danna Kelmer | 21f4bd3 | 2018-11-29 11:04:48 -0800 | [diff] [blame] | 165 | "--incompatible_remove_native_maven_jar=" + rand.nextBoolean(), |
cparsons | 6b3724f | 2019-04-26 08:53:32 -0700 | [diff] [blame] | 166 | "--incompatible_restrict_named_params=" + rand.nextBoolean(), |
laurentlb | ed63333 | 2019-04-12 16:34:08 -0700 | [diff] [blame] | 167 | "--incompatible_static_name_resolution_in_build_files=" + rand.nextBoolean(), |
laurentlb | 18ef7a5 | 2019-03-28 08:07:25 -0700 | [diff] [blame] | 168 | "--incompatible_string_join_requires_strings=" + rand.nextBoolean(), |
Marwan Tammam | 20c8413 | 2019-06-04 07:27:31 -0700 | [diff] [blame] | 169 | "--incompatible_restrict_string_escapes=" + rand.nextBoolean(), |
plf | 0d40b7f | 2019-04-29 08:09:11 -0700 | [diff] [blame] | 170 | "--internal_skylark_flag_test_canary=" + rand.nextBoolean()); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /** |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 174 | * Constructs a {@link StarlarkSemantics} object with random fields. Must access {@code rand} |
| 175 | * using the same sequence of operations (for the same fields) as {@link #buildRandomOptions}. |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 176 | */ |
laurentlb | 6659b4c | 2019-02-18 07:23:36 -0800 | [diff] [blame] | 177 | private static StarlarkSemantics buildRandomSemantics(Random rand) { |
| 178 | return StarlarkSemantics.builder() |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 179 | // <== Add new options here in alphabetic order ==> |
Googler | 137019f | 2019-04-23 02:23:37 -0700 | [diff] [blame] | 180 | .experimentalAllowIncrementalRepositoryUpdates(rand.nextBoolean()) |
juliexxia | 1f332e0 | 2018-10-31 14:20:55 -0700 | [diff] [blame] | 181 | .experimentalBuildSettingApi(rand.nextBoolean()) |
plf | 7e41f9b | 2018-08-03 01:47:22 -0700 | [diff] [blame] | 182 | .experimentalCcSkylarkApiEnabledPackages( |
| 183 | ImmutableList.of(String.valueOf(rand.nextDouble()), String.valueOf(rand.nextDouble()))) |
Googler | c2cd957 | 2018-10-02 14:38:15 -0700 | [diff] [blame] | 184 | .experimentalEnableAndroidMigrationApis(rand.nextBoolean()) |
cparsons | ed6bfbe | 2019-04-19 10:17:03 -0700 | [diff] [blame] | 185 | .experimentalGoogleLegacyApi(rand.nextBoolean()) |
elenairina | e679d02 | 2019-01-07 07:49:27 -0800 | [diff] [blame] | 186 | .experimentalJavaCommonCreateProviderEnabledPackages( |
| 187 | ImmutableList.of(String.valueOf(rand.nextDouble()), String.valueOf(rand.nextDouble()))) |
cparsons | 140c076 | 2018-10-05 14:07:19 -0700 | [diff] [blame] | 188 | .experimentalPlatformsApi(rand.nextBoolean()) |
cparsons | e0efc14 | 2018-10-17 09:39:10 -0700 | [diff] [blame] | 189 | .experimentalStarlarkConfigTransitions(rand.nextBoolean()) |
Googler | 5736381 | 2019-05-28 07:24:13 -0700 | [diff] [blame] | 190 | .experimentalStarlarkUnusedInputsList(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 191 | .incompatibleBzlDisallowLoadAfterStatement(rand.nextBoolean()) |
plf | 0d40b7f | 2019-04-29 08:09:11 -0700 | [diff] [blame] | 192 | .incompatibleDepsetForLibrariesToLinkGetter(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 193 | .incompatibleDepsetIsNotIterable(rand.nextBoolean()) |
laurentlb | 2bbda4a | 2017-12-07 10:38:46 -0800 | [diff] [blame] | 194 | .incompatibleDepsetUnion(rand.nextBoolean()) |
cparsons | e506858 | 2018-07-16 13:33:33 -0700 | [diff] [blame] | 195 | .incompatibleDisableDeprecatedAttrParams(rand.nextBoolean()) |
cparsons | 99be8b4 | 2018-03-01 15:16:46 -0800 | [diff] [blame] | 196 | .incompatibleDisableObjcProviderResources(rand.nextBoolean()) |
gregce | 4aa059a | 2019-02-26 13:20:47 -0800 | [diff] [blame] | 197 | .incompatibleDisableThirdPartyLicenseChecking(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 198 | .incompatibleDisallowDictPlus(rand.nextBoolean()) |
laurentlb | 9bc841e | 2019-05-28 05:59:35 -0700 | [diff] [blame] | 199 | .incompatibleDisallowEmptyGlob(rand.nextBoolean()) |
laurentlb | 707acfe | 2018-04-13 06:09:30 -0700 | [diff] [blame] | 200 | .incompatibleDisallowFileType(rand.nextBoolean()) |
tomlu | e374970 | 2018-05-02 09:38:00 -0700 | [diff] [blame] | 201 | .incompatibleDisallowLegacyJavaInfo(rand.nextBoolean()) |
elenairina | 2fe38c1 | 2019-01-10 00:49:13 -0800 | [diff] [blame] | 202 | .incompatibleDisallowLegacyJavaProvider(rand.nextBoolean()) |
nharmata | d86b509 | 2018-10-16 15:50:21 -0700 | [diff] [blame] | 203 | .incompatibleDisallowLoadLabelsToCrossPackageBoundaries(rand.nextBoolean()) |
laurentlb | 64e833c | 2019-02-22 09:50:34 -0800 | [diff] [blame] | 204 | .incompatibleDisallowNativeInBuildFile(rand.nextBoolean()) |
tomlu | beafd7e | 2018-04-05 15:03:19 -0700 | [diff] [blame] | 205 | .incompatibleDisallowOldStyleArgsAdd(rand.nextBoolean()) |
cparsons | 5d53171 | 2019-02-05 13:31:03 -0800 | [diff] [blame] | 206 | .incompatibleDisallowStructProviderSyntax(rand.nextBoolean()) |
John Cater | 5688793 | 2019-04-26 05:27:07 -0700 | [diff] [blame] | 207 | .incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(rand.nextBoolean()) |
plf | 0d40b7f | 2019-04-29 08:09:11 -0700 | [diff] [blame] | 208 | .incompatibleDoNotSplitLinkingCmdline(rand.nextBoolean()) |
tomlu | 774bfe0 | 2018-08-24 14:15:44 -0700 | [diff] [blame] | 209 | .incompatibleExpandDirectories(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 210 | .incompatibleNewActionsApi(rand.nextBoolean()) |
laurentlb | d8d3776 | 2018-10-26 14:08:33 -0700 | [diff] [blame] | 211 | .incompatibleNoAttrLicense(rand.nextBoolean()) |
laurentlb | de41cf8 | 2019-04-12 13:47:58 -0700 | [diff] [blame] | 212 | .incompatibleNoKwargsInBuildFiles(rand.nextBoolean()) |
cparsons | fbc828b | 2018-10-04 14:38:50 -0700 | [diff] [blame] | 213 | .incompatibleNoOutputAttrDefault(rand.nextBoolean()) |
cparsons | 36c70a6 | 2019-06-07 09:31:14 -0700 | [diff] [blame^] | 214 | .incompatibleNoRuleOutputsParam(rand.nextBoolean()) |
tomlu | aaf11e9 | 2018-06-02 10:20:16 -0700 | [diff] [blame] | 215 | .incompatibleNoSupportToolsInActionInputs(rand.nextBoolean()) |
cparsons | 3cb3a5d | 2018-10-01 10:36:08 -0700 | [diff] [blame] | 216 | .incompatibleNoTargetOutputGroup(rand.nextBoolean()) |
laurentlb | 9d179e1 | 2018-09-27 08:15:42 -0700 | [diff] [blame] | 217 | .incompatibleNoTransitiveLoads(rand.nextBoolean()) |
Googler | f8e87fb | 2019-04-12 19:13:28 -0700 | [diff] [blame] | 218 | .incompatibleObjcFrameworkCleanup(rand.nextBoolean()) |
dannark | ed87463 | 2019-01-17 14:01:15 -0800 | [diff] [blame] | 219 | .incompatibleRemapMainRepo(rand.nextBoolean()) |
Danna Kelmer | 21f4bd3 | 2018-11-29 11:04:48 -0800 | [diff] [blame] | 220 | .incompatibleRemoveNativeMavenJar(rand.nextBoolean()) |
cparsons | 6b3724f | 2019-04-26 08:53:32 -0700 | [diff] [blame] | 221 | .incompatibleRestrictNamedParams(rand.nextBoolean()) |
laurentlb | ed63333 | 2019-04-12 16:34:08 -0700 | [diff] [blame] | 222 | .incompatibleStaticNameResolutionInBuildFiles(rand.nextBoolean()) |
laurentlb | 18ef7a5 | 2019-03-28 08:07:25 -0700 | [diff] [blame] | 223 | .incompatibleStringJoinRequiresStrings(rand.nextBoolean()) |
Marwan Tammam | 20c8413 | 2019-06-04 07:27:31 -0700 | [diff] [blame] | 224 | .incompatibleRestrictStringEscapes(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 225 | .internalSkylarkFlagTestCanary(rand.nextBoolean()) |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 226 | .build(); |
| 227 | } |
| 228 | |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 229 | private static StarlarkSemanticsOptions parseOptions(String... args) throws Exception { |
| 230 | OptionsParser parser = OptionsParser.newOptionsParser(StarlarkSemanticsOptions.class); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 231 | parser.setAllowResidue(false); |
| 232 | parser.parse(Arrays.asList(args)); |
laurentlb | 92c43cd | 2019-02-18 08:27:55 -0800 | [diff] [blame] | 233 | return parser.getOptions(StarlarkSemanticsOptions.class); |
brandjon | 60be531 | 2017-10-04 23:06:41 +0200 | [diff] [blame] | 234 | } |
| 235 | } |