Skip to content
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

Update manifest entry of project for non-local manifests #3579

Merged
merged 3 commits into from
Aug 16, 2023

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Aug 11, 2023

Instead of just skipping manifest pruning all together (which is tricky because we're often not operating in a root-level context which would correctly prune everything), we can at least update the dependency list of the currently activated project in the root-level manifest.

@quinnj
Copy link
Member Author

quinnj commented Aug 11, 2023

Will try to think of a way to add a test here

@nickrobinson251
Copy link
Contributor

nickrobinson251 commented Aug 11, 2023

thanks for fixing this!

The problem we're seeing is that, if you have a package Foo with a Project.toml (at e.g. packages/Foo/Project.toml) which looks like:

name = "Foo"
uuid = "801270c1-6d38-4c07-85b6-74a2f576d89a"
manifest = "../../Manifest.toml"
version = "0.1.0"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ContextVariablesX = "6add18c4-b38d-439d-96f6-d6bc489c04c5"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
ExceptionUnwrapping = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"

[compat]
ReTestItems = "1"

[extras]
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DeepDiffs", "JSON3", "ReTestItems", "Test"]

note the manifest = "../../Manifest.toml" entry

And then you add and then remove a package

] activate Foo
] add Example
] rm Example

which should leave the Project.toml (packages/Foo/Project.toml) and Manifest.toml (../../Manifest.toml) without any changes

But we see

(Foo) pkg> add Example
   Resolving package versions...
    Updating `~/packages/Foo/Project.toml`
  [7876af07] + Example v0.5.3
    Updating `~/Manifest.toml`
  [7876af07] + Example v0.5.3

(Foo) pkg> rm Example
    Updating `~/packages/Foo/Project.toml`
  [7876af07] - Example v0.5.3
  No Changes to `~/Manifest.toml`

And the Manifest.toml is left with a diff like:

diff --git a/Manifest.toml b/Manifest.toml
index 1311df8842..2042e8dd9d 100644
--- a/Manifest.toml
+++ b/Manifest.toml
@@ -2,7 +2,7 @@
 
 julia_version = "1.9.2"
 manifest_format = "2.0"
-project_hash = "53c4ec67dcb0841eab26478fa1ef6c1836f9ee8b"
+project_hash = "c42550b13eba1529c8ab6377082cae8993859c62"
 
 [[deps.ANSIColoredPrinters]]
 git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
@@ -497,6 +497,11 @@ git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237"
 uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
 version = "1.0.4"
 
+[[deps.Example]]
+git-tree-sha1 = "46e44e869b4d90b96bd8ed1fdcf32244fddfb6cc"
+uuid = "7876af07-990d-54b4-ab0e-23690620f79a"
+version = "0.5.3"
+
 [[deps.ExceptionUnwrapping]]
 deps = ["Test"]
 git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96"
@@ -1632,7 +1637,7 @@ uuid = "66d59315-31dc-41c8-b200-e39bcbf712f1"
 version = "0.1.0"
 
 [[deps.Foo]]
-deps = ["Compat", "ContextVariablesX", "Dates", "ExceptionUnwrapping", "JSON", "Logging"]
+deps = ["Compat", "ContextVariablesX", "Dates", "Example", "ExceptionUnwrapping", "JSON", "Logging"]
 path = "packages/Foo"
 uuid = "801270c1-6d38-4c07-85b6-74a2f576d89a"
 version = "0.1.0"

Which has two issues:

  1. The deps.Foo entry is left with Example in its deps
  2. There is a deps.Example entry, even though nothing depends on Example (given that Foo doesn't depend on Example after the rm)

This PR is to at least fix the first of those issues (cleaning up deps.Foo)

@nickrobinson251
Copy link
Contributor

Can we add backport 1.9 to this?

Copy link
Contributor

@nickrobinson251 nickrobinson251 left a comment

Choose a reason for hiding this comment

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

LGTM!

Opened an issue for the second part of this #3590

test/project_manifest.jl Show resolved Hide resolved
Co-authored-by: Nick Robinson <npr251@gmail.com>
@quinnj quinnj merged commit f4d64d2 into master Aug 16, 2023
13 checks passed
@quinnj quinnj deleted the jq-tidy-mono-manifest branch August 16, 2023 22:25
quinnj added a commit that referenced this pull request Aug 17, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
quinnj added a commit that referenced this pull request Aug 17, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
IanButterworth pushed a commit that referenced this pull request Aug 18, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
(cherry picked from commit f4d64d2)
IanButterworth pushed a commit that referenced this pull request Aug 18, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
(cherry picked from commit f4d64d2)
@IanButterworth IanButterworth mentioned this pull request Aug 18, 2023
10 tasks
IanButterworth pushed a commit that referenced this pull request Aug 18, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
(cherry picked from commit f4d64d2)
@IanButterworth IanButterworth mentioned this pull request Aug 18, 2023
14 tasks
IanButterworth pushed a commit that referenced this pull request Aug 18, 2023
* Update manifest entry of project for non-local manifests

* Add a test

* Update test/project_manifest.jl

Co-authored-by: Nick Robinson <npr251@gmail.com>

---------

Co-authored-by: Nick Robinson <npr251@gmail.com>
(cherry picked from commit f4d64d2)
sjkelly added a commit to sjkelly/Pkg.jl that referenced this pull request Nov 10, 2023
….jl manual

This should be mentioned here.
Added in: JuliaLang#3579
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.

3 participants