-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow library tool resource handling to be disabled
- Loading branch information
1 parent
57d46ed
commit 0b0b4e0
Showing
6 changed files
with
82 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load("//rules:framework.bzl", "apple_framework") | ||
load("//rules:test.bzl", "ios_unit_test") | ||
load("//rules:precompiled_apple_resource_bundle.bzl", "precompiled_apple_resource_bundle") | ||
|
||
precompiled_apple_resource_bundle( | ||
name = "BundleInDataResources", | ||
bundle_name = "BundleInDataResources", | ||
bundle_id = "com.example.BundleInDataResources", | ||
platforms = {"ios": "12.0"}, | ||
resources = ["fake-data.txt"], | ||
) | ||
|
||
apple_framework( | ||
name = "BundleInDataResourcesFramework", | ||
srcs = ["BundleInData.swift"], | ||
data = [":BundleInDataResources"], | ||
platforms = {"ios": "12.0"}, | ||
library_tools = {"wrap_resources_in_filegroup": None}, | ||
) | ||
|
||
ios_unit_test( | ||
name = "BundleInDataTests", | ||
minimum_os_version = "12.0", | ||
srcs = ["BundleInDataTests.swift"], | ||
deps = [":BundleInDataResourcesFramework"], | ||
) |
13 changes: 13 additions & 0 deletions
13
tests/ios/frameworks/bundle-in-data-resources/BundleInData.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Foundation | ||
|
||
private class BundleInDataBundleFinder {} | ||
|
||
// Helper for finding the bundle named "BundleInDataResources" | ||
public extension Bundle { | ||
static let bundleInDataResources: Bundle = { | ||
let container = Bundle(for: BundleInDataBundleFinder.self) | ||
let bundlePath = container.path(forResource: "BundleInDataResources", ofType: "bundle")! | ||
return Bundle(path: bundlePath)! | ||
}() | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tests/ios/frameworks/bundle-in-data-resources/BundleInDataTests.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
import XCTest | ||
|
||
@testable import BundleInDataResourcesFramework | ||
|
||
class BundleInDataTests: XCTestCase { | ||
|
||
func testBundleInData() throws { | ||
let fakeDataPath = try XCTUnwrap(Bundle.bundleInDataResources.path(forResource: "fake-data", ofType: "txt")) | ||
let fakeDataContents = try XCTUnwrap(String(contentsOfFile: fakeDataPath)) | ||
|
||
XCTAssertEqual( | ||
fakeDataContents, | ||
"fake-data\n" | ||
) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fake-data |