Skip to content

Improved error messages for when swiftc, clang, or sysroot can't be found #588

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

Merged
merged 3 commits into from
Aug 29, 2016

Conversation

abertelrud
Copy link
Contributor

No fix-its yet, but they will be added in further diffs.
https://bugs.swift.org/browse/SR-2271

@@ -19,7 +19,7 @@ import var Utility.stderr

public enum Error: Swift.Error {
case noManifestFound
case invalidToolchain
case invalidToolchain(problem: String)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that having a named property here is inconsistent with the other enum values; I will add names to them in a separate diff but wanted to keep this one small. The reason for adding names will become more clear when we add a solution property as well.

@abertelrud
Copy link
Contributor Author

I am going to do local checking on Linux and also check various error conditions before doing a smoke test and a merge.

@abertelrud
Copy link
Contributor Author

abertelrud commented Aug 5, 2016

I would like to add unit tests for this, but we don't seem to have any good structure for testing various invocations of the swift subcommands other than the particular case of building fixtures. This is a piece of infrastructure that we should add.

@abertelrud
Copy link
Contributor Author

@swift-ci please test

@abertelrud
Copy link
Contributor Author

Linux failure is: fatal: unable to access 'https://github.com/apple/swift-corelibs-libdispatch.git/': Could not resolve host: github.com

@@ -14,7 +14,7 @@ import PackageLoading
import Utility

extension Command {
static func compile(swiftModule module: SwiftModule, configuration conf: Configuration, prefix: AbsolutePath, otherArgs: [String], SWIFT_EXEC: String) throws -> Command {
static func compile(swiftModule module: SwiftModule, configuration conf: Configuration, prefix: AbsolutePath, otherArgs: [String], compilerExec: AbsolutePath) throws -> Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should clean up this area to just pass the toolchain around...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I wanted to keep this diff minimal while still doing the basic work of cleaning up the error message, but it make sense to do it as a separate diff in the same PR. I'll do that.

@ddunbar
Copy link
Contributor

ddunbar commented Aug 6, 2016

LGTM, it is unfortunate we won't have test coverage of it though.

@ddunbar
Copy link
Contributor

ddunbar commented Aug 7, 2016

@swift-ci please test os x

@abertelrud
Copy link
Contributor Author

I agree. I forgot where, but it one of the commit messages (I think) I mentioned the reason. We need to add an infrastructure for testing environment settings and other external conditions (e.g. what which returns), as well as command line options.

We have a similar issue in not having testing of the command lines. We definitely need to add testing of that but I didn't want to block this change on that. I'll make sure that there is a JIRA, though.

@abertelrud
Copy link
Contributor Author

One way would be to never call getenv() or shell out to which etc directly, but to always go through a protocol, which could then be mocked up in unit tests to return various boilerplate things. Or we can invoke the built swift-build binary with a PATH that causes it to find a custom which that returns a mock value. But it definitely requires some scaffolding.

@abertelrud
Copy link
Contributor Author

I have updated to top-of-tree and will land after it passes tests (tests seem to get cancelled when you push an update).

@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

…mes and types, and also add comments to document what they are.
…improvements to toolchain loading error messages propagate through the APIs.
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud merged commit 64a4183 into swiftlang:master Aug 29, 2016
@abertelrud abertelrud deleted the error-improvements branch August 29, 2016 18:32
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

Successfully merging this pull request may close these issues.

2 participants