SDT Build System
This document describes the SDT build system and how to build the SDT and validate new contributions.
The files referenced in this document point to version 3.0 of the SDT.
Directory Structure and Important Files
- SDT/schema3.0/ : Base directory
SDT/schema3.0/src/ : Source files of the SDT.
domain.rng : RELAX NG file with the SDT schema definition. This is the source file that is converted to the actual schema definition domain.xsd during the build. See also http://en.wikipedia.org/wiki/RELAX_NG.
Only edit this file when one wants to make changes to the SDT!
- domain.xsd : The SDT schema definition that is generated from domain.rng.
- xml.xsd : General schema definitions for the SDT
- domain.rng : RELAX NG file with the SDT schema definition. This is the source file that is converted to the actual schema definition domain.xsd during the build. See also http://en.wikipedia.org/wiki/RELAX_NG.
- SDT/schema3.0/test/ : This directory contains all XML files with SDT definitions that should be validated whether they conform to the SDT schema. This could be example definitions or contributions.
- SDT/schema3.0/build.xml : This is the definition file for the ant build system.
- SDT/schema3.0/etc/, SDT/schema3.0/style/ : internal directories for the build system. Please, don't make unnecessary changes to these files.
SDT/schema3.0/etc/dal.rnc : This file contains various configuration parameter to convert the file domain.rng to schema file. The important parameter to change when changing the namespace or the version number is:
default namespace xsl = "http://homegatewayinitiative.org/xml/dal/3.0"
SDT/schema3.0/etc/schemas.xml : This file contains the header for the schema file. This must be changed when changing the namespace or the version number.
- Install Java on your computer
- Download and install Apache ant from http://ant.apache.org
Clone the SDT repository from GitHub:
$ git clone https://github.com/Homegateway/SmartDeviceTemplate.git
How to Use the Build System
After cloning the repository go to the directory SDT/schema and run commands depending on what you want to achieve.
Build the Schema
$ cd SDT/schema $ ant
Validate SDT Definitions
You can use the build system to validate new SDT definitions or changes made to existing ones by running the following command:
$ cd SDT/schema $ ant validate
The output after a successful validation should look like this:
[schemavalidate] 2 file(s) have been successfully validated.
Total time: 1 second
Otherwise you most likely receive a stack trace or some other error messages. Search the output for the line BUILD FAILED. Above this line you will find some helpful hints for the filename and line number on which the error occurred (here: file mseeb.xml on line 66) and a reason:
[schemavalidate] /Users/someone/Sources/git/SmartDeviceTemplate/SDT/schema/test/mseeb.xml:66:18: cvc-elt.1: Cannot find the declaration of element 'Domain'.
You may need to make additional changes in the following files, e.g. when the name space or the version number need to be adjusted.
PLEASE ONLY EDIT THESE FILES IF NECESSARY.