Skip to content

Migrated nuspec to csproj and improved packaging #54

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

Merged
merged 9 commits into from
Apr 29, 2019

Conversation

alefranz
Copy link
Contributor

@alefranz alefranz commented Apr 25, 2019

This fixes #36, fixes #37, fixes #38, fixes #40

  • Migrated from nuspec to csproj
  • Fixed targets location
  • Fixed package dependencies
  • Fixed package to be recognised as netstandard2.0
  • Moved debug symbols to symbols package
  • Added Sourcelink
  • Fixed package dependencies

Before / After
image

Symbols package
image

Package size is actually bigger now
image

For the Azure Pipelines I'm flying blind, but hopefully should work correctly and not break the signature.
I don't think the symbol package needs to be signed.

  • There's a descriptive title that will make sense to other developers some time from now.
  • There's associated issues. All PR's should have issue(s) associated - unless a trivial self-evident change such as fixing a typo. You can use the format Fixes #nnnn in your description to cause GitHub to automatically close the issue(s) when your PR is merged.
  • Your change description explains what the change does, why you chose your approach, and anything else that reviewers should know.
  • You have included any necessary tests in the same PR.

- Migrate from nuspec to csproj
- Fixed targets location
- Fixed package dependencies
- Fixed package to be recognised as netstandard2.0
- Moved debug symbols to symbols package
- Added Sourcelink
- Fixed package dependencies
@imback82 imback82 added the enhancement New feature or request label Apr 25, 2019
@eerhardt
Copy link
Member

- task: NuGetToolInstaller@0

I believe you can remove this NuGetToolInstaller line now that we aren't using nuget.exe


Refers to: azure-pipelines.yml:182 in 3bd65d5. [](commit_id = 3bd65d5, deletion_comment = False)


<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Copy link
Member

Choose a reason for hiding this comment

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

Now we are creating .snupkg packages, but we aren't doing anything with them in the build. Can we publish them somewhere? Like in a "BuildArtifact"?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we would publish them to the Microsoft symbol server, but that is probably outside of the scope of this PR. We can do that in the future.


In reply to: 278755885 [](ancestors = 278755885)

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 added a step to publish them as artifacts. Does it help?

<Pack>true</Pack>
<PackagePath>jars\%(Filename)%(Extension)</PackagePath>
</Content>
<Content Include="..\build\**" Link="build\%(Filename)%(Extension)">
Copy link
Member

Choose a reason for hiding this comment

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

What do you feel about moving this file into a src/csharp/Microsoft.Spark/build/netstandard2.0 folder?

I have 2 concerns:

  1. If we add other nupkgs that need build scripts, they can't go into this root build directory, or else they would start being packed here.
  2. The .csproj shouldn't be deciding where this file goes. Instead the file system should. If you put a file in build/foo/bar/myFile.targets, it should be in the same folder in the package.

So instead of the above, you could have:

<Content Include="build\**\*" Pack="true" PackagePath="build" />

And it would pick up any file/folder structure under the build folder.

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 was trying to not move things around :) but agree it is better with this approach. Done!

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

This is great @alefranz! Thanks for helping out here.

<Pack>true</Pack>
<PackagePath>jars\%(Filename)%(Extension)</PackagePath>
</Content>
<Content Include="..\build\**" Link="build\%(Filename)%(Extension)">
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also include the License and Third-Parties files that we define on the root of the repo. This is a convention we've followed in other repos. https://github.com/dotnet/iot/blob/master/Directory.Build.props#L21

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've added that as well as moved the Licence expression and some other generic bits to the props file.
Please note this means the third party notices file will show up in the Solution Explorer for each project

Copy link
Contributor

Choose a reason for hiding this comment

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

How about Visible="false"?

<Content Include="$(MSBuildThisFileDirectory)..\..\THIRD-PARTY-NOTICES.TXT" Pack="true" PackagePath="\"  Visible="false"/>

Copy link
Member

Choose a reason for hiding this comment

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

Yes, let's fix this on a follow up PR 😄

Copy link
Member

@safern safern left a comment

Choose a reason for hiding this comment

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

Thanks @alefranz 😄

@alefranz
Copy link
Contributor Author

- task: NuGetToolInstaller@0

I believe you can remove this NuGetToolInstaller line now that we aren't using nuget.exe

Refers to: azure-pipelines.yml:182 in 3bd65d5. [](commit_id = 3bd65d5, deletion_comment = False)

@eerhardt - I thought this was needed to install the MicroBuildSigningPlugin, can you confirm it is not needed? I can try to import the pipeline so I can test this job (as it doesn't run for PRs)

@eerhardt
Copy link
Member

I thought this was needed to install the MicroBuildSigningPlugin

I don't believe this is needed for the MicroBuildSigningPlugin. We are using an older version of that plugin on ML.NET https://github.com/dotnet/machinelearning/blob/master/build/vsts-ci.yml#L134, and it doesn't require the NuGetToolInstaller. Maybe @safern knows for sure, but I believe we can remove the NuGetToolInstaller.

@eerhardt
Copy link
Member

<None Include="$(MSBuildThisFileDirectory)../jars/microsoft-spark*.jar">

Is this still the right path now that this file has moved?


Refers to: src/csharp/Microsoft.Spark/build/netstandard2.0/Microsoft.Spark.targets:3 in 008abc5. [](commit_id = 008abc5, deletion_comment = False)


<ItemGroup>
<Content Include="..\..\scala\microsoft-spark-*\target\microsoft-spark-*.jar" Link="jars\%(Filename)%(Extension)"
Pack="true" PackagePath="jars\%(Filename)%(Extension)" />
Copy link
Member

@eerhardt eerhardt Apr 29, 2019

Choose a reason for hiding this comment

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

(nit) A more readable multi-line format here would be:

<Content Include="..\..\scala\microsoft-spark-*\target\microsoft-spark-*.jar"
         Link="jars\%(Filename)%(Extension)"
         Pack="true"
         PackagePath="jars\%(Filename)%(Extension)" />

It's easier to see each attribute. You don't have to parse the string, or miss something way off to the right.

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

@alefranz
Copy link
Contributor Author

@eerhardt

I removed the NugetInstall step.

I'm still not able to test on my Azure DevOps account as I don't know how to get the Signing plugin.
Could not queue the build because there were validation errors or warnings. Job Package: Step references task 'MicroBuildSigningPlugin' at version '2' which does not exist.

If you could please try to manually run a build of this PR so the Build.Reason will not be PullRequest and it will run all the tasks, so we can verify that it works correctly.

<None Include="$(MSBuildThisFileDirectory)../jars/microsoft-spark*.jar">

Is this still the right path now that this file has moved?

I haven't moved the jars, as they are installed by maven. Not sure if needed and in scope.

@eerhardt
Copy link
Member

I haven't moved the jars, as they are installed by maven. Not sure if needed and in scope.

You didn't move the jars, but you did move the .targets file that is referencing the jars using $(MSBuildThisFileDirectory)../jars/microsoft-spark*.jar. $(MSBuildThisFileDirectory) is the directory that the current MSBuild file (i.e. the Microsoft.Spark.targets file) is contained in. Since you moved the .targets file down a directory, you need two ../ here to move up 2 directories.

@eerhardt
Copy link
Member

I've kicked off a test of the official build using your changes @alefranz. I'll let you know how it goes.

@alefranz
Copy link
Contributor Author

I haven't moved the jars, as they are installed by maven. Not sure if needed and in scope.

You didn't move the jars, but you did move the .targets file that is referencing the jars using $(MSBuildThisFileDirectory)../jars/microsoft-spark*.jar. $(MSBuildThisFileDirectory) is the directory that the current MSBuild file (i.e. the Microsoft.Spark.targets file) is contained in. Since you moved the .targets file down a directory, you need two ../ here to move up 2 directories.

Ah sorry, I didn't realize you were referring to the targets file. Fixed it.

eerhardt
eerhardt previously approved these changes Apr 29, 2019
Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

I ran a test build on commit 623de33 (the one before the jar path fix), and the build passed. So I verified we can remove NuGetToolInstaller task.

Thanks for the fix @alefranz!


<ItemGroup>
<Content Include="..\..\scala\microsoft-spark-*\target\microsoft-spark-*.jar"
Link="jars\%(Filename)%(Extension)"
Copy link
Member

Choose a reason for hiding this comment

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

(nit) I wasn't clear about the formatting, but we typically align the attributes underneath the attribute on the first line. This isn't 100% necessary to fix, but if you are changing something else, consider this.

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 worries, fixed

@alefranz
Copy link
Contributor Author

Updated top of description to correctly specify the issues it fixes, also added #40

@imback82 imback82 merged commit 649c192 into dotnet:master Apr 29, 2019
@@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup Condition="'$(SignNugetPackages)' == 'true'">
<FilesToSign Include="$(OutDir)*.nupkg" Exclude="$(OutDir)*.symbols.nupkg">
<FilesToSign Include="$(OutDir)*.nupkg">
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also sign snupkg, right? Since the plan is for it to go into nuget? @eerhardt what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Opps we merged right at the same moment I commented on this, but @imback82 I think we want to solve this.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it depends on what we plan on doing with them... if we just use it to publish the symbols to the Microsoft Symbol Server during the build, they probably don't need to be signed.
But if we do plan on uploading them to nuget.org, then maybe they need to be signed?

@dagood @mikem8361 - for thoughts/recommendations on what should be done with .snupkg files.

Copy link
Member

Choose a reason for hiding this comment

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

@tmat knows the most about snupkgs, I think.

Copy link
Member

Choose a reason for hiding this comment

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

snupkgs should be published to NuGet.org and the PDBs to Microsoft Symbol servers.

eerhardt added a commit to eerhardt/spark that referenced this pull request Apr 29, 2019
imback82 pushed a commit that referenced this pull request Apr 29, 2019
@tmat
Copy link
Member

tmat commented Apr 29, 2019

Have you considered using Arcade SDK? It's kind of sad to see folks spending a time on their infrastructure reinventing the wheel for the hundredth time when the same work has already been done and it's easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
6 participants