aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/rules/objc/IosExtensionTest.java
blob: af7f0f1f893ac111b6c4358ce0d736da8a6e5eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
// Copyright 2017 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.

package com.google.devtools.build.lib.rules.objc;

import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.ReleaseBundlingRule.APP_ICON_ATTR;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.ReleaseBundlingRule.LAUNCH_IMAGE_ATTR;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMultiset;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multiset;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.CommandAction;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher;
import com.google.devtools.build.lib.rules.apple.DottedVersion;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.BundleFile;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Test case for ios_extension. */
@RunWith(JUnit4.class)
public class IosExtensionTest extends ObjcRuleTestCase {
  protected static final RuleType RULE_TYPE =
      new RuleType("ios_extension") {
        @Override
        Iterable<String> requiredAttributes(
            Scratch scratch, String packageDir, Set<String> alreadyAdded) throws IOException {
          ImmutableList.Builder<String> attributes = new ImmutableList.Builder<>();
          if (!alreadyAdded.contains("binary")) {
            scratch.file(packageDir + "/extension_binary/a.m");
            scratch.file(
                packageDir + "/extension_binary/BUILD",
                "ios_extension_binary(",
                "    name = 'extension_binary',",
                "    srcs = ['a.m'],",
                ")");
            attributes.add(String.format("binary = '//%s/extension_binary'", packageDir));
          }
          return attributes.build();
        }
      };

  protected static final BinaryRuleTypePair RULE_TYPE_PAIR =
      new BinaryRuleTypePair(
          IosExtensionBinaryTest.RULE_TYPE,
          RULE_TYPE,
          ReleaseBundlingSupport.EXTENSION_BUNDLE_DIR_FORMAT);

  private ConfiguredTarget addMockExtensionAndLibs(String... extraExtAttributes)
      throws Exception {
    createLibraryTargetWriter("//lib1:lib1")
        .setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
        .setAndCreateFiles("hdrs", "hdr.h")
        .write();
    createLibraryTargetWriter("//lib2:lib2")
        .setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
        .setAndCreateFiles("hdrs", "hdr.h")
        .write();
    scratch.file("x/a.m");
    scratch.file("x/BUILD",
        "ios_extension_binary(",
        "    name = 'bin',",
        "    srcs = ['a.m'],",
        "    deps = ['//lib1:lib1', '//lib2:lib2'],",
        ")",
        "",
        "ios_extension(",
        "    name = 'x',",
        "    binary = ':bin',",
        Joiner.on(',').join(extraExtAttributes),
        ")");
    return getConfiguredTarget("//x:x");
  }

  @Test
  public void testSigningAction() throws Exception {
    checkDeviceSigningAction(RULE_TYPE);
  }

  @Test
  public void testSigningWithCertName() throws Exception {
    checkSigningWithCertName(RULE_TYPE);
  }

  @Test
  public void testPostProcessingAction() throws Exception {
    checkPostProcessingAction(RULE_TYPE);
  }

  @Test
  public void testSigningAndPostProcessing() throws Exception {
    checkSigningAndPostProcessing(RULE_TYPE);
  }

  @Test
  public void testSigning_simulatorBuild() throws Exception {
    checkSigningSimulatorBuild(RULE_TYPE_PAIR, false);
  }

  @Test
  public void testSigning_simulatorBuild_multiCpu() throws Exception {
    checkSigningSimulatorBuild(RULE_TYPE_PAIR, true);
  }

  @Test
  public void testProvisioningProfile_deviceBuild() throws Exception {
    checkProvisioningProfileDeviceBuild(RULE_TYPE_PAIR, false);
  }

  @Test
  public void testProvisioningProfile_deviceBuild_multiCpu() throws Exception {
    checkProvisioningProfileDeviceBuild(RULE_TYPE_PAIR, true);
  }

  @Test
  public void testUserSpecifiedProvisioningProfile_deviceBuild() throws Exception {
    checkProvisioningProfileUserSpecified(RULE_TYPE_PAIR, false);
  }

  @Test
  public void testUserSpecifiedProvisioningProfile_deviceBuild_multiCpu() throws Exception {
    checkProvisioningProfileUserSpecified(RULE_TYPE_PAIR, true);
  }

  @Test
  public void testMergeControlAction() throws Exception {
    addMockExtensionAndLibs("infoplist = 'Info.plist'");
    Action mergeAction = bundleMergeAction("//x:x");
    Action action = bundleMergeControlAction("//x:x");
    assertThat(action.getInputs()).isEmpty();
    assertThat(Artifact.toRootRelativePaths(action.getOutputs())).containsExactly(
        "x/x.ipa-control");
    assertThat(bundleMergeControl("//x:x"))
        .isEqualTo(
            BundleMergeProtos.Control.newBuilder()
                .addBundleFile(
                    BundleFile.newBuilder()
                        .setSourceFile(execPathEndingWith(mergeAction.getInputs(), "x_lipobin"))
                        .setBundlePath("x")
                        .setExternalFileAttribute(BundleableFile.EXECUTABLE_EXTERNAL_FILE_ATTRIBUTE)
                        .build())
                .setBundleRoot("PlugIns/x.appex")
                .setBundleInfoPlistFile(
                    getMergedInfoPlist(getConfiguredTarget("//x:x")).getExecPathString())
                .setOutFile(execPathEndingWith(mergeAction.getOutputs(), "x.unprocessed.ipa"))
                .setMinimumOsVersion(DEFAULT_IOS_SDK_VERSION.toString())
                .setSdkVersion(DEFAULT_IOS_SDK_VERSION.toString())
                .setPlatform("IOS_SIMULATOR")
                .setFallbackBundleIdentifier("example.x")
                .build());
  }

  @Test
  public void testMergeBundleAction() throws Exception {
    checkMergeBundleAction(RULE_TYPE_PAIR);
  }

  protected List<BuildConfiguration> getExtensionConfigurations() throws InterruptedException {
    return getSplitConfigurations(getTargetConfiguration(),
        IosExtension.MINIMUM_OS_AND_SPLIT_ARCH_TRANSITION);
  }

  @Test
  public void testErrorForLaunchImageGivenWithNoAssetCatalog() throws Exception {
    checkAssetCatalogAttributeError(RULE_TYPE, LAUNCH_IMAGE_ATTR);
  }

  @Test
  public void testErrorForAppIconGivenWithNoAssetCatalog() throws Exception {
    checkAssetCatalogAttributeError(RULE_TYPE, APP_ICON_ATTR);
  }

  @Test
  public void testCollectsAssetCatalogsTransitively() throws Exception {
    checkCollectsAssetCatalogsTransitively(RULE_TYPE_PAIR);
  }

  @Test
  public void testSpecifyAppIconAndLaunchImageUsingXcassetsOfDependency() throws Exception {
    checkSpecifyAppIconAndLaunchImageUsingXcassetsOfDependency(
        RULE_TYPE_PAIR, DEFAULT_IOS_SDK_VERSION);
  }

  private void addTargetWithAssetCatalogs() throws IOException {
    scratch.file("x/foo.xcassets/foo");
    scratch.file("x/foo.xcassets/bar");
    scratch.file("x/a.m");
    scratch.file("x/BUILD",
        "ios_extension_binary(",
        "    name = 'bin',",
        "    asset_catalogs = ['foo.xcassets/foo', 'bar.xcassets/bar'],",
        "    srcs = ['a.m'],",
        ")",
        "",
        "ios_extension(",
        "    name = 'x',",
        "    binary = ':bin',",
        ")");
  }

  @Test
  public void testActoolActionCorrectness() throws Exception {
    addTargetWithAssetCatalogs();
    checkActoolActionCorrectness(DEFAULT_IOS_SDK_VERSION);
  }

  @Test
  public void testPassesFamiliesToActool() throws Exception {
    checkPassesFamiliesToActool(RULE_TYPE_PAIR);
  }

  @Test
  public void testPassesFamiliesToIbtool() throws Exception {
    checkPassesFamiliesToIbtool(RULE_TYPE_PAIR);
  }

  @Test
  public void testReportsErrorsForInvalidFamiliesAttribute() throws Exception {
    checkReportsErrorsForInvalidFamiliesAttribute(RULE_TYPE);
  }

  @Test
  public void testMergeActionsWithAssetCatalog() throws Exception {
    addTargetWithAssetCatalogs();
    checkMergeActionsWithAssetCatalog(RULE_TYPE_PAIR);
  }

  private void addBinAndLibWithRawResources() throws Exception {
    addBinAndLibWithResources(
        "resources", "resource1.txt", "ja.lproj/resource2.txt", "ios_extension_binary");
    scratch.file("x/BUILD",
        "ios_extension(",
        "    name = 'x',",
        "    binary = '//bin:bin',",
        ")");
  }

  private void addBinAndLibWithStrings() throws Exception {
    addBinAndLibWithResources(
        "strings", "foo.strings", "ja.lproj/bar.strings", "ios_extension_binary");
    scratch.file("x/BUILD",
        "ios_extension(",
        "    name = 'x',",
        "    binary = '//bin:bin',",
        ")");
  }

  @Test
  public void testCollectsRawResourceFilesTransitively() throws Exception {
    addBinAndLibWithRawResources();
    checkCollectsResourceFilesTransitively(
        "//x:x",
        ImmutableList.of("lib/resource1.txt", "bin/ja.lproj/resource2.txt"),
        ImmutableList.of("lib/resource1.txt"),
        ImmutableSetMultimap.<String, Multiset<String>>of(
            "bin_bin", ImmutableMultiset.of("bin/ja.lproj/resource2.txt", "lib/resource1.txt"),
            "x_x", ImmutableMultiset.of("bin/ja.lproj/resource2.txt", "lib/resource1.txt"),
            "lib_lib", ImmutableMultiset.of("lib/resource1.txt")));
  }

  @Test
  public void testCollectsStringsFilesTransitively() throws Exception {
    addBinAndLibWithStrings();
    checkCollectsResourceFilesTransitively(
        "//x:x",
        ImmutableList.of("x/lib/foo.strings.binary", "x/bin/ja.lproj/bar.strings.binary"),
        ImmutableList.of("lib/foo.strings.binary"),
        ImmutableSetMultimap.<String, Multiset<String>>of(
            "bin_bin", ImmutableMultiset.of("bin/ja.lproj/bar.strings", "lib/foo.strings"),
            "x_x", ImmutableMultiset.of("bin/ja.lproj/bar.strings", "lib/foo.strings"),
            "lib_lib", ImmutableMultiset.of("lib/foo.strings")));
  }

  @Test
  public void testResourceFilesMergedInBundle() throws Exception {
    addBinAndLibWithRawResources();
    checkBundleablesAreMerged("//x:x",
        ImmutableListMultimap.of(
            "resource1.txt", "resource1.txt",
            "ja.lproj/resource2.txt", "ja.lproj/resource2.txt"));
  }

  @Test
  public void testStringsFilesMergedInBundle() throws Exception {
    addBinAndLibWithStrings();
    checkBundleablesAreMerged("//x:x",
        ImmutableListMultimap.of(
            "foo.strings.binary", "foo.strings",
            "ja.lproj/bar.strings.binary", "ja.lproj/bar.strings"));
  }

  @Test
  public void testMergesXcdatamodelZips() throws Exception {
    checkMergesXcdatamodelZips(RULE_TYPE_PAIR);
  }

  @Test
  public void testPlistRequiresDotInName() throws Exception {
    checkError("x", "x",
        "'//x:Infoplist' does not produce any ios_extension infoplist files (expected .plist)",
        "ios_extension_binary(",
        "    name = 'bin',",
        "    srcs = ['a.m'],",
        ")",
        "",
        "ios_extension(",
        "    name = 'x',",
        "    infoplist = 'Infoplist',",
        "    binary = ':bin',",
        ")");
  }

  @Test
  public void testMergesPartialInfoplists() throws Exception {
    checkMergesPartialInfoplists(RULE_TYPE_PAIR);
  }

  @Test
  public void testNibZipsMergedIntoBundle() throws Exception {
    checkNibZipsMergedIntoBundle(RULE_TYPE_PAIR);
  }

  @Test
  public void testNoEntitlementsDefined() throws Exception {
    checkNoEntitlementsDefined(RULE_TYPE);
  }

  @Test
  public void testEntitlementsDefined() throws Exception {
    checkEntitlementsDefined(RULE_TYPE);
  }

  @Test
  public void testExtraEntitlements() throws Exception {
    checkExtraEntitlements(RULE_TYPE);
  }

  @Test
  public void testDebugEntitlements() throws Exception {
    checkDebugEntitlements(RULE_TYPE);
  }

  @Test
  public void testFastbuildDebugEntitlements() throws Exception {
    checkFastbuildDebugEntitlements(RULE_TYPE);
  }

  @Test
  public void testOptNoDebugEntitlements() throws Exception {
    checkOptNoDebugEntitlements(RULE_TYPE);
  }

  @Test
  public void testExplicitNoDebugEntitlements() throws Exception {
    checkExplicitNoDebugEntitlements(RULE_TYPE);
  }

  @Test
  public void testPassesFallbackBundleIdToBundleMerging() throws Exception {
    checkBundleIdPassedAsFallbackId(RULE_TYPE);
  }

  @Test
  public void testPassesPrimaryBundleIdToBundleMerging() throws Exception {
    checkBundleIdPassedAsPrimaryId(RULE_TYPE);
  }

  @Test
  public void testMultiPlatformBuild_fails() throws Exception {
    checkBinaryActionMultiPlatform_fails(RULE_TYPE_PAIR);
  }

  @Test
  public void testMultiArchitectureResources() throws Exception {
    checkMultiCpuResourceInheritance(RULE_TYPE_PAIR);
  }

  @Test
  public void testMultiCpuCompiledResources() throws Exception {
    checkMultiCpuCompiledResources(RULE_TYPE_PAIR);
  }

  @Test
  public void testMomczipActions() throws Exception {
    checkMomczipActions(RULE_TYPE_PAIR, DEFAULT_IOS_SDK_VERSION);
  }

  @Test
  public void testConvertStringsActions() throws Exception {
    checkConvertStringsAction(RULE_TYPE_PAIR);
  }

  @Test
  public void testCompileXibActions() throws Exception {
    checkCompileXibActions(RULE_TYPE_PAIR, DEFAULT_IOS_SDK_VERSION, "iphone");
  }

  @Test
  public void testRegistersStoryboardCompileActions() throws Exception {
    checkRegistersStoryboardCompileActions(
        RULE_TYPE_PAIR, DEFAULT_IOS_SDK_VERSION, "iphone");
  }

  @Test
  public void testMultiCpuCompiledResourcesFromGenrule() throws Exception {
    checkMultiCpuCompiledResourcesFromGenrule(RULE_TYPE_PAIR);
  }

  @Test
  public void testMultiCpuGeneratedResourcesFromGenrule() throws Exception {
    checkMultiCpuGeneratedResourcesFromGenrule(RULE_TYPE_PAIR);
  }

  @Test
  public void testTwoStringsOneBundlePath() throws Exception {
    checkTwoStringsOneBundlePath(RULE_TYPE_PAIR, "x");
  }

  @Test
  public void testTwoResourcesOneBundlePath() throws Exception {
    checkTwoResourcesOneBundlePath(RULE_TYPE_PAIR, "x");
  }

  @Test
  public void testSameStringsTwice() throws Exception {
    checkSameStringsTwice(RULE_TYPE_PAIR, "x");
  }

  @Test
  public void testExtensionReplacesMinimumOsInBundleMerge() throws Exception {
    useConfiguration("--ios_minimum_os=7.1");
    addMockExtensionAndLibs("infoplist = 'Info.plist'");

    assertThat(bundleMergeControl("//x:x").getMinimumOsVersion())
        .isEqualTo(IosExtension.EXTENSION_MINIMUM_OS_VERSION.toString());
  }

  @Test
  public void testExtensionReplacesMinimumOsVersionInBundleMergeAtMost80() throws Exception {
    useConfiguration("--ios_minimum_os=8.1");
    addMockExtensionAndLibs("infoplist = 'Info.plist'");

    assertThat(bundleMergeControl("//x:x").getMinimumOsVersion())
        .isEqualTo("8.1");
  }

  @Test
  public void testCheckPrimaryBundleIdInMergedPlist() throws Exception {
    checkPrimaryBundleIdInMergedPlist(RULE_TYPE_PAIR);
  }

  @Test
  public void testCheckFallbackBundleIdInMergedPlist() throws Exception {
    checkFallbackBundleIdInMergedPlist(RULE_TYPE_PAIR);
  }

  protected void checkExtensionReplacesMinimumOsInCompilation() throws Exception {
    addMockExtensionAndLibs("infoplist = 'Info.plist'");

    Action lipoAction = lipoBinAction("//x:x");

    for (Artifact bin : lipoAction.getInputs()) {
      CommandAction action = (CommandAction) getGeneratingAction(bin);
      if (action == null) {
        continue;
      }
      assertThat(generatingArgumentsToString(action))
          .contains("-mios-simulator-version-min=" + IosExtension.EXTENSION_MINIMUM_OS_VERSION);
      assertThat(generatingArgumentsToString(action))
          .doesNotContain("-mios-simulator-version-min=7.1");
    }
  }

  private String generatingArgumentsToString(CommandAction generatingAction) {
    return Joiner.on(' ').join(generatingAction.getArguments());
  }

  protected void checkExtensionDoesNotReplaceMinimumOsInCompilation() throws Exception {
    addMockExtensionAndLibs("infoplist = 'Info.plist'");

    Action lipoAction = lipoBinAction("//x:x");

    for (Artifact bin : lipoAction.getInputs()) {
      CommandAction action = (CommandAction) getGeneratingAction(bin);
      if (action == null) {
        continue;
      }
      assertThat(generatingArgumentsToString(action)).contains("-mios-simulator-version-min=8.1");
      assertThat(generatingArgumentsToString(action))
          .doesNotContain("-mios-simulator-version-min=" + DEFAULT_IOS_SDK_VERSION);
    }
  }

  @Test
  public void testExtensionReplacesMinimumOsVersionInMomcZipAtMost80() throws Exception {
    useConfiguration("--ios_minimum_os=8.1");
    checkMomczipActions(RULE_TYPE_PAIR, DottedVersion.fromString("8.1"));
  }

  @Test
  public void testGenruleWithoutJavaCcDeps() throws Exception {
    checkGenruleWithoutJavaCcDependency(RULE_TYPE_PAIR);
  }

  @Test
  public void testCcDependencyWithProtoDependencyMultiArch() throws Exception {
    checkCcDependencyWithProtoDependencyMultiArch(
        RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testLaunchStoryboardIncluded() throws Exception {
    checkLaunchStoryboardIncluded(RULE_TYPE_PAIR);
  }

  @Test
  public void testLaunchStoryboardXibIncluded() throws Exception {
    checkLaunchStoryboardXib(RULE_TYPE_PAIR);
  }

  @Test
  public void testLaunchStoryboardLproj() throws Exception {
    checkLaunchStoryboardLproj(RULE_TYPE_PAIR);
  }
  
  @Test
  public void testAutomaticPlistEntries() throws Exception {
    checkAutomaticPlistEntries(RULE_TYPE);
  }

  @Test
  public void testBundleMergeInputContainsPlMergeOutput() throws Exception {
    checkBundleMergeInputContainsPlMergeOutput(RULE_TYPE);
  }

  @Test
  public void testMergeBundleActionsWithNestedBundle() throws Exception {
    BuildConfiguration extensionConfiguration =
        Iterables.getOnlyElement(getExtensionConfigurations());
    checkMergeBundleActionsWithNestedBundle(RULE_TYPE_PAIR, extensionConfiguration);
  }

  @Test
  public void testIncludesStoryboardOutputZipsAsMergeZips() throws Exception {
    BuildConfiguration extensionConfiguration =
        Iterables.getOnlyElement(getExtensionConfigurations());
    checkIncludesStoryboardOutputZipsAsMergeZips(RULE_TYPE_PAIR, extensionConfiguration);
  }

  @Test
  public void testCcDependency() throws Exception {
    checkCcDependency(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testCcDependencyMultiArch() throws Exception {
    checkCcDependencyMultiArch(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testCcDependencyWithProtoDependency() throws Exception {
    checkCcDependencyWithProtoDependency(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testCcDependencyAndJ2objcDependency() throws Exception {
    checkCcDependencyAndJ2objcDependency(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testMultiArchitectureFanOut() throws Exception {
    checkBinaryLipoActionMultiCpu(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testTargetHasCpuSpecificDsymFiles() throws Exception {
    checkTargetHasCpuSpecificDsymFiles(RULE_TYPE);
  }

  @Test
  public void testTargetHasDsymPlist() throws Exception {
    checkTargetHasDsymPlist(RULE_TYPE);
  }

  @Test
  public void testGenruleDependencyMultiArch() throws Exception {
    checkGenruleDependencyMultiArch(RULE_TYPE_PAIR, ConfigurationDistinguisher.IOS_EXTENSION);
  }

  @Test
  public void testExtensionReplacesMinimumOsInCompilation() throws Exception {
    useConfiguration("--ios_minimum_os=7.1");
    checkExtensionReplacesMinimumOsInCompilation();
  }

  @Test
  public void testExtensionReplacesMinimumOsInCompilationAtMost80() throws Exception {
    useConfiguration("--ios_minimum_os=8.1");
    checkExtensionDoesNotReplaceMinimumOsInCompilation();
  }

  @Test
  public void testExtensionReplacesMinimumOsInCompilationMultiArch() throws Exception {
    useConfiguration("--ios_minimum_os=7.1", "--ios_multi_cpus=i386,x86_64");
    checkExtensionReplacesMinimumOsInCompilation();
  }

  @Test
  public void testExtensionReplacesMinimumOsInCompilationAtMost80MultiArch() throws Exception {
    useConfiguration("--ios_minimum_os=8.1", "--ios_multi_cpus=i386,x86_64");
    checkExtensionDoesNotReplaceMinimumOsInCompilation();
  }
}