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

Fix RestrictionsChanged Detection #3464

Merged
merged 4 commits into from
Jan 10, 2019
Merged

Fix RestrictionsChanged Detection #3464

merged 4 commits into from
Jan 10, 2019

Conversation

lust4life
Copy link
Contributor

@lust4life lust4life commented Dec 22, 2018

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
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
Copy link
Contributor Author

lust4life commented Dec 22, 2018

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

@matthid
Copy link
Member

matthid commented Dec 22, 2018

@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
Contributor Author

@matthid test added.

@matthid
Copy link
Member

matthid commented Dec 24, 2018

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
Copy link
Contributor Author

lust4life commented Dec 24, 2018

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
Copy link
Contributor Author

lust4life commented Dec 24, 2018

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
Contributor Author

@matthid ping

@matthid
Copy link
Member

matthid commented Jan 7, 2019

Afaik warnings don't make integration tests fail?

@lust4life
Copy link
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
Copy link
Member

matthid commented Jan 7, 2019

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
Contributor Author

@matthid got you, fixed.

@lust4life
Copy link
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 ? 🙂

Copy link
Member

@matthid matthid left a comment

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
Copy link
Member

matthid commented Jan 10, 2019

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
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.

None yet

3 participants