Parts of the Sentinel IP-SM-GW SDK environment should be added to a source control system such as Git or Subversion.

For a developer using the SDK for familiarisation with Sentinel development, the SDK should be initialised as a local git repository.

Name Include in source control?

Sentinel IP-SM-GW SDK root directory

yes

Sentinel IP-SM-GW SDK build directory

no

Sentinel IP-SM-GW SDK rhino-sdk directory

no

Any module created by a developer

yes

Preparing the SDK for source control

Prior to applying source control using Subversion, Git or another source control system it is necessary to exclude any files and directories such as those created during building and publishing modules, or used for configuration of an IDE.

In the following two sections instructions are provided for configuring Subversion and Git to exclude the working files and directories.

To get a clear set of files and directories to add without excluding certain paths, the following command can be used from the root of the SDK:

ant clean-branch

Running this command removes the files and directories (retrieved jar files, compiled classes etc.) that are created when a module is built. None of the files and directories created as part of the module build process should be committed into a source control system. The target subdirectory of the module is used to contain most of these files and directories. However, other files and directories may be added by the IDE or by the developer outside of the target directory.

Subversion

In Subversion the files and directories to be ignored are included in a property called svn:ignore. From the root directory of the SDK module run the following command:

svn propset svn:ignore "/build
/rhino-sdk
/ivy.properties
/repositories
/.classpath
/.project
/.settings
/ivy-eclipse.properties" .

After creating new modules run the following command:

svn propset svn:ignore ".classpath
.settings
.project
target" <new module directory>

Git

When using git the files and directories to ignore are listed in a file called .gitignore. The following example shows a typical .gitignore file for an SDK module:

/.settings
/target
/.classpath
/.ivy-eclipse.properties
/.project

In modules created from OpenCloud provided module packs, the .gitignore file will already be present. If for any reason it is not present, create it based on the example above. The .gitignore file must be added and committed.

Initialising a Repository in the SDK root directory

When evaluating, or learning the Sentinel IP-SM-GW SDK it is advisable to perform local source control. Git is the ideal system to use.

Once the SDK environment has been set up initialise the SDK as a local repository:

$ git init
Initialized empty Git repository in /home/testuser/ipsmgw-sdk/.git/

For each module add a .gitignore file to exclude working files and directories from source control. See the example above.

In the root of the SDK check that the .gitignore file with the following contents exists and create it if it does not:

/build
/rhino-sdk
/ivy.properties
/repositories
/.classpath
/.project
/.settings
/ivy-eclipse.properties

Once the .gitignore files are set up, start tracking the SDK from the initial state using git add. For example:

$ git add .

The following files are now staged as shown by git status:

$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   .build
	new file:   .gitignore
	new file:   .sdk.root
	new file:   README.txt
	new file:   build.xml
	new file:   deps.properties
	new file:   sdk.properties

Commit the initial state of the SDK:

$ git commit -m "Initial Sentinel IP-SM-GW SDK state."
[master (root-commit) d029da5] Initial Sentinel IP-SM-GW SDK state.
 7 files changed, 159 insertions(+)
 create mode 100644 .build
 create mode 100644 .gitignore
 create mode 100644 .sdk.root
 create mode 100644 README.txt
 create mode 100644 build.xml
 create mode 100644 deps.properties
 create mode 100644 sdk.properties

Adding a module

Create a new module in the SDK using sdkadm. Once it is created, check that the module root directory contains a .gitignore file. If not, add one following the instructions and template above.

Add the module and commit to the local repository. In the example below sdkadm has been used to create a new feature in the new-feature directory:

$ git add new-feature
$ git commit -m "Adding new-feature."
[master (root-commit) ff6408f] Adding new-feature
 7 files changed, 213 insertions(+)
 create mode 100644 new-feature/.gitignore
 create mode 100644 new-feature/.sdk.root
 create mode 100644 new-feature/build.xml
 create mode 100644 new-feature/doc/ivy.xml
 create mode 100644 new-feature/ivy.xml
 create mode 100644 new-feature/module.properties
 create mode 100644 new-feature/src/com/opencloud/sentinel/feature/common/NewFeature.java
Previous page Next page