Comments (11)
Dynamic, currently adding Buck onto a project that we've split out to a number of modules prebuilt with Carthage. Should be able to take a look at this in the next day or two.
from bucksample.
I think this could be solved by no longer using libraries
and instead declare your pre-built libraries directly as deps
. I’m not positive though. Can confirm next week, but I think we moved from libraries
recently due to a conversation in the Buck Slack.
Either way, we should have an example of a pre-built library in this repo.
from bucksample.
Ah, I think I misread the OP here. @dharr419-ford looks like you're saying that you are already declaring your precompiled libraries as deps
, but they aren't being embedded transitively into your CI test target. Is your precompiled a library a static library or a dynamic library? I haven't seen this behavior before, so I'm trying to get a better sense of the issue.
from bucksample.
In #46, it didn't seem like I needed to do anything special in apple_test_all
to support the SwiftWithPrecompiledDependency
library. I'm curious how your configuration differs!
from bucksample.
So here's a simple way to reproduce the usual Library not loaded
crash:
Cartfile:
github "krzyzanowskim/CryptoSwift"
Carthage/Buck:
prebuilt_apple_framework(
name = "CryptoSwift",
framework = "Build/iOS/CryptoSwift.framework",
preferred_linkage = "shared",
visibility = ["PUBLIC"],
)
Libraries/SwiftWithPrecompiledDependency/BUCK:
load("//Config:buck_rule_macros.bzl", "first_party_library", "mlmodel_resource")
first_party_library(
name = "SwiftWithPrecompiledDependency",
deps = [
"//Pods:Fabric",
"//Carthage:CryptoSwift",
],
)
Libraries/SwiftWithPrecompiledDependency/SwiftWithPrecompiledDependencyClass.swift:
import Fabric
import CryptoSwift
public class SwiftWithPrecompiledDependencyClass {
public static var isFabricInDebugMode: Bool {
return Fabric.sharedSDK().debug
}
public func printCryptoThings() {
let data = Data(bytes: [0x01, 0x02, 0x03])
print("Crypto: \(data)")
}
}
Run carthage update
and then buck test Libraries/SwiftWithPrecompiledDependencyClass
and you'll get what I usually expect in Library not loaded: @rpath/CryptoSwift.framework/CryptoSwift
.
I'm guessing there's some way to update the LD_RUNPATH_SEARCH_PATHS for this but I'm confused as to why it's needed for this but works fine the precompiled Pod
from bucksample.
Oh no. That there are differences between precompiled Carthage frameworks and precompiled Pods frameworks is absurdly frustrating. Let me play with the diff you just sent. Thank you for the explanation!
from bucksample.
This is a rough one. You're right that libraries compiled via Carthage in the deps
list aren't transitively included in the test targets when the test is executed from Buck's command line interface.
After more investigation, it seems like building with Carthage creates a framework that isn't automatically included in test targets (though admittedly that sentence sounds crazy at face value). I don't yet understand why the pre-built Fabric library works, but a Carthage-build framework doesn't. Note I can use Carthage to bring in a pre-built Fabric framework (Carthage doesn't compile the framework, but rather downloads a pre-built version) and it works just fine.
from bucksample.
Huh, our experience is that anything pre-compiled in any way we've, within Xcode, had to embed the framework in the test targets or set the Runpath Search Paths to also include $(FRAMEWORKS_SEARCH_DIR), which we usually do because it reduces the size of the xctest bundles quite a bit (our apps are currently built out of a number of modules we precompile with Carthage). This holds for whether it's a Carthage built framework or something precompiled shipped to us by another team or pulled within Carthage.
But if I'm reading you right, the precompiled Fabric framework works fine?
from bucksample.
@thedavidharris: #46 seems to be working with a precompiled library, without a separate embed step. But I'm unable to get another precompiled library working without a separate embed step. I don't fully understand how #46 works, but I won't merge it + consider this task done until I do / add some reproduction steps.
from bucksample.
@dfed Fabric uses static libraries inside a .framework
folder structure. Perhaps that is part of it?
from bucksample.
Aha! That would explain why I can only get Fabric
to work without additional changes. With that information, I'm going to close #46, and give it another shot with a Carthage lib. This will certainly require more changes 😬
from bucksample.
Related Issues (20)
- Update CI to Xcode 10 HOT 8
- Issues with importing *-Swift.h in an apple_binary() HOT 4
- XCode 11 issues with `UICollectionViewDiffableDataSourceCellProvider` HOT 1
- [Feature Request] Basic build caching on CI
- Running Buck on 32bit simulators HOT 5
- Running on iPhone X or higher (arm64e) HOT 2
- Question about Embedded Binaries (Carthage frameworks) in generated Xcode workspace HOT 2
- [Question] Local build time with Xcode project HOT 2
- [Question] How to deal with resources/localization keys?
- Tests take 15 seconds to run, if run individually HOT 9
- [Question] How to know when a test result is cached? HOT 4
- Running `make test` fails with Xcode 11.1 HOT 4
- Precompiled Library Issue (no such module) HOT 2
- Modify Swift method implementation shouldn't cause rebuilding its dependents HOT 2
- Add example of App Clip HOT 1
- make test meeting some mistake
- Get Hosted App testing working and reenable it
- linker flags error in cxx_library and "-I $(location //targets:myrule)" preprocessor flags
- Is it supported on Linux?
- [PSA] Airbnb iOS has migrated to Bazel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bucksample.