From 2e4e60418b65feae1cdc5ceb7bcaad1c793b52d4 Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Fri, 5 Jul 2024 13:00:33 -0400 Subject: [PATCH] Revert "Disable docc_archive tests & examples" This reverts commit d201565503339efc7b5cc09e0836943fe6300ce7. --- examples/ios/HelloWorldSwift/BUILD | 22 +-- test/starlark_tests/docc_tests.bzl | 155 +++++++++--------- .../targets_under_test/ios/BUILD | 73 +++++---- 3 files changed, 127 insertions(+), 123 deletions(-) diff --git a/examples/ios/HelloWorldSwift/BUILD b/examples/ios/HelloWorldSwift/BUILD index 40419c4b07..41bdb8df9c 100644 --- a/examples/ios/HelloWorldSwift/BUILD +++ b/examples/ios/HelloWorldSwift/BUILD @@ -1,5 +1,6 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("//apple:docc.bzl", "docc_archive") load("//apple:ios.bzl", "ios_application", "ios_ui_test", "ios_unit_test") licenses(["notice"]) @@ -90,14 +91,13 @@ ios_ui_test( ) # Example using docc_archive to generate documentation -# TODO: enable once new rules_swift 2.0 symbol graph rule is supported -# docc_archive( -# name = "HelloWorldSwift.doccarchive", -# default_code_listing_language = "en", -# dep = ":HelloWorldSwift", -# diagnostic_level = "information", -# enable_inherited_docs = True, -# fallback_bundle_identifier = "com.example.hello-world-swift", -# fallback_bundle_version = "1.0.0", -# fallback_display_name = "HelloWorldSwift", -# ) +docc_archive( + name = "HelloWorldSwift.doccarchive", + default_code_listing_language = "en", + dep = ":HelloWorldSwift", + diagnostic_level = "information", + enable_inherited_docs = True, + fallback_bundle_identifier = "com.example.hello-world-swift", + fallback_bundle_version = "1.0.0", + fallback_display_name = "HelloWorldSwift", +) diff --git a/test/starlark_tests/docc_tests.bzl b/test/starlark_tests/docc_tests.bzl index ec15090165..8a151b4dd2 100644 --- a/test/starlark_tests/docc_tests.bzl +++ b/test/starlark_tests/docc_tests.bzl @@ -14,6 +14,11 @@ """docc Starlark tests.""" +load( + "//test/starlark_tests/rules:common_verification_tests.bzl", + "archive_contents_test", +) + def docc_test_suite(name): """Test suite for docc rules. @@ -22,89 +27,85 @@ def docc_test_suite(name): """ # Verify doccarchive bundle is created for Swift iOS app. - # TODO: enable once new rules_swift 2.0 symbol graph rule is supported - # archive_contents_test( - # name = "{}_contains_doccarchive_when_ios_swift_app".format(name), - # build_type = "simulator", - # target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_swift_dep.doccarchive", - # contains = [ - # "$BUNDLE_ROOT/index.html", - # ], - # text_file_not_contains = [ - # "$BUNDLE_ROOT/documentation/basicframework/readme/index.html", # only included with a .docc bundle in data - # ], - # text_test_file = "$BUNDLE_ROOT/metadata.json", - # text_test_values = [ - # "\"bundleDisplayName\":\"app_with_swift_dep\"", - # "\"bundleIdentifier\":\"com.google.example\"", - # "\"major\":0", - # "\"minor\":1", - # "\"patch\":0", - # ], - # tags = [name], - # ) + archive_contents_test( + name = "{}_contains_doccarchive_when_ios_swift_app".format(name), + build_type = "simulator", + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_swift_dep.doccarchive", + contains = [ + "$BUNDLE_ROOT/index.html", + ], + text_file_not_contains = [ + "$BUNDLE_ROOT/documentation/basicframework/readme/index.html", # only included with a .docc bundle in data + ], + text_test_file = "$BUNDLE_ROOT/metadata.json", + text_test_values = [ + "\"bundleDisplayName\":\"app_with_swift_dep\"", + "\"bundleIdentifier\":\"com.google.example\"", + "\"major\":0", + "\"minor\":1", + "\"patch\":0", + ], + tags = [name], + ) # Verify doccarchive bundle is created for Swift iOS framework which includes a .docc bundle. - # TODO: enable once new rules_swift 2.0 symbol graph rule is supported - # archive_contents_test( - # name = "{}_contains_doccarchive_with_docc_bundle_when_ios_framework".format(name), - # build_type = "simulator", - # target_under_test = "//test/starlark_tests/targets_under_test/ios:basic_framework_with_docc_bundle.doccarchive", - # contains = [ - # "$BUNDLE_ROOT/index.html", - # "$BUNDLE_ROOT/documentation/basicframework/readme/index.html", - # ], - # text_file_not_contains = [], - # text_test_file = "$BUNDLE_ROOT/metadata.json", - # text_test_values = [ - # "\"bundleDisplayName\":\"BasicFramework\"", - # "\"bundleIdentifier\":\"com.google.example.framework\"", - # "\"major\":0", - # "\"minor\":1", - # "\"patch\":0", - # ], - # tags = [name], - # ) + archive_contents_test( + name = "{}_contains_doccarchive_with_docc_bundle_when_ios_framework".format(name), + build_type = "simulator", + target_under_test = "//test/starlark_tests/targets_under_test/ios:basic_framework_with_docc_bundle.doccarchive", + contains = [ + "$BUNDLE_ROOT/index.html", + "$BUNDLE_ROOT/documentation/basicframework/readme/index.html", + ], + text_file_not_contains = [], + text_test_file = "$BUNDLE_ROOT/metadata.json", + text_test_values = [ + "\"bundleDisplayName\":\"BasicFramework\"", + "\"bundleIdentifier\":\"com.google.example.framework\"", + "\"major\":0", + "\"minor\":1", + "\"patch\":0", + ], + tags = [name], + ) # Verify doccarchive bundle is created for an ObjC library which defines data and has a dependency on a Swift lib. - # TODO: enable once new rules_swift 2.0 symbol graph rule is supported - # archive_contents_test( - # name = "{}_contains_doccarchive_when_objc_library_with_swift_dep".format(name), - # build_type = "simulator", - # target_under_test = "//test/starlark_tests/targets_under_test/ios:basic_objc_lib_with_data_and_docc_bundle_dependency.doccarchive", - # contains = [ - # "$BUNDLE_ROOT/index.html", - # "$BUNDLE_ROOT/documentation/basiclib/readme/index.html", - # ], - # text_file_not_contains = [], - # text_test_file = "$BUNDLE_ROOT/metadata.json", - # text_test_values = [ - # "\"bundleDisplayName\":\"BasicLib\"", - # "\"bundleIdentifier\":\"com.google.example.objc.lib\"", - # "\"major\":0", - # "\"minor\":1", - # "\"patch\":0", - # ], - # tags = [name], - # ) + archive_contents_test( + name = "{}_contains_doccarchive_when_objc_library_with_swift_dep".format(name), + build_type = "simulator", + target_under_test = "//test/starlark_tests/targets_under_test/ios:basic_objc_lib_with_data_and_docc_bundle_dependency.doccarchive", + contains = [ + "$BUNDLE_ROOT/index.html", + "$BUNDLE_ROOT/documentation/basiclib/readme/index.html", + ], + text_file_not_contains = [], + text_test_file = "$BUNDLE_ROOT/metadata.json", + text_test_values = [ + "\"bundleDisplayName\":\"BasicLib\"", + "\"bundleIdentifier\":\"com.google.example.objc.lib\"", + "\"major\":0", + "\"minor\":1", + "\"patch\":0", + ], + tags = [name], + ) # Verify hosting_base_path support. - # TODO: enable once new rules_swift 2.0 symbol graph rule is supported - # archive_contents_test( - # name = "{}_contains_doccarchive_with_docc_bundle_when_ios_framework_with_hosting_base_path".format(name), - # build_type = "simulator", - # target_under_test = "//test/starlark_tests/targets_under_test/ios:basic_framework_with_docc_bundle_custom_base_path.doccarchive", - # contains = [ - # "$BUNDLE_ROOT/index.html", - # "$BUNDLE_ROOT/documentation/basicframework/readme/index.html", - # ], - # text_file_not_contains = [], - # text_test_file = "$BUNDLE_ROOT/index.html", - # text_test_values = [ - # "