func complexSingleTest_DefaultConfig()

in src/TulsiGeneratorIntegrationTests/AspectTests.swift [136:311]


  func complexSingleTest_DefaultConfig() throws {
    installBUILDFile("ComplexSingle", intoSubdirectory: "tulsi_test")
    makeTestXCDataModel("DataModelsTestv1", inSubdirectory: "tulsi_test/Test.xcdatamodeld")
    makeTestXCDataModel("DataModelsTestv2", inSubdirectory: "tulsi_test/Test.xcdatamodeld")

    // iOS extension's Info.plist is generated by the Aspect after reading the infoplists listed in
    // the attribute, so we'll need to generate them otherwise extraction will fail.
    makePlistFileNamed("Plist1.plist",
                       withContent: ["NSExtension": ["NSExtensionPointIdentifier": "com.apple.extension-foo"]],
                       inSubdirectory: "(tulsi_test/TodayExtension")

    let ruleEntryMap = try extractRuleEntriesForLabels([BuildLabel("//tulsi_test:XCTest")])

    let checker = InfoChecker(ruleEntryMap: ruleEntryMap)

    checker.assertThat("//tulsi_test:Application")
        .dependsOn("//tulsi_test:Application.apple_binary")
        .dependsOn("//tulsi_test:TodayExtension")
        .hasAttribute(.supporting_files,
                      value: [["is_dir": false,
                               "path": "tulsi_test/Application/Info.plist",
                               "src": true]] as NSArray)

    checker.assertThat("//tulsi_test:ApplicationResources")
        .hasAttribute(.supporting_files,
                      value: [["is_dir": false,
                               "path": "tulsi_test/Application/structured_resources.file1",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/structured_resources.file2",
                               "src": true]] as NSArray)

    checker.assertThat("//tulsi_test:ApplicationLibrary")
        .dependsOn("//tulsi_test:Library")
        .dependsOn("//tulsi_test:NonPropagatedLibrary")
        .dependsOn("//tulsi_test:ObjCBundle")
        .hasSources(["tulsi_test/Application/srcs/main.m",
                     "bazel-genfiles/tulsi_test/SrcGenerator/outs/output.m"
                    ])
        .hasNonARCSources(["tulsi_test/Application/non_arc_srcs/NonARCFile.mm"])
        .hasObjcDefines(["SubLibraryWithDefines=1",
                         "SubLibraryWithDefines_DEFINE=SubLibraryWithDefines",
                         "SubLibraryWithDifferentDefines=1",
                         "LIBRARY_DEFINES_DEFINE=1",
                         "LIBRARY SECOND DEFINE=2",
                         "LIBRARY_VALUE_WITH_SPACES=Value with spaces",
                         "A=BINARY_DEFINE"])
        .hasIncludes(["tulsi_test/Application/includes/first/include",
                      "tulsi-includes/x/x/tulsi_test/Application/includes/first/include",
                      "tulsi_test/Application/includes/second/include",
                      "tulsi-includes/x/x/tulsi_test/Application/includes/second/include",
                      "tulsi_test/SubLibraryWithDifferentDefines/includes",
                      "tulsi-includes/x/x/tulsi_test/SubLibraryWithDifferentDefines/includes"])
        .hasAttribute(.supporting_files,
                      value: [["is_dir": false,
                               "path": "tulsi_test/Application/Base.lproj/Localizable.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/Base.lproj/Localized.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/en.lproj/Localized.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/en.lproj/EN.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/es.lproj/Localized.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/NonLocalized.strings",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/Base.lproj/One.storyboard",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/StoryboardGenerator/outs/Two.storyboard",
                               "root": "bazel-genfiles",
                               "src": false],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/AssetsOne.xcassets",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Application/AssetsTwo.xcassets",
                               "src": true]] as NSArray)

    checker.assertThat("//tulsi_test:ObjCBundle")
        .hasAttribute(.supporting_files,
                      value: [["is_dir": false,
                               "path": "tulsi_test/ObjCBundle.bundle",
                               "src": true]] as NSArray)

    checker.assertThat("//tulsi_test:CoreDataResources")
        .hasAttribute(.datamodels,
                      value: [["is_dir": false,
                               "path": "tulsi_test/Test.xcdatamodeld/DataModelsTestv1.xcdatamodel",
                               "src": true],
                              ["is_dir": false,
                               "path": "tulsi_test/Test.xcdatamodeld/DataModelsTestv2.xcdatamodel",
                               "src": true], ] as NSArray)

    checker.assertThat("//tulsi_test:Library")
        .hasSources(["tulsi_test/LibrarySources/srcs/src1.m",
                     "tulsi_test/LibrarySources/srcs/src2.m",
                     "tulsi_test/LibrarySources/srcs/src3.m",
                     "tulsi_test/LibrarySources/srcs/src4.m",
                     "tulsi_test/Library/srcs/src5.mm",
                     "tulsi_test/Library/srcs/SrcsHeader.h",
                     "tulsi_test/Library/hdrs/HdrsHeader.h"])
        .hasAttribute(.copts, value: ["-DLIBRARY_COPT_DEFINE"] as NSArray)
        .hasObjcDefines(["SubLibraryWithDefines=1",
                         "SubLibraryWithDefines_DEFINE=SubLibraryWithDefines",
                         "SubLibraryWithDifferentDefines=1",
                         "LIBRARY_DEFINES_DEFINE=1",
                         "LIBRARY SECOND DEFINE=2",
                         "LIBRARY_VALUE_WITH_SPACES=Value with spaces",])
        .hasAttribute(.pch, value: ["is_dir": false,
                                    "path": "tulsi_test/PCHGenerator/outs/PCHFile.pch",
                                    "root": "bazel-genfiles",
                                    "src": false] as NSDictionary)
        .hasAttribute(.supporting_files,
                      value: [["is_dir": false, "path": "tulsi_test/Library/xib.xib", "src": true]] as NSArray)

    checker.assertThat("//tulsi_test:SubLibrary")
        .hasSources(["tulsi_test/SubLibrary/srcs/src.mm"])
        .hasAttribute(.pch, value: ["is_dir": false,
                                    "path": "tulsi_test/SubLibrary/pch/AnotherPCHFile.pch",
                                    "src": true] as NSDictionary)
        .hasAttribute(.enable_modules, value: true)

    checker.assertThat("//tulsi_test:SubLibraryWithDefines")
        .hasSources(["tulsi_test/SubLibraryWithDefines/srcs/src.mm"])
        .hasAttribute(.copts, value: ["-menable-no-nans",
                                      "-menable-no-infs",
                                      "-I/SubLibraryWithDefines/local/includes",
                                      "-Irelative/SubLibraryWithDefines/local/includes"] as NSArray)
        .hasObjcDefines(["SubLibraryWithDefines=1",
                         "SubLibraryWithDefines_DEFINE=SubLibraryWithDefines"])

    checker.assertThat("//tulsi_test:SubLibraryWithDifferentDefines")
        .hasSources(["tulsi_test/SubLibraryWithDifferentDefines/srcs/src.mm"])
        .hasAttribute(.copts, value: ["-DSubLibraryWithDifferentDefines_LocalDefine",
                                      "-DSubLibraryWithDifferentDefines_INTEGER_DEFINE=1",
                                      "-DSubLibraryWithDifferentDefines_STRING_DEFINE=Test",
                                      "-DSubLibraryWithDifferentDefines_STRING_WITH_SPACES=String with spaces",
                                      "-D'SubLibraryWithDifferentDefines_SINGLEQUOTED=Single quoted with spaces'",
                                      "-D\"SubLibraryWithDifferentDefines_PREQUOTED=Prequoted with spaces\""] as NSArray)
        .hasObjcDefines(["SubLibraryWithDifferentDefines=1"])
        .hasIncludes(["tulsi_test/SubLibraryWithDifferentDefines/includes",
                      "tulsi-includes/x/x/tulsi_test/SubLibraryWithDifferentDefines/includes"])

    checker.assertThat("//tulsi_test:NonPropagatedLibrary")
        .hasSources(["tulsi_test/NonPropagatedLibrary/srcs/non_propagated.m"])

    checker.assertThat("//tulsi_test:ObjCFramework")
        .hasFrameworks(["tulsi_test/ObjCFramework/test.framework"])

    checker.assertThat("//tulsi_test:TodayExtensionLibrary")
        .hasSources(["tulsi_test/TodayExtension/srcs/today_extension_library.m"])

    checker.assertThat("//tulsi_test:TodayExtension")
        .dependsOn("//tulsi_test:TodayExtension.apple_binary")

    checker.assertThat("//tulsi_test:TodayExtension.apple_binary")
        .dependsOn("//tulsi_test:TodayExtensionLibrary")
        .dependsOn("//tulsi_test:TodayExtensionResources")

    checker.assertThat("//tulsi_test:XCTest")
        .hasTestHost("//tulsi_test:Application")
        .dependsOn("//tulsi_test:Application")
        .dependsOn("//tulsi_test:XCTest_test_binary")

    checker.assertThat("//tulsi_test:XCTest_test_binary")
        .dependsOn("//tulsi_test:Library")
        .dependsOn("//tulsi_test:TestLibrary")
  }