forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contributor Guide.html
157 lines (119 loc) · 7.84 KB
/
Contributor Guide.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<html>
<head>
<title>NHibernate Contributor Guide</title>
<style type="text/css">
h1 { background-color: #9999FF; width: 100% }
h2 { background-color: #CCCCFF; width: 100% }
h3 { background-color: #DDDDDD; width: 100% }
body { font-family: Sans-Serif; }
</style>
</head>
<body>
<h1>Contributing to NHibernate</h1>
<p>
This document describes the policies and procedures for working with NHibernate. It also describes how to quickly get going with a test case and optionally a fix for NHibernate.
</p>
<p>
For the least friction, please follow the steps in the order presented, being careful not to miss any. There are many details in this document that will help your contribution go as smoothly as possible. Please read it thoroughly.
</p>
<h2>Check for Existing Issues</h2>
Visit <a href="https://nhibernate.jira.com/">https://nhibernate.jira.com</a> and search for your issue. If you see it, voting for it is a good way to increase the visibility of the issue.
<h2>Create a JIRA Issue</h2>
<p>
JIRA is used to generate the release notes and serves as a central point of reference for all changes that have occurred to NHibernate.
</p>
<p>
Before creating an issue, please do your best to verify the existence of the problem. This reduces noise in the issue tracker and helps conserve the resources of the team for more useful tasks. Note the issue number for future steps. Ex. NH-2318
</p>
<h2>Fork and Clone from GitHub</h2>
<p>
The main GitHub repository is at <a href="https://github.com/nhibernate/nhibernate-core">https://github.com/nhibernate/nhibernate-core</a>. If you plan to contribute your test case or improvement back to NHibernate, you should visit that page and fork the repository so you can commit your own changes and then submit a pull request.
</p>
<h2>The Build Menu</h2>
<b>ShowBuildMenu.bat</b> will be your friend throughout this journey. He's easiest to work with if you make his box bigger by following these steps:
<ol>
<li>Run ShowBuildMenu.bat.</li>
<li>Right click on the title bar of the window.</li>
<li>Select "Properties".</li>
<li>Select the "Layout" tab.</li>
<li>
Set the following options.
<ul>
<li>
Screen Buffer Size
<ul>
<li>Width: 160</li>
<li>Height: 9999</li>
</ul>
Window Size
<ul>
<li>Width: 160</li>
<li>Height: 50</li>
</ul>
</li>
</ul>
</li>
</ol>
<h2>Setting up For Development</h2>
<ol>
<li>Install your favorite database and optionally set up a user capable of creating and dropping a database called <b>nhibernate</b>. There are some per-database instructions in the lib/teamcity/* folders, which you may find helpful. For SQL Server, you might be able to use the <b>localhost\sqlexpress</b> instance installed with Visual Studio. Often people already have databases set up, so you might not even need to do anything in this step.</li>
<li>Run the build menu and select the option A to create the AssemblyInfo.cs files.</li>
<li>Run the build menu and select option B to create a new test configuration. Notepad will pop up and you should edit the connection string information, saving it when you're done. These configurations will appear in the "available-test-configurations" folder.</li>
<li>Run the build menu and select option C to activate the test configuration you created. The appropriate configuration will be copied to the "current-test-configuration" folder.</li>
<li>(Optional) Run all the tests with option 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.</li>
<li>Before using the database for unit tests from Visual Studio, you'll need to create an empty database that matches your connection string. <a href="https://nhibernate.jira.com/browse/NH-2866">NH-2866</a> will make this easier, but for now you just have to drop/create the database specified in your connection string yourself.</li>
</ol>
<h2>Creating a Test Case to Verify the Issue</h2>
<p>
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.
</p>
<ol>
<li>Open <b>NHibernate.sln</b> from the src folder.</li>
<li>If adding a C# test, go to the NHSpecificTest folder in the NHibernate.Test project. If adding a VisualBasic test, go to the Issues folder in the NHibernate.Test.VisualBasic project.</li>
<li>Copy and paste the NH0000 folder to create a duplicate test ("Copy of NH0000").</li>
<li>Replace the four (five for vb) instances of NH0000 with your issue number.</li>
<li>Edit the test as you see fit. Don't commit yet; there are details in a later step.</li>
</ol>
<h2>Running Your Unit Test</h2>
<h3>Debugging Through Included NUnit GUI</h3>
<ol>
<li>Right click on the project (ex. NHibernate.Test) in Visual Studio.</li>
<li>Select: Debug -> Start New Instance</li>
<li>Type the name of your unit test to quickly go to it. For example: NH2318</li>
<li>Select and run the test.</li>
<li>You can also make the test project your startup project and it will run NUnit when you press F5.</li>
</ol>
<h3>Third Party NUnit Test Runner</h3>
This would be something like ReSharper.
<ol>
<li>Sometimes tests fail when run under x64. If required (ex. SQLite and Firebird), go to the project properties Build tab and set the target to x86.</li>
<li>Next, just run the tests as usual.</li>
</ol>
<h2>Commit your Test Case</h2>
<p>
Ensure that your e-mail address and name are configured appropriately in Git.
</p>
<p>
Create a feature branch so it's easy to keep it separate from other improvements. Having a pull request accepted might involve further commits based on community feedback, so having the feature branch provides a tidy place to work from. Using the issue number as the branch name is good practice.
</p>
<p>
When you commit, please include the issue number in your commit message. This will allow the JIRA issue tracker to link to automatically link your commits to the issue. For example: NH-1234
</p>
<h2>Implementing the Bug Fix or Improvement</h2>
Since you now have a failing test case, it should be straight-forward to step into NHibernate to attempt to ascertain what the problem is. While this may seem daunting at first, feel free to give it a go. It's just code afterall. :)
<h3>Ensure All Tests Pass</h3>
Once you've made changes to the NHibernate code base, you'll want to ensure that you haven't caused any previously passing tests to fail. The easiest way to check this is to select option D from the build menu, ensure the root tree node is selected, then press run to have all the tests run.
<h2>Submit a Pull Request</h2>
<p>
Be sure to link to the JIRA issue in your GitHub pull request. Also, go back to your JIRA issue and link to the pull request.
</p>
<p>We use tabs for code indentation, not spaces. As this is not the default in Visual Studio, you will need to reconfigure Visual Studio to indent with tabs whenever you work on the NHibernate codebase. To make this easier, NHibernate has an
<a href="http://www.editorconfig.org/">editorconfig</a> configuration file to switch Visual Studio automatically between
tabs and spaces mode. It is recomended you install editorconfig from the Visual Studio Extension Manager.</p>
<h2>Further Discussion</h2>
<p>
The NHibernate team monitors JIRA and GitHub regularly, so your request will be noticed. If you want to discuss it further, you are welcome to post to the <a href="http://groups.google.com/group/nhibernate-development">nhibernate-development mailing list</a>.
</p>
<h2>Happy Contributing!</h2>
<p>The NHibernate community values your contributions. Thank you for the time you have invested.</p>
</body>