diff options
author | 2018-03-28 07:54:41 -0700 | |
---|---|---|
committer | 2018-03-28 07:55:49 -0700 | |
commit | 64524c1faa22eca5921a0bdd7bb98b89d013bdaf (patch) | |
tree | 1a699f87e445b3edb9929b2b9458e7b21df27e26 /src/test/java | |
parent | a0e13f6d11540b65e7d14af4bbf274029b4d71f2 (diff) |
Delete the ios_device rule from bazel.
PiperOrigin-RevId: 190771926
Diffstat (limited to 'src/test/java')
3 files changed, 0 insertions, 184 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MockObjcSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/MockObjcSupport.java index be5778e256..227bb30b8f 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/MockObjcSupport.java +++ b/src/test/java/com/google/devtools/build/lib/packages/util/MockObjcSupport.java @@ -157,23 +157,9 @@ public final class MockObjcSupport { config.create(TestConstants.TOOLS_REPOSITORY_SCRATCH + "tools/objc/j2objc_dead_code_pruner.py"); config.create(TestConstants.TOOLS_REPOSITORY_SCRATCH + "tools/objc/header_scanner"); createCrosstoolPackage(config, partialToolchainLines); - setupIosSimDevice(config); setupObjcProto(config); } - /** - * Sets up mock IOS simulated device support. - */ - public static void setupIosSimDevice(MockToolsConfig config) throws IOException { - config.create( - TestConstants.TOOLS_REPOSITORY_SCRATCH + "tools/objc/sim_devices/BUILD", - "ios_device(", - " name = 'default',", - " ios_version = '9.8',", - " type = 'iChimpanzee',", - ")"); - } - /** Sets up the support for building protocol buffers for ObjC. */ private static void setupObjcProto(MockToolsConfig config) throws IOException { config.create( diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/IosDeviceTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/IosDeviceTest.java deleted file mode 100644 index 02e58ba134..0000000000 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/IosDeviceTest.java +++ /dev/null @@ -1,169 +0,0 @@ -// 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 com.google.devtools.build.lib.analysis.ConfiguredTarget; -import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; -import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; -import com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions; -import com.google.devtools.build.lib.rules.apple.DottedVersion; -import com.google.devtools.build.lib.rules.apple.XcodeVersionProperties; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * Unit tests for the {@code ios_device} rule. - */ -@RunWith(JUnit4.class) -public class IosDeviceTest extends BuildViewTestCase { - - @Test - public void testIosVersion_specified() throws Exception { - scratch.file("test/BUILD", - "ios_device(name = 'foo', ios_version = '42.0', type = 'IPHONE_6',)"); - - assertIosVersion("//test:foo", "42.0"); - } - - @Test - public void testIosVersion_default() throws Exception { - scratch.file("test/BUILD", - "ios_device(name = 'foo', type = 'IPHONE_6',)"); - - assertIosVersion("//test:foo", AppleCommandLineOptions.DEFAULT_IOS_SDK_VERSION); - } - - @Test - public void testIosVersion_flagValue() throws Exception { - scratch.file("test/BUILD", - "ios_device(name = 'foo', type = 'IPHONE_6',)"); - useConfiguration("--ios_sdk_version=42.3"); - - assertIosVersion("//test:foo", "42.3"); - } - - /** - * Tests that if {@code ios_device} specifies an xcode version that does not specify a {@code - * default_ios_sdk_version}, the ios sdk version of the device defaults to the default value of - * {@code default_ios_sdk_version} instead of the build configuration value. This is a confusing - * (perhaps convoluted) corner case. - */ - @Test - public void testXcodeVersion_noIosVersion() throws Exception { - scratch.file("test/BUILD", - "xcode_version(name = 'my_xcode', version = '15.2')", - "ios_device(name = 'foo', type = 'IPHONE_6', xcode = ':my_xcode')"); - useConfiguration("--xcode_version=7.3", "--ios_sdk_version=42.3"); - - assertXcodeVersion("//test:foo", "15.2"); - assertIosVersion("//test:foo", XcodeVersionProperties.DEFAULT_IOS_SDK_VERSION); - } - - @Test - public void testXcodeVersion_withIosVersion() throws Exception { - scratch.file("test/BUILD", - "xcode_version(name = 'my_xcode', version = '15.2', default_ios_sdk_version='17.8')", - "ios_device(name = 'foo', type = 'IPHONE_6', xcode = ':my_xcode')"); - useConfiguration("--xcode_version=7.3", "--ios_sdk_version=42.3"); - - assertXcodeVersion("//test:foo", "15.2"); - assertIosVersion("//test:foo", "17.8"); - } - - @Test - public void testXcodeVersion_iosVersionOverride() throws Exception { - scratch.file("test/BUILD", - "xcode_version(name = 'my_xcode', version = '15.2', default_ios_sdk_version='17.8')", - "ios_device(name = 'foo', type = 'IPHONE_6', ios_version='98.7', xcode = ':my_xcode')"); - useConfiguration("--xcode_version=7.3", "--ios_sdk_version=42.3"); - - assertXcodeVersion("//test:foo", "15.2"); - assertIosVersion("//test:foo", "98.7"); - } - - @Test - public void testType() throws Exception { - scratch.file("test/BUILD", - "ios_device(name = 'foo', type = 'IPHONE_6',)"); - - assertThat(view.hasErrors(getConfiguredTarget("//test:foo"))).isFalse(); - - ConfiguredTarget target = getConfiguredTarget("//test:foo"); - IosDeviceProvider provider = target.get(IosDeviceProvider.SKYLARK_CONSTRUCTOR); - assertThat(provider.getType()).isEqualTo("IPHONE_6"); - } - - @Test - public void testIosDeviceAttributesCanBeReadFromSkylark() throws Exception { - scratch.file("examples/rule/BUILD"); - scratch.file( - "examples/rule/apple_rules.bzl", - "def my_rule_impl(ctx):", - " ios_device_attr = ctx.attr.ios_device[apple_common.IosDevice]", - " return struct(", - " xcode_version=ios_device_attr.xcode_version,", - " ios_version=ios_device_attr.ios_version,", - " type=ios_device_attr.type", - " )", - "my_rule = rule(implementation = my_rule_impl,", - " attrs = {", - " 'ios_device': attr.label(),", - " },", - ")"); - scratch.file( - "examples/apple_skylark/BUILD", - "package(default_visibility = ['//visibility:public'])", - "load('//examples/rule:apple_rules.bzl', 'my_rule')", - "my_rule(", - " name = 'my_target',", - " ios_device = ':my_device',", - ")", - "ios_device(", - " name = 'my_device',", - " type = 'IPHONE_8',", - " xcode = ':my_xcode',", - " ios_version='98.7'", - ")", - "xcode_version(", - " name = 'my_xcode',", - " version = '15.2'", - ")"); - - RuleConfiguredTarget skylarkTarget = - (RuleConfiguredTarget) getConfiguredTarget("//examples/apple_skylark:my_target"); - assertThat((String) skylarkTarget.get("xcode_version")).isEqualTo("15.2"); - assertThat((String) skylarkTarget.get("type")).isEqualTo("IPHONE_8"); - assertThat((String) skylarkTarget.get("ios_version")).isEqualTo("98.7"); - } - - private void assertXcodeVersion(String label, String version) throws Exception { - assertThat(view.hasErrors(getConfiguredTarget(label))).isFalse(); - - ConfiguredTarget target = getConfiguredTarget(label); - IosDeviceProvider provider = target.get(IosDeviceProvider.SKYLARK_CONSTRUCTOR); - assertThat(provider.getXcodeVersion()).isEqualTo(DottedVersion.fromString(version)); - } - - private void assertIosVersion(String label, String version) throws Exception { - assertThat(view.hasErrors(getConfiguredTarget(label))).isFalse(); - - ConfiguredTarget target = getConfiguredTarget(label); - IosDeviceProvider provider = target.get(IosDeviceProvider.SKYLARK_CONSTRUCTOR); - assertThat(provider.getIosVersion()).isEqualTo(DottedVersion.fromString(version)); - } -} diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryTest.java index 09cb47d7c2..cd511272f4 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryTest.java @@ -80,7 +80,6 @@ public class J2ObjcLibraryTest extends ObjcRuleTestCase { " name = 'transpile',", " deps = ['test'])"); MockObjcSupport.setup(mockToolsConfig); - MockObjcSupport.setupIosSimDevice(mockToolsConfig); MockJ2ObjcSupport.setup(mockToolsConfig); MockProtoSupport.setup(mockToolsConfig); |