Comments (8)
Maybe we have to check the part for copy frameworks
build phase to fully support the statically linked frameworks with carthage. The only investigation we have to do is configuring the static linkage of the libraries correctly inside the project
Adding support to SPM based project could possibly be more difficult.
from accio.
Short answer: Nope, currently this is not supported.
And actually, I wasn't aware of the fact that the framework authors could decide to make a library static using Carthage, I always thought it's always dynamic. If there's an easy way of altering an Xcode project to produce a static framework rather than a dynamic framework, we could definitely add this feature into Accio though. We are already doing quite some corrections in the XcodeProjectIntegrationService
and could add an option to explicitly change the framework type to static or dynamic if specified via a parameter, which would need to be defined also.
Could you please explain the steps necessary to set the framework type? Is there even a simple way? And would you be up to implementing the change and posting a PR? I'll be on vacation the coming weeks, so I might only be able to have a cursory look and comment. But @fredpi, @JensK611 and @mrylmz might be able to help in the meantime.
from accio.
Yes. I will look into it as soon as I find some time :)
Short answer:
- SPM (seems like) already allows the consumer to select dynamic or static linking. This means that maybe we do not even need to add an option to Accio to select the framework type, as such information may already be in the
Package.swift
file. - In order to generate a static framework with Carthage, the only thing to do is set the
MACH_O_TYPE
build setting in the Xcode project tostaticlib
.
We may have all the necessary things to make this happen :)
Long answer:
- In the SPM it is possible to specify the product type as dynamic or static, or to let the Swift Package Manager choose. From here:
/// A library's product can either be statically or dynamically linked. It
/// is recommended to not declare the type of library explicitly to let the
/// Swift Package Manager choose between static or dynamic linking depending
/// on the consumer of the package.
Seems the SPM allows the consumer to specify how the linking happens, but I did not fully understand how yet. I will need to look into it.
- Carthage supports building a static framework by setting the
MACH_O_TYPE
build setting in the Xcode project tostaticlib
. When integrating the framework into an app, the procedure is the same as with dynamic frameworks, but without adding them to thecarthage copy-frameworks
build phase (Source).
For changing theMACH_O_TYPE
build setting we can manually edit the Xcode project. Another option that I am using at the moment is to wrap the carthage call in the following script (so I do not need to edit the Xcode project of the dependency), which tellsxcodebuild
to override the build settings with the ones specified in thexcconfig
file passed in theXCODE_XCCONFIG_FILE
env variable:
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
echo "MACH_O_TYPE = staticlib" >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
carthage bootstrap --platform ios --no-use-binaries
from accio.
Carthage also supports downloading prebuilt static frameworks (these are built in Objective-C, as Swift will not support static frameworks until module stability in 5.1). For example a Cartfile can declare:
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" == 6.1.0
In the JSON file you see a list of prebuilt frameworks for each version:
{
"6.0.0":"https://dl.google.com/dl/firebase/ios/carthage/6.0.0/Analytics-597265ca9352ba4a.zip",
"6.1.0":"https://dl.google.com/dl/firebase/ios/carthage/6.1.0/Analytics-dba70a4b2638700a.zip",
// ...
}
Carthage just downloads these frameworks for you. They do not need to be added to the Carthage Copy Frameworks phase as they are linked/copied as part of Xcode's normal build process.
As far as I can tell, SPM does not support this in the manifest, so Accio may need to add a supplementary file that it scans for this case.
from accio.
@andrewtheis Swift static frameworks are already supported. From here: Since version 0.30.0 Carthage project rolls out support for statically linked frameworks written in Swift or Objective-C
From what I researched so far, you are right, SPM does not support specifying if the produced framework should be static or dynamic, and Accio will need to get that information somehow.
from accio.
So, how would the consumer of a package specify if it is integrated as a static or dynamic framework? I didn't quite get this from the above comments ... other than that, it reads like we could support this. Is anyone up to implement it?
from accio.
So, how would the consumer of a package specify if it is integrated as a static or dynamic framework?
@Dschee I think there is no final decision on this yet. For now, what seems to be the main proposal is to introduce an accio.yml
/accio.swift
configuration file
EDIT: I just created #54 in order to look into this
from accio.
Closing this, as Accio is now deprecated.
from accio.
Related Issues (20)
- Leverage Swift 5.1 module stability HOT 4
- Dependencies cannot be resolved when the target is in the same Package.swift HOT 5
- Accio is resetting the project it self when using local dependencies
- Missing CFBundleVersion in Info.plist of frameworks HOT 1
- Unable to successfully compile the sample project HOT 2
- No dependencies specified for target ... HOT 3
- Error: The file “Info.plist” couldn’t be opened HOT 2
- accio fails to install dependencies HOT 23
- Accio isn't compatible with certain Package.swift formats
- Add new "Xcode 11 Supplement" mode & Version 1.0.0 HOT 2
- Error installing Accio HOT 2
- Pick a less generic name than `Dependencies` for your folder HOT 9
- Error with dependencies with higher Swift tools version HOT 1
- Support shorthand Semantic Version Strings HOT 2
- $ accio install won't add build phase after re-generate Xcode project HOT 3
- Deprecate Accio in favor of SwiftPM starting with Xcode 12? HOT 7
- Unable to integrate Accio to support simple clone and build in Xcode IDE HOT 1
- Accio checking for wrong output name when copy framework (Facebook iOS SDK) HOT 2
- Homebrew installation broken HOT 4
- [Deleted Spam Title] HOT 1
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 accio.