Skip to content

Commit

Permalink
Example
Browse files Browse the repository at this point in the history
  • Loading branch information
omarzl committed Oct 16, 2021
0 parents commit 3c1874a
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build --apple_platform_type=ios
build --verbose_failures
build --use_top_level_targets_for_symlinks
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.1.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
13 changes: 13 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

swift_library(
name = "MyLib",
srcs = glob(["Sources/*.swift"]),
copts = [
"-Xcc",
"-fmodule-map-file=Sources/Dummy.modulemap",
],
data = ['Sources/Dummy.modulemap', 'Sources/Dummy-umbrella.h'],
module_name = "MyLib",
visibility = ["//visibility:public"],
)
15 changes: 15 additions & 0 deletions Sources/Dummy-umbrella.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif


FOUNDATION_EXPORT double DummyVersionNumber;
FOUNDATION_EXPORT const unsigned char DummyVersionString[];
6 changes: 6 additions & 0 deletions Sources/Dummy.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Dummy {
umbrella header "Dummy-umbrella.h"

export *
module * { export * }
}
10 changes: 10 additions & 0 deletions Sources/OtherClass.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import UIKit

class OtherClass {

private let vc: UIViewController

init() {
vc = UIViewController()
}
}
10 changes: 10 additions & 0 deletions Sources/SomeClass.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import UIKit

class SomeClass {

private let vc: UIViewController

init() {
vc = UIViewController()
}
}
21 changes: 21 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_swift",
sha256 = "4f167e5dbb49b082c5b7f49ee688630d69fb96f15c84c448faa2e97a5780dbbc",
url = "https://github.com/bazelbuild/rules_swift/releases/download/0.24.0/rules_swift.0.24.0.tar.gz",
)

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel build //:MyLib

0 comments on commit 3c1874a

Please sign in to comment.