How to Contribute to ManifoldCF

"Contributing" to an Apache project is about more than just writing code – it's about doing what you can to make the project better. There are lots of ways to contribute. New connectors and authorities are welcome. Documentation and tests are equally as important. New features are worthy of proposal and discussion. And last, simple bug fixes are always helpful.

Be Involved

Contributors should join the ManifoldCF mailing lists. In particular:

Please keep discussions about ManifoldCF on list so that everyone benefits. Emailing individual committers with questions about specific ManifoldCF issues is discouraged. See http://people.apache.org/~hossman/#private_q.  If you have specific bugs to report, you can do so here: https://issues.apache.org/jira/browse/CONNECTORS/ .

Contributing Code (Features, Bug Fixes, Tests, etc...)

This section identifies the ''optimal'' steps community member can take to submit a changes or additions to the ManifoldCF code base. This can be new features, bug fixes optimizations of existing features, or tests of existing code to prove it works as advertised (and to make it more robust against possible future changes).

Please note that these are the "optimal" steps, and community members that don't have the time or resources to do everything outlined on this below should not be discouraged from submitting their ideas "as is" per "Yonik Seeley's (Solr committer) Law of Patches" ...

A half-baked patch in Jira, with no documentation, no tests
and no backwards compatibility is better than no patch at all.

Just because you may not have the time to write unit tests, or cleanup backwards compatibility issues, or add documentation, doesn't mean other people don't. Putting your patch out there allows other people to try it and possibly improve it.

Getting the source code

First of all, you need the ManifoldCF source code.

Get the source code on your local drive using SVN. Most development is done on the "trunk":

> svn checkout http://svn.apache.org/repos/asf/manifoldcf/trunk mcf-trunk

Note that committers have to use https instead of http here, but http is fine for read-only access to the trunk code.

Making Changes

Before you start, you should send a message to the ManifoldCF developer mailing list (Note: you have to subscribe before you can post), or file a bug in Jira. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements. In the end, you will need to attach your patch to a Jira ticket, so one of these must be created by either you or someone else that covers your work.

Modify the source code and add some (very) nice features using your favorite IDE, or no IDE at all.

But take care about the following points

Generating a patch

A "patch file" is the format that all good contributions come in. It bundles up everything that is being added, removed, or changed in your contribution. Here's how to generate one.

Unit Tests

Please make sure that all unit tests succeed before constructing your patch. The easiest way to do this is via ant.

ant test

If you have a PostgreSQL instance installed, you might also want to run the PostgreSQL version of the tests.

ant test-postgresql

The "build" will fail if there are test errors, which is a sign that there is something wrong that you should investigate. Please, read carefully the errors messages and check your code.

Creating the patch file

Check to see what files you have modified with:

svn status

Add any new files with:

svn add src/.../MyNewClass.java

Don't forget to attach the standard V2.0 Apache license header to any new files!

Subversion's "add" command only modifies your local copy, so it does not require commit permissions. By using "svn add", your entire contribution can be included in a single patch file, without needing to submit a separate set of "new" files.

Edit the ''CHANGES.txt'' file, adding a description of your change, including the bug number it fixes.

In order to create a patch, just type the following from the root of the trunk directory hierarchy:

svn diff > CONNECTORS-xxx.patch

This will report all modifications done on ManifoldCF sources on your local disk and save them into the ''CONNECTORS-xxx.patch'' file. Instead of 'xxx', use the actual Jira ticket number.

Read the patch file. Make sure it includes ONLY the modifications required to fix a single issue.

Please do not:

Please do:

Contributing your work

Finally, patches should be attached to a bug report in Jira. Always remember to check the radio button that grants the license rights to the patch to the Apache Software Foundation; if that button is not checked, then we cannot use your patch! Also, if you are revising an existing patch, please re-use the exact same name as the previous attachment, Jira will "grey out" the older versions so it's clear which version is the newest.

Please be patient. Committers are busy people too. If no one responds to your patch after a few days, please make friendly reminders. Please incorporate others' suggestions into into your patch if you think they're reasonable. Finally, remember that even a patch that is not committed is useful to the community.

Review/Improve Existing Patches

If there's a Jira issue that already has a patch you think is really good, and works well for you – please add a comment saying so. If there's room for improvement (more tests, better javadocs, etc...) then make the changes and attach it as well. If a lot of people review a patch and give it a thumbs up, that's a good sign for committers when deciding if it's worth spending time on the patch – and if other people have already put in effort to improve the docs/tests for a patch, that helps even more.

Applying a patch

From the base directory (assuming that is where the patch is generated from), run:

patch -p 0 -i <PATH TO PATCH> [--dry-run]

Helpful Resources

The following resources may prove helpful when developing ManifoldCF contributions. (These are not an endorsement of any specific development tools). Note: These are the same code styles that Lucene and Solr use.