OpenTV ION

Launcher release build for OTT

Introduction 

This page covers:

  • Building release build for the launcher variant

  • 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 Android mobile or tablet, use these commands:


This command will generate the APK.

yarn builds --buildType=release


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

yarn builds --client=sales --launcher=ott --buildType=release

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

--launcher

This parameter accepts the launcher name. Valid values are ott and hybrid.

Optional

(no default) 

--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 and 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 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 and will 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

Use this command for copying the platform configuration for the client.

yarn copy-config-files demo tv

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 & condition, etc.

Step 4: Copy localization file

Use this command 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.

./gradlew assembleProductLauncherOTTRelease

Once the app generation is completed. the app can be found in android/app/build/outputs/apk.

The apk folder is generated based on the variant (variant will automatically form based on the client->platform->buildType).

Example 

For these build parameters: --client=sales --platform=androidTv --buildType=release, the apk folder will be generated at android/app/build/outputs/apk/productAndroidTv/release/ocb-androidTv-{version}.apk