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

Pack localized assemblies. #1816

Merged
merged 1 commit into from
Jul 18, 2016
Merged

Conversation

JohanLarsson
Copy link
Contributor

@JohanLarsson JohanLarsson commented Jul 17, 2016

Second attempt at #1806.

  • Should fix Paket 3.7.0.0 broke paket pack #1810.
  • Printing warning instead of throwing if satellite dll is not found. Added integration test for this.
  • Better pattern for finding languages.
  • Checking that matches for the regex is a culture name.

Thank you for all the help @smoothdeveloper!

paket ("pack -v output \"" + outPath) scenario |> ignore
ZipFile.ExtractToDirectory(package, outPath)

Path.Combine(outPath, "lib", "net45", "LocalizedLib.dll") |> checkFileExists
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use </> operator defined in Paket.IO (it is AutoOpen so you don't even have to open the namespace):

outPath </> "lib" </> "net45" </> "LocalizedLib.dll" |> checkFileExists

Copy link
Contributor Author

@JohanLarsson JohanLarsson Jul 17, 2016

Choose a reason for hiding this comment

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

While it looks sweet I have not seen it in the rest of the code so not sure. Trying to stay consistent with the codebase. Also as a noob Path.Combine(...) is nice as I know what it does.
As always, thanks for taking the time to read!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's minor thing.

That same operator is defined in FAKE and pretty much any codebase dealing with paths so I thin it is not too far from reach for average F# developer.

You can use go to definition on operators also 😄

@JohanLarsson JohanLarsson force-pushed the pack_localized branch 3 times, most recently from f45ed83 to 2c47583 Compare July 18, 2016 00:32
@JohanLarsson JohanLarsson changed the title Pack localized assemblies. WIP Pack localized assemblies. Jul 18, 2016
@forki
Copy link
Member

forki commented Jul 18, 2016

Why do we show warnings and when? I mean having no satellite assemblies is the 95% case

@JohanLarsson
Copy link
Contributor Author

JohanLarsson commented Jul 18, 2016

The warning is shown here, it happens when:

  1. A localization for language is found in the project file.
  2. No matching ../{language}/foo.resources.dll is found.
    In the previous version I threw here but it was too harsh I think.
    I can remove it of course but think it can be a good reminder to build before running paket pack.

No localization should not give a warning.

Fixes since previous attempt:
- fsprojects#1810 should be ok now.
- Outputting warning instead of throwing if satellite dll is not found.
- Better pattern for finding languages.
- Checking that matches for the regex is a culture name.
open System.Collections.Generic
open System.Globalization

[<CompilationRepresentation (CompilationRepresentationFlags.ModuleSuffix)>]
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless you have a type Cultures under Paket namespace, I don't think we need those attributes (which is used to disambiguate between module and type bearing same name).

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 copy pasted them from the Cache module, no idea what they mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is needed for Cache module because there is also a Cache type under same namespace.

F# will coallesce both to expose them as Cache but the module need to be given that attribute which under the hood suffixes the static class with Module.

We don't need it for this Cultures since there is no Cultures type that would conflict.

Copy link
Contributor Author

@JohanLarsson JohanLarsson Jul 18, 2016

Choose a reason for hiding this comment

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

Thanks for the explanation, removing it.
Oh, too late.

Copy link
Member

Choose a reason for hiding this comment

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

there is always room for new PR ;-)

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 gonna try to fix the uri issue but was too slow :D

Copy link
Member

Choose a reason for hiding this comment

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

That one is a bit tricky. not sure if my fix was good. have to think about it a bit more.

@forki forki merged commit f9508c6 into fsprojects:master Jul 18, 2016
@forki
Copy link
Member

forki commented Jul 18, 2016

there is still one related test failing on mono: https://travis-ci.org/fsprojects/Paket/builds/145555619

@JohanLarsson
Copy link
Contributor Author

Checking it out, didn't see that one before, strange.

@forki
Copy link
Member

forki commented Jul 18, 2016

I assume there is something not commited

@forki
Copy link
Member

forki commented Jul 18, 2016

#1816 pack localized happy path fails on my machine with:

System.Exception : Paket failed with:
Could not find 'paket.dependencies'. To use Paket with this solution, please run 'paket init' first.
If you have already run 'paket.init' then ensure that 'paket.dependencies' is located in the top level directory of your repository.
Like this:
MySourceDir
  .paket
  paket.dependencies

@JohanLarsson
Copy link
Contributor Author

Looks like the templates are missing, must have dumbed it during some rebase. Opening a new WIP PR for fixing it.

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.

Paket 3.7.0.0 broke paket pack
3 participants