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

Add nfproj to supported project extensions #3943

Merged
merged 4 commits into from
Apr 7, 2021

Conversation

josesimoes
Copy link
Contributor

@josesimoes josesimoes commented Mar 8, 2021

Bug

Fixes: NuGet/Home#10562.

Regression? Last working version:

Description

  • Add extension to supported projects.
  • Add unit tests for install and update commands in CLI.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
  • Documentation

    • N/A

@josesimoes josesimoes requested a review from a team as a code owner March 8, 2021 11:00
Copy link
Contributor

@donnie-msft donnie-msft left a comment

Choose a reason for hiding this comment

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

Hello! My first pass is just pointing out obvious coding guideline violations. See rule #10.
Will take another look soon...

@donnie-msft donnie-msft added the Community PRs created by someone not in the NuGet team label Mar 8, 2021
slnContent.AppendLine("# Visual Studio Version 16");
slnContent.AppendLine("VisualStudioVersion = 16.0.31005.135");

foreach(string project in projectList)
Copy link
Contributor

Choose a reason for hiding this comment

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

space after foreach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no more space

Copy link
Contributor

Choose a reason for hiding this comment

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

Please check below example, we want space foreach ( :

foreach (var reader in packagesAndDependencies)
{
foreach (var set in reader.Item1.GetPackageDependencies())
{
foreach (var dependency in set.Packages)
{

Another way to deal with syntax is install dotnet-format tool from https://github.com/dotnet/format
then run dotnet-format --exclude submodules, it'll take care of it for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got you. Should be OK now

@erdembayar
Copy link
Contributor

@josesimoes
Hi. There're some unaddressed PR comments and conflict with dev branch.
Please rebase to dev branch and address PR comments.
If you're not able to do it in anytime soon then could you please change PR to draft mode?

@josesimoes
Copy link
Contributor Author

@erdembayar rebase done!

As for the unaddressed comments, I couldn't find none... Can you please point me to those?

@erdembayar
Copy link
Contributor

erdembayar commented Mar 25, 2021

@erdembayar rebase done!

As for the unaddressed comments, I couldn't find none... Can you please point me to those?

I can see one unaddressed here: #3943 (comment)
Also why did you mark as resolved https://github.com/NuGet/NuGet.Client/pull/3943/files#r589666134 ? Can give some context about meeting or proposal you mentioned here?

@josesimoes
Copy link
Contributor Author

Also why did you mark as resolved https://github.com/NuGet/NuGet.Client/pull/3943/files#r589666134 ?

Just unresolved it.

Can give some context about meeting or proposal you mentioned here?
Sure: it was discussed the creation of a TFM for .NET nanoFramework.
You can check with @JonDouglas or @terrajobst or @clairernovotny although I don't think it's relevant for the PR here...

Copy link
Contributor

@erdembayar erdembayar left a comment

Choose a reason for hiding this comment

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

@josesimoes
Thank you for your contribution. There are still some work need to do.
Please review PR comment and clean up. There are some unused items.

test/NuGet.Clients.Tests/NuGet.CommandLine.Test/Util.cs Outdated Show resolved Hide resolved
/// Create a simple package with a lib folder for .NET nanoFramework
/// The package will be removed from the machine cache upon creation
/// </summary>
public static ZipPackage CreateNFPackage(string repositoryPath, string id, string version)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the use of this one? Not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

/// <param name="path">Path where the package will be saved</param>
/// <param name="contentFiles">Content file(s) to be added to the package</param>
/// <returns></returns>
public static string CreateNFTestPackage(
Copy link
Contributor

Choose a reason for hiding this comment

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

Here nothing special about NF is going on. How about using existing create package utility instead of creating new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we don't have a TFM, our DLLs have to be placed inside the lib folder. I couldn't find a nice way to do it with the existing methods. If there is one, please point me to it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nkolev92
Do you have any recommendation here?

Copy link
Member

Choose a reason for hiding this comment

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

Look into SimpleTestPackageContext and then do Files.Clear() and add a few file paths,

public List<KeyValuePair<string, byte[]>> Files { get; set; } = new List<KeyValuePair<string, byte[]>>();
.

If you search for references of Files, you'll likely find many tests already do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe I've replaced them all with the equivalent ones from SimpleTestPackage.

Copy link
Contributor

Choose a reason for hiding this comment

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

@josesimoes
I assume you're going to remove this one since it's not referenced anymore.

@@ -1841,5 +1841,43 @@ public static CommandRunnerResult RunInstall(SimpleTestPathContext pathContext,

return r;
}

[Fact]
public void InstallCommand_NF_Project()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check other comment about CreateNFTestPackage.
Here nothing is actually special about 'NF'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the above, I thought it was relevant to have this one here. If it's not please confirm and I'll remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Currently I don't see any value in this, so I prefer to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Removing it.

Copy link
Contributor

@erdembayar erdembayar Mar 31, 2021

Choose a reason for hiding this comment

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

Ok. I'll review again. Also could you be able to make incremental commits instead quashing to 1 commit next time?
It's hard to see what was actual change from last time. I have to start again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh... I apologize... though you would prefer it as a single commit...

Copy link
Member

Choose a reason for hiding this comment

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

We squash when merging in the dev branch for this exact reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood. Each project handles this differently... there was nothing about this on the contributing guide. I'll start doing that.

Copy link
Member

Choose a reason for hiding this comment

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

Honestly, it's something we haven't documented.

The incremental commits has been largely at the discretion of the contributor + reviewers.

Copy link
Contributor

@erdembayar erdembayar left a comment

Choose a reason for hiding this comment

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

@josesimoes
We're getting very close, just 1 more comment from me.
Can you address comment from nkolev92?

@@ -1841,5 +1841,43 @@ public static CommandRunnerResult RunInstall(SimpleTestPathContext pathContext,

return r;
}

[Fact]
public void InstallCommand_NF_Project()
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently I don't see any value in this, so I prefer to remove it.

/// <param name="path">Path where the package will be saved</param>
/// <param name="contentFiles">Content file(s) to be added to the package</param>
/// <returns></returns>
public static string CreateNFTestPackage(
Copy link
Contributor

Choose a reason for hiding this comment

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

@nkolev92
Do you have any recommendation here?

@@ -1237,5 +1237,155 @@ public static void TestCommandInvalidArguments(string command)
// Verify traits of help message in stdout
Assert.Contains("usage:", result.Item2);
}

#region helper methods for .NET nanoFramework tests
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Contributor

@erdembayar erdembayar left a comment

Choose a reason for hiding this comment

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

@josesimoes
Good job.
Please remove unused method, then we're good.
Also just in case rebase with latest dev branch. Once it passes CI build then I'll approve.

/// <param name="path">Path where the package will be saved</param>
/// <param name="contentFiles">Content file(s) to be added to the package</param>
/// <returns></returns>
public static string CreateNFTestPackage(
Copy link
Contributor

Choose a reason for hiding this comment

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

@josesimoes
I assume you're going to remove this one since it's not referenced anymore.

a1Package.Files.Clear();
a1Package.AddFile($"lib/{a1.Id}.dll");

var a1File = await a1Package.CreateAsFileAsync(packagesSourceDirectory, a1Package.PackageName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace var with FileInfo type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

b1Package.Files.Clear();
b1Package.AddFile($"lib/{b1.Id}.dll");

var b1File = await a1Package.CreateAsFileAsync(packagesSourceDirectory, b1Package.PackageName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace var with FileInfo type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

- Add extension to supported projects.
- Add unit tests for install and update commands in CLI.
@josesimoes
Copy link
Contributor Author

Good job. 👍🏻

Please remove unused method, then we're good.

Done

Also just in case rebase with latest dev branch. Once it passes CI build then I'll approve.

Rebased

@josesimoes
Copy link
Contributor Author

Anything I need to do/change to address whatever is causing those checks to fail?

@erdembayar
Copy link
Contributor

Anything I need to do/change to address whatever is causing those checks to fail?

Most likely no, I'll take care of it.

Copy link
Contributor

@erdembayar erdembayar left a comment

Choose a reason for hiding this comment

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

@josesimoes
Thank you for contribution.
It'll merge today or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the project type nfproj to the list of supportedProjectExtensions for Nuget CLI.
4 participants