Skip to content

Fix RestrictionsChanged Detection - #3464

Merged
forki merged 4 commits into
fsprojects:masterfrom
lust4life:master
Jan 10, 2019
Merged

forki merged 4 commits into
fsprojects:masterfrom
lust4life:master

Conversation

@lust4life

@lust4life lust4life commented Dec 22, 2018 •

Copy link
Copy Markdown
Contributor

see details: #2638 (comment)

// the requirement's setting
{ImportTargets = None;
    FrameworkRestrictions = AutoDetectFramework;
    OmitContent = None;
    IncludeVersionInPath = None;
    LicenseDownload = None;
    ReferenceCondition = None;
    CreateBindingRedirects = None;
    EmbedInteropTypes = None;
    CopyLocal = None;
    SpecificVersion = None;
    StorageConfig = Some NoPackagesFolder;
    Excludes = [];
    Aliases = map [];
    CopyContentToOutputDirectory = None;
    GenerateLoadScripts = None;}

// the resolved package 
// Install Settings
{ImportTargets = None;
    FrameworkRestrictions = ExplicitRestriction true;                                                                                                       
    OmitContent = None;                                                                                                                                     
    IncludeVersionInPath = None;
    LicenseDownload = None;                                                                                                                                 
    ReferenceCondition = None;                                                                                                                              
    CreateBindingRedirects = None;
    EmbedInteropTypes = None;                                                                                                                               
    CopyLocal = None;
    SpecificVersion = None;                                                                                                                                 
    StorageConfig = None;
    Excludes = [];                                                                                                                                          
    Aliases = map [];
    CopyContentToOutputDirectory = None;
    GenerateLoadScripts = None;};

//    GroupSettings =
{ImportTargets = None;
      FrameworkRestrictions =
       ExplicitRestriction
         || (== net461) (== netcoreapp2.0) (== netcoreapp2.2) (== netstandard2.0);
      OmitContent = None;
      IncludeVersionInPath = None;
      LicenseDownload = None;
      ReferenceCondition = None;
      CreateBindingRedirects = None;
      EmbedInteropTypes = None;
      CopyLocal = None;
      SpecificVersion = None;
      StorageConfig = Some NoPackagesFolder;
      Excludes = [];
      Aliases = map [];
      CopyContentToOutputDirectory = None;
      GenerateLoadScripts = None;};

// Settings =
{ImportTargets = None;
      FrameworkRestrictions =
       ExplicitRestriction
         || (== net461) (== netcoreapp2.0) (== netcoreapp2.2) (== netstandard2.0);
      OmitContent = None;
      IncludeVersionInPath = None;
      LicenseDownload = None;
      ReferenceCondition = None;
      CreateBindingRedirects = None;
      EmbedInteropTypes = None;
      CopyLocal = None;
      SpecificVersion = None;
      StorageConfig = Some NoPackagesFolder;
      Excludes = [];
      Aliases = map [];
      CopyContentToOutputDirectory = None;
      GenerateLoadScripts = None;};}

@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid the impact here is :
when we use config like below in packet.dependencies

storage: none
framework: auto-detect

run dotnet build , it will always shows a trace warning like

  paket.dependencies and paket.lock are out of sync in E:\git\test\go.
  Please run 'paket install' or 'paket update' to recompute the paket.lock file.
  Changes were detected for Main/FSharp.Core
      - RestrictionsChanged
  Starting restore process.

although it will only occurs the first time after we generate a restore cache in xx/obj/ folder, but when in ci case, it will always show a warning message, if we have many packages, it will generate warning message for every packages. and using paket install or paket update here doesn't help.

e.g.

  • new project
  • paket.dependencies
source https://api.nuget.org/v3/index.json
storage: none
framework: auto-detect
nuget FSharp.Core
  • run dotnet build

@lust4life

lust4life commented Dec 22, 2018 •

Copy link
Copy Markdown
Contributor Author

And if this is not a FullRestore , it will give this warning message always.
e.g. run paket restore --project xxx.fsproj

@matthid

matthid commented Dec 22, 2018

Copy link
Copy Markdown
Member

@lust4life Thanks for clarifying and the fix. I'd like to see a unit test for this (I think you can copy one of mine and edit them from the PR you commented in). But in any case this looks reasonable (without me looking at the details)

lust4life added a commit to lust4life/Paket that referenced this pull request Dec 24, 2018
@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid test added.

@matthid

matthid commented Dec 24, 2018

Copy link
Copy Markdown
Member

Ok but the test didn't fail before the change, correct? I feel like a unit test might be easier to realize (assert that the settings are as they should be). The other way would be to assert that paket doesn't emit any warning?

@lust4life

lust4life commented Dec 24, 2018 •

Copy link
Copy Markdown
Contributor Author

the test ( #3464 Paket restore (not full restore) should not warn RestrictionsChanged when using auto-detect with storage none) do fail before the change. since it will generate a warning message which should not be. not very familiar with paket's source code, could you tell me how to assert paket doesn't emit any warning, seems this warning message are publish to a event through traceWarn

@lust4life

lust4life commented Dec 24, 2018 •

Copy link
Copy Markdown
Contributor Author

since we need compare a lock file and the origin dependencies file, mock a lock file's content (in unit test style) which seems not very robust when paket change its lock content's generate strategy. what do you think ?

@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid ping

@matthid

matthid commented Jan 7, 2019

Copy link
Copy Markdown
Member

Afaik warnings don't make integration tests fail?

@lust4life

Copy link
Copy Markdown
Contributor Author

Are you suggesting a unit test to cover this situation ?i think the difference here is how to generate a lock file : by real service (integration test) or by fake one (unit test).

The problem here is not about whether the warning will cause the test to fail. It will generate inappropriate warnings.

and it give tips : paket.dependencies and paket.lock are out of sync in %s.%sPlease run 'paket install' or 'paket update' to recompute the paket.lock file. re-run paket install will not solve this problem.

@matthid

matthid commented Jan 7, 2019

Copy link
Copy Markdown
Member

All I'm saying is that the test is "green" before and after the change even if it emits a warnings before and none after the change. Afaik there is nothing in place to "check" if the warning is there or not. Therefore there is no benefit in the test as it is now.

Yes my suggestion would be to either change the test in a way to check if the warning was emitted and fail the test or use a unit-test instead (which I'd argue is easier because then you can "test" that the "settings object" is correct instead of testing the output)

@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid got you, fixed.

@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid ping, I don't mean to rush you, can you do a release for this pr ? since this warning message will cause our ci pipeline failed (too many log message, travis will kill the build job). or is there anything I can help ? 🙂

@matthid matthid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me now. Thanks for going all the way :)

@matthid

matthid commented Jan 10, 2019

Copy link
Copy Markdown
Member

Not sure if the failing test is related, doesn't look like it.

@forki
forki merged commit 0e5632e into fsprojects:master Jan 10, 2019
@lust4life

Copy link
Copy Markdown
Contributor Author

@matthid @forki thx.

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