Skip to content

Commit

Permalink
Revert "Disable docc_archive tests & examples"
Browse files Browse the repository at this point in the history
This reverts commit d201565.
  • Loading branch information
luispadron committed Jul 5, 2024
1 parent d201565 commit 2e4e604
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 123 deletions.
22 changes: 11 additions & 11 deletions examples/ios/HelloWorldSwift/BUILD
Original file line number Diff line number Diff line change
@@ -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"])
Expand Down Expand Up @@ -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",
)
155 changes: 78 additions & 77 deletions test/starlark_tests/docc_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 = [
# "<script src=\"/custom/base/path/js/",
# ],
# tags = [name],
# )
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 = [
"<script src=\"/custom/base/path/js/",
],
tags = [name],
)

native.test_suite(
name = name,
Expand Down
73 changes: 38 additions & 35 deletions test/starlark_tests/targets_under_test/ios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ load(
"//test/starlark_tests:common.bzl",
"common",
)
load(
"//apple:docc.bzl",
"docc_archive",
)
load(
"//apple:xcarchive.bzl",
"xcarchive",
Expand Down Expand Up @@ -643,15 +647,15 @@ ios_application(
"//test/starlark_tests/resources:swift_main_lib",
],
)
# TODO: enable once new rules_swift 2.0 symbol graph rule is supported
# docc_archive(
# name = "app_with_swift_dep.doccarchive",
# dep = ":app_with_swift_dep",
# fallback_bundle_identifier = "com.google.example",
# fallback_bundle_version = "1.0.0",
# fallback_display_name = "app_with_swift_dep",
# tags = common.fixture_tags,
# )

docc_archive(
name = "app_with_swift_dep.doccarchive",
dep = ":app_with_swift_dep",
fallback_bundle_identifier = "com.google.example",
fallback_bundle_version = "1.0.0",
fallback_display_name = "app_with_swift_dep",
tags = common.fixture_tags,
)

ios_static_framework(
name = "swift_static_framework",
Expand Down Expand Up @@ -4885,14 +4889,14 @@ objc_library(
data = ["//test/starlark_tests/resources:additional.txt"],
deps = [":basic_framework_lib_with_docc_bundle"],
)
# TODO: enable once new rules_swift 2.0 symbol graph rule is supported
# docc_archive(
# name = "basic_objc_lib_with_data_and_docc_bundle_dependency.doccarchive",
# dep = ":basic_objc_lib_with_data_and_docc_bundle_dependency",
# fallback_bundle_identifier = "com.google.example.objc.lib",
# fallback_bundle_version = "1.0",
# fallback_display_name = "BasicLib",
# )

docc_archive(
name = "basic_objc_lib_with_data_and_docc_bundle_dependency.doccarchive",
dep = ":basic_objc_lib_with_data_and_docc_bundle_dependency",
fallback_bundle_identifier = "com.google.example.objc.lib",
fallback_bundle_version = "1.0",
fallback_display_name = "BasicLib",
)

ios_dynamic_framework(
name = "basic_framework_with_docc_bundle",
Expand All @@ -4911,24 +4915,23 @@ ios_dynamic_framework(
":basic_framework_lib_with_docc_bundle",
],
)
# TODO: enable once new rules_swift 2.0 symbol graph rule is supported
# docc_archive(
# name = "basic_framework_with_docc_bundle.doccarchive",
# dep = ":basic_framework_with_docc_bundle",
# fallback_bundle_identifier = "com.google.example.framework",
# fallback_bundle_version = "1.0",
# fallback_display_name = "BasicFramework",
# )

# TODO: enable once new rules_swift 2.0 symbol graph rule is supported
# docc_archive(
# name = "basic_framework_with_docc_bundle_custom_base_path.doccarchive",
# dep = ":basic_framework_with_docc_bundle",
# fallback_bundle_identifier = "com.google.example.framework",
# fallback_bundle_version = "1.0",
# fallback_display_name = "BasicFramework",
# hosting_base_path = "custom/base/path",
# )

docc_archive(
name = "basic_framework_with_docc_bundle.doccarchive",
dep = ":basic_framework_with_docc_bundle",
fallback_bundle_identifier = "com.google.example.framework",
fallback_bundle_version = "1.0",
fallback_display_name = "BasicFramework",
)

docc_archive(
name = "basic_framework_with_docc_bundle_custom_base_path.doccarchive",
dep = ":basic_framework_with_docc_bundle",
fallback_bundle_identifier = "com.google.example.framework",
fallback_bundle_version = "1.0",
fallback_display_name = "BasicFramework",
hosting_base_path = "custom/base/path",
)

# ---------------------------------------------------------------------------------------
# Target for extension resource bundling.
Expand Down

0 comments on commit 2e4e604

Please sign in to comment.