-
Notifications
You must be signed in to change notification settings - Fork 935
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 a Linux build menu #1830
Add a Linux build menu #1830
Conversation
build-common/NHibernate.props
Outdated
@@ -10,8 +10,10 @@ | |||
<AssemblyVersion>$(VersionMajor).$(VersionMinor).0.0</AssemblyVersion> | |||
<FileVersion>$(VersionPrefix).0</FileVersion> | |||
|
|||
<NhAppTargetFrameworks>net461;netcoreapp2.0</NhAppTargetFrameworks> | |||
<NhLibTargetFrameworks>net461;netcoreapp2.0;netstandard2.0</NhLibTargetFrameworks> | |||
<NhAppTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net461;netcoreapp2.0</NhAppTargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this change? I can debug net461 without problems on my non windows laptop. These days I rarely run Windows at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? Every time I try to build Nhiberte fail, says I don’t have .Net Framework 4.6.1
Have you installed Mono on your laptop? I didn’t try to install mono
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I do have mono.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To debug NHibernate on Linux , Should be necessary install mono?
… README.md, it's necessery install mono if you is debug on Linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently testing working under Linux (Debian 9, Stretch).
I have done it only with master current state so far. I will likely update your branch to test it soon.
Some notes about my tests so far:
Under my setup, trying to load the nhibernate-core folder under VS Code triggers failures in Omnisharp (extension required for having basic C# support) if NHibernate project has not been already externally compiled. It tries to compile it but fails loading the ANTLR task. Otherwise once compiled externally, it seems to work.
Compiling under Rider fails on a clean project but succeed when launched a second time, then does no more fail. The failure is due to ANTLR build task too, but this time that is some kind of internal error in the build task: it fails finding some files it is supposed to have generated.
README.md
Outdated
|
||
If you want to debug NHibernate on Linux, I need install [mono](https://www.mono-project.com/download/stable/) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Development information is in Contributing.md. I think this should be moved in this other file, likely in "Setting up For Development" section.
Maybe also reword to something like:
Compiling the solution under Linux requires installation of [Mono](https://www.mono-project.com/download/stable) and of the [.NET Core SDK](https://www.microsoft.com/net/download).
src/NHibernate/NHibernate.csproj
Outdated
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" /> | ||
<PackageReference Include="System.Security.Permissions" Version="4.4.1" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this files are undue. But merging master in this PR branch should remove them.
ShowBuildMenu.sh
Outdated
echo "B. Add a test configuration for Firebird." | ||
echo "C. Add a test configuration for SQLite." | ||
echo "D. Add a test configuration for PostgreSQL." | ||
echo "E. Add a test configuration for Oracle(NOT Support yet)." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better remove unsupported databases.
ShowBuildMenu.sh
Outdated
echo "." | ||
echo "--- BUILD ---" | ||
echo "D. Build NHibernate (Debug)" | ||
echo "E. Build NHibernate (Release)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the Contributing.md files references the test menu options by letters, better keep the same letters.
echo "E. Build NHibernate (Release)" | ||
echo "." | ||
echo "--- Exit ---" | ||
echo "X. Make the beautiful build menu go away." |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
.editorconfig
Outdated
@@ -31,3 +31,6 @@ indent_size = 2 | |||
[*.cshtml] | |||
indent_style = space | |||
indent_size = 4 | |||
|
|||
[*.sh] | |||
end_of_line = LF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise code editors wrecks the sh file by switching it to CRLF. But maybe we should instead remove end_of_line = CRLF
from the start of this file. Normally, this is handled by the .gitattributes file (text=auto
) anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this needs to be in the .gitattributes, but not in for of text=auto (but rather an explicit)
ShowBuildMenu.sh
Outdated
echo "B. Add a test configuration for Firebird." | ||
echo "C. Add a test configuration for SQLite." | ||
echo "D. Add a test configuration for PostgreSQL." | ||
echo "E. Add a test configuration for SQL Server Compact." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can SQL Server CE run? It fails on my setup, when tried with Mono. If no one can get it working, we would have better removing it from the menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a search if is possible run SQL Server CE on Linux, it isn't possible run SQL Server CE:
Stack Overflow
ShowBuildMenu.sh
Outdated
|
||
testRun(){ | ||
eval "dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj" -f netcoreapp2.0 | ||
eval "dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj" -f netcoreapp2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limiting tests to netcoreapp2.0. On Windows, we do limit them to net461 when launched from the build menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Isn't better run the tests with netcoreapp2.0 and net461?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mono has issues running all the NHibernate tests. Many of them always fail with Mono.
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Remove SQL Server CE from .sh
set BUILD_TOOL_SLN_PATH=%~dp0Tools\BuildTool\BuildTool.sln | ||
set BUILDTOOL=dotnet run -p %BUILD_TOOL_PATH% -c Release --no-build | ||
set BUILD_TOOL_PATH=%~dp0Tools\BuildTool\bin\BuildTool.dll | ||
set BUILDTOOL=dotnet %BUILD_TOOL_PATH% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be it under Linux or Windows, I was noticing a lag in the build menu for displaying the letter choices prompt. And there was also a startup lag due to relaunching the build.
There were also some differences in the way the build tool was handled between Linux and Windows, without me seeing why they would need to be differently handled.
So I have changed the logic for building only if the binary is not already there, and for running directly the binary (dotnet pathOfBinary
) instead of running the project from sources (dotnet run pathToSrc
).
This eliminates the lag in the build menu both under Linux and Windows.
For simplicity, I have redirected the build output directly in the bin folder instead of letting it go into Release\netcoreapp2.0
.
Let Git handle that, it does a better job of putting the right eol according to the target OS. (editorconfig could have got the option, but this was unfortunately rejected: editorconfig/editorconfig#226)
Unfortunately, async generator fails running on my setup.
It needs it in some case under Windows, better do it under Linux too
I have added the async generator option. But when inspecting the 2.7.0 assembly with ILSpy, it actually already depends on it. Manually adding the assembly in the async generator folder solves the trouble. So it seems this thing is a somewhat "rogue" dependency causing issues only on some setup (Mono version maybe?), and using latest Microsoft.CodeAnalysis.Workspaces.Common versions should solve it since it now explicitly depends on it. For now I have added a hack for including it in the async generator directory. In other words, this script now works for launching the async generator, but it would be better to not need the SQLitePCLRaw hack it has. |
gitreleasemanager.* | ||
SQLitePCLRaw.core.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required for the Linux/Mono hack I have used to get async generator running.
wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | ||
fi | ||
|
||
async_generator_path="CSharpAsyncGenerator.CommandLine.$(cat packages.config | grep id=\"CSharpAsyncGenerator.CommandLine | cut -d\" -f4)/tools" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hack for parsing the async generator version out of the packages.config file:
- Output the content of packages.config
- Filter out any line not containing
id=\"CSharpAsyncGenerator.CommandLine
- Split the remaining line(s) by
"
and take the fourth string resulting of the split
If you know a better way, of course propose it.
I need it to build the path to the async generator version we have to use.
CONTRIBUTING.md
Outdated
@@ -20,7 +20,7 @@ The main GitHub repository is at [https://github.com/nhibernate/nhibernate-core] | |||
|
|||
## The Build Menu | |||
|
|||
**ShowBuildMenu.bat** will be your friend throughout this journey. He's easiest to work with if you make his box bigger by following these steps: | |||
**ShowBuildMenu.bat** will be your friend throughout this journey. A .sh version exists for Linux. He's easiest to work with if you make his box bigger by following these steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ShowBuildMenu.bat
is referenced as "He"? Shouldn't it be "It"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
ShowBuildMenu.sh
Outdated
|
||
if [ ! -d $async_generator_path ] | ||
then | ||
eval "mono nuget.exe install" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just nuget install
should be enough. (Without ".exe", and at least in my installation).
91b0e3a
Hi,
In this PR I'm improving linux support to debug.
I've tested on Ubuntu with IDE Jetbrains Rider, I tried to test on Fedora but I had some problem to run NUnit, the test neve begin.
I create a new file ShowBuildMenu.sh , this file is similar to ShowBuildMenu.bat, but with less function because I think some function are not useful to linux environment, today with this file is possible create and activated a new Database, build and execute test.
I recreated BuildTool to .NET Core and change ShowBuildMenu.bat to use this project, now to debug on Windows is necessary .NET Core installed