Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no targets found for file layout #18

Closed
abiaad opened this issue Feb 16, 2016 · 7 comments
Closed

no targets found for file layout #18

abiaad opened this issue Feb 16, 2016 · 7 comments

Comments

@abiaad
Copy link
Contributor

abiaad commented Feb 16, 2016

Hi,

Stupid question and not especially relative to blackfish but this is with your library I'm testing packages ...
Inside my project folder I created a Package.swift :

import PackageDescription

let package = Package (
    name: "Blackfish",
    dependencies: [
        .Package(url: "https://github.com/elliottminns/blackfish", majorVersion: 0),
    ]
)

When I run swift build I have this output error : error: no targets found for this file layout
I'm sure I'm doing something very wrong but can't find what ...

Any help please ? 😅

@elliottminns
Copy link
Owner

I think one of the main problems is that you're naming that Package Blackfish also, so when the compiler builds the project, it overwrites the Blackfish symbols with your own symbols. Also you should use .git at the end of the package URL.

I'd suggest changing your Package.swift to look like below:

import PackageDescription

let package = Package (
    name: "BlackfishApp",
    dependencies: [
        .Package(url: "https://github.com/elliottminns/blackfish.git", majorVersion: 0)
    ]
)

The other problem you're having is that you don't have a Sources folder set up, so the compiler can't find any files to build. If you're creating an executable target, you'll need your project setup to look like this:

MyApp
├── Sources
│   └── main.swift
└── Package.swift

This should allow it to build, you'll need to create a Blackfish instance in your main.swift for the server to start running also.

main.swift
import Blackfish

let app = Blackfish() 

app.listen(port: 3000) { error in 
    if error == nil {
        print("Server started on port 3000")
    }
}

let me know if this helps.

@abiaad
Copy link
Contributor Author

abiaad commented Feb 16, 2016

Thanks, I got it !
Build process is executing until I get : (running on Ubuntu 15.10x64 DigitalOcean)

Compiling Swift Module 'Blackfish' (21 sources)
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:16:28: error: use of undeclared type 'DriverType'
    var pathTree: PathTree<DriverType.Handler> { get }
                           ^~~~~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:16:28: error: use of undeclared type 'DriverType'
    var pathTree: PathTree<DriverType.Handler> { get }
                           ^~~~~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:16:28: error: use of undeclared type 'DriverType'
    var pathTree: PathTree<DriverType.Handler> { get }
                           ^~~~~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:16:28: error: use of undeclared type 'DriverType'
    var pathTree: PathTree<DriverType.Handler> { get }
                           ^~~~~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:9:18: error: use of undeclared type 'Handler'
    var handler: Handler { get }
                 ^~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:9:18: error: use of undeclared type 'Handler'
    var handler: Handler { get }
                 ^~~~~~~
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:6:5: error: expected declaration
    associatedtype Handler
    ^
ServerApp/Packages/blackfish-0.1.5/Sources/RouteDriver.swift:14:5: error: expected declaration
    associatedtype DriverType: Driver
    ^
<unknown>:0: error: build had 1 command failures
error: exit(1): ["swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swift-build-tool", "-f", "ServerApp/.build/debug/Blackfish.o/llbuild.yaml"]

@elliottminns
Copy link
Owner

You may need to use a more recent version of swift 2.2.

associatedtype was implemented to replace typealias, which has now been deprecated for protocols. The version of swift I'm building with is the most recent snapshot 2016-02-08

@abiaad
Copy link
Contributor Author

abiaad commented Feb 16, 2016

I first use the last release but seems swift-build disappeared 👍

error: unable to invoke subcommand: /usr/abiaad/swift-2.2-SNAPSHOT-2016-02-08-a-ubuntu15.10/usr/bin/swift-build (No such file or directory)

@elliottminns
Copy link
Owner

They removed it from the Swift 2.2 branch, the latest development snapshot has it in still

@abiaad
Copy link
Contributor Author

abiaad commented Feb 16, 2016

Ok this is working ! Thanks a lot 👏

@abiaad abiaad closed this as completed Feb 16, 2016
@elliottminns
Copy link
Owner

No problem! Please let me know if there's anything else I can help with :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants