OpenTV ION

Fire TV release build


Introduction

This page covers:

  • Building release build for Fire TV

  • Checking lint and typescript errors and generating the _build folder

  • Copying client-specific configuration files

  • Copying localization

  • Generating the APK

Build commands

To generate an app for Fire TV, use these commands:


This command will generate the APK.

yarn builds --platform=fireTv --buildType=release


For customization of builds, the same command is used but with additional parameters. 

yarn builds --client=sales --platform=fireTv --buildType=release


builds command with params

builds command accepts three parameters.

--client - This parameter accepts the valid client name, based on the client name configuration files will be copied and this is an optional param and the default value is sales.

--platform - This parameter accepts the platform name and default platform is andmob.

--buildType - for release build this field is mandatory with value release else it will build for development.

For all the valid values for each parameter please refer to the table - build props and values .


Build command parameters

Parameter

Details

Required

Default value

--client

This parameter accepts the valid client name, based on the client name configuration files to be copied

Optional

sales

--platform

This parameter accepts the platform name

Optional

andmob

--buildType

This parameter accepts build type value. For a release build, set value to Release otherwise it will use the default value.

Mandatory

debug


For a list of valid values for each parameter, refer to the table - build props and values.


Build process

Step 1: Lint validation in the source code

This step checks for common errors in the source code. If any errors are found, they are listed in the console and the process will stop to wait for developer confirmation. If there are lint errors, they must be fixed before continuing otherwise the build will fail.

 ERROR:"lint" exited with 2.
 ERROR: Command failed with exit code 1.
 INFO:info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
 
The process raised an error. Would you like to continue?(y/n) 

Common lint errors

ERROR: ocb/src/ui/screens/explore/search.tsx[527, 50]: file should end with a newline
ERROR: ocb/src/ui/screens/explore/search.tsx[524, 1]: Consecutive blank lines are forbidden
ERROR: ocb/src/ui/screens/explore/search.tsx[297, 3]: Calls to 'console.log' are not allowed.
ERROR: ocb/src/ui/screens/explore/search.tsx[230, 52]: trailing whitespace
ERROR: ocb/src/ui/screens/explore/search.tsx[298, 1]: trailing whitespace
ERROR: ocb/src/ui/screens/explore/search.tsx[234, 19]: ' should be "
ERROR: ocb/src/ui/screens/explore/search.tsx[48, 28]: Missing semicolon
ERROR: ocb/src/ui/screens/explore/search.tsx[36, 1]: 'equals' is declared but its value is never read.

Step 2: Validate typescript functionality validation in the source code by tslint

Once the lint is successfully completed, the next step is to validate the typescript functionality errors.

If no typescript functionality errors are found, then the build will generate the _build folder and continue to the next step.

If there are any functionality errors in the source code, then it lists the errors in the console and the process will stop to wait for developer confirmation.

Functionality errors are mandatory to fix.

Common functionality errors

INFO:$ tslint --project tslint.json
ERROR: ocb/src/ui/screens/explore/search.tsx[69, 10]: variable name must be in lowerCamelCase, PascalCase or UPPER_CASE
ERROR: ocb/src/ui/screens/explore/search.tsx[38, 1]: 'isNumber' is declared but its value is never read.
ERROR: ocb/src/ui/screens/explore/search.tsx[69, 10]: '__isTV' is declared but its value is never read.

Step 3: Set client-specific configuration

Once the _build folder is successfully created, the next step is to set the client-specific configuration. For each client, there will be a different configuration such as API endpoint, features, UI theme, terms & conditions, etc.

These files will be copied to the android or ios folder based on the client and platform.

This command is for copying platform configuration for client.

yarn copy-config-files demo tv

Step 4: Copy localization file

This command is for copying the localization file. It is common for all the clients.

yarn copy-localization

Step 5: APK generation

This command is for generating the APK once all previous steps are completed without errors.

This command is for generating APK once all the steps are completed without errors
./gradlew assembleProductRelease


Once the app generation is complete, the app will be located at android/app/build/outputs/apk.

The apk folder location is generated based on the variant values for client, platform, and buildType.

Example

For these build parameters:

--client=sales

--platform=fireTv

--buildType=release

The apk location would be: android/app/build/outputs/apk/productFireTv/release/ocb-fireTv-{version}.apk