-
Notifications
You must be signed in to change notification settings - Fork 933
Add a Linux build menu #1830
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
Changes from 28 commits
f587f55
1c511f6
4d34da6
14a9ffd
6a69d95
2d7f706
a4dcfc3
843c4e7
144497c
55af57b
f812725
7794b4a
3e1c4c1
0578804
4b7ca0c
15211bd
1d71022
606dff5
58a0898
b9889a7
78d22df
1ccbbc5
91084ca
170281b
913908b
7813826
e484a61
13e3d20
f5d6177
31ec297
0452514
bb3263a
150123a
f9c8116
91b0e3a
32c21ff
28b9443
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ indent_size = 2 | |
[*.cshtml] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.sh] | ||
end_of_line = LF | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ NHibernate.dll | |
TestResult.xml | ||
.vscode | ||
.DS_Store | ||
|
||
.idea/ | ||
.vs/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. |
||
|
||
1. Run ShowBuildMenu.bat. | ||
2. Right click on the title bar of the window. | ||
|
@@ -41,6 +41,8 @@ The main GitHub repository is at [https://github.com/nhibernate/nhibernate-core] | |
4. (Optional) Run all the tests with option C or D and hopefully you will see no failing tests. The build may fail on certain databases; please ask on the mailing list if you are having trouble. | ||
5. Before using the database for unit tests from an IDE, you'll need to create an empty database that matches your connection string. The unit test in NHibernate.TestDatabaseSetup supports some databases. If the one you have configured is supported, it will drop the database if it does already exist, then recreate it. | ||
|
||
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). | ||
|
||
## Creating a Test Case to Verify the Issue | ||
|
||
In most cases, you will be adding your test to the NHibernate.Test project. If there is a test that only works with VisualBasic, then add it to the NHibernate.Test.VisualBasic project instead. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,16 @@ | |
pushd %~dp0 | ||
|
||
set NANT="%~dp0Tools\nant\bin\NAnt.exe" -t:net-4.0 | ||
set BUILDTOOL="%~dp0Tools\BuildTool\bin\Release\BuildTool.exe" | ||
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 commentThe 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 ( 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 |
||
set AVAILABLE_CONFIGURATIONS=%~dp0available-test-configurations | ||
set CURRENT_CONFIGURATION=%~dp0current-test-configuration | ||
set NUNIT="%~dp0Tools\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe" | ||
|
||
if not exist %BUILD_TOOL_PATH% ( | ||
dotnet build %~dp0Tools\BuildTool\BuildTool.sln -c Release -o bin | ||
) | ||
|
||
:main-menu | ||
echo ========================= NHIBERNATE BUILD MENU ========================== | ||
echo --- TESTING --- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
#!/bin/sh | ||
|
||
BUILD_TOOL_PATH="./Tools/BuildTool/bin/BuildTool.dll" | ||
BUILD_TOOL="dotnet $BUILD_TOOL_PATH" | ||
AVAILABLE_CONFIGURATIONS="available-test-configurations" | ||
CONFIG_NAME="" | ||
TEST_PLATFORM="" | ||
LIB_FILES="" | ||
LIB_FILES2="" | ||
CURRENT_CONFIGURATION="./current-test-configuration" | ||
OPTION=0 | ||
|
||
if [ ! -f $BUILD_TOOL_PATH ] | ||
then | ||
eval "dotnet build ./Tools/BuildTool/BuildTool.sln -c Release -o bin" | ||
fi | ||
|
||
buildDebug(){ | ||
eval "dotnet build ./src/NHibernate.sln" | ||
echo "." | ||
echo "Assuming the build succeeded, your results will be in the build folder." | ||
echo "." | ||
mainMenu | ||
} | ||
|
||
buildRelease(){ | ||
eval "dotnet build ./src/NHibernate.sln -c Release" | ||
echo "." | ||
echo "Assuming the build succeeded, your results will be in the build folder." | ||
echo "." | ||
mainMenu | ||
} | ||
|
||
testActivate(){ | ||
FILE_TEMP="folder.tmp" | ||
|
||
$BUILD_TOOL pick-folder $AVAILABLE_CONFIGURATIONS $FILE_TEMP "Which test configuration should be activated?" | ||
|
||
if [ -d $CURRENT_CONFIGURATION ] | ||
then | ||
rm -r $CURRENT_CONFIGURATION/ | ||
fi | ||
|
||
CURRENT_FOLDER=$(pwd) | ||
INFORMATION=$(cat $CURRENT_FOLDER/$FILE_TEMP) | ||
cp -r $INFORMATION/ $CURRENT_CONFIGURATION | ||
|
||
rm $FILE_TEMP | ||
|
||
echo "Configuration activated." | ||
|
||
mainMenu | ||
} | ||
|
||
testSetupGeneric() { | ||
echo "Enter a name for your test configuration or press enter to use default name:" | ||
read CFGNAME | ||
if [ $CFGNAME = ""] | ||
then | ||
CFGNAME="$CONFIG_NAME-$TEST_PLATFORM" | ||
echo $CFGNAME | ||
fi | ||
|
||
mkdir -p $AVAILABLE_CONFIGURATIONS/$CFGNAME | ||
|
||
if [ ! "$LIB_FILES" ] | ||
then | ||
cp $LIB_FILES $AVAILABLE_CONFIGURATIONS/$CFGNAME | ||
|
||
if [ ! "$LIB_FILES2" ] | ||
then | ||
cp $LIB_FILES2 $AVAILABLE_CONFIGURATIONS/$CFGNAME | ||
fi | ||
fi | ||
|
||
cp "src/NHibernate.Config.Templates/$CONFIG_NAME.cfg.xml" "$AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml" | ||
echo "Done setting up files. Please edit the connection string in file:" | ||
echo "$AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml" | ||
echo "When you're done, don't forget to activate the configuration through the menu." | ||
mainMenu | ||
} | ||
|
||
testSetupSqlServer() { | ||
CONFIG_NAME="MSSQL" | ||
TEST_PLATFORM="AnyCPU" | ||
LIB_FILES="" | ||
LIB_FILES2="" | ||
testSetupGeneric | ||
} | ||
|
||
testSetupFirebird() { | ||
CONFIG_NAME="FireBird" | ||
TEST_PLATFORM="AnyCPU" | ||
LIB_FILES="" | ||
LIB_FILES2="" | ||
testSetupGeneric | ||
} | ||
|
||
testSetupSqlite() { | ||
CONFIG_NAME="SQLite" | ||
TEST_PLATFORM="AnyCPU" | ||
LIB_FILES="" | ||
LIB_FILES2=""e | ||
testSetupGeneric | ||
} | ||
|
||
testSetupPostgresql() { | ||
CONFIG_NAME="PostgreSQL" | ||
TEST_PLATFORM="AnyCPU" | ||
LIB_FILES="" | ||
LIB_FILES2="" | ||
testSetupGeneric | ||
} | ||
|
||
testSetupMysql() { | ||
CONFIG_NAME="MySql" | ||
TEST_PLATFORM="AnyCPU" | ||
LIB_FILES="" | ||
LIB_FILES2="" | ||
testSetupGeneric | ||
} | ||
|
||
testSetupMenu() { | ||
echo "A. Add a test configuration for SQL Server." | ||
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 MySql." | ||
echo "." | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
echo "X. Exit to main menu." | ||
echo "." | ||
|
||
$BUILD_TOOL prompt ABCDEX | ||
|
||
OPTION=$? | ||
if [ $OPTION -eq 5 ] | ||
then | ||
echo "Main menu" | ||
mainMenu | ||
elif [ $OPTION -eq 4 ] | ||
then | ||
echo "MySQL" | ||
testSetupMysql | ||
mainMenu | ||
elif [ $OPTION -eq 3 ] | ||
then | ||
echo "PostgreSQL" | ||
testSetupPostgresql | ||
mainMenu | ||
elif [ $OPTION -eq 2 ] | ||
then | ||
echo "Sqlite" | ||
testSetupSqlite | ||
mainMenu | ||
elif [ $OPTION -eq 1 ] | ||
then | ||
echo "Firebird" | ||
testSetupFirebird | ||
mainMenu | ||
elif [ $OPTION -eq 0 ] | ||
then | ||
echo "SQL Server" | ||
testSetupSqlServer | ||
mainMenu | ||
fi | ||
} | ||
|
||
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 commentThe 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 commentThe 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 commentThe 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. |
||
mainMenu | ||
} | ||
|
||
mainMenu() { | ||
echo "========================= NHIBERNATE BUILD MENU ==========================" | ||
echo "--- TESTING ---" | ||
echo "A. (Step 1) Set up a new test configuration for a particular database." | ||
echo "B. (Step 2) Activate a test configuration." | ||
echo "C. (Step 3) Run tests." | ||
echo "." | ||
echo "--- BUILD ---" | ||
echo "E. Build NHibernate (Debug)" | ||
echo "F. Build NHibernate (Release)" | ||
echo "." | ||
echo "--- Exit ---" | ||
echo "X. Make the beautiful build menu go away." | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. |
||
echo "." | ||
|
||
$BUILD_TOOL prompt ABCEFX | ||
|
||
OPTION=$? | ||
|
||
if [ $OPTION -eq 4 ] | ||
then | ||
buildRelease | ||
elif [ $OPTION -eq 3 ] | ||
then | ||
buildDebug | ||
elif [ $OPTION -eq 2 ] | ||
then | ||
testRun | ||
elif [ $OPTION -eq 1 ] | ||
then | ||
testActivate | ||
elif [ $OPTION -eq 0 ] | ||
then | ||
testSetupMenu | ||
fi | ||
} | ||
|
||
mainMenu |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
*.user | ||
*.suo | ||
.vs/ | ||
bin/Debug/ | ||
bin/ | ||
obj/ | ||
*.vshost.* | ||
*.vshost.* | ||
.idea/ | ||
.vs/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{9F599EF4-F977-4063-9141-3D95359EE076}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>BuildTool</RootNamespace> | ||
<AssemblyName>BuildTool</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildTool", "BuildTool.csproj", "{9F599EF4-F977-4063-9141-3D95359EE076}" | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26124.0 | ||
MinimumVisualStudioVersion = 15.0.26124.0 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildTool", "BuildTool.csproj", "{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9F599EF4-F977-4063-9141-3D95359EE076}.Debug|x86.ActiveCfg = Debug|x86 | ||
{9F599EF4-F977-4063-9141-3D95359EE076}.Debug|x86.Build.0 = Debug|x86 | ||
{9F599EF4-F977-4063-9141-3D95359EE076}.Release|x86.ActiveCfg = Release|x86 | ||
{9F599EF4-F977-4063-9141-3D95359EE076}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|x64.Build.0 = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Debug|x86.Build.0 = Debug|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|x64.ActiveCfg = Release|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|x64.Build.0 = Release|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|x86.ActiveCfg = Release|Any CPU | ||
{1973E971-94A9-4A8A-B9C1-B4F8E0C5E3BF}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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)