Re: [swift-users] package graphroot error

2017-10-11 Thread Ankit Agarwal via swift-users
Hey,

There is no command called swift tools in the official Swift snapshots.
This sounds like a question for swiftenv project.

On Sun, Oct 1, 2017 at 10:28 AM, Muhammad Tahir Vali via swift-users <
swift-users@swift.org> wrote:

> Hello,
>
> I've updated to swift 4.0 and downloaded a CL tool swiftenv . Mixing and
> debugging with different versions , I may have messed up my swift
> environment variables and ultimately deleted my swift-tools. How do I
> safely default everything back to working form?
>
> swift tools --version
>
> error: unable to invoke subcommand: /Library/Developer/Toolchains/
> swift-4.0-RELEASE.xctoolchain/usr/bin/swift-tools (No such file or
> directory)
>
>
> --
> Best Regards,
>
> Muhammad T. Vali
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Debugging XCTests on Linux

2017-01-06 Thread Ankit Agarwal via swift-users
Yes you should be able to import Foundation in REPL using the latest
toolchain on linux. FWIW I am getting same error you are from latest
toolchain:

root@4027f71e87ff:/swiftpm# swift -I .build/debug -L .build/debug -lResult
-I /usr/lib/clang/3.8/include
Welcome to Swift version 3.1-dev (LLVM c3e057b06a, Clang 0540ceb7ad, Swift
093e275775). Type :help for assistance.
  1> import Foundation
  2> import Result
  3> let r = Result("a")
r: Result.Result = success {
  success = "a"
}
  4> let nse = NSError(domain: "Foo", code: 42, userInfo: nil)
nse: Foundation.NSError = {
  Foundation.NSObject = {}
  _domain = "Foo"
  _code = 42
  _userInfo = nil
}
  5> let ae = AnyError(nse)
ae: Result.AnyError = {
  error = 

}
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
  6> ae
$R0: Result.AnyError = {
  error = {
instance_type = 0x
  }
}


On Fri, Jan 6, 2017 at 5:50 PM, Robert Atkins <
ratkins+swift-us...@fastmail.fm> wrote:

> On Fri, 6 Jan 2017, at 11:14, Ankit Agarwal wrote:
>
> Thats weird, you should be able to import Foundation from the toolchain
>
>
> This is on Linux, so the toolchain stuff isn't relevant, is it?
>
> Cheers, Robert.
>



-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Debugging XCTests on Linux

2017-01-06 Thread Ankit Agarwal via swift-users
Thats weird, you should be able to import Foundation from the toolchain

On Fri, Jan 6, 2017 at 4:28 PM, Robert Atkins <
ratkins+swift-us...@fastmail.fm> wrote:

> On Fri, 6 Jan 2017, at 09:45, Ankit Agarwal wrote:
>
> Might be, please file a JIRA with a minimal test case!
>
>
> As a first step I'm attempting to see if I get the same behaviour with the
> latest Swift snapshot release but I'm having difficulty there too. Simply
> downloading and un-tarring the Jan 4th snapshot and adding it to my path
> (as described in https://swift.org/download/#using-downloads) gets me a
> running swift 3.1-dev REPL but I can't import Foundation because it doesn't
> know where to find its libs. I can't add them to the library search paths
> with -F/-I/-L via the command line and invoke spm at the same time to build
> Result either (see upthread).
>
> Is there another environment variable I can use to set swift's framework
> search path?
>
> Cheers, Robert.
>



-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Debugging XCTests on Linux

2017-01-06 Thread Ankit Agarwal via swift-users
Might be, please file a JIRA with a minimal test case!

On Fri, Jan 6, 2017 at 3:11 PM, Robert Atkins <
ratkins+swift-us...@fastmail.fm> wrote:

> On Thu, 5 Jan 2017, at 18:13, Ankit Agarwal wrote:
>
> Using swift module in REPL:
>
>
> [...]
>
> $ swift build
> $ swift -I .build/debug -L .build/debug -lResult -I
> /usr/lib/clang/3.8/include
> Welcome to Swift version 3.1-dev (LLVM 217eb6c2b6, Clang 34a98ce92e, Swift
> 1eb5648c46). Type :help for assistance.
>   1> import Result
>   2> let a = Result("a")
> a: Result.Result = success {
>   success = "a"
> }
>
>
> Oh wait, this works for me! It was the specific thing I was trying to do
> (wrapping an NSError instance in an AnyError) that breaks which was leading
> me to think importing the Result library into the REPL wasn't working:
>
> $ swift -I.build/debug -L.build/debug -lResult
>
> Welcome to Swift version 3.0.2 (swift-3.0.2-RELEASE). Type :help for
> assistance.
>   1> import Foundation
>   2> import Result
>   3> let r = Result("a")
> r: Result.Result = success {
>   success = "a"
> }
>   4> let nse = NSError(domain: "Foo", code: 42, userInfo: nil)
> nse: Foundation.NSError = {
>   Foundation.NSObject = {}
>   _domain = "Foo"
>   _code = 42
>   _userInfo = nil
> }
>   5> let ae = AnyError(nse)
> ae: Result.AnyError = {
>   error = 
>
> }
> Execution interrupted. Enter code to recover and continue.
> Enter LLDB commands to investigate (type :help for assistance.)
>   6>
>
> So it looks like I have a Foundation on Linux bug? I will do what the REPL
> suggests and see if I can figure out what's going on.
>
> Thanks, Robert.
>



-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Debugging XCTests on Linux

2017-01-05 Thread Ankit Agarwal via swift-users
Using swift module in REPL:


Toolchain: January 4, 2017
Platform: Ubuntu 16.04

Add this at end of Package.swift:

```
products += [Product(name: "Result", type: .Library(.Dynamic), modules:
"Result")]
```

$ swift build
$ swift -I .build/debug -L .build/debug -lResult -I
/usr/lib/clang/3.8/include
Welcome to Swift version 3.1-dev (LLVM 217eb6c2b6, Clang 34a98ce92e, Swift
1eb5648c46). Type :help for assistance.
  1> import Result
  2> let a = Result("a")
a: Result.Result = success {
  success = "a"
}
  3> a.dematerialize()
$R0: String = "a"

PS: Make sure you pass these flags when launching docker bash:
"--security-opt seccomp=unconfined"




On Thu, Jan 5, 2017 at 3:33 PM, Robert Atkins via swift-users <
swift-users@swift.org> wrote:

> Hi all,
>
> I'm trying to solve a simple (?) problem where a test suite runs fine on
> macOS but fails on Linux
> (https://github.com/antitypical/Result/pull/210#pullrequestreview-14963305
> ).
> I've downloaded and installed the Swift Linux Docker image
> (https://ashfurrow.com/blog/swift-on-linux/) and got the project
> building and testing, and, mercifully, I get the same failure locally as
> I'm getting on Travis CI. But at this point I'm stuck.
>
> 1) I can't get the SPM-built module the project produces working
> properly in the Swift REPL in order to just play around with it
> (https://bugs.swift.org/browse/SR-1191). Can anyone help me with this?
>
> 2a) How do I use LLDB to set a breakpoint in a test method and step into
> its execution so I can trace through the source of the test failure?
> Saying "lldb swift test" does something, but doesn't know about any of
> the lines I'm trying to set a breakpoint on—I suspect it thinks I'm
> trying to set breakpoints in the swift binary itself, rather than the
> test suite?
>
> 2b) Saying "swift -warnings-as-errors test" doesn't seem to do what I
> want, complaining about "no such file or directory: 'test'", whereas
> "swift test" works fine. Is there a way to pass flags to the swift
> interpreter when it runs tests?
>
> Thanks, Robert.
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>



-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] question about swift and c callbacks

2017-01-05 Thread Ankit Agarwal via swift-users
I simplified your example package and posted a bug report here:
https://bugs.swift.org/browse/SR-3556

On Thu, Jan 5, 2017 at 9:59 PM, Yang Yang via swift-users <
swift-users@swift.org> wrote:

> sorry, i made mistake on compiling. It still report the same link error.
>
> Yang
>
> On Wed, Jan 4, 2017 at 11:20 PM Yang Yang  wrote:
>
>> Thanks.
>> It compiled successfully now under linux.
>>
>>
>> 2017-01-04 12:29 GMT-06:00 Joe Groff :
>>
>>
>>
>>
>> > On Dec 30, 2016, at 11:17 AM, Yang Yang via swift-users <
>> swift-users@swift.org> wrote:
>>
>>
>> >
>>
>>
>> > I try to wrap a c library in swift package named Test.
>>
>>
>> > The code looks like this:
>>
>>
>> >
>>
>>
>> > Test1.h
>>
>>
>> >
>>
>>
>> > struct MyParams {
>>
>>
>> >   int (*func)();
>>
>>
>> > };
>>
>>
>> >
>>
>>
>> > typedef struct MyParams MyParams;
>>
>>
>> >
>>
>>
>> > Test2.h
>>
>>
>> > #include "Test1.h"
>>
>>
>> >
>>
>>
>> > static int test(){
>>
>>
>> >   return 0;
>>
>>
>> > }
>>
>>
>> >
>>
>>
>> > void myTest()
>>
>>
>> > {
>>
>>
>> >   MyParams params;
>>
>>
>> >   params.func = test;
>>
>>
>> > }
>>
>>
>> >
>>
>>
>> >
>>
>>
>> > Then I try to import the package into swift code and use
>>
>>
>> > in Test.swift.
>>
>>
>> > 
>>
>>
>> > import Test
>>
>>
>> >
>>
>>
>> > class TestSwift {
>>
>>
>> >   func runtest(){
>>
>>
>> > myTest()
>>
>>
>> >   }
>>
>>
>> > }
>>
>>
>> >
>>
>>
>> > However, the compiler report link error:
>>
>>
>> > function myTest: error: undefined reference to 'test'
>>
>>
>> >
>>
>>
>> > If I comment out
>>
>>
>> > "params.func = test;" in myTest.
>>
>>
>> >
>>
>>
>> > It successfully build. How should I handle this situation?
>>
>>
>>
>>
>>
>> Try making `test` static inline instead of just static.
>>
>>
>>
>>
>>
>> -Joe
>>
>>
>>
>>
>>
>>
>>
>>
>>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Monorepo workflow using SPM

2016-11-03 Thread Ankit Agarwal via swift-users
+swift-build-dev

Not right now but we're considering adding support for multiple packages in
a repository. It would be good if you can explain your
requirements/features/flow are you looking for.

On Friday 4 November 2016, Georgios Moschovitis via swift-users <
swift-users@swift.org> wrote:

> The Swift Package Manager is a great addition to the Swift programmer's
> toolbelt and in general I like the integration with Git.
>
> However, since SPM promotes a separate Git repo per package and actually
> leverages Git tags to resolve dependency versions, I am wondering if it's
> possible to use the popular(?) 'monorepo' workflow with SPM.
>
> thanks,
> -g.
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] SwiftPM: How to verify that PKG_CONFIG_PATH is being used

2016-09-29 Thread Ankit Agarwal via swift-users
Hi,

SwiftPM finds the first matching .pc file in the list of search paths,
unfortunately the environment variable PKG_CONFIG_PATH was last in the
list. It was corrected in this commit:
https://github.com/apple/swift-package-manager/commit/ac0479653032ded2efa1d71ab290d5b8d66c0e82
Can you try with a recent snapshot and check if the environment variable is
being respected?

On Thu, Sep 29, 2016 at 11:35 PM, Jerry Carter via swift-users <
swift-users@swift.org> wrote:

>
> Newbie question.  How can I tell that PKG_CONFIG_PATH is being respected?
>
> I am using Swift 3.0 (swiftlang-800.0.49) under OS X.  I do not have
> pkg-config installed.  I have specified the PKG_CONFIG_PATH environment
> variable and have validated the .pc files at that location.  The project
> builds but the resulting binary links to a different library — according to
> otool, the path is /usr/lib rather than that specified in my .pc file.
> I’ve tried ’swift build -v’ and do not see the directory that I specified
> using PKG_CONFIG_PATH.
>
> Not sure what to try next.  Thanks.
>
> -=- Jerry
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>



-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] SPM: Subfolders in a Module

2016-09-15 Thread Ankit Agarwal via swift-users
On Fri, Sep 16, 2016 at 12:21 AM, Toni Suter via swift-users <
swift-users@swift.org> wrote:

> Hi everyone,
>
> Let's assume there's a Swift package with the following Layout:
>
> MyPackage/
> ├── Package.swift
> └── Sources
> └── MyModule
> ├── SubFolder
> │   └── MyClass.swift
> └── main.swift
>
> As far as I can tell, there's still just one module called MyModule and
> the subfolder doesn't create
> a nested module or something like that. Is that correct? Do only top level
> folders in the Sources directory
> become modules?
>


Yup thats correct, in this case there will be one executable module named
`MyModule` with sources being `SubFolder/MyClass.swift` and `main.swift`.


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Guide on how to use Swift Package Manager

2016-08-13 Thread Ankit Agarwal via swift-users
There has been some progress towards better documentation, but there is
still a lot to be done. Here are some current references (which might need
updates..)
https://github.com/apple/swift-package-manager/blob/master/Documentation/Usage.md#build-an-executable
https://swift.org/package-manager/#example-usage
https://swift.org/package-manager/

Basically SwiftPM has three commands: swift build, swift package and swift
test
You can see available options on each using --help option.

$ swift package --help

To create an executable:

$ mkdir myPackage && cd myPackage
$ swift package init --type executable
$ swift build
$ .build/debug/myPackage

some JIRAs tracking this:
https://bugs.swift.org/browse/SR-2304
https://bugs.swift.org/browse/SR-2179


On Sat, Aug 13, 2016 at 2:39 PM, Adrian Brink via swift-users <
swift-users@swift.org> wrote:

> Hi,
>
> so I would like to write a small CLI in Swift and use the Swift Package
> Manager.
>
> However, I have a hard time finding resources that explain, which versions
> of Swift support it exactly, what the init command is and where to go from
> there.
>
> All I have found are these two resources:
> https://github.com/apple/swift-package-manager
> https://github.com/apple/swift-package-manager/tree/master/Documentation
>
> Is there something like this:
> https://docs.npmjs.com/
> https://doc.rust-lang.org/book/getting-started.html
>
> I think this is crucial if we want to get new people to try out the open
> source version of Swift because these tutorials are what people have come
> to expect when approaching a new language.
>
> If there is, I would appreciate it if we could share it and if there isn't
> it would be nice if we, as a community, could create something like this,
> or at least one README page that walks through the initial flow.
>
> If someone is interested let me know and then we can try and make it work.
>
> Sent from Nylas N1
> ,
> the extensible, open source mail client.
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift Build in Xcode 7.3

2016-04-06 Thread Ankit Agarwal via swift-users
swift build is not included in swift 2.2, it'll be released with swift 3
You can grab the Trunk development (master) snapshots from
https://swift.org/download/#snapshots

On Wed, Apr 6, 2016 at 12:54 PM, Nikhil Pagidala via swift-users <
swift-users@swift.org> wrote:

> Hello All,
>
> I am unable to find Swift Build.
>
> I found that another user clearly described the problem at
>
> https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160321/000361.html
>
> Please clarify.
>
> Also, in Xcode 7.3 I am unable to find the ToolChains under
> Preferences>Components.
>
>
> Thanks,
> Nikhil
>
>
>
>
>
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] [swift-dev] how to write package.swift if i want to use dependency file in local?

2016-01-06 Thread Ankit Agarwal via swift-users
I am assuming by downloaded you meant Downloaded the zip from github.

Suppose you have all three downloaded side by side

some-dir
├── PlayingCard
├── FisherYates
└── DeckOfPlayingCards

since you downloaded as a zip and not cloned these directories will not be
under git version control anymore.
place PlayCard and FisherYates under git and add tag to them as they are
dependencies to DeckOfPlayingCards.
DeckOfPlayingCards need not be under git to be built.

$ cd PlayingCard
$ git init && git add . && git commit -m "init" && git tag 1.0.0

$ cd ../FisherYates
$ git init && git add . && git commit -m "init" && git tag 1.0.0

$ cd ../DeckOfPlayingCards

edit Package.swift and change

`https://github.com/apple/example-package-fisheryates.git` to
`../FisherYates`
`https://github.com/apple/example-package-playingcard.git` to `../PlayingCar

$ swift build

done.


PS: This should be in swift-users or swift-build-dev


On Thu, Jan 7, 2016 at 9:58 AM, qibo_cn--- via swift-dev <
swift-...@swift.org> wrote:

> hi all
>   i want to build dealer project in swift package-manager.because my
> ubuntu is not supported to connect github.so i dowload
> playingcard,fisheryates,deckofplaycards projects in local.build playingcatd
> and fisheryates successfully. how i shuold change the package.swift in
> deckofplaycards, to duild this project.
>
> Best
> Bob
>
> ___
> swift-dev mailing list
> swift-...@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
>
>


-- 
Ankit
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users