Skip to content

Throw error if debug.yaml not found #153

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
Feb 29, 2016
Merged

Conversation

aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Feb 27, 2016

Shows error this error if swift test is run before swift build

error: build the package using `swift build` before running tests

instead of

<unknown>:0: error: unable to attach DB: unable to open database
error: exit(1): swift-build-tool -f /Users/aciid/mycode/test/MyPackage/.build/debug.yaml test

@czechboy0
Copy link
Member

Is there a reason to not automatically run swift build as the first step of swift test? To me running build, then test, then changing some test code and running test again - I'd assume that the changes would be applied. But since testing doesn't rebuild it doesn't, which initially confused me and I wonder whether it's not going to be confusing to newcomers as well.

I'd probably propose to automatically run build as the first step of test. Or is there a reason not to?

@aciidgh
Copy link
Contributor Author

aciidgh commented Feb 27, 2016

agreed, Utilities/bootstrap test also builds if not already built instead of exiting with error.
@mxcl suggestions?

@mxcl
Copy link
Contributor

mxcl commented Feb 27, 2016

@czechboy0 we may change it. As it stands things are more flexible if you can control when the build happens entirely.

@@ -24,6 +24,8 @@ do {
setenv("SPM_INSTALL_PATH", dir.build, 0)

let yamlPath = Path.join(dir.build, "debug.yaml")
if !yamlPath.exists { throw Error.DebugYAMLNotFound }
Copy link
Contributor

Choose a reason for hiding this comment

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

guard seems more appropriate to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

return "build the package using `swift build` before running tests"
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there's no newline at the end of this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@czechboy0
Copy link
Member

@mxcl Makes sense. The way I think of it is in Xcode, the "easier" action is Run and Test, which actually mean Build+Run and Build+Test. Then you can trigger Run Without Building & Test Without Building manually, but that's more work.
In the same way I'd imagine we'd change the default here to build before testing, but we'd also add a flag to just test, something like swift build --test --no-rebuild or similar.

mxcl added a commit that referenced this pull request Feb 29, 2016
Throw error if `debug.yaml` not found
@mxcl mxcl merged commit 8f1a3ee into swiftlang:master Feb 29, 2016
@aciidgh aciidgh deleted the tests_yaml_check branch February 29, 2016 18:01
aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
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.

4 participants