Skip to content

Commit

Permalink
Adds a test_host for executing Promises tests on real iOS devices. (#95)
Browse files Browse the repository at this point in the history
* Updates Bazel Apple rules to 0.13.0 and xctestrunner to 0.2.6.

* Updates Travis before_install steps to manually download Bazel rather than rely on Homebrew. Update to Bazel 0.22.0.

* Adds Tulsi support.

* Adds a test_host for executing Promises tests on a real iOS device.
  • Loading branch information
temrich authored Feb 4, 2019
1 parent 9813858 commit e6dc134
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ os: osx
osx_image: xcode10.1
language: objective-c
install: true
addons:
homebrew:
taps: homebrew/cask-versions
casks: java8
before_install:
- brew update
- brew install bazel
- bazel_version=0.22.0
- bazel_script=/tmp/bazel.sh
- curl -L https://github.com/bazelbuild/bazel/releases/download/$bazel_version/bazel-$bazel_version-installer-darwin-x86_64.sh -o $bazel_script
- chmod +x $bazel_script
- sh $bazel_script --user
- export PATH="$PATH:$HOME/bin"
script:
- bazel shutdown
- bazel version
- bazel test Tests --nokeep_state_after_build --spawn_strategy=standalone --genrule_strategy=standalone --test_strategy=standalone --noshow_progress --noshow_loading_progress --verbose_failures --test_verbose_timeout_warnings --test_output=errors
34 changes: 31 additions & 3 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE"])

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

OBJC_COPTS = [
Expand All @@ -19,6 +19,8 @@ SWIFT_COPTS = [
"-wmo",
]

MINIMUM_OS_VERSION = "8.0"

swift_library(
name = "Promises",
srcs = glob([
Expand Down Expand Up @@ -83,8 +85,8 @@ objc_library(

ios_unit_test(
name = "Tests",
minimum_os_version = "8.0",
test_host = "@build_bazel_rules_apple//apple/testing/default_host/ios",
minimum_os_version = MINIMUM_OS_VERSION,
test_host = ":TestHostApp",
deps = [
":FBLPromisesInteroperabilityTests",
":FBLPromisesPerformanceTests",
Expand All @@ -95,6 +97,32 @@ ios_unit_test(
],
)

ios_application(
name = "TestHostApp",
testonly = 1,
bundle_id = "com.google.promises.TestHost",
families = [
"iphone",
"ipad",
],
infoplists = [
"Promises.xcodeproj/TestHost_Info.plist",
],
minimum_os_version = MINIMUM_OS_VERSION,
deps = [
":TestHost",
],
)

swift_library(
name = "TestHost",
testonly = 1,
srcs = glob([
"Tests/TestHost/*.swift",
]),
copts = SWIFT_COPTS,
)

swift_library(
name = "PromisesTests",
testonly = 1,
Expand Down
68 changes: 68 additions & 0 deletions Promises.tulsiproj/Configs/Promises.tulsigen
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"sourceFilters" : [
"Sources",
"Sources/FBLPromises",
"Sources/FBLPromises/DotSyntax",
"Sources/FBLPromises/include",
"Sources/FBLPromises/include/DotSyntax",
"Sources/FBLPromisesTestHelpers",
"Sources/FBLPromisesTestHelpers/include",
"Sources/Promises",
"Sources/PromisesTestHelpers",
"Tests",
"Tests/FBLPromisesInteroperabilityTests",
"Tests/FBLPromisesPerformanceTests",
"Tests/FBLPromisesTests",
"Tests/PromisesInteroperabilityTests",
"Tests/PromisesPerformanceTests",
"Tests/PromisesTests",
"Tests/TestHost"
],
"buildTargets" : [
"//:FBLPromises",
"//:Promises",
"//:Tests"
],
"projectName" : "Promises",
"optionSet" : {
"BazelBuildOptionsDebug" : {
"p" : "$(inherited)"
},
"BazelBuildStartupOptionsRelease" : {
"p" : "$(inherited)"
},
"LaunchActionPreActionScript" : {
"p" : "$(inherited)"
},
"BazelBuildOptionsRelease" : {
"p" : "$(inherited)"
},
"EnvironmentVariables" : {
"p" : "$(inherited)"
},
"BuildActionPreActionScript" : {
"p" : "$(inherited)"
},
"CommandlineArguments" : {
"p" : "$(inherited)"
},
"TestActionPreActionScript" : {
"p" : "$(inherited)"
},
"TestActionPostActionScript" : {
"p" : "$(inherited)"
},
"BuildActionPostActionScript" : {
"p" : "$(inherited)"
},
"BazelBuildStartupOptionsDebug" : {
"p" : "$(inherited)"
},
"LaunchActionPostActionScript" : {
"p" : "$(inherited)"
}
},
"additionalFilePaths" : [
"BUILD"
]
}
14 changes: 14 additions & 0 deletions Promises.tulsiproj/project.tulsiconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"configDefaults" : {
"optionSet" : {
"ProjectPrioritizesSwift" : {
"p" : "YES"
}
}
},
"projectName" : "Promises",
"packages" : [
""
],
"workspaceRoot" : ".."
}
21 changes: 21 additions & 0 deletions Promises.xcodeproj/TestHost_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
25 changes: 25 additions & 0 deletions Tests/TestHost/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2018 Google Inc. 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.

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
return true
}
}
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.12.0",
tag = "0.13.0",
)

load(
Expand All @@ -25,5 +25,5 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
http_file(
name = "xctestrunner",
executable = 1,
urls = ["https://github.com/google/xctestrunner/releases/download/0.2.5/ios_test_runner.par"],
urls = ["https://github.com/google/xctestrunner/releases/download/0.2.6/ios_test_runner.par"],
)

0 comments on commit e6dc134

Please sign in to comment.