aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/objc/BUILD
blob: d6c833dffe23db593e8b7fc4b54cb98acd1df9b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright 2015 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.

ios_application(
    name = "PrenotCalculator",
    binary = ":PrenotCalculator_binary",
    bundles = [":PrenotCalculatorResources"],
    datamodels = glob(["PrenotCalculator/DataModel.xcdatamodeld/**"]),
    infoplist = "PrenotCalculator/PrenotCalculator-Info.plist",
    visibility = ["//visibility:public"],
    xibs = ["PrenotCalculator/CalculatorViewController.xib"],
)

objc_binary(
    name = "PrenotCalculator_binary",
    srcs = [
        "PrenotCalculator/AppDelegate.m",
        "PrenotCalculator/CalculatedValues.m",
        "PrenotCalculator/CalculatorViewController.m",
        "PrenotCalculator/CoreData.m",
        "PrenotCalculator/Equation.m",
        "PrenotCalculator/Literal.m",
        "PrenotCalculator/ValuesViewController.m",
        "PrenotCalculator/main.m",
    ],
    hdrs = glob(
        ["**/*.h"],
        exclude = ["PrenotCalculator/Expression.h"],
    ),
    sdk_frameworks = ["CoreData"],
    deps = [":ExpressionPrebuilt"],
)

# A prebuilt library that contains multiple architectures.
# Currently compiled for: i386, x86_64, armv7.
objc_import(
    name = "ExpressionPrebuilt",
    hdrs = ["PrenotCalculator/Expression.h"],
    archives = [
        "expression_prebuilt.a",
    ],
)

# Don't use this directly, instead use it to construct ExpressionPrebuilt and
# depend on that instead.
# You can build using the following command:
#    for i in armv7 arm64 i386 x86_64; \
#    do output/bazel build --xcode_version=7.2 --ios_sdk_version=9.2 --ios_cpu=$i examples/objc:ExpressionClasses; \
#    mv bazel-bin/examples/objc/libExpressionClasses.a bazel-bin/examples/objc/libExpressionClasses_$i.a; \
#    done; \
#    xcrun lipo -create bazel-bin/examples/objc/libExpressionClasses_{armv7,arm64,i386,x86_64}.a -output bazel-bin/examples/objc/expression_prebuilt.a \
#    cp bazel-bin/examples/objc/expression_prebuilt.a examples/objc/expression_prebuilt.a
# You may need to adjust the xcode_version and ios_sdk_versions as appropriate.
objc_library(
    name = "ExpressionClasses",
    srcs = [
        "PrenotCalculator/Expression.m",
    ],
    hdrs = ["PrenotCalculator/Expression.h"],
)

objc_bundle_library(
    name = "PrenotCalculatorResources",
    resources = glob(["PrenotCalculator/Resources/**"]),
)

filegroup(
    name = "srcs",
    srcs = glob([
        "**",
        "BUILD",
    ]),
    visibility = ["//examples:__pkg__"],
)