Professional Documents
Culture Documents
Building OSMF & OSMF-based Projects
Building OSMF & OSMF-based Projects
Building OSMF & OSMF-based Projects
This document explains how to use various build tools with OSMF (Open Source Media Framework). It is intended for developers building OSMF itself as well as OSMF-based applications, such as: a media player using OSMF or the Strobe Media Playback ("SMP") sample player OSMF-based applications or plugins new functionality for OSMF The build tools covered are: Adobe Flash Builder 4 with the Flex 4.5 SDK Adobe Flash Builder 4 with the Flex 4.1 SDK Adobe Flash Professional Creative Suite 5 free command-line tools
Downloading OSMF requires the use of a Subversion ("SVN") client. Many free Subversion clients are readily available online.
Contains testing project libraries and certification-related projects and corresponding test projects.
Contains libraries and scripts for the command-line tools. You must configure this folder in order to make the command-line tools work properly.
Other files found in /trunk: Files build.xml Description Main build script, can be used with the command-line tools to build the entire project or a part of it; for more details, see Appendix B. Properties file for the command-line tools that sets the different parameters of a build; for more details, see Appendix A.
build.properties
-swf-version=11 -define CONFIG::LOGGING true -define CONFIG::FLASH_10_1 true -define CONFIG::PLATFORM true -define CONFIG::MOCK false
These parameters are: swf-version : required for stageVideo support CONFIG::LOGGING : configures the framework to send log traces, (recommended to be set to false for release builds) CONFIG::FLASH_10_1 : makes the Flash Player 10.1 features (DRM, HTTP streaming) available CONFIG::PLATFORM and CONFIG::MOCK control the mocking of stageVideo for unit tests. They are usually in opposition (one true, the other false). To use stageVideo, please use the above recommended configuration; to run unit tests, please negate the values. 7. Remove the older version of OSMF that is shipped with the Flex 4.5.1 SDK. To do so, select File > Properties > Flex Build Path > Library path, select osmf.swc under Flex 4.5.1 SDK on the Library Path panel, and click the Remove button.
-define CONFIG::LOGGING true -define CONFIG::FLASH_10_1 true -define CONFIG::PLATFORM true -define CONFIG::MOCK false
These parameters are: CONFIG::LOGGING : configures the framework to send log traces, (recommended to be set to false for release builds) CONFIG::FLASH_10_1 : makes the Flash Player 10.1 features (DRM, HTTP streaming) available CONFIG::PLATFORM and CONFIG::MOCK control the mocking of stageVideo for unit tests. They are usually in opposition (one true, the other false). To use Stage Video, use the above recommended configuration; to run unit tests, negate the values. 4. It is recommended that you remove the older version of OSMF that is shipped with Flex 4 SDK. To do so, select File > Properties > Flex Build Path > Library path, select osmf.swc under Flex 4.1 SDK on the Library Path panel, and click the Remove button.
to:
8. Also modify:
to:
9. Open Adobe Flash CS5 and in the Publish Settings select FlashPlayer10.2 10. Compile. NOTE: You may need to install the fonts provided in StrobeMediaPlayback/assets/fonts on your system. NOTE: To run OSMFTest (the unit test suite), include the following files in your project library folder: FlexUnit.swc FlexUnitOptional.swc NetMocker.swc You may also need to update the SWC file path when you import the OSMFTest project.
Dependencies between projects at build are solved manually (for example, we compile VPAIDLibrary before VASTLibrary). For new added projects you may need to check the building order and solve any conflicts.
Software requirements
Flexunit (version 4.1) Flex SDK (version 4.5.1) Ant (version >1.7) Java JDK Ant-contrib-1.0b3.jar Optional: Subversion client
Installing ant
1. Download the binary (any later version than 1.7 should work) and extract the zip. 2. Set the environment variables. Assuming ant is installed in c:\ant , the following sets up the environment:
set ANT_HOME=c:\ant set PATH=%PATH%;%ANT_HOME%\bin
2.
buildtools.dir=${trunk.dir}/buildtools
3. Install ant-contrib Download ant-contrib-1.0b3.jar download link and extract it in the "libs" folder In the buildtools directory create a folder named "libs" and extract the archive here or extract the archive in ant's /lib folder (you will find this folder in the location you extracted ant) 4. Install flexunit (optional, the needed flexunit files are already provided for ease of use): Download flexunit In the buildtools directory create a folder "flexunit" and extract the archive here You can choose to save the flexunit in a different location but remember to update the following line from the build.properties file so that it points to the folder you extracted flexunit
FLEX_UNIT_HOME=${buildtools.dir}/flexunit
When adding a path in build.properties file avoid using backward slashes, instead use the forward slash or double backward slashes. 5. Install FLEX SDK 4.5.1. Download FLEX SDK 4.5.1 download link In the buildtools directory create the following folder structure "sdks/4.5.1" and extract the archive here Remove the older version of OSMF that is shipped with the Flex SDK (located at frameworks/libs/osmf.swc) You can choose to save the Flex SDK in a different location but remember to update the following line from the build.properties file so that it points to the folder you extracted Flex SDK
FLEX_HOME=${buildtools.dir}/sdks/4.5.1
>ant
Note. This calls the default target "all" from main build.xml and builds the OSMF framework, player, and other applications that have build.xml configured properly. It also runs test and creates test reports.
Building OSMF.swc
You can build the OSMF project on its own, either via the main build script or a local one. Main build script 1. Follow steps 1. 2. and 3. from "Building the full project". 2. From cmd in the trunk directory, execute:
>ant compile.osmf
Note. Target "compile.osmf" builds just the OSMF project and generates the corresponding .swc .
Or, from cmd in the OSMF project directory execute the following, where { Path to build.properties file } is the location of a well-configured build.properties file.
>ant Dproperties.file= { Path to build.properties file }
Target "core" builds the OSMF project and runs tests from OSMFTests project. If needed, you can add more test projects by editing this target from main build.xml.
Local build script 1. From svn, download the framework/ folder found in the trunk and the build.properties file from trunk. 2. Download and edit the build.properties file as described in "Setting up the environment". 3. Manually build the OSMF project, and build and run all tests from *Test projects placed in trunk (see also, the use case "Building and running tests and visualizing the results").
Strobe media player is an OSMF-based application and you will need an osmf.swc to be able to compile the player.
You can build the Strobe Media Playback project on its own, either via the main build script or the local one. Main build script 1. Follow steps 1. 2. and 3. from "building the full project". 2. From cmd in the trunk directory, execute:
>ant compile.smp
Target "compile.smp" builds just the Strobe Media Player project and uses the OSMF.swc from the current trunk. You can change the OSMF.swc used at build by editing the value of property osmf.swc.path. For more details, see Appendix A.
Local build script 1. Download from svn the framework/StrobeMediaPlayer project and the build.properties file from trunk. 2. Download and edit the build.properties file as described in "Setting up the environment". 3. Specify the path to the osmf.swc lib by setting the property osmf.swc.path to the corresponding value. You can pass this value: a.
b. or, in the build.properties file 4. Copy build.properties in the StrobeMediaPlayer project directory (make sure you verify relative path values) and from the StrobeMediaPlayer project directory, execute:
>ant
Or, from cmd in the StrobeMediaPlayer project directory, execute the following, where { Path to build.properties file } is the location of a well configured build.properties file.
>ant Dproperties.file= { Path to build.properties file }
All sample applications need osmf.swc in order to build. Some applications might need additional libraries, which can be found in trunk/samples and are identified by the name of the project directory *Library. The paths for the additional libraries are specified in projectName-build-config.xml in the <library-path> tag. You might want to keep the default values and build the application after downloading the full trunk and keeping the folder structure, or edit these values according your needs and specify another path for these libraries.
1. From svn, download the application and all related projects. (To find related projects you can view projectName-build-config.xml and look for <library-path> tag. All needed libraries are specified here.) 2. Download and edit build.properties file as described in "Setting up the environment". 3. Resolve any dependencies with other projects or libraries. For osmf.swc library: Keep the default location /trunk/framework/OSMF/${output.bin}/OSMF.bin. You will need to make sure the project is compiled and, if neccesssary, manually compile it before building the current application. Specify a path by setting the property osmf.swc.path to the corresponding value. You can pass this value either in the build.properties file or via the cmd line:
> ant Dosmf.swc.path= { Path to build osmf.swc }
For other libraries: Keep the default locations (view projectName-build-config.xml to see these values). You will need to make sure all needed libraries are previously compiled either by manually building each library project (go into their directory and execute ant) or, use main build.xml target "compile.libs", which compiles all application libraries that are properly configured for the build tools (meaning they have a well-configured build.xml and projectName-build-config.xml) Specify paths to these libraries. To do so, edit the current projectName-build-config.xml (edit the paths placed in the <library-path> tag) 4. Make sure the additional libraries are compiled and verify the paths to these libraries from projectName-build.config.xml; make sure they are correctly set or edit them according to your needs. 5. Copy build.properties in your current project directory (make sure you verify relative path values) and from that directory, execute:
>ant [-Dosmf.swc.path= { Path to osmf.swc }]
Or, from cmd in your current project directory, execute the following, where { Path to build.properties file } is the location of a well-configured build.properties file.
>ant Dproperties.file= { Path to build.properties file } [-Dosmf.swc.path= { Path to osmf.swc }]
3. Keep in mind that the local build file contains the default target "run" that rebuilds the test project and runs the tests, creating test reports. By default, test reports are saved in the test project directory, in a subfolder called test-results. You can edit this location by editing the value of the reports.dir parameter. (See Appendix A, for more details.)
For testing, we use flexunit. Test reporting is based on junit reporting, and the format of the reports is .html. You will also have the .xml generated by flexunit in the report directory, in a subdirectory called /xml-format.
Activating logging
To activate logging you only need to set the "logging" property to true. There are two ways to do this: From cmd, execute:
>ant -Dlogging=true
Note that this overrides the value from the build.properties file. Or, edit the build.properties file and set the logging value to true.
Note that this overrides the value from the build.properties file. Or, edit the build.properties file and set the debug value to true.
The ant property value is immutable; once the value is set you cannot change it.
You can also change the version Flash Player used by altering the value of "flash.target.player.base". For more details, see Appendix A.
Common errors
Missing library
If any of the needed library .swc files are missing or located at an unknown path, you get the following error: [mxmlc] Adobe Flex Compiler (mxmlc) [mxmlc] Version 4.5.1 build 21328 [mxmlc] Copyright (c) 2004-2011 Adobe Systems, Inc. All rights reserved. [mxmlc] [mxmlc] C:\Users[UserName][ProjectLocation][ProjectName]-build-config.tmp.xml(59): Error: unable to open 'C:\Users[UserName][PathToMissingLibrary][LibraryName].swc' [mxmlc] [mxmlc] </library-path> [mxmlc] Solution Identify the project of the missing library, compile the project, make sure the path set in your project's -build.config.xml file points to the location where the compiled library is to be found.
logging
false
false false true Sets CONFIG::MOCK value (see platform parameter) Sets CONFIG::PLATFORM value. Note: CONFIG::PLATFORM and CONFIG::MOCK control the mocking of stageVideo for unit tests. They are usually in opposition (one true, the other false). To use stageVideo, use the above recommended configuration; to run unit tests, negate the values Required for stageVideo support
swfversion
11
osmf.swc.path smp.swc.path
${trunk.dir}/framework/OSMF/${output.bin} ${trunk.dir}/framework/player/StrobeMediaPlayer/${output.bin}
Targets from the main build script: Target name all build core player test compile.osmf compile.smp compile.libs compile.extended compile.plugins compile.samples compile.zeri run.unittest run.integrationtests clean Description Calls the following targets "build", "test" and "dist" in order to build and test the full project Builds the entire project (calls compile.osmf, compile.libs, compile.smp, compile.extended and compile.zeri) Compiles framework and compiles and runs framework tests (depends "compile.osmf") Compile strobe media player and compiles and runs framework tests (depends "compile.smp") Runs specified project available tests (calls "run.unittests") Compiles OSMF project Compiles Strobe Media Player project Compiles all libraries projects. When adding a new libarary, you must resolve all the dependencies with other libraries. Compiles all application plugins and samples (calls "compile.plugins", "compile.samples") Compiles all plugin projects Compiles all sample projects Compiles zeri certification projects Runs specified unit tests. Note. The target rebuilds the corresponding test project and then runs the tests. Runs specified integration tests. Note. The target rebuilds the corresponding test project and then runs the tests. Deletes the output directories and their content