diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..594ae2c --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --apple_platform_type=ios diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000..91e4a9f --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +6.3.2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 595f6d9..0076e03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,3 +61,11 @@ jobs: run: Scripts/github/prepare-simulators.sh ${{ matrix.platform }} - name: Build run: Scripts/build.swift spm ${{ matrix.platform }} `which xcpretty` + bazel: + name: Bazel + runs-on: macOS-12 + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Build and Test + run: bazel test ParalayoutTests diff --git a/.gitignore b/.gitignore index 53087e2..99d8614 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,7 @@ Pods/ # Swift Package Manager generated/ .build/ -.swiftpm/ \ No newline at end of file +.swiftpm/ + +# Bazel +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..272ac31 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,44 @@ +load( + "@build_bazel_rules_swift//swift:swift.bzl", + "swift_library", + "swift_test", +) + +load( + "@build_bazel_rules_apple//apple:ios.bzl", + "ios_framework", + "ios_unit_test", +) + +swift_library( + name = "Paralayout.lib", + module_name = "Paralayout", + srcs = glob(["Paralayout/**/*.swift"]), + deps = [], +) + +swift_library( + name = "ParalayoutTests.lib", + module_name = "ParalayoutTests", + deps = [":Paralayout.lib"], + srcs = glob(["ParalayoutTests/**/*.swift"]), + testonly = True, +) + +ios_framework( + name = "Paralayout", + deps = [":Paralayout.lib"], + visibility = ["//visibility:public"], + bundle_id = "com.squareup.Paralayout", + infoplists = ["Paralayout/Info.plist"], + minimum_os_version = "12.0", + families = ["iphone", "ipad"], +) + +ios_unit_test( + name = "ParalayoutTests", + deps = [":ParalayoutTests.lib"], + bundle_name = "ParalayoutTests", + minimum_os_version = "12.0", + runner = "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner", +) \ No newline at end of file diff --git a/Paralayout/Info.plist b/Paralayout/Info.plist index fbe1e6b..609619b 100644 --- a/Paralayout/Info.plist +++ b/Paralayout/Info.plist @@ -17,7 +17,7 @@ CFBundleShortVersionString 1.0 CFBundleVersion - $(CURRENT_PROJECT_VERSION) + 1.0 NSPrincipalClass diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 0000000..b7013e7 --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,35 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "build_bazel_rules_apple", + sha256 = "8ac4c7997d863f3c4347ba996e831b5ec8f7af885ee8d4fe36f1c3c8f0092b2c", + url = "https://github.com/bazelbuild/rules_apple/releases/download/2.5.0/rules_apple.2.5.0.tar.gz", +) + +load( + "@build_bazel_rules_apple//apple:repositories.bzl", + "apple_rules_dependencies", +) + +apple_rules_dependencies() + +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() + +load( + "@build_bazel_apple_support//lib:repositories.bzl", + "apple_support_dependencies", +) + +apple_support_dependencies()