Cloning these example-package-* repos and then filing pull requests for them is 
problematic because the github username “apple” is burned into the dependency 
urls in the Package.swift files.

It would be good if these packages would take a build-time argument for the 
github username, defaulting to “apple”. I thought this would do it, but it 
doesn’t work:

import Foundation

let githubUserVarName = "GITHUB_USER"
let env = ProcessInfo.processInfo().environment
let githubUser = env[githubUserVarName] ?? "apple"
print("env[\"\(githubUserVarName)\"] is \(env[githubUserVarName])")


import PackageDescription

let package = Package(
    name: "Dealer",
    dependencies: [
        .Package(url: 
"https://github.com/\(githubUser)/example-package-deckofplayingcards.git", 
majorVersion: 1),
    ]
)

/*
 This source file is part of the Swift.org open source project

 Copyright 2015 Apple Inc. and the Swift project authors
 Licensed under Apache License v2.0 with Runtime Library Exception

 See http://swift.org/LICENSE.txt for license information
 See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

and then invoke like this:

GITHUB_USER=daveyostcom   swift build

but for some reason only a few environment variables are visible in the env 
dictionary. The GITHUB_USER environment variable is not among them.

Seems like a bug against “swift build”. Yes?


> On 2016-06-29, at 11:26 PM, Daniel Dunbar <daniel_dun...@apple.com> wrote:
> 
> I wouldn't say they are "unclean", but they have not been retagged after the 
> latest commits to them, and you are right they probably should be. Feel free 
> to file a bug on this at http://bugs.swift.org <http://bugs.swift.org/>.

Done.

> 
>  - Daniel
> 
>> On Jun 29, 2016, at 11:25 PM, Dave Yost <d...@yost.com 
>> <mailto:d...@yost.com>> wrote:
>> 
>> Dumb questions:
>> 
>> These repos are not clean, tho, right? The head should be tagged with a 
>> version number, right?
>> 
>>> On 2016-06-29, at 7:56 PM, Daniel Dunbar <daniel_dun...@apple.com 
>>> <mailto:daniel_dun...@apple.com>> wrote:
>>> 
>>> FYI, some of our planned workflow improvements here are covered by:
>>>   
>>> https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md
>>>  
>>> <https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md>
>>> 
>>>  - Daniel
>>> 
>>>> On Jun 29, 2016, at 7:11 PM, Hugo Hennies via swift-users 
>>>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>>>> 
>>>> The swift package manager uses git tags to resolve the commit it’s going 
>>>> to get. So if you want to make your changes available to the package 
>>>> manager, you must tag your latest commit with a semantic versioning number 
>>>> (1.0.3 for instance) and explicitly put that as the version you want to 
>>>> fetch in your Package.swift file.
>>>> 
>>>> You can find more information on the swift project website
>>>> https://swift.org/package-manager/ <https://swift.org/package-manager/>
>>>> 
>>>> —H
>>>> 
>>>>> On Jun 29, 2016, at 10:43 PM, Dave Yost via swift-users 
>>>>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>>>>> 
>>>>> Following the example here:
>>>>> https://swift.org/package-manager/#conceptual-overview 
>>>>> <https://swift.org/package-manager/#conceptual-overview>
>>>>> 
>>>>> When I do “swift build”, as expected the dependencies are downloaded into 
>>>>> the Packages/ subfolder. I expect them to all be up to date, but they are 
>>>>> all behind their origin/master repos. Why?
>>>>> 
>>>>> This is really a problem when I clone theses 4 projects and modify the 
>>>>> dependencies to point to my clones. When I do that, the 
>>>>> DeckOfPlayingCards project doesn’t download with my changes.
>>>>> 
>>>>> 0 Wed 18:30:30 yost DaveBook ~/p/swift
>>>>> 421 Z% git clone g...@github.com:apple/example-package-dealer.git
>>>>> Cloning into 'example-package-dealer'...
>>>>> remote: Counting objects: 21, done.
>>>>> remote: Total 21 (delta 0), reused 0 (delta 0), pack-reused 21
>>>>> Receiving objects: 100% (21/21), 7.03 KiB | 0 bytes/s, done.
>>>>> Resolving deltas: 100% (8/8), done.
>>>>> Checking connectivity... done.
>>>>> 0 Wed 18:30:40 yost DaveBook ~/p/swift
>>>>> 422 Z% cd example-package-dealer 
>>>>> 0 Wed 18:30:42 yost DaveBook ~/p/swift/example-package-dealer
>>>>> 423 Z% swift build
>>>>> Cloning https://github.com/apple/example-package-deckofplayingcards.git 
>>>>> <https://github.com/apple/example-package-deckofplayingcards.git>
>>>>> HEAD is now at 0879cff Merge pull request #1 from kostiakoval/master
>>>>> Resolved version: 1.0.4
>>>>> Cloning https://github.com/apple/example-package-fisheryates.git 
>>>>> <https://github.com/apple/example-package-fisheryates.git>
>>>>> HEAD is now at d3752ab Merge pull request #5 from 
>>>>> contraultra/random-for-all
>>>>> Resolved version: 1.1.0
>>>>> Cloning https://github.com/apple/example-package-playingcard.git 
>>>>> <https://github.com/apple/example-package-playingcard.git>
>>>>> HEAD is now at 7986c83 Remove: `targets: []`
>>>>> Resolved version: 1.0.1
>>>>> Compile Swift Module 'FisherYates' (2 sources)
>>>>> Compile Swift Module 'PlayingCard' (3 sources)
>>>>> Compile Swift Module 'DeckOfPlayingCards' (1 sources)
>>>>> Compile Swift Module 'Dealer' (1 sources)
>>>>> Linking .build/debug/Dealer
>>>>> 0 Wed 18:30:52 yost DaveBook ~/p/swift/example-package-dealer
>>>>> 424 Z% .build/debug/Dealer
>>>>> ♣︎7
>>>>> ♢A
>>>>> ♡A
>>>>> ♠︎Q
>>>>> ♣︎5
>>>>> ♢6
>>>>> ♣︎8
>>>>> ♢8
>>>>> ♢Q
>>>>> ♣︎4
>>>>> 0 Wed 18:30:59 yost DaveBook ~/p/swift/example-package-dealer
>>>>> 425 Z% cd Packages/PlayingCard-1.0.1 
>>>>> 0 Wed 18:31:28 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/PlayingCard-1.0.1
>>>>> 430 Z% git status
>>>>> On branch 1.0.1
>>>>> Your branch is behind 'origin/master' by 4 commits, and can be 
>>>>> fast-forwarded.
>>>>>   (use "git pull" to update your local branch)
>>>>> nothing to commit, working directory clean
>>>>> 0 Wed 18:31:31 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/PlayingCard-1.0.1
>>>>> 431 Z% git remote -v          
>>>>> origin    https://github.com/apple/example-package-playingcard.git 
>>>>> <https://github.com/apple/example-package-playingcard.git> (fetch)
>>>>> origin    https://github.com/apple/example-package-playingcard.git 
>>>>> <https://github.com/apple/example-package-playingcard.git> (push)
>>>>> 0 Wed 18:35:57 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/PlayingCard-1.0.1
>>>>> 432 Z% cd ../FisherYates-1.1.0
>>>>> 0 Wed 18:36:19 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/FisherYates-1.1.0
>>>>> 433 Z% git status
>>>>> On branch 1.1.0
>>>>> Your branch is behind 'origin/master' by 2 commits, and can be 
>>>>> fast-forwarded.
>>>>>   (use "git pull" to update your local branch)
>>>>> nothing to commit, working directory clean
>>>>> 0 Wed 18:36:20 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/FisherYates-1.1.0
>>>>> 434 Z% git remote -v
>>>>> origin    https://github.com/apple/example-package-fisheryates.git 
>>>>> <https://github.com/apple/example-package-fisheryates.git> (fetch)
>>>>> origin    https://github.com/apple/example-package-fisheryates.git 
>>>>> <https://github.com/apple/example-package-fisheryates.git> (push)
>>>>> 0 Wed 18:36:23 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/FisherYates-1.1.0
>>>>> 435 Z% cd ../DeckOfPlayingCards-1.0.4 
>>>>> 0 Wed 18:36:46 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/DeckOfPlayingCards-1.0.4
>>>>> 436 Z% git status
>>>>> On branch 1.0.4
>>>>> Your branch is behind 'origin/master' by 3 commits, and can be 
>>>>> fast-forwarded.
>>>>>   (use "git pull" to update your local branch)
>>>>> nothing to commit, working directory clean
>>>>> 0 Wed 18:36:49 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/DeckOfPlayingCards-1.0.4
>>>>> 437 Z% git remote -v
>>>>> origin    https://github.com/apple/example-package-deckofplayingcards.git 
>>>>> <https://github.com/apple/example-package-deckofplayingcards.git> (fetch)
>>>>> origin    https://github.com/apple/example-package-deckofplayingcards.git 
>>>>> <https://github.com/apple/example-package-deckofplayingcards.git> (push)
>>>>> 0 Wed 18:36:52 yost DaveBook 
>>>>> ~/p/swift/example-package-dealer/Packages/DeckOfPlayingCards-1.0.4
>>>>> 438 Z% 
>>>>> 
>>>>> _______________________________________________
>>>>> swift-users mailing list
>>>>> swift-users@swift.org <mailto:swift-users@swift.org>
>>>>> https://lists.swift.org/mailman/listinfo/swift-users 
>>>>> <https://lists.swift.org/mailman/listinfo/swift-users>
>>>> 
>>>> _______________________________________________
>>>> swift-users mailing list
>>>> swift-users@swift.org <mailto:swift-users@swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-users 
>>>> <https://lists.swift.org/mailman/listinfo/swift-users>
>>> 
>> 
> 

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

Reply via email to