@24i/smartapps-bigscreen-rnv-build-engine 0.17.26-alpha.2755 → 0.17.27-alpha.2774

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +3 -3
  2. package/dist/src/resolvers/index.js +3 -1
  3. package/dist/src/resolvers/resolveZippedDirRelativePath.js +32 -0
  4. package/dist/src/scripts/buildProductionPackagesAll.js +1 -10
  5. package/dist/src/scripts/release/productionPackages/deployProductionPackages.js +52 -0
  6. package/dist/src/scripts/release/productionPackages/notifySlack.js +29 -0
  7. package/dist/src/scripts/releaseAllWithScheme.js +1 -3
  8. package/dist/src/scripts/releaseAllWithSchemes.js +1 -3
  9. package/dist/src/scripts/releaseProductionPackagesAll.js +37 -4
  10. package/dist/src/scripts/smokeTest/smokeTestUtils.js +2 -1
  11. package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +4 -0
  12. package/dist/src/tasks/deploy/aswS3/aws.js +4 -4
  13. package/dist/src/tasks/deploy/aswS3/deployS3.js +6 -4
  14. package/dist/src/tasks/deploy/aswS3/distToLiveS3.js +3 -1
  15. package/dist/templates/platforms/_shared/webpack.base.js +3 -1
  16. package/dist/templates/platforms/androidtv/project/app/build.gradle +9 -4
  17. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeToJavaScript.kt +16 -0
  18. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryExoPlayerNpaw.kt +63 -16
  19. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +5 -2
  20. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +13 -4
  21. package/package.json +1 -1
  22. package/dist/src/scripts/release/appCenter/appCenter.js +0 -17
  23. package/dist/src/scripts/release/appCenter/deployProductionPackagesToAppCenter.js +0 -126
  24. package/dist/src/scripts/release/appCenter/deployToAppCenter.js +0 -76
package/README.md CHANGED
@@ -30,7 +30,7 @@ which is used instead of core ReNative engine to fulfill the needs of SmartApps
30
30
  it
31
31
  - **builds** applications for requested platforms
32
32
  - **deploys** the built applications to `AWS S3` (or to server configured to host `HbbTV` applications)
33
- - **releases** new versions to `AppCenter.me`, `GitHub`
33
+ - **releases** new versions to `GitHub`
34
34
  - sends **Slack notifications** for `release candidate` and `release` builds
35
35
  - supports `Sentry.io` runtime **error logging**
36
36
 
@@ -210,12 +210,12 @@ It allows us to extend the number of platforms we build for
210
210
 
211
211
  Using the custom engine allows us to change the build steps defined in core ReNative engine.
212
212
  Also, custom engine is prepared for deploying the built applications to `AWS S3` and to server specially configured for `HbbTV` builds.
213
- Our custom build engine is also configured to deploy releases to `AppCenter.me`, `GitHub` and `Sentry`.
213
+ Our custom build engine is also configured to deploy releases to `GitHub` and `Sentry`.
214
214
 
215
215
  - added support for more platforms (see [supported platforms](#supported-platforms))
216
216
  - overwritten rnv tasks (such us `build`, `deploy`)
217
217
  - added automatic installation of `Tizen` and `webOS` SDKs before building the packages
218
- - deploy to `AWS S3`, `Appcenter.me`, `GitHub`, `Sentry`
218
+ - deploy to `AWS S3`, `GitHub`, `Sentry`
219
219
  - added support for `Slack` notifications for `release candidate` and `release` builds
220
220
 
221
221
  Inside [src/tasks/](src/tasks) folder, there is a source code for **ReNative tasks** which overrides core ReNative tasks.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProductionZipFileRelativePath = exports.resolveZippedPlatformBuildsRelativeFilePath = exports.resolvePackageVersions = exports.resolveBuildFileExtension = exports.resolveUsedFlavours = exports.resolveSupportedFlavoursForPlatform = exports.resolveSupportedPlatforms = exports.getBaseConfig = exports.resolveBuildFileName = exports.resolveBuildFileBaseName = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBuildEnvName = exports.resolveS3BucketAppPath = exports.resolveProductionPackagesBaseUrl = exports.resolveBaseUrl = void 0;
3
+ exports.getZippedDirRelativePath = exports.getProductionZipFileRelativePath = exports.resolveZippedPlatformBuildsRelativeFilePath = exports.resolvePackageVersions = exports.resolveBuildFileExtension = exports.resolveUsedFlavours = exports.resolveSupportedFlavoursForPlatform = exports.resolveSupportedPlatforms = exports.getBaseConfig = exports.resolveBuildFileName = exports.resolveBuildFileBaseName = exports.resolveHbbtvDeployConfig = exports.resolveHbbtvDeployUrl = exports.resolveHbbtvRemoteBuildDirRelativePath = exports.resolveDeployLocations = exports.resolveBuildVersionOffset = exports.resolveBuildVersion = exports.resolveBuildEnvName = exports.resolveS3BucketAppPath = exports.resolveProductionPackagesBaseUrl = exports.resolveBaseUrl = void 0;
4
4
  var resolveBaseUrl_1 = require("./resolveBaseUrl");
5
5
  Object.defineProperty(exports, "resolveBaseUrl", { enumerable: true, get: function () { return resolveBaseUrl_1.resolveBaseUrl; } });
6
6
  Object.defineProperty(exports, "resolveProductionPackagesBaseUrl", { enumerable: true, get: function () { return resolveBaseUrl_1.resolveProductionPackagesBaseUrl; } });
@@ -40,3 +40,5 @@ var resolveZippedPlatformBuildsRelativeFilePath_1 = require("./resolveZippedPlat
40
40
  Object.defineProperty(exports, "resolveZippedPlatformBuildsRelativeFilePath", { enumerable: true, get: function () { return resolveZippedPlatformBuildsRelativeFilePath_1.resolveZippedPlatformBuildsRelativeFilePath; } });
41
41
  var resolveProductionZipFileRelativePath_1 = require("./resolveProductionZipFileRelativePath");
42
42
  Object.defineProperty(exports, "getProductionZipFileRelativePath", { enumerable: true, get: function () { return resolveProductionZipFileRelativePath_1.getProductionZipFileRelativePath; } });
43
+ var resolveZippedDirRelativePath_1 = require("./resolveZippedDirRelativePath");
44
+ Object.defineProperty(exports, "getZippedDirRelativePath", { enumerable: true, get: function () { return resolveZippedDirRelativePath_1.getZippedDirRelativePath; } });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getZippedDirRelativePath = void 0;
27
+ const path = __importStar(require("path"));
28
+ const getZippedDirRelativePath = (c) => {
29
+ const { platformBuildsDir } = c.buildConfig.paths;
30
+ return path.join(platformBuildsDir, 'zipped_production_packages');
31
+ };
32
+ exports.getZippedDirRelativePath = getZippedDirRelativePath;
@@ -32,10 +32,6 @@ const constants_1 = require("../constants");
32
32
  const buildProductionPackages_1 = require("../constants/buildProductionPackages");
33
33
  const resolvers_1 = require("../resolvers");
34
34
  const getArgs_1 = require("./utils/getArgs");
35
- const getZippedDirRelativePath = (c) => {
36
- const { platformBuildsDir } = c.buildConfig.paths;
37
- return path.join(platformBuildsDir, 'zipped_production_packages');
38
- };
39
35
  const buildProductionTask = (options, c) => {
40
36
  const { scheme, platform, flavour } = options;
41
37
  const { platformBuildsDir } = c.buildConfig.paths;
@@ -45,7 +41,7 @@ const buildProductionTask = (options, c) => {
45
41
  fs.rmSync(buildDirPath, { recursive: true, force: true });
46
42
  const cmd = `npx rnv build -s ${scheme} -p ${platform} -c ${flavour} --ci --mono --productionPackagesHostedUrl`;
47
43
  (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
48
- const zippedDir = path.join(getZippedDirRelativePath(c), platform);
44
+ const zippedDir = path.join((0, resolvers_1.getZippedDirRelativePath)(c), platform);
49
45
  fse.copySync(buildOutputDirPath, zippedDir);
50
46
  };
51
47
  const buildProductionPackagesAll = () => {
@@ -72,11 +68,6 @@ const buildProductionPackagesAll = () => {
72
68
  return false;
73
69
  });
74
70
  (0, forEachSupportedPlatformFlavour_1.forEachSupportedPlatformFlavour)(c, (options) => buildProductionTask(options, c), { ignoredPlatforms: skipPlatforms });
75
- const zippedDirPath = path.resolve(getZippedDirRelativePath(c));
76
- const zipFilePath = path.resolve((0, resolvers_1.getProductionZipFileRelativePath)(c));
77
- fs.rmSync(zipFilePath, { force: true });
78
- (0, child_process_1.execSync)(`zip -r ${zipFilePath} *`, { cwd: `${zippedDirPath}` });
79
- fs.rmSync(zippedDirPath, { recursive: true, force: true });
80
71
  return true;
81
72
  };
82
73
  const startTimestamp = Date.now();
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.deployProductionPackages = void 0;
27
+ const path = __importStar(require("path"));
28
+ const fs = __importStar(require("fs"));
29
+ const resolvers_1 = require("../../../resolvers");
30
+ const aws = __importStar(require("../../../tasks/deploy/aswS3/aws"));
31
+ const formatDateTime = (date) => {
32
+ const year = date.getFullYear();
33
+ const month = String(date.getMonth() + 1).padStart(2, '0');
34
+ const day = String(date.getDate()).padStart(2, '0');
35
+ const h = String(date.getHours()).padStart(2, '0');
36
+ const m = String(date.getMinutes()).padStart(2, '0');
37
+ const s = String(date.getSeconds()).padStart(2, '0');
38
+ return `${year}-${month}-${day}T${h}-${m}-${s}`;
39
+ };
40
+ const deployProductionPackages = (c) => {
41
+ const originalZipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
42
+ const { dir, name } = path.parse(originalZipPath);
43
+ const fileName = `${name}_${formatDateTime(new Date())}`;
44
+ const zipPath = path.join(dir, `${fileName}.zip`);
45
+ fs.renameSync(originalZipPath, zipPath);
46
+ const bucketName = c.buildConfig?.common.deploy?.aws3?.bucketName || '';
47
+ const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
48
+ const destinationPath = `${bucketName}/production_builds/`;
49
+ aws.cp(zipPath, destinationPath, acl);
50
+ return fileName;
51
+ };
52
+ exports.deployProductionPackages = deployProductionPackages;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notifySlack = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const slackBlockKitBuilder_1 = require("../../utils/slackBlockKitBuilder");
6
+ const getSlackPayload = (appName, fileName, filePath) => {
7
+ return {
8
+ blocks: [
9
+ slackBlockKitBuilder_1.Divider.plain(),
10
+ slackBlockKitBuilder_1.Section.mrkdwn(`${appName} Production Packages`),
11
+ slackBlockKitBuilder_1.Context.mrkdwns([fileName]),
12
+ slackBlockKitBuilder_1.Actions.buttons([{
13
+ text: 'Download Production Packages',
14
+ url: filePath,
15
+ }]),
16
+ ],
17
+ };
18
+ };
19
+ const notifySlack = (c, fileName) => {
20
+ const appName = c.buildConfig.common.appName ?? '';
21
+ const webHookUrl = c.buildConfig.common.deploy.slack?.webhookUrl ?? '';
22
+ const hostedBaseUrl = c.buildConfig?.common?.hostedUrl?.baseUrl;
23
+ const filePath = `${hostedBaseUrl}/production_builds/${fileName}.zip`;
24
+ const data = JSON.stringify(getSlackPayload(appName, fileName, filePath));
25
+ const contentType = '"Content-type: application/json"';
26
+ const cmd = `curl -X POST -H ${contentType} --data '${data}' ${webHookUrl}`;
27
+ (0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
28
+ };
29
+ exports.notifySlack = notifySlack;
@@ -5,7 +5,6 @@ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlat
5
5
  const resolvers_1 = require("../resolvers");
6
6
  const zipBuildsByPlatforms_1 = require("../utils/zipBuildsByPlatforms");
7
7
  const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
8
- const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
9
8
  const githubRelease_1 = require("./release/githubRelease");
10
9
  const notifySlack_1 = require("./release/notifySlack/notifySlack");
11
10
  const sentryRelease_1 = require("./release/sentryRelease");
@@ -43,11 +42,10 @@ const doStagingDistributionRelease = (c) => {
43
42
  const doProductionDistributionRelease = (c) => {
44
43
  console.log('doProductionDistributionRelease');
45
44
  (0, zipBuildsByPlatforms_1.zipBuildsByPlatforms)(c);
46
- deployBuilds(c);
47
45
  (0, sentryRelease_1.sentryRelease)(c);
48
46
  (0, deleteSourceMaps_1.deleteSourceMaps)(c);
47
+ deployBuilds(c);
49
48
  (0, githubRelease_1.githubRelease)(c);
50
- (0, deployToAppCenter_1.deployToAppCenter)(c);
51
49
  (0, notifySlack_1.notifySlack)(c, [c.runtime.scheme]);
52
50
  return true;
53
51
  };
@@ -5,7 +5,6 @@ const forEachSupportedPlatformFlavour_1 = require("../utils/forEachSupportedPlat
5
5
  const resolvers_1 = require("../resolvers");
6
6
  const zipStagingProdBuildsByPlatforms_1 = require("../utils/zipStagingProdBuildsByPlatforms");
7
7
  const deleteSourceMaps_1 = require("./release/deleteSourceMaps");
8
- const deployToAppCenter_1 = require("./release/appCenter/deployToAppCenter");
9
8
  const githubRelease_1 = require("./release/githubRelease");
10
9
  const notifySlack_1 = require("./release/notifySlack/notifySlack");
11
10
  const sentryRelease_1 = require("./release/sentryRelease");
@@ -62,11 +61,10 @@ const doDistributionRelease = (c, schemes) => {
62
61
  if (prodScheme) {
63
62
  c.runtime.scheme = prodScheme.type;
64
63
  (0, zipStagingProdBuildsByPlatforms_1.zipStagingProdBuildsByPlatforms)(c, [stagingScheme?.type, prodScheme.type]);
65
- deployBuilds(c);
66
64
  (0, sentryRelease_1.sentryRelease)(c);
67
65
  (0, deleteSourceMaps_1.deleteSourceMaps)(c);
66
+ deployBuilds(c);
68
67
  (0, githubRelease_1.githubRelease)(c);
69
- (0, deployToAppCenter_1.deployToAppCenter)(c);
70
68
  }
71
69
  const schemeArr = schemes.map((scheme) => scheme?.type).filter(Boolean);
72
70
  (0, notifySlack_1.notifySlack)(c, schemeArr);
@@ -1,10 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("../resolvers/index");
4
- const deployProductionPackagesToAppCenter_1 = require("./release/appCenter/deployProductionPackagesToAppCenter");
26
+ const child_process_1 = require("child_process");
27
+ const fs = __importStar(require("fs"));
28
+ const path = __importStar(require("path"));
29
+ const deployProductionPackages_1 = require("./release/productionPackages/deployProductionPackages");
30
+ const notifySlack_1 = require("./release/productionPackages/notifySlack");
31
+ const resolvers_1 = require("../resolvers");
5
32
  const releaseProductionPackagesAll = () => {
6
- const c = (0, index_1.getBaseConfig)();
7
- (0, deployProductionPackagesToAppCenter_1.deployProductionPackagesToAppCenter)(c);
33
+ const c = (0, resolvers_1.getBaseConfig)();
34
+ const zippedDirPath = path.resolve((0, resolvers_1.getZippedDirRelativePath)(c));
35
+ const zipFilePath = path.resolve((0, resolvers_1.getProductionZipFileRelativePath)(c));
36
+ fs.rmSync(zipFilePath, { force: true });
37
+ (0, child_process_1.execSync)(`zip -r ${zipFilePath} *`, { cwd: `${zippedDirPath}` });
38
+ fs.rmSync(zippedDirPath, { recursive: true, force: true });
39
+ const fileName = (0, deployProductionPackages_1.deployProductionPackages)(c);
40
+ (0, notifySlack_1.notifySlack)(c, fileName);
8
41
  };
9
42
  const startTimestamp = Date.now();
10
43
  releaseProductionPackagesAll();
@@ -93,7 +93,8 @@ const uploadLogsZipToS3 = (c, zipFilePath) => {
93
93
  const zipFileName = path.parse(zipFilePath).base;
94
94
  const bucketName = c.buildConfig?.common.deploy?.aws3?.bucketName || '';
95
95
  const uploadPath = `${bucketName}/${logsDirPathOnS3()}/${zipFileName}`;
96
- aws.cp(zipFilePath, uploadPath);
96
+ const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
97
+ aws.cp(zipFilePath, uploadPath, acl);
97
98
  };
98
99
  exports.uploadLogsZipToS3 = uploadLogsZipToS3;
99
100
  const resolveLogsZipUrl = (c, zipFileName) => {
@@ -200,6 +200,7 @@ const configureEntryUrl = (c) => {
200
200
  || rnv_1.Common.getConfigProp(c, c.platform, 'theoLicense', '');
201
201
  const npawAccountCode = process.env.NPAW_ACCOUNT_CODE
202
202
  || rnv_1.Common.getConfigProp(c, c.platform, 'npawAccountCode', '');
203
+ const enableImaSdk = !!rnv_1.Common.getConfigProp(c, c.platform, 'enableImaSdk', false);
203
204
  const injects = [{
204
205
  pattern: '{{APP_URL}}',
205
206
  override: entryUrl,
@@ -209,6 +210,9 @@ const configureEntryUrl = (c) => {
209
210
  }, {
210
211
  pattern: '{{NPAW_ACCOUNT_CODE}}',
211
212
  override: npawAccountCode,
213
+ }, {
214
+ pattern: '{{ENABLE_IMA_SDK}}',
215
+ override: enableImaSdk,
212
216
  }];
213
217
  rnv_1.Common.addSystemInjects(c, injects);
214
218
  rnv_1.FileUtils.writeCleanFile(buildGradleFilePath, buildGradleFilePath, injects, null, c);
@@ -14,16 +14,16 @@ const ls = (remotePath) => {
14
14
  runCmdSyncSilent(`aws s3 ls s3://${remotePath}`);
15
15
  };
16
16
  exports.ls = ls;
17
- const cp = (source, destination) => {
18
- let cmd = `aws s3 cp ${source} s3://${destination} --acl public-read`;
17
+ const cp = (source, destination, useAcl = true) => {
18
+ let cmd = `aws s3 cp ${source} s3://${destination} ${useAcl ? '--acl public-read' : ''}`;
19
19
  if ((0, fsUtils_1.isDir)(source)) {
20
20
  cmd += RECURSIVE_FLAG;
21
21
  }
22
22
  runCmdSync(cmd);
23
23
  };
24
24
  exports.cp = cp;
25
- const cpRemote = (source, destination) => {
26
- let cmd = `aws s3 cp s3://${source} s3://${destination} --acl public-read`;
25
+ const cpRemote = (source, destination, useAcl = true) => {
26
+ let cmd = `aws s3 cp s3://${source} s3://${destination} ${useAcl ? '--acl public-read' : ''}`;
27
27
  if (source.endsWith('/')) {
28
28
  cmd += RECURSIVE_FLAG;
29
29
  }
@@ -37,13 +37,15 @@ const uploadPackage = (c, sourcePath, uploadPath) => {
37
37
  const packageLocalPath = `"${packageOutputDirPath}/${packageFileName}"`;
38
38
  const packageRemotePath = `"${uploadPath}/build/${packageFileName}"`;
39
39
  rnv_1.Logger.logDebug(`uploadPackage: src: ${packageLocalPath}, dest: ${packageRemotePath}`);
40
- aws.cp(packageLocalPath, packageRemotePath);
40
+ const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
41
+ aws.cp(packageLocalPath, packageRemotePath, acl);
41
42
  };
42
- const uploadPublicDir = (sourcePath, uploadPath) => {
43
+ const uploadPublicDir = (c, sourcePath, uploadPath) => {
43
44
  const publicDirLocalPath = path.join(sourcePath, 'project', 'public');
44
45
  const publicDirRemotePath = `${uploadPath}/public`;
45
46
  rnv_1.Logger.logDebug(`uploadPublicDir: src: ${publicDirLocalPath}, dest: ${publicDirRemotePath}`);
46
- aws.cp(publicDirLocalPath, publicDirRemotePath);
47
+ const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
48
+ aws.cp(publicDirLocalPath, publicDirRemotePath, acl);
47
49
  };
48
50
  const deployToS3 = async (c) => {
49
51
  rnv_1.Logger.logTask('deployToS3');
@@ -67,7 +69,7 @@ const deployToS3 = async (c) => {
67
69
  return true;
68
70
  }
69
71
  const sourceDirPath = isBuildHosted ? `${sourcePath}-public` : sourcePath;
70
- uploadPublicDir(sourceDirPath, uploadPath);
72
+ uploadPublicDir(c, sourceDirPath, uploadPath);
71
73
  process.stdout.write('Deploy done.\n');
72
74
  return true;
73
75
  };
@@ -61,13 +61,15 @@ const checkDistVersionAvailability = (options, version) => {
61
61
  };
62
62
  exports.checkDistVersionAvailability = checkDistVersionAvailability;
63
63
  const distToLiveS3 = (options, version, copyIndexOnly) => {
64
+ const c = (0, resolveGenericRnvConfig_1.getBaseConfig)();
64
65
  const uploadPath = getUploadPath(options, version);
65
66
  if (!uploadPath)
66
67
  return false;
67
68
  const indexPath = copyIndexOnly ? 'index.html' : '';
68
69
  const copyFrom = `${uploadPath}/public/${indexPath}`;
69
70
  const copyTo = `${uploadPath.replace(/dist\/v.*/, 'live')}/public/${indexPath}`;
70
- aws.cpRemote(copyFrom, copyTo);
71
+ const acl = c.buildConfig?.common.deploy?.aws3?.acl ?? true;
72
+ aws.cpRemote(copyFrom, copyTo, acl);
71
73
  process.stdout.write('Publish done.\n');
72
74
  return true;
73
75
  };
@@ -142,8 +142,10 @@ function generateConfig(config) {
142
142
  },
143
143
  }),
144
144
  webpack: new webpack_1.default.DefinePlugin({
145
+ WEBPACK_INJECTION_APP_ID: JSON.stringify(buildConfig.platforms[PLATFORM].id || buildConfig.common.id || ''),
145
146
  WEBPACK_INJECTION_APP_NAME: JSON.stringify(buildConfig.common.appName || ''),
146
147
  WEBPACK_INJECTION_APP_TITLE: JSON.stringify(buildConfig.common.title || ''),
148
+ WEBPACK_INJECTION_APP_STORE_URL: JSON.stringify(buildConfig.platforms[PLATFORM].storeUrl || ''),
147
149
  WEBPACK_INJECTION_APP_CONFIG_ID: JSON.stringify(config.appConfigId || ''),
148
150
  WEBPACK_INJECTION_APP_CREATED: JSON.stringify(new Date().toISOString()),
149
151
  WEBPACK_INJECTION_APP_SCHEME: JSON.stringify(config.scheme || ''),
@@ -237,7 +239,7 @@ function generateConfig(config) {
237
239
  output: {
238
240
  environment: outputEnvironment,
239
241
  filename: 'content/js/[name].js',
240
- publicPath: isBuildHosted ? `${baseUrl}/public` : '',
242
+ publicPath: isBuildHosted ? `${baseUrl}/public/` : '',
241
243
  path: appBuildEngineProjectPublicDir,
242
244
  },
243
245
  Plugins: plugins,
@@ -6,6 +6,7 @@ def theoLicense = '{{THEO_LICENSE}}'
6
6
  def useTheoPlayer = theoLicense != ''
7
7
  def npawAccountCode = '{{NPAW_ACCOUNT_CODE}}'
8
8
  def useNpawPlugin = npawAccountCode != ''
9
+ def useImaSdk = {{ENABLE_IMA_SDK}}
9
10
 
10
11
  android {
11
12
  namespace = 'com.twentyfouri.tvbridge'
@@ -104,12 +105,12 @@ dependencies {
104
105
  implementation "com.squareup.okhttp3:logging-interceptor:4.9.2"
105
106
  implementation "com.squareup.okhttp3:okhttp:4.9.2"
106
107
  if (useTheoPlayer) {
107
- compileOnly "com.twentyfouri.player:exoplayer:0.8.0-alpha.8"
108
- implementation "com.twentyfouri.player:theoplayer:0.8.0-alpha.8"
108
+ compileOnly "com.twentyfouri.player:exoplayer:0.8.0-alpha.15"
109
+ implementation "com.twentyfouri.player:theoplayer:0.8.0-alpha.15"
109
110
  implementation "com.theoplayer.theoplayer-sdk-android:core:8.2.0"
110
111
  } else {
111
- implementation "com.twentyfouri.player:exoplayer:0.8.0-alpha.8"
112
- compileOnly "com.twentyfouri.player:theoplayer:0.8.0-alpha.8"
112
+ implementation "com.twentyfouri.player:exoplayer:0.8.0-alpha.15"
113
+ compileOnly "com.twentyfouri.player:theoplayer:0.8.0-alpha.15"
113
114
  compileOnly "com.theoplayer.theoplayer-sdk-android:core:8.2.0"
114
115
  }
115
116
 
@@ -123,6 +124,10 @@ dependencies {
123
124
  compileOnly 'com.google.android.exoplayer:extension-okhttp:2.19.1'
124
125
  }
125
126
 
127
+ if (useImaSdk) {
128
+ implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.36.0'
129
+ }
130
+
126
131
  implementation project(':common')
127
132
  }
128
133
 
@@ -1,6 +1,8 @@
1
1
  package com.twentyfouri.tvbridge.bridge
2
2
 
3
3
  import android.util.Log
4
+ import com.twentyfouri.player.base.Ad
5
+ import com.twentyfouri.player.base.AdBreak
4
6
  import com.twentyfouri.player.base.AudioTrack
5
7
  import com.twentyfouri.player.base.DefaultSourceSerializer
6
8
  import com.twentyfouri.player.base.TextTrack
@@ -63,6 +65,20 @@ class BridgeToJavaScript(
63
65
  executeJavaScript(mediaEventString)
64
66
  }
65
67
 
68
+ fun bridgeAndroidToJavaScript_MediaAdEvent(
69
+ mediaEvent: String,
70
+ adBreak: AdBreak?,
71
+ ad: Ad?
72
+ ) {
73
+ val serializer = DefaultSourceSerializer()
74
+ val adBreakJson = adBreak?.let { serializer.toPersistentMap(it).toString() } ?: ""
75
+ val adJson = ad?.let { serializer.toPersistentMap(it).toString() } ?: ""
76
+
77
+ val mediaEventString = "javascript:((function dispatchEvent(){var evt = document.createEvent('Events');evt.initEvent('$mediaEventPrefix$mediaEvent',true,true);evt.adbreak='$adBreakJson';evt.adbreak='$adJson';document.dispatchEvent(evt);})())"
78
+ Log.v(LOG_TAG, mediaEventString)
79
+ executeJavaScript(mediaEventString)
80
+ }
81
+
66
82
  fun bridgeAndroidToJavaScript_MediaAdBreaksEvent(
67
83
  mediaEvent: String,
68
84
  timeline: List<TimelineEvent>
@@ -1,7 +1,6 @@
1
1
  package com.twentyfouri.tvbridge.global.utils
2
2
 
3
3
  import android.annotation.SuppressLint
4
- import android.app.Application
5
4
  import android.content.Context
6
5
  import android.content.ContextWrapper
7
6
  import android.os.Bundle
@@ -45,13 +44,16 @@ import com.npaw.analytics.video.VideoOptions
45
44
  import com.npaw.core.options.AnalyticsOptions
46
45
  import com.npaw.exoplayer.ExoPlayerAdapter
47
46
  import com.npaw.exoplayer.ExoPlayerBalancer
47
+ import com.twentyfouri.player.base.BackgroundMode
48
48
  import com.twentyfouri.player.base.CastingEnded
49
49
  import com.twentyfouri.player.base.CastingStarted
50
+ import com.twentyfouri.player.base.CastingType
50
51
  import com.twentyfouri.player.base.DrmPlayready
51
52
  import com.twentyfouri.player.base.DrmWidevine
52
53
  import com.twentyfouri.player.base.EventListenerDispose
53
54
  import com.twentyfouri.player.base.PlayerBase
54
55
  import com.twentyfouri.player.base.PlayerGesturesTarget
56
+ import com.twentyfouri.player.base.PlayerProxy
55
57
  import com.twentyfouri.player.base.PlayerSurface
56
58
  import com.twentyfouri.player.base.ResizeEvent
57
59
  import com.twentyfouri.player.base.ScaleType
@@ -71,11 +73,11 @@ import com.twentyfouri.player.exoplayer.DrmSessionManagerProvider
71
73
  import com.twentyfouri.player.exoplayer.PlayerComponents
72
74
  import com.twentyfouri.player.exoplayer.PlayerExoPlayer
73
75
  import com.twentyfouri.player.exoplayer.PlayerFactoryExoPlayer
74
- import com.twentyfouri.player.exoplayer.PlayerProxy
75
76
  import com.twentyfouri.player.exoplayer.PlayerViewAdvertisement
76
77
  import com.twentyfouri.player.exoplayer.SharedComponents
77
78
  import com.twentyfouri.tvbridge.BuildConfig
78
79
  import com.twentyfouri.tvbridge.configuration.BridgeConfig
80
+ import java.util.WeakHashMap
79
81
  import com.npaw.core.util.extensions.Log as NpawLog
80
82
 
81
83
  class PlayerFactoryExoPlayerNpaw(
@@ -86,9 +88,11 @@ class PlayerFactoryExoPlayerNpaw(
86
88
 
87
89
  override val engineVersion: String = ExoPlayerLibraryInfo.VERSION
88
90
 
91
+ private val activePlayers = WeakHashMap<PlayerBase, Boolean>()
92
+
89
93
  override fun createSharedComponents(context: Context): SharedComponents =
90
94
  CustomizedSharedComponents(context)
91
-
95
+
92
96
  override fun createView(parent: ViewGroup): View {
93
97
  return NpawPlayerView(parent.context).also {
94
98
  val basePlayer = createPlayer(parent.context)
@@ -97,7 +101,7 @@ class PlayerFactoryExoPlayerNpaw(
97
101
  .sharedComponents as CustomizedSharedComponents
98
102
  ).npawPlugin
99
103
  val npawPlayer = NpawPlayer(basePlayer, npawPlugin)
100
- trackPlayer(npawPlayer)
104
+ activePlayers[npawPlayer] = true
101
105
  it.player = npawPlayer
102
106
  }
103
107
  }
@@ -111,10 +115,15 @@ class PlayerFactoryExoPlayerNpaw(
111
115
  ?: throw IllegalStateException("Player was not initialized by PlayerFactory")
112
116
  }
113
117
 
114
- private inner class CustomizedSharedComponents(context: Context) : DefaultSharedComponents(context) {
118
+ override fun release() {
119
+ activePlayers.keys.forEach {
120
+ it.destroy()
121
+ }
122
+ activePlayers.clear()
123
+ super.release()
124
+ }
115
125
 
116
- val application = context.applicationContext as? Application
117
- ?: throw IllegalStateException("Missing application")
126
+ private inner class CustomizedSharedComponents(context: Context) : DefaultSharedComponents(context) {
118
127
 
119
128
  val npawPlugin: NpawPlugin = NpawPlugin
120
129
  .Builder(application, config.npawAccount)
@@ -335,6 +344,10 @@ class PlayerFactoryExoPlayerNpaw(
335
344
  adOverlay.gesturesTarget = value
336
345
  }
337
346
 
347
+ override var supportsPictureInPicture: Boolean
348
+ get() = false
349
+ set(value) {}
350
+
338
351
  var player: PlayerBase? = null
339
352
  set(value) {
340
353
  if (field == value) return
@@ -474,6 +487,23 @@ class PlayerFactoryExoPlayerNpaw(
474
487
  }
475
488
  }
476
489
 
490
+ override fun onUserLeaveHint() {
491
+ (player as? PlayerProxy)?.onUserLeaveHint()
492
+ }
493
+
494
+ override fun onPictureInPictureModeChanged(inPictureInPictureMode: Boolean) {
495
+ }
496
+
497
+ fun autoPauseByBackground() {
498
+ val player = this.player ?: return
499
+ if (player.live) {
500
+ player.stop()
501
+ } else {
502
+ player.pause()
503
+ }
504
+ pausedByBackground = true
505
+ }
506
+
477
507
  private inner class ComponentListener : TextOutput, Player.Listener,
478
508
  DefaultLifecycleObserver {
479
509
  override fun onCues(cueGroup: CueGroup) {
@@ -499,29 +529,46 @@ class PlayerFactoryExoPlayerNpaw(
499
529
  this@NpawPlayerView.keepScreenOn = isPlaying
500
530
  }
501
531
 
502
- override fun onPause(owner: LifecycleOwner) {
532
+ override fun onStop(owner: LifecycleOwner) {
503
533
  val player = this@NpawPlayerView.player ?: return
504
534
  player.asPlayerExoPlayer()?.also {
505
535
  detachSurface(it)
506
536
  }
507
- if (!player.continueInBackground && !player.paused && player.state.source != null) {
508
- if (player.live) {
509
- player.stop()
510
- } else {
511
- player.pause()
537
+ if (
538
+ !player.paused && player.state.source != null &&
539
+ player.castingType == CastingType.NONE
540
+ ) {
541
+ val shouldPause = when (player.continueInBackgroundMode) {
542
+ BackgroundMode.PAUSE -> true
543
+ BackgroundMode.PICTURE_IN_PICTURE -> when {
544
+ player.isCastingHost -> false
545
+ player.pictureInPicture -> false
546
+ else -> true // PiP disabled in system settings?
547
+ }
548
+ else -> false
549
+ }
550
+ if (shouldPause) {
551
+ autoPauseByBackground()
512
552
  }
513
- pausedByBackground = true
553
+ }
554
+ if (player is PlayerProxy) {
555
+ player.onLifecycleStop()
514
556
  }
515
557
  }
516
558
 
517
- override fun onResume(owner: LifecycleOwner) {
559
+ override fun onStart(owner: LifecycleOwner) {
518
560
  val player = this@NpawPlayerView.player ?: return
519
561
  if (pausedByBackground) {
520
562
  pausedByBackground = false
521
563
  player.play()
522
564
  }
565
+ if (player is PlayerProxy) {
566
+ player.onLifecycleStart()
567
+ }
523
568
  player.asPlayerExoPlayer()?.also {
524
- attachSurface(it)
569
+ if (player.castingType == CastingType.NONE) {
570
+ attachSurface(it)
571
+ }
525
572
  }
526
573
  }
527
574
 
@@ -20,7 +20,10 @@ object MediaEventType {
20
20
  const val KEY_UP = "keyup"
21
21
  const val KEY_DOWN = "keydown"
22
22
  const val TRACKS_CHANGED = "trackschanged"
23
- const val AD_BREAK_START = "adbreakstart"
23
+ const val AD_BREAK_START = "adbreakbegin"
24
24
  const val AD_BREAK_END = "adbreakend"
25
- const val AD_BREAKS_RESCHEDULED = "adbreaksrescheduled"
25
+ const val AD_BREAKS_RESCHEDULED = "admetadata"
26
+ const val AD_STARTED = "adbegin"
27
+ const val AD_ERROR = "aderror"
28
+ const val AD_SKIPPED = "adskip"
26
29
  }
@@ -328,14 +328,23 @@ class WebViewModel @Inject constructor(
328
328
  Log.d("WebViewModel", "onTrackschanged: audio=$audioTrack subtitle=$subtitleTrack")
329
329
  jsBridge.bridgeAndroidToJavaScript_MediaTrackEvent(MediaEventType.TRACKS_CHANGED, player.audioTracks, player.textTracks)
330
330
  }
331
+ is AdBreaksRescheduledEvent -> {
332
+ jsBridge.bridgeAndroidToJavaScript_MediaAdBreaksEvent(MediaEventType.AD_BREAKS_RESCHEDULED, player.timeline)
333
+ }
331
334
  is AdBreakStartedEvent -> {
332
- jsBridge.bridgeAndroidToJavaScript_MediaEvent(MediaEventType.AD_BREAK_START)
335
+ jsBridge.bridgeAndroidToJavaScript_MediaAdEvent(MediaEventType.AD_BREAK_START, player.currentAdBreak, player.currentAd)
333
336
  }
334
337
  is AdBreakEndedEvent -> {
335
- jsBridge.bridgeAndroidToJavaScript_MediaEvent(MediaEventType.AD_BREAK_END)
338
+ jsBridge.bridgeAndroidToJavaScript_MediaAdEvent(MediaEventType.AD_BREAK_END, player.currentAdBreak, player.currentAd)
336
339
  }
337
- is AdBreaksRescheduledEvent -> {
338
- jsBridge.bridgeAndroidToJavaScript_MediaAdBreaksEvent(MediaEventType.AD_BREAKS_RESCHEDULED, player.timeline)
340
+ is AdStartedEvent -> {
341
+ jsBridge.bridgeAndroidToJavaScript_MediaAdEvent(MediaEventType.AD_STARTED, player.currentAdBreak, player.currentAd)
342
+ }
343
+ is AdErrorEvent -> {
344
+ jsBridge.bridgeAndroidToJavaScript_MediaAdEvent(MediaEventType.AD_ERROR, player.currentAdBreak, player.currentAd)
345
+ }
346
+ is AdSkippedEvent -> {
347
+ jsBridge.bridgeAndroidToJavaScript_MediaAdEvent(MediaEventType.AD_SKIPPED, player.currentAdBreak, player.currentAd)
339
348
  }
340
349
  }
341
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.17.26-alpha.2755",
3
+ "version": "0.17.27-alpha.2774",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appCenterRelease = void 0;
4
- const child_process_1 = require("child_process");
5
- const appCenterRelease = (params) => {
6
- const { filePath, releaseNotesPath, buildVersion, token, projectName } = params;
7
- const app = `24i-Media/${projectName}`;
8
- (0, child_process_1.execSync)('appcenter distribute release '
9
- + `--file "${filePath}" `
10
- + `--release-notes-file "${releaseNotesPath}" `
11
- + `--build-version "${buildVersion}" `
12
- + `--app "${app}" `
13
- + `--token "${token}" `
14
- + '--group "Collaborators" '
15
- + '--disable-telemetry', { stdio: 'inherit' });
16
- };
17
- exports.appCenterRelease = appCenterRelease;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.deployProductionPackagesToAppCenter = void 0;
27
- const child_process_1 = require("child_process");
28
- const path = __importStar(require("path"));
29
- const fs = __importStar(require("fs"));
30
- const constants_1 = require("../../../constants");
31
- const buildProductionPackages_1 = require("../../../constants/buildProductionPackages");
32
- const resolvers_1 = require("../../../resolvers");
33
- const appCenter_1 = require("./appCenter");
34
- const ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES = 'APPCENTER_TOKEN_PRODUCTION_PACKAGES';
35
- const newLine = '\r\n';
36
- const formatDateTime = (date) => {
37
- const year = date.getFullYear();
38
- const month = String(date.getMonth() + 1).padStart(2, '0');
39
- const day = String(date.getDate()).padStart(2, '0');
40
- const h = String(date.getHours()).padStart(2, '0');
41
- const m = String(date.getMinutes()).padStart(2, '0');
42
- const s = String(date.getSeconds()).padStart(2, '0');
43
- return `${year}-${month}-${day}T${h}-${m}-${s}`;
44
- };
45
- const getAppCenterConfig = (c) => {
46
- try {
47
- return c.buildConfig.common.deploy?.productionPackages?.appCenter || null;
48
- }
49
- catch (error) {
50
- return null;
51
- }
52
- };
53
- const getPlatformPackagesList = (c) => {
54
- const scheme = constants_1.BuildSchemes.RELEASE_PROD_DIST;
55
- const packagesList = [];
56
- const platforms = (0, resolvers_1.resolveSupportedPlatforms)(c)
57
- .filter((platform) => buildProductionPackages_1.SUPPORTED_PACKAGE_PLATFORMS.includes(platform));
58
- platforms.forEach((platform) => {
59
- const supportedFlavours = (0, resolvers_1.resolveSupportedFlavoursForPlatform)(c, platform);
60
- const platformObj = {
61
- platformName: platform,
62
- packages: supportedFlavours.map((appConfigID) => {
63
- const config = (0, resolvers_1.getBaseConfig)({
64
- platform, scheme, appConfigID, productionPackagesHostedUrl: true,
65
- });
66
- return {
67
- name: (0, resolvers_1.resolveBuildFileName)(config),
68
- flavour: appConfigID,
69
- hostedUrl: `${(0, resolvers_1.resolveProductionPackagesBaseUrl)(c)}/public`,
70
- };
71
- }),
72
- };
73
- packagesList.push(platformObj);
74
- });
75
- return packagesList;
76
- };
77
- const getAppCenterToken = () => process.env[ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES] || '';
78
- const deployProductionPackagesToAppCenter = (c) => {
79
- console.log('deployProductionPackagesToAppCenter');
80
- const appCenterConfig = getAppCenterConfig(c);
81
- if (!appCenterConfig) {
82
- throw new Error('Not found App Center Config (for production packages) in build config');
83
- }
84
- const { appName: centerAppName } = appCenterConfig;
85
- const token = getAppCenterToken();
86
- const { appName } = c.buildConfig.common;
87
- if (!centerAppName)
88
- throw new Error('Missing AppName in appCenterConfig');
89
- if (!token) {
90
- throw new Error(`Missing App Center Token. To fix it, set "${ENV_APPCENTER_TOKEN_PRODUCTION_PACKAGES}" env variable`);
91
- }
92
- const originalZipPath = (0, resolvers_1.getProductionZipFileRelativePath)(c);
93
- const { dir, name: fileName } = path.parse(originalZipPath);
94
- const zipPath = path.join(dir, `${fileName}_${formatDateTime(new Date())}.zip`);
95
- fs.renameSync(originalZipPath, zipPath);
96
- const tempReleaseNotesPath = 'RELEASE_NOTES_APPCENTER_PRODUCTION_PACKAGES.md';
97
- if (fs.existsSync(tempReleaseNotesPath)) {
98
- fs.unlinkSync(tempReleaseNotesPath);
99
- }
100
- const packagesList = getPlatformPackagesList(c);
101
- const notes = [
102
- `# ${appName} Production Packages`,
103
- '',
104
- '## List of Production Packages',
105
- ...packagesList.reduce((acc, { platformName, packages }) => ([
106
- ...acc,
107
- `- ${platformName}`,
108
- ...packages.reduce((accPackages, { name, hostedUrl }) => ([
109
- ...accPackages,
110
- ` - ${name}`,
111
- ` - App URL: ${hostedUrl}`,
112
- ]), []),
113
- ]), []),
114
- ];
115
- const packagesMarkdown = notes.join(newLine);
116
- (0, child_process_1.execSync)(`echo "${packagesMarkdown}" >> ${tempReleaseNotesPath}`);
117
- console.log('Deploying Production packages to AppCenter.ms...');
118
- (0, appCenter_1.appCenterRelease)({
119
- projectName: centerAppName,
120
- buildVersion: '0',
121
- filePath: zipPath,
122
- releaseNotesPath: tempReleaseNotesPath,
123
- token,
124
- });
125
- };
126
- exports.deployProductionPackagesToAppCenter = deployProductionPackagesToAppCenter;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.deployToAppCenter = void 0;
27
- const child_process_1 = require("child_process");
28
- const fs = __importStar(require("fs"));
29
- const rnv_1 = require("rnv");
30
- const resolvers_1 = require("../../../resolvers");
31
- const urlsMarkdown_1 = require("../urlsMarkdown");
32
- const appCenter_1 = require("./appCenter");
33
- const getAppCenterConfigByPlatformName = (c, platformName) => {
34
- try {
35
- return c.buildConfig.platforms[platformName]?.deploy?.appCenter || null;
36
- }
37
- catch (error) {
38
- return null;
39
- }
40
- };
41
- const getAppCenterTokenByPlatform = (platformName = '') => {
42
- const envVariableName = `APPCENTER_TOKEN_${platformName.toUpperCase()}`;
43
- return process.env[envVariableName] || '';
44
- };
45
- const processPlatform = (c, platformName) => {
46
- const { getConfigProp } = rnv_1.Common;
47
- const appCenterConfig = getAppCenterConfigByPlatformName(c, platformName);
48
- if (!appCenterConfig)
49
- return;
50
- const { appName } = appCenterConfig;
51
- const token = getAppCenterTokenByPlatform(platformName);
52
- const zipPath = (0, resolvers_1.resolveZippedPlatformBuildsRelativeFilePath)(c, platformName);
53
- const buildVersion = getConfigProp(c, platformName, 'packageVersion', '');
54
- const releaseNotesPath = getConfigProp(c, platformName, 'releaseNotes', {}).relativePath || '';
55
- if (!appName || !token || !releaseNotesPath || !zipPath || !buildVersion)
56
- return;
57
- const tempReleaseNotesPath = `RELEASE_NOTES_APPCENTER_${platformName.toUpperCase()}.md`;
58
- if (fs.existsSync(tempReleaseNotesPath)) {
59
- fs.unlinkSync(tempReleaseNotesPath);
60
- }
61
- (0, child_process_1.execSync)(`cat ${releaseNotesPath} >> ${tempReleaseNotesPath}`);
62
- const urlsMarkdown = (0, urlsMarkdown_1.getUrlsMarkdown)(c, [platformName]);
63
- (0, child_process_1.execSync)(`echo "${urlsMarkdown}" >> ${tempReleaseNotesPath}`);
64
- console.log(`Deploying ${platformName} platform to AppCenter.ms...`);
65
- (0, appCenter_1.appCenterRelease)({
66
- projectName: appName,
67
- buildVersion,
68
- filePath: zipPath,
69
- releaseNotesPath: tempReleaseNotesPath,
70
- token,
71
- });
72
- };
73
- const deployToAppCenter = (c) => {
74
- (0, resolvers_1.resolveSupportedPlatforms)(c).forEach((platformName) => processPlatform(c, platformName));
75
- };
76
- exports.deployToAppCenter = deployToAppCenter;