Questions about the SwiftPM `--update`


#1

Hi, I'm JPMartha.

I mentioned the following questions on
https://github.com/apple/swift-package-manager/pull/228. But, I send that
to the mailing lists again.
Because I feel questions might be mentioned on the mailing list better than
GitHub PR.

···

----------

I understand the SwiftPM don't support running `--fetch` twice in the
current implementation.
-
https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160328/000380.html

Then, can I ask any questions about `--update`?

Let's suppose the following situation:
- `MyApp` depends on `PackageA` and `B`.
- `PackageB` depends on `C`.

MyApp
├── Package A
└── Package B
    └── Package C

##### Questions #####

1. If `PackageA` requires update, then SwitPM should fetch `PackageA` only,
or all packages?
2. If `PackageB` requires update, then SwitPM should fetch both `PackageB`
and `C`?
3. if `PackageA-1.0.0` requires update to `2.0.0`, then SwiftPM shoud
remain `PackageA-1.0.0` directory, or remove?

- - -

#### P.S.

It seems the SwiftPM gets current package version from a part of directory
name in the `Packages` directory.
If `Lockfile` is supported, is it planned to change?

-
https://github.com/apple/swift-package-manager/blob/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a/Sources/Get/Fetcher.swift#L76-L86
-
https://github.com/apple/swift-package-manager/blob/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a/Sources/Get/Package.swift#L32-L34

Best regards,
JPMartha


(Max Howell) #2

I understand the SwiftPM don't support running `--fetch` twice in the current implementation.
- https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160328/000380.html

Then, can I ask any questions about `--update`?

Let's suppose the following situation:
- `MyApp` depends on `PackageA` and `B`.
- `PackageB` depends on `C`.

MyApp
├── Package A
└── Package B
    └── Package C

##### Questions #####

1. If `PackageA` requires update, then SwitPM should fetch `PackageA` only, or all packages?

—update updates everything

2. If `PackageB` requires update, then SwitPM should fetch both `PackageB` and `C`?

—update updates everything

3. if `PackageA-1.0.0` requires update to `2.0.0`, then SwiftPM shoud remain `PackageA-1.0.0` directory, or remove?

It depends on the Package.swift for MyApp. If it allows A to be 2.0, then it updates to 2.0, if not then it does not update to 2.0


#3

Thank you so much for the quick reply.

About 3, I'm really sorry that I can't explain it well in English.
I want to get to know the `Pacakes` directory condition after the update to
2.0.0, SwiftPM remains PackageA-1.0.0 directory or not.

##### Before the update #####

MyApp
├── Packages/
│   ├── PackageA-1.0.0

##### After the update to 2.0.0 #####

MyApp
├── Packages/
│   ├── PackageA-1.0.0
│   ├── PackageA-2.0.0

or

MyApp
├── Packages/
│   ├── PackageA-2.0.0

Best regards,
JPMartha

···

2016-04-02 8:39 GMT+09:00 Max Howell <max.howell@apple.com>:

I understand the SwiftPM don't support running `--fetch` twice in the
current implementation.
-
https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160328/000380.html

Then, can I ask any questions about `--update`?

Let's suppose the following situation:
- `MyApp` depends on `PackageA` and `B`.
- `PackageB` depends on `C`.

MyApp
├── Package A
└── Package B
    └── Package C

##### Questions #####

1. If `PackageA` requires update, then SwitPM should fetch `PackageA`
only, or all packages?

—update updates everything

2. If `PackageB` requires update, then SwitPM should fetch both `PackageB`
and `C`?

—update updates everything

3. if `PackageA-1.0.0` requires update to `2.0.0`, then SwiftPM shoud
remain `PackageA-1.0.0` directory, or remove?

It depends on the Package.swift for MyApp. If it allows A to be 2.0, then
it updates to 2.0, if not then it does not update to 2.0


(Max Howell) #4

You cannot have two versions of PackageA in the same Packages/ directory for the foreseeable future. So:

MyApp
├── Packages/
│ ├── PackageA-2.0.0

Provided MyApp/Package.swift allows it.

···

Thank you so much for the quick reply.

About 3, I'm really sorry that I can't explain it well in English.
I want to get to know the `Pacakes` directory condition after the update to 2.0.0, SwiftPM remains PackageA-1.0.0 directory or not.