johnsundell / swiftplate Goto Github PK
View Code? Open in Web Editor NEWEasily generate cross platform Swift framework projects from the command line
License: MIT License
Easily generate cross platform Swift framework projects from the command line
License: MIT License
Not sure if I'm being stupid here or not, but what's the best way of managing subdependencies with this? For Cocoapods I could specify them in the podspec via s.dependency ...
but can't really install them without a Podfile (something that would require an .xcworkspace as well).
Also those using the framework project built like this will probably have to use my dependency manager of choice as well, which is far from ideal. Is there a way to work around this? Or is it just not practical working with subdependencies when making a framework for use with all three currently used dependency managers?
Hi, π for this tool
I'm running through SwiftPlate, at this Github URL
step
Any GitHub URL that you'll be hosting this project at (for Podspec)? (Leave empty to use the remote URL of your repo: https://github.com/JohnSundell/SwiftPlate)
I think most people use Github now so it's more convenient if we support it directly. My proposal is to ask for Github username
instead, and generate Github URL
as https://github.com/{user_name}/{project_name}
What do you think? I would happily make a PR
Hi,
I'm running through SwiftPlate, on the last step of generating the project, I see that the {PROJECT} placeholder is not being updated. This is the screenshot
This is my terminal
./main.swift
Welcome to the SwiftPlate project generator π£
π¦ Where would you like to generate a project? (Leave empty to use current directory)
/Users/khoa/Downloads/Superman
π What's the name of your project? (Leave empty to use the name of the project folder: Superman)
πΆ What's your name? (Leave empty to use your git config name: Khoa Pham)
π« What's your email address (for Podspec)? (Leave empty to use your git config email: [email protected])
π Any GitHub URL that you'll be hosting this project at (for Podspec)? You may leave this empty.
π’ What's your organization name? You may leave this empty.
---------------------------------------------------------------------
SwiftPlate will now generate a project with the following parameters:
π¦ Destination: /Users/khoa/Downloads/Superman
π Name: Superman
πΆ Author: Khoa Pham
π« Author email: [email protected]
---------------------------------------------------------------------
Proceed? β
(Y/N)
y
π Starting to generate project Superman...
π Removing any previous temporary folder...
β
Done
π Making temporary folder (/Users/khoa/Downloads/Superman/swiftplate_temp)...
β
Done
π Making a local clone of the SwiftPlate repo...
β
Done
π Copying template folder...
β
Done
π Removing temporary folder...
β
Done
π Filling in template...
β
Done
All done! π Good luck with your project! π
I expect the {PROJECT}
placeholder be replaced by Superman
, maybe I miss something π€
I would like to see the template adopt the single scheme/target mentioned in this blog post:
If SwiftPlate is run in a repo that has been cloned from an empty GitHub repo, it will already contain a README.md
and LICENSE
files, which will cause SwiftPlate to error. What should happen is that if any (or both) of those files already exists, SwiftPlate should not attempt to overwrite them.
Noticed that Swift libraries that are to be run on Linux have one slight variation in the testing that is missing from SwiftPlate.
Swift Package Manager (swift package init --type library
) does additionally the following:
In Tests/{PROJECT}Tests/{PROJECT}Tests.swift
it adds:
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
XCTAssertEqual({PROJECT}().text, "Hello, World!")
}
static var allTests : [(String, ({PROJECT}Tests) -> () throws -> Void)] {
return [
("testExample", testExample),
]
}
the example assert is related to boilerplate code in the Sources/ implementation, but the allTests is more interesting, as that is the convention for the slightly different testing flow for Swift encountered under Linux.
For Linux it adds another, related file Tests/LinuxMain.swift
. Its contents:
import XCTest
@testable import {PROJECT}Tests
XCTMain([
testCase({PROJECT}Tests.allTests),
])
Could the "cross-platformness" of SwiftPlate be updated to include libraries on Linux?
Can't generate project if ssh is not setup.
Try to replace [email protected]:JohnSundell/SwiftPlate.git with https://github.com/JohnSundell/SwiftPlate.git
Error output
π Starting to generate project SmartAPI...
π Removing any previous temporary folder...
β
Done
π Making temporary folder (/Users/Amadeu/Developer/swiftplate_temp)...
β
Done
π Making a local clone of the SwiftPlate repo...
β
Done
π Copying template folder...
β
Done
π Removing temporary folder...
β
Done
π Filling in template...
An error was encountered π
Error: Error Domain=NSCocoaErrorDomain Code=264 "The file βA.cpython-36.pycβ couldnβt be opened because the text encoding of its contents canβt be determined." UserInfo={NSFilePath=/Users/Amadeu/Developer/AREPL-vscode/test/manualAreplTests/__pycache__/A.cpython-36.pyc}
Hi, I try to run test using package manager and return this error: error: no tests found to execute, create a module in your 'Tests' directory
Adding a playground to a project generated with SwiftPlate is a bit convoluted, you need to wrap it in a workspace and then create and register in the plist an empty umbrella c header (that swiftplate normally doesn't include).
It would be nice to have all this done automatically when creating the project, if someone else is interested i could implement it.
As suggested by @krzysztofzablocki on Twitter, it would be great if SwiftPlate could suggest to create a new Git Repo in the folder it's generating a project in, if it's not already a repo.
If I will generate project using swiftplate
there isn't path attribute in target in Package.swift. Because of that I am unable to install framework as dependency through package manager.
After adding path: "Sources"
installation is possible.
Hi John,
I'm using the brew
version of SwiftPlate and found a few issues that already have been fixed on master. Looks like a lot of things have been fixed since the last release. Can you consider making a new brew
version?
Hey John!
I tried to generate my first SwiftPlate project today π
I cd
'ed into my Desktop and then run swiftplate
. I have other files in my Desktop and the script failed with the following error.
I expected it to create a new folder with my project name. I think you didn't consider the case where I would like to generate a project in an existing directory with other files. Or maybe it's just that if there are files without standard text encoding (in my case a Sketch file) in the current directory, the script fails.
I expected it to work like Xcode -> New -> Project
does. A brand new folder with the project name is created in the chosen directory.
I'm using SSH authentication for my remote. SwiftPlate defaults to reading my remote, which isn't a valid HTTP(S) URL to be used for the podspec or similar.
π Any GitHub URL that you'll be hosting this project at (for Podspec)? (Leave empty to use the remote URL of your repo: [email protected]:kiliankoe/{projectname})
I use cookiecutter and my custom template for project generation. I guess you have the same problem - it's very hand to update or create a new template. How you do it? It would be great if you add a command for template generation based on existing project. I want to write a script for it, but if you have a plan for it, I'll wait π
Wonder if we could add Quick
and Nimble
as test dependencies, would make the whole process faster! we can use Carthage
for that.
Hi, nice work.
I'm wondering if is it possible to generate one single Framework instead of 4.
Something similar to the old fashion fat libraries.
Hi John,
First of all, thanks for this tool, it has been very helpful for me.
Do you think that an option to enable the "Gather coverage data" for all the testing targets would be useful? Does it suit in this project?
If so, I would like to work on that and prepare a PR.
Currently, SwiftPlate just leaves the temporary directory it creates as one of its first steps if the git clone
of the SwiftPlate repo failed. If there's a failure, we should clean up so that SwiftPlate may be run again.
I have this error when trying to do swiftplate -r ./swiftplate
:
π Starting to generate project Test...
π Removing any previous temporary folder...
β
Done
π Making temporary folder (Test/swiftplate_temp)...
β
Done
π Making a local clone of the SwiftPlate repo...
β
Done
π Copying template folder...
An error was encountered π
Error: Error Domain=NSCocoaErrorDomain Code=260 "The folder βTemplateβ doesnβt exist." UserInfo={NSFilePath=Test/swiftplate_temp/SwiftPlate/Template, NSUserStringVariant=(
Folder
), NSUnderlyingError=0x7f926940afa0 {Error Domain=NSOSStatusErrorDomain Code=-43 "fnfErr: File not found"}}
Maybe I'm missing something ? π€
It work well without the option -r
Could be nice to have setup for CI, i.e. generated .yml etc. Maybe only Travis would be a good start. Keep up the good work π
As suggested by @krzysztofzablocki on Twitter, it would be great if the README file that SwiftPlate generates would contain instructions on how to install the generated framework using CocoaPods, Carthage and the Swift Package Manager.
Not sure if this is a requirement for this project-- or is supported-- but wanted to put an issue out there. It might never be supported.
I do not need this for myself as I can build/run SwiftPlate on macOS, and once I have the boilerplate build, I can use git clones to share in Linux environment.
I tried to build SwiftPlate from recent clone on Linux (Ubuntu 16.04), and get build errors. Most of them look like they are Swift Core library/Foundation related, which is known to be lagging in completeness compared to macOS/*OS.
$ swift ../SwiftPlate/main.swift test
../SwiftPlate/main.swift:56:16: error: value of type 'ObjCBool' (aka 'Bool') has no member 'boolValue'
return objCBool.boolValue
^~~~~~~~ ~~~~~~~~~
../SwiftPlate/main.swift:176:19: error: use of unresolved identifier 'Process'
let process = Process()
^~~~~~~
Foundation.NSProgress:1:12: note: did you mean 'NSProgress'?
open class NSProgress : Foundation.NSObject {
^
Foundation.ProcessInfo:1:12: note: did you mean 'ProcessInfo'?
open class ProcessInfo : Foundation.NSObject {
^
Process
changed to CommandLine
?I didn't really dig much into these errors. Googling the Process()
one yielded something that would appear to related, but after further investigation, I do not think it is: Rename Process to CommandLine [SE-0086] swiftlang/swift@f65c139
The change referred to has been in place for a while on Swift 3 branch.
I was able to confirm that Process is available in Foundation on macOS, but is not present in Foundation on Linux (at this time).
OS: Ubuntu 16.04.1
$ swift --version
Swift version 3.0.1 (swift-3.0.1-RELEASE)
Target: x86_64-unknown-linux-gnu
$ uname -a
Linux vader 4.4.0-49-generic #70-Ubuntu SMP Fri Nov 11 16:40:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Apparently it does not support Linux right now, but it also does not inform what is failing under Ubuntu.
Calling it generates the following:
ββΞ» swiftplate --verbose
Welcome to the SwiftPlate project generator π£
π¦ Where would you like to generate a project? (Leave empty to use current directory)
π What's the name of your project? (Leave empty to use the name of the project folder: bum)
lubaluba
πΆ What's your name?
lf-araujo
π« What's your email address (for Podspec)? You may leave this empty.
π Any GitHub URL that you'll be hosting this project at (for Podspec)? You may leave this empty.
lf-araujo/lubaluba
π’ What's your organization name? You may leave this empty.
---------------------------------------------------------------------
SwiftPlate will now generate a project with the following parameters:
π¦ Destination: /tmp/bum
π Name: lubaluba
πΆ Author: lf-araujo
π GitHub URL: lf-araujo/lubaluba
---------------------------------------------------------------------
Proceed? β
(Y/N)
y
π Starting to generate project lubaluba...
π Removing any previous temporary folder...
β
Done
π Making temporary folder (/tmp/bum/swiftplate_temp)...
β
Done
π Making a local clone of the SwiftPlate repo...
β
Done
π Copying template folder...
An error was encountered π
Error: The operation could not be completed
Hey! Not sure how and if it could work, but would it be possible to install SwiftPlate
via Homebrew? π
Hi there at the moment when I try to use SwiftPlate it fails to download the repo, correct me if I'm doing anything wrong. If you need further info more than happy to help. Just a heads up I normally use gitKrakken client but also have the git client installed, if it's a case of installing git via brew and making sure it's up-to-date I will proceed and feedback.
Thanks!
git version 2.8.4 (Apple Git-73)
DEBUG:
(lldb) expr dump(process.arguments)
([String]?) $R1 = 2 values {
[0] = "-c"
[1] = "git clone https://github.com/JohnSundell/SwiftPlate.git /Users/xxxxx/Documents/Personal Development/swiftplate_temp/SwiftPlate -q"
}
INPUT:
Welcome to the SwiftPlate project generator π£
π¦ Where would you like to generate a project? (Leave empty to use current directory)
/Users/xxxxx/Documents/Personal Development
π What's the name of your project?
Test
πΆ What's your name?
xxxxx xxxxx
π« What's your email address (for Podspec)? You may leave this empty.π Any GitHub URL that you'll be hosting this project at (for Podspec)? You may leave this empty.
SwiftPlate will now generate a project with the following parameters:
π¦ Destination: /Users/xxxxx/Documents/Personal Development
π Name: Test
πΆ Author: xxxxxx xxxxxxxProceed? β (Y/N)
Y
π Starting to generate project Test...
π Removing any previous temporary folder...
β Done
π Making temporary folder (/Users/xxxxx/Documents/Personal Development/swiftplate_temp)...
β Done
π Making a local clone of the SwiftPlate repo...
Too many arguments.usage: git clone [] [--] [
]-v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don't create a checkout --bare create a bare repository --mirror create a mirror repository (implies bare) -l, --local to clone from a local repository --no-hardlinks don't use local hardlinks, always copy -s, --shared setup as shared repository --recursive initialize submodules in the clone --recurse-submodules initialize submodules in the clone --template <template-directory> directory from which templates will be used --reference <repo> reference repository --dissociate use --reference only while cloning -o, --origin <name> use <name> instead of 'origin' to track upstream -b, --branch <branch> checkout <branch> instead of the remote's HEAD -u, --upload-pack <path> path to git-upload-pack on the remote --depth <depth> create a shallow clone of that depth --single-branch clone only one branch, HEAD or --branch --separate-git-dir <gitdir> separate git dir from working tree -c, --config <key=value> set config inside the new repository -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only
β Done
π Copying template folder...
An error was encountered π
Error: Error Domain=NSCocoaErrorDomain Code=260 "The folder βTemplateβ doesnβt exist." UserInfo={NSFilePath=/Users/xxxxx/Documents/Personal Development//swiftplate_temp/SwiftPlate/Template, NSUserStringVariant=(
Folder
), NSUnderlyingError=0x100905080 {Error Domain=NSOSStatusErrorDomain Code=-43 "fnfErr: File not found"}}
Program ended with exit code: 0
Hi, I use Carthage to handle dependencies.
I need use Alamofire and RxSwift for prod, and Nimble and Quick for test.
I add Alamofire and RxSwift to iOS target, and tests still run, but when I add the Quick and Nimble to iOS test target, I get this error when tried to run tests
In the case of macOS target, the same error occurs after add Alamofire or RxSwift to prod target, no in tests target as occurs with iOS
This is the source code, please take a look :D. I don't know if the problem is the template, Carthage or anything else :(
project.zip
Resolving this issue could be helpful for Template development/maintenance and testing.
Noticed as I was testing Template changes that SwiftPlate
always clones from the main GitHub repo. It would be useful to have a command line switch to clone instead from the local clone on the filesystem. Something like --local-clone
If it is running from inside a cloned git repository, and the flag is specified,rather than cloning from GitHub, it could instead git clone
from the local filesystem.
Hi,
I was trying to use the generator and got this error in the generation phase:
Error: Error Domain=NSCocoaErrorDomain Code=264 "The file βUserInterfaceState.xcuserstateβ couldnβt be opened because the text encoding of its contents canβt be determined." UserInfo={NSFilePath=/Users/or/dev/Back/Back.xcodeproj/project.xcworkspace/xcuserdata/or.xcuserdatad/UserInterfaceState.xcuserstate}
Now a second run prints the following error:
Error: Error Domain=NSCocoaErrorDomain Code=516 "βConfigsβ couldnβt be copied to βdevβ because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/or/dev/swiftplate_temp/SwiftPlate/Template/Configs, NSUserStringVariant=( Copy ), NSDestinationFilePath=/Users/or/dev/Configs, NSFilePath=/Users/or/dev/swiftplate_temp/SwiftPlate/Template/Configs, NSUnderlyingError=0x7ff59d6185a0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
I tried deleting /Users/or/dev/swiftplate_temp
but I get the same error.
Let me know if I can provide addional information,
Cheers π»
Or.
Will be good a feature where the users could choose the schemes to be generated in the xcode project.
One solution is by command line argument. For example:
swift swiftplate/main.swift # create all schemes (iOS, macOS, watchOS, tvOS)
swift swiftplate/main.swift --ios # create schemes only for iOS
swift swiftplate/main.swift --ios --tvos # create schemes only for iOS and tvOS
How to add SwiftPlate generated project as dependence for another SwiftPlate generated project?
It it posible?
Hi! SwiftPlate is awesome, thanks for creating it. I was wondering if it makes sense to include a default .gitignore file for Xcode/Swift projects, I've seen other tools like this doing it.
I am assuming this doesn't work with Objective-C projects? If so it would be great if it could. π
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.