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

Implement DependencyChecker #900

Merged
merged 18 commits into from
Apr 2, 2015

Conversation

amaitland
Copy link
Member

This is a rough first draft of DependencyChecker. Basically loops through list of all Cef/CefSharp dependencies.

Creating this PR before I go too far, some questions to be answered I think.

  • Should we provide the option to validate have some dependencies marked as optional?
  • What's the expected output if calling from user land? Is a list of strings containing which files are missing ok? Would people just prefer a formatted string?
  • Anyone have any thoughts on obtaining the path? I've started with the ExecutingAssembly and allowed an overload so that users can call themselves.

Will include an overload for Cef.Initialize() that enables/disables the dependency check when I'm happy the other questions have been answered.

Resolves #876

@amaitland
Copy link
Member Author

@jornh @jankurianski @rassilon Any thoughts/comments?

(Full disclaimer, first draft is a little rough).

@amaitland amaitland added this to the 39.0.0 milestone Mar 24, 2015
@jankurianski
Copy link
Member

Should we provide the option to validate have some dependencies marked as optional?

Yes, I would like that. I do not include pdf.dll or ffmpegsumo.dll with my app as they are unnecessary for me.

Is CefSharp.BrowserSubprocess.* required? Though I have not tried, I thought you could re-use your main .exe somehow.

What's the expected output if calling from user land? Is a list of strings containing which files are missing ok? Would people just prefer a formatted string?

An exception with a formatted string sounds good to me. It ensures that an informative message appears in Visual Studio if debugging, and when their app is deployed, it will ensure their exception handling code will log the relevant missing files (as most people will at a minimum log the exception type and message via e.ToString()).

Anyone have any thoughts on obtaining the path? I've started with the ExecutingAssembly and allowed an overload so that users can call themselves.

Default works for me, and overload seems flexible enough to handle anything weird.

Good job BTW 👍

@amaitland
Copy link
Member Author

Yes, I would like that. I do not include pdf.dll or ffmpegsumo.dll with my app as they are unnecessary for me.

Any thoughts on handling this? There are so many dependencies that are only used in specific scenarios. Is it enough to check for Required or Required + Optional without going down into the meticulous detail of checking that d3dcompiler_43.dll is present for a windows xp machine?

Is CefSharp.BrowserSubprocess.* required? Though I have not tried, I thought you could re-use your main .exe somehow.

CEF allows for the scenario where you can use your main exe and launch the render/gpu processes via command line options. CefSharp explicitly implements render/gpu with BrowserSubprocess. Quite a common mistake to forget them, which means Cef will load without exception, just won't render any content.

@amaitland
Copy link
Member Author

Think I've got something that I'm relatively happy with.

Further comments? It's not very well tested yet.

@amaitland
Copy link
Member Author

There's likely to be a few refactoring to DRY the code out a bit. Keeping it simple until I'm happy we've got something that will work in 99% of cases.

@amaitland
Copy link
Member Author

Should also note that disabling pack loading will cause the scrollbars to become red, known issue. #598

/// <param name="resourcesDirPath"></param>
/// <param name="localePackFile">The locale pack file e.g. <see cref="LocalesPackFile"/> </param>
/// <returns>List of missing dependencies, if all present an empty List will be returned</returns>
public static List<string> CheckDependencies(bool checkOptional, bool packLoadingDisabled, string path, string resourcesDirPath, string localePackFile = LocalesPackFile)
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever I see gobs of bool parameters I usually think: Are you really sure using a flag enum isn't the correct thing to do here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Pack loading is a special case. checkOptional would be replaced with an enum if we went down that path.

@rassilon
Copy link
Contributor

This is looking good. I think the optional dlls fall into these separate catagories:

  • GPUAcceleration
  • OSGPUAcceleration
  • AudioVideo
  • PDFPlugin

The flag enum idea would allow you to easily check which set to examine.

I don't really care at the moment whether or not the above suggestions are put in the PR before merging though.

Bill

…don't think it's worth spending too much time on though)

Use Path.Combine instead of manual string concat
@amaitland
Copy link
Member Author

I've added a slightly crude IsWindowsXp static property, not great. Will do for now I guess. Also moved the code into Cef.Initialize(), it's not called by default as yet. Expanded the example to demo it.

@rassilon
Copy link
Contributor

Still looking good.

@rassilon
Copy link
Contributor

If we eventually do the flag thing might as well include:

  • WinForm
  • WPF
  • Generic OSR

Bill

}

builder.AppendLine("Executing Assembly Path:" + path);

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also add an informational reminder in this string about locales\xxxx.pak that explains what they do if we know even though I would never suggest checking for the dependency to exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rassilon Not sure I understand, can you clarify?

@amaitland
Copy link
Member Author

Anyone up for taking this for a spin and reporting back?

At some point I'd still like to see the enum option implemented, though I'm thinking this might be enough for 39 and we improve for 41?

@amaitland
Copy link
Member Author

Merging this one now, if anyone has improvements they wish to make just shout out so we can work out if they are done before 39 release.

amaitland added a commit that referenced this pull request Apr 2, 2015
@amaitland amaitland merged commit a434d3c into cefsharp:master Apr 2, 2015
@amaitland amaitland deleted the feature/dependencychecker branch July 13, 2015 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DependencyChecker
3 participants