Skip to content

Commit

Permalink
[Tabs] Move "Tabs2" into an extension. (#7663)
Browse files Browse the repository at this point in the history
Rather than having an independent "component" for the new view, it can be
homed as an extension of the existing component. Later migration should be as
simple as updating the umbrella import.

Closes #7655
  • Loading branch information
Robert Moore committed Jun 21, 2019
1 parent 76b14be commit 83797d1
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 304 deletions.
17 changes: 9 additions & 8 deletions MaterialComponentsBeta.podspec
Expand Up @@ -104,17 +104,18 @@ Pod::Spec.new do |mdc|
end
end

mdc.subspec "Tabs2" do |component|
component.ios.deployment_target = '9.0'
component.public_header_files = "components/#{component.base_name}/src/*.h"
component.source_files = [
"components/#{component.base_name}/src/*.{h,m}",
"components/#{component.base_name}/src/private/*.{h,m}",
mdc.subspec "Tabs+TabBarView" do |extension|
extension.ios.deployment_target = '9.0'
extension.public_header_files = "components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.h"
extension.source_files = [
"components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/*.{h,m}",
"components/#{extension.base_name.split('+')[0]}/src/#{extension.base_name.split('+')[1]}/private/*.{h,m}"
]
extension.dependency "MaterialComponents/#{extension.base_name.split('+')[0]}"

component.test_spec 'UnitTests' do |unit_tests|
extension.test_spec 'UnitTests' do |unit_tests|
unit_tests.source_files = [
"components/#{component.base_name}/tests/unit/*.m"
"components/#{extension.base_name.split('+')[0]}/tests/unit/#{extension.base_name.split('+')[1]}/*.{h,m,swift}",
]
end
end
Expand Down
4 changes: 2 additions & 2 deletions MaterialComponentsSnapshotTests.podspec
Expand Up @@ -15,8 +15,8 @@ module SnapshotPodspecHelper
source_files = Dir["components/#{@name}/tests/snapshot/*.{h,m,swift}"]
supplemental_files = Dir["components/#{@name}/tests/snapshot/supplemental/*.{h,m,swift}"]
example_files = Dir["components/#{@name}/examples/tests/snapshot/*.{h,m,swift}"]
theming_files = Dir["components/#{@name}/tests/snapshot/Theming/*.{h,m,swift}"]
return source_files + supplemental_files + example_files + theming_files
extension_files = Dir["components/#{@name}/tests/snapshot/*/*.{h,m,swift}"]
return source_files + supplemental_files + example_files + extension_files
end
return []
end
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion catalog/Podfile
Expand Up @@ -73,7 +73,7 @@ target "MDCCatalog" do
'ActionSheet+ColorThemer/UnitTests',
'BottomNavigation/UnitTests',
'ButtonBar+Theming/UnitTests',
'Tabs2/UnitTests',
'Tabs+TabBarView/UnitTests',
]
pod 'MaterialComponentsSnapshotTests', :path => '../', :testspecs => [
'SnapshotTests'
Expand Down
32 changes: 31 additions & 1 deletion components/Tabs/BUILD
Expand Up @@ -91,10 +91,15 @@ mdc_extension_objc_library(
],
)

mdc_extension_objc_library(
name = "TabBarView",
)

mdc_examples_objc_library(
name = "ObjcExamples",
deps = [
":ColorThemer",
":TabBarView",
":Tabs",
":TypographyThemer",
"//components/AppBar",
Expand Down Expand Up @@ -133,6 +138,13 @@ mdc_objc_library(
visibility = ["//visibility:private"],
)

mdc_objc_library(
name = "privateTabBarView",
hdrs = native.glob(["src/TabBarView/private/*.h"]),
includes = ["src/TabBarView/private"],
visibility = ["//visibility:private"],
)

mdc_objc_library(
name = "unit_test_sources",
testonly = 1,
Expand Down Expand Up @@ -173,20 +185,38 @@ mdc_objc_library(
],
)

mdc_objc_library(
name = "unit_test_tabbarview_sources",
srcs = native.glob([
"tests/unit/TabBarView/*.m",
]),
sdk_frameworks = [
"CoreGraphics",
"XCTest",
],
deps = [
":TabBarView",
":privateTabBarView",
],
)

mdc_unit_test_suite(
name = "unit_tests",
deps = [
":unit_test_sources",
":unit_test_tabbarview_sources",
":unit_test_theming_sources",
],
)

mdc_snapshot_objc_library(
name = "snapshot_test_lib",
extra_srcs = native.glob(["tests/snapshot/Theming/*.m"]),
extra_srcs = native.glob(["tests/snapshot/*/*.m"]),
deps = [
":TabBarView",
":Tabs",
":Theming",
":privateTabBarView",
],
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -15,7 +15,7 @@
#import <XCTest/XCTest.h>

#import <CoreGraphics/CoreGraphics.h>
#import "../../src/private/MDCTabBarViewItemView.h"
#import "../../../src/TabBarView/private/MDCTabBarViewItemView.h"
#import "MaterialSnapshot.h"

@interface MDCTabBarViewItemViewSnapshotTests : MDCSnapshotTestCase
Expand Down
Expand Up @@ -15,7 +15,7 @@
#import <XCTest/XCTest.h>

#import <CoreGraphics/CoreGraphics.h>
#import "../../src/private/MDCTabBarViewItemView.h"
#import "../../../src/TabBarView/private/MDCTabBarViewItemView.h"

// Minimum width of an item view.
static const CGFloat kMinWidth = 90;
Expand Down
75 changes: 0 additions & 75 deletions components/Tabs2/BUILD

This file was deleted.

This file was deleted.

0 comments on commit 83797d1

Please sign in to comment.