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

Build configuration migration .net 4.7.1 & .net core 2.0 #3535

Conversation

Latency
Copy link

@Latency Latency commented Jan 12, 2018

Take #2. Incorporated suggestions.

Had to create a new branch since my works in progress for my ResourceGenerator rewrite is on master.

Localization string files added.
Downloads files 50% faster with considerable file size reduction.
Uses new Image format to replace Bitmap.  Compiliant with .NET Core.
Updated framework and libraries to .NET 4.7.1.
Revamped Pre/Postevent.bat file to better automate & installation for resource generation.
Fixed various hotpoints and related NPEs throughout assemblies.
…project.

Helps eliminate dependancy problems associated with the new buildTools format v15.
Fixed many hotpoints and NPEs that exist throughout the project.
Added ImageSharp library as replacement for Bitmap types not found within .NET Core.
Rewrote ResourceGenerator project to fix tiles croped x.Pos += ~50.
Revamped ResourceWriter format I/O to handle new ImageSharp PNG format.
Reduces file store size by 50%+.
Revamped pre/post build.bat files to help with automation for Resource importation.
Updated msbuild configuration .csproj.
Fixed NuGet dependancy references and cleanup of .NET assembly internals.
@Zawodowiec1532
Copy link
Contributor

Dude, it's too big for just single PR. Nobody will review it. Firstly I recommend you to:

  1. Create new branch which is uptodate with Hearthstone-Deck-Tracker/master
  2. Push there only ResourceGenerator changes
  3. Create PR. :)

After you can create PR which only contain changes CRLF -> LF, etc.

@Latency
Copy link
Author

Latency commented Jan 12, 2018 via email

@azeier
Copy link
Member

azeier commented Jan 12, 2018

I can only suggest that you download a copy of my forked version and test to make sure everything is working as I have done.

That's not a reasonable way to make sure this PR is fine. Me being busy for two weeks doesn't mean reviewing a +-3k diff isn't crazy. Not only that not checking what possibly non obvious implications all of the changes might have.

This should at least be split into PRs for:

  • Cleanup
  • .NET Core (see below - I'm not sure why this is necessary)
  • .NET Framework 4.7 (see below)

This allows for much easier selective merging. It's okay for PRs to depends on one another.

There are also still what looks like to me line ending changes that result in major unnecessary diffs in a lot of the files. Also the CHANGELOG is user facing and should not contain technical changes.

Two major questions I have:

  • What happens when HDT updates to the new version but the user only has .NET Framework 4.5 installed?
  • What are the advantages of .NET Core besides cross platform (which are not relevant in a WPF project)?

@Latency
Copy link
Author

Latency commented Jan 13, 2018 via email

@Latency
Copy link
Author

Latency commented Jan 14, 2018

It was recommended that I try to split this PR into 2-4 smaller ones.
I have since done this for :

  1. ResourceGenerator
  2. Build configuration migration
  3. Hotpoint / NPE cleanup
  4. Namespace refactoring to match the new build configurations are still left in this one here.

In fact, all 4x issues are bundled into this PR as final release on my fork in (master).

@antonfirsov
Copy link

antonfirsov commented Jan 14, 2018

@Latency

WORKING!!! TESTED!!!

This is not how OSS collaboration works. Project maintainers should be able to prove that it's also "WORKING!!!" for 100-s of other users using the project. The safest way do so is to break down your changes to smaller PR-s.

@azeier
Copy link
Member

azeier commented Jan 30, 2018

From what I could find out so far: It looks like Squirrel (our updater) is not able to upgrade .NET installations on update. Which means updating HDT to any newer .NET Framework version will not be possible. In addition to that, 15% of the HDT userbase are using the zipped version, which comes with it's own updater, that would also require a custom implementation.

There are possible workarounds like pushing an HDT update that installs the required .NET Framework version and then downloads another update only that version can download. That is super nasty though and really not something I want to do.

On top of all that: I have over the last two months been working on pulling basically all the non-UI code into a separate library and rewriting it (currently still a private project). Which means a lot of the changes here would have to be ported.

It doesn't seem like upgrading .NET Framework and using .NET Core (which I'm still not sure what the benefits of would be) are worth it at this point. If we had concrete plans to make HDT cross platform this might be a different story, but that is not currently on our roadmap.

@Latency
Copy link
Author

Latency commented Jan 30, 2018

The build configurations have been considerably consolidated and updated completely to support the new format. It is not dependant upon .NET Core at all. In fact, I do not include the 'FrameworkVersion' to include Core in the main ASM. Dependency assemblies support both and they compile just fine and were easy to port since they are APIs which do not necessarily include XAML page files and resources.

Note, these build configurations are easier to use / add plugins / resources / NuGet packages / etc. and have better handling for binding redirects.

Updating the framework allows the project to be able to use 3rd party plugins / libraries that are compiled with targeted framework versions greater than what the project currently supports. Since my system does not have .NET 4.5 installed nor does it even come with Widows 10, would require that I have to install the RTs and SDK anyway.

Also, there are benefits to upgrading, as newer features and fixes are within the framework itself. This can be illustrated as depicted in my fork; specifically, for the NuGet packages being used in the ResourceGenerator v2 upgrade required as example.

As for squirrel, and everything else in the project, it should work the same and backwards compatible. I removed a few references / usings in which it wasn't being used in the file as code cleanup / analyzers depicted. Yet, these appeared to be identified in somebody else's commit as noticeable inference anyway.
I do know that I am getting the dialog window to appear OnLoad, prompting to do a code update, but I hadn't initiated it to test as of yet.

This PR looks rather large. I am thinking it has mostly to do with refactoring the namespaces to be in alignment with the folder hierarchy matching default build rules within the new build configuration now.

See also:

    <!-- App.xaml --> 
    <ApplicationDefinition Include="App.xaml" SubType="Designer" Generator="MSBuild:XamlIntelliSenseFileGenerator" />
	
    <!-- XAML elements -->
    <Page Include="**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" Exclude="App.xaml" />
    <Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />
	
    <!-- Resources -->
    <Resource Include="Images\**\*.ico" />
    <Resource Include="Images\**\*.png" />
    <Resource Include="Resources\**\*.png" />
    <Resource Include="Resources\**\*.jpg" />
    <Resource Include="Resources\Chunkfive.otf" />

Globbing has been restored to nest the designer file under the page.
I am not totally sold on intellisense working in XAML with this.
I believe that the Generator should change from Generator="MSBuild:Compile" to Generator="MSBuild:XamlIntelliSenseFileGenerator"
If anybody wants to confirm this & resolve... that would be great!

If you go on Gitub/dotnet and read the experimental workarounds for support we are trying to add with the new build configurations and compiler, you can see it is rather challenging. XAML is not a feature of .NET Core yet and using new build configurations that potentially can target ALL frameworks has its qwirks.

First of all, default build rules are now internal. Targets for pre-build / post-build & its synopsis have changed and specific concerns relating to CLP as illustrated here.

Setting the XAML pages to be Included (instead of Updated) && enabled within the VS IDE, disable the file completely. This breaks the designer entirely and will not get the project to load properly as discovered. It took me several attempts and weeks to figure out how to get this to work properly and extensive research all over the internet as workaround.

In my previous PR, it addressed a compromise (medium) of this new release and the original one found within the project. But, I finally was able to get it working with the new build configuration this weekend.

Also, without having to use explicit rules to enable backwards compatibility support for old MSBuild rules and conventions requires that additional rules be added to handle the XAML files. By default, we can see rules added above to specifically override **\*.* - But this does not support globbing, so I have added a line to fix that.

To keep the build configuration small and tidy and the project namespaces consistent, refactoring should persist to preserve ordering and adhere to the new build rules.

Finally, the main UI assembly must be forced to compile as x86 to keep visibility to the dependency Process.Module assemblies that are required to load .. specifically "mono.dll" -
"Hearthmirror\ProcessView.cs" since "Hearthstone.exe" is targeting x86.

"You have to compile your program using the same architecture as the target-process. The target-process loaded modules that establish x86-support on x64-OS, hence you got to compile using x86-architecture in order to aquire x86-modules from the target-process." - Zat

Dependency assemblies can be targeted to AnyCPU, which will support both and SN'd now to add reference to the GAC or dependent assemblies that may require it in the future. Also, it is possible that migrations can be made to now 'pack' dependency project assemblies as NuGet packages and have bootstrap automation update the packages with NuGet package manager & restore. This will eliminate much of what the confusing batch files are doing for handling this today and make visibility & versioning easier to work with as shown by the elimination / modifications of particular batch files in my PRs.

@Latency
Copy link
Author

Latency commented Feb 1, 2018

See reference 3539

@Latency Latency closed this Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants