Developer Notes - YAMJ/yamj-v2 GitHub Wiki

Information for developers

Table of Contents

<wiki:toc max_depth="2" />

Introduction

This page is intended for developers or those wishing to download and compile the YAMJ code.

Google Group page for developers & skin makers

http://groups.google.co.uk/intl/en/images/logos/groups_logo_sm.gif

You can apply to join the group here

Project code style

We need to be consistent in using the code formatting styles. Some of the rules are as below.

  • encoding UTF-8
  • indentation: 4 spaces
  • tab size: 4 spaces
  • expand tabs to spaces
  • right margin: 160
  • beginning brace on same line as declaration
  • no new line for else, while, catch, finally
  • use whitespace around assignment and comparators
  • only a single declaration per line
  • always use braces for conditional statements and looping; even if only contains a single statement
  • use blank lines and spaces to assist in readability
  • comment logic that isn't straight forward

Example

package com.my.package;

import java.util.List;

public class MyClass {

    private String memberAttribute;
    private String blahString;

    public MyClass {
    }

    public void methodA() {
        // can use inline comments where necessary
        if (memberAttribute == null) {
            memberAttribute = "blah";
        }
    }

    public int methodB(List<String> someList) {
        int count = 0;

        for (String s : someList) {
            if (s.contains("abc")) {
                count++;
            } else {
                System.out.println(s);
            }
        }

        return count;
    }

}

Making code changes

Please follow these simple rules when updating the code base to make it easier for all of us to keep up with the changes that have been made.

Release_notes.txt

If you make a code change, before you commit the change you need to update the release_notes.txt file in the config directory.

The format of the release notes file should be fairly self explanatory:

  - {Enhancement/Fixed Defect} #{google code issue number} {google code issue title}

with the issues listed in numerical order.

Committing Code Changes

When committing code changes, you should enter this as the comment:

Issue {google code issue number} {google code issue title}

as this allows the automatic linking back to the issue from the revision page on the google code site. Additional information about the code update can also be entered.

Updating the Issue

You should then update the issue and mark it as "Fixed" with a minimum comment of "Fixed in r????" where r???? is the revision that you have just committed.

As an alternative, you can commit the issue with the text "Fixes issue #????" and this will automatically close the google code issue for you.

Skin Changes

If you make changes that could affect skin makers, please make a post describing the change on this thread in the Networked Media Tank forums so that they can update their skins appropriately http://www.networkedmediatank.com/showthread.php?tid=18631

Updating documentation

Don't forget to document the changes you have made, for example add new properties to the PropertiesConfiguration and SkinConfiguration pages.


Setting up a Development Environment for YAMJ

There are two programs you can use (free) on all platforms; either !NetBeans (Recommended) or Eclipse.

Netbeans install instructions are HERE

Eclipse install instructions are HERE


Building the project

There are several Maven steps required for building the project, each of them can be done separately, or they can be combined together depending on how you work.

These instruction will vary depending on the IDE you are using. Firstly, you should "clean" the Maven build before any other steps. Right click on the project, run as, then maven clean

mvn clean

When you are ready to compile the source, you can do a maven package and that will generate the zip file in the target folder of the project. You might need to refresh the directory structure F5 to see the folder.

mvn package

The first time you package, it will take some time as it will download all the dependencies that are required by YAMJ to your local machine to ensure you have the latest packages.

A combined maven command would look like this

mvn clean package

Optional Parameters

There are a couple of parameters that are useful if you are developing that could save you some time.

Skip Tests

When developing, it's sometimes worthwhile skipping all the Junit tests that are included with YAMJ. You can do this by adding the following switch to the command line:

-DskipTests=true

Don't zip target directory

If you are compiling the code to deploy to your own test environment, you probably don't need to have the output directory compressed only to uncompress it again. You can do this by adding the following switch to the command line:

-Ddistribution.format=dir

Example command line

Here is an example command line with all of the above in it:

mvn clean package -DskipTests=true -Ddistribution.format=dir

Development Servers

There are two development servers available to the YAMJ developers.

The first, I don't expect any of you to really need to interact with, is the Jenkins Continuous Integration system (http://jenkins-ci.org/). This is the application that builds YAMJ whenever there are changes to the google code source. So whenever you commit a change, this should kick in, build YAMJ and then upload it to mediaplayersite.com.

If you want to see what it does, what's been built, error logs, etc., then you can access it here:

URL: http://jenkins.omertron.com Username: yamj Password: D_v_l0p_r! (Replace "_" with the result of 2 plus 1)

If you want changes made, or you want the build uploaded to another server, let me know and I'll configure it appropriately.

The second system is perhaps a lot more useful for us, is Sonar (http://sonar.codehaus.org/) which is a code quality management system.

URL: http://sonar.omertron.com Username: yamj Password: D_v_l0p_r! (Replace "_" with the result of 2 plus 1)

With this, you can see where there are "rules" violations, errors in the code, etc. I've not fully configured it yet, You can help out by using the system and suggesting rules that need to be added or removed from the system so we can clean up YAMJ - Go to "Configuration" -> "YAMJ" and see the rules that are currently set, we can change these easily

⚠️ **GitHub.com Fallback** ⚠️