Download source code:
git clone -b source-only https://github.com/bazelbuild/examples
cd into forder examples/tutorial and make file WORKSPACE by terminal:
touch WORKSPACE
Open WORKSPACE and type:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.31.3", | |
) | |
git_repository( | |
name = "build_bazel_rules_swift", | |
remote = "https://github.com/bazelbuild/rules_swift.git", | |
tag = "0.23.0", | |
) | |
git_repository( | |
name = "build_bazel_apple_support", | |
remote = "https://github.com/bazelbuild/apple_support.git", | |
tag = "0.11.0", | |
) | |
git_repository( | |
name = "bazel_skylib", | |
remote = "https://github.com/bazelbuild/bazel-skylib.git", | |
tag = "1.0.3", | |
) |
cd into ios-app and make BUILD file:
touch BUILD
Open BUILD file and type:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") | |
objc_library( | |
name = "UrlGetClasses", | |
srcs = [ | |
"UrlGet/AppDelegate.m", | |
"UrlGet/UrlGetViewController.m", | |
"UrlGet/main.m", | |
], | |
hdrs = glob(["UrlGet/*.h"]), | |
data = ["UrlGet/UrlGetViewController.xib"], | |
) | |
ios_application( | |
name = "ios-app", | |
bundle_id = "Google.UrlGet", | |
families = [ | |
"iphone", | |
"ipad", | |
], | |
minimum_os_version = "9.0", | |
infoplists = [":UrlGet/UrlGet-Info.plist"], | |
visibility = ["//visibility:public"], | |
deps = [":UrlGetClasses"], | |
) |
On this file:
objc_library(
name = "UrlGetClasses",
srcs = [
"UrlGet/AppDelegate.m",
"UrlGet/UrlGetViewController.m",
"UrlGet/main.m",
],
hdrs = glob(["UrlGet/*.h"]),
data = ["UrlGet/UrlGetViewController.xib"],
)
This script make 1 library objective-c with name UrlGetClasses, include files .m in forder UrlGet. header file in hdrs, data file is .xib.
Make .ipa file with rule:
ios_application(
name = "ios-app",
bundle_id = "Google.UrlGet",
families = [
"iphone",
"ipad",
],
minimum_os_version = "9.0",
infoplists = [":UrlGet/UrlGet-Info.plist"],
visibility = ["//visibility:public"],
deps = [":UrlGetClasses"],
)
Build app by:
bazel build //ios-app:ios-app
It make logs:

The output here:
bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-e637a0adc749/bin/ios-app/ios-app.ipa