Skip to content

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

Merged
merged 37 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f587f55
Update lib
lillo42 Jul 31, 2018
1c511f6
building project on Rider
Aug 3, 2018
4d34da6
Update Show
Aug 6, 2018
14a9ffd
Merge branch 'master' into linux-support
lillo42 Aug 18, 2018
6a69d95
improve problem to setup active database
lillo42 Aug 19, 2018
2d7f706
Improve windows bat
lillo42 Aug 19, 2018
a4dcfc3
improve on ShowBuildMenu.sh
lillo42 Aug 19, 2018
843c4e7
Remove build.cake
lillo42 Aug 19, 2018
144497c
improve script
lillo42 Aug 19, 2018
55af57b
Improve sh
Aug 19, 2018
f812725
Rollback some change
lillo42 Aug 21, 2018
7794b4a
Remove unused file
lillo42 Aug 21, 2018
3e1c4c1
Fix problem on file ShowBuildMenu.sh
lillo42 Sep 1, 2018
0578804
Remove Windows condicional on NHibernate.props and add information in…
lillo42 Sep 1, 2018
4b7ca0c
roll back some files
lillo42 Sep 1, 2018
15211bd
roll back IInterceptor.cs
lillo42 Sep 1, 2018
1d71022
Roll back some files
lillo42 Sep 1, 2018
606dff5
Revert files
hazzik Sep 14, 2018
58a0898
Reduce verbosity on build tool
hazzik Sep 14, 2018
b9889a7
Merge branch 'master' into linux-support
fredericDelaporte Oct 10, 2018
78d22df
Fix sh build-menu
fredericDelaporte Oct 10, 2018
1ccbbc5
Move linux instructions to contributing.md
fredericDelaporte Oct 10, 2018
91084ca
Cleanup of buildtool refactoring
fredericDelaporte Oct 10, 2018
170281b
Fix test option of Linux build menu
fredericDelaporte Oct 10, 2018
913908b
Update ShowBuildMenu.sh
lillo42 Oct 11, 2018
7813826
Merge branch 'master' into linux-support
fredericDelaporte Oct 11, 2018
e484a61
Adjust SQL Server CE removal
fredericDelaporte Oct 11, 2018
13e3d20
Avoid recompiling buildtool
fredericDelaporte Oct 11, 2018
f5d6177
Remove editor config forcing windows endline
fredericDelaporte Oct 11, 2018
31ec297
Add async generator option
fredericDelaporte Oct 11, 2018
0452514
Add solution restore in async generator option
fredericDelaporte Oct 11, 2018
bb3263a
Fix innocuous typo
fredericDelaporte Oct 11, 2018
150123a
Fix missing hidden dependency
fredericDelaporte Oct 11, 2018
f9c8116
Adjust contributing about Mono
fredericDelaporte Oct 13, 2018
91b0e3a
Do minor adjustments
fredericDelaporte Oct 15, 2018
32c21ff
Remove all eval
fredericDelaporte Oct 15, 2018
28b9443
Merge branch 'master' into linux-support
fredericDelaporte Oct 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ NHibernate.dll
TestResult.xml
.vscode
.DS_Store

.idea/
.vs/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ There are two official NHibernate community forums:
[B1]: http://groups.google.com/group/nhusers
[B2]: http://groups.google.com/group/nhibernate-development

Linux Debug
-----------

If you want to debug NHibernate on Linux, I need install [mono](https://www.mono-project.com/download/stable/)


Copy link
Member

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).

Bug Reports
-----------

Expand Down
8 changes: 7 additions & 1 deletion ShowBuildMenu.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
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\BuildTool.csproj
set BUILD_TOOL_SLN_PATH=%~dp0Tools\BuildTool\BuildTool.sln
set BUILDTOOL=dotnet run -p %BUILD_TOOL_PATH% -c Release --no-build
set AVAILABLE_CONFIGURATIONS=%~dp0available-test-configurations
set CURRENT_CONFIGURATION=%~dp0current-test-configuration
set NUNIT="%~dp0Tools\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe"

dotnet build %BUILD_TOOL_SLN_PATH% -c Release

:main-menu
echo ========================= NHIBERNATE BUILD MENU ==========================
echo --- TESTING ---
Expand All @@ -30,6 +34,8 @@ echo --- Exit ---
echo X. Make the beautiful build menu go away.
echo.



%BUILDTOOL% prompt ABCDEFGHIX
if errorlevel 9 goto end
if errorlevel 8 goto teamcity-menu
Expand Down
271 changes: 271 additions & 0 deletions ShowBuildMenu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
#!/bin/sh

BUILD_PROJECT="./Tools/BuildTool/BuildTool.csproj"
AVAILABLE_CONFIGURATIONS="available-test-configurations"
CONFIG_NAME=""
TEST_PLATFORM=""
LIB_FILES=""
LIB_FILES2=""
CURRENT_CONFIGURATION="./current-test-configuration"
BUILD_TOOL="dotnet run -p $BUILD_PROJECT -c Release --no-build -v q"
OPTION=0

buildDebug(){
eval "dotnet build ./src/NHibernate.sln"
echo "."
echo "Assuming the build succeeded, your results will be in the build folder."
echo "."
testSetupMenu
}

buildRelease(){
eval "dotnet build ./src/NHibernate.sln -c Release"
echo "."
echo "Assuming the build succeeded, your results will be in the build folder."
echo "."
testSetupMenu
}

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
}

testSetupGenericSkipCopy(){
cp "src/NHibernate.Config.Templates/$CONFIG_NAME.cfg.xml" "$AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml"
echo "Done setting up files. Starting notepad to edit connection string in file:"
echo "$AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml"
echo "Edit $AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml with your favorite text editor"
#start notepad "$AVAILABLE_CONFIGURATIONS/$CFGNAME/hibernate.cfg.xml"
echo "When you're done, don't forget to activate the configuration through the menu."
}

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
testSetupGenericSkipCopy
else
cp $LIB_FILES $AVAILABLE_CONFIGURATIONS/$CFGNAME
fi

if [ $LIB_FILES2 == ""]
then
testSetupGenericSkipCopy
else
cp $LIB_FILES2 $AVAILABLE_CONFIGURATIONS/$CFGNAME
fi
}

testSetupSqlServer() {
CONFIG_NAME="MSSQL"
TEST_PLATFORM="AnyCPU"
LIB_FILES=""
LIB_FILES2=""
testSetupGeneric
}

testSetupSqlServerCe(){
CONFIG_NAME="SqlServerCe"
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
}

testSetupOracle(){
CONFIG_NAME="Oracle"
TEST_PLATFORM="x86"
LIB_FILES="lib\teamcity\oracle\x86\*.dll"
LIB_FILES2=""
testSetupGeneric
}

testSetupOracleManaged() {
CONFIG_NAME="Oracle-Managed"
TEST_PLATFORM="AnyCPU"
LIB_FILES=""
LIB_FILES2=""
testSetupGeneric
}

testSetupHana() {
CONFIG_NAME="HANA"
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 Oracle(NOT Support yet)."
Copy link
Member

Choose a reason for hiding this comment

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

Better remove unsupported databases.

echo "F. Add a test configuration for Oracle with managed driver (NOT Support yet)."
echo "G. Add a test configuration for SQL Server Compact."
echo "H. Add a test configuration for MySql."
echo "I. Add a test configuration for SAP HANA(NOT Support yet)."
echo "."

This comment was marked as resolved.

echo "X. Exit to main menu."
echo "."

$BUILD_TOOL prompt ABCDEFGHIX

OPTION=$?
if [ $OPTION -eq 9 ]
then
echo "Main menu"
mainMenu
elif [ $OPTION -eq 8 ]
then
echo "HANA"
testSetupHana
mainMenu
elif [ $OPTION -eq 7 ]
then
echo "MySQL"
testSetupMysql
mainMenu
elif [ $OPTION -eq 6 ]
then
echo "SQL Server CE"
testSetupSqlServerCe
mainMenu
elif [ $OPTION -eq 5 ]
then
echo "Oracle Ma"
testSetupOracleManaged
mainMenu
elif [ $OPTION -eq 4 ]
then
echo "Oracle"
testSetupOracle
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"
eval "dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.csproj"
}

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 "D. Build NHibernate (Debug)"
echo "E. Build NHibernate (Release)"
Copy link
Member

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 "."
echo "--- Exit ---"
echo "X. Make the beautiful build menu go away."

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

echo "."

$BUILD_TOOL prompt ABCDEX

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
}

dotnet build ./Tools/BuildTool/BuildTool.sln -c Release
mainMenu


6 changes: 4 additions & 2 deletions Tools/BuildTool/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*.user
*.suo
.vs/
bin/Debug/
bin/
obj/
*.vshost.*
*.vshost.*
.idea/
.vs/
57 changes: 2 additions & 55 deletions Tools/BuildTool/BuildTool.csproj
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.1</TargetFramework>
</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>
Loading