Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit bcea5f4

Browse files
Change the full output in the cloud builds to be the actual full output and change the build output event name and data.
1 parent abb5240 commit bcea5f4

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const tns = require("nativescript");
99

1010
### Module cloudBuildService
1111
The `cloudBuildService` allows build of applications in the cloud. You can call the following methods:
12-
* `build` method - it validates passed arguments and tries to build the application in the cloud. In case of successful build, the build result (.apk, .ipa or .zip) is downloaded. The result contains information about the whole build process, path to the downloaded build result and information used to generate a QR code, pointing to the latest build result (in S3). </br>
12+
* `build` method - it validates passed arguments and tries to build the application in the cloud. In case of successful build, the build result (.apk, .ipa or .zip) is downloaded. The result contains information about the whole build process, path to the downloaded build result and information used to generate a QR code, pointing to the latest build result (in S3). During the build the cloudBuildService will emit buildOutput event which will contain parts of the current build output.</br>
1313
Definition:
1414

1515
```TypeScript
@@ -51,6 +51,17 @@ const androidReleaseConfigurationData = {
5151
const platform = "android";
5252
const buildConfiguration = "release";
5353

54+
tns.cloudBuildService.on("buildOutput", (data) => {
55+
console.log(data);
56+
/*
57+
Sample data object:
58+
{
59+
"pipe": "stdout",
60+
"data": "Add platform ios with runtime version 2.5.*"
61+
}
62+
*/
63+
});
64+
5465
tns.cloudBuildService
5566
.build(projectSettings, platform, buildConfiguration, androidReleaseConfigurationData)
5667
.then(buildResult => console.log(buildResult))

lib/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const BUILD_SERVICE_NAME = "build";
2424
export const EMULATORS_SERVICE_NAME = "emulators";
2525

2626
export const CLOUD_BUILD_EVENT_NAMES = {
27-
OUTPUT: "output"
27+
BUILD_OUTPUT: "buildOutput"
2828
};
2929

3030
export const DEVICE_DISCOVERY_EVENTS = {

lib/services/cloud-build-service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ export class CloudBuildService extends EventEmitter implements ICloudBuildServic
7474
url: buildResultUrl
7575
};
7676

77+
const fullOutput = await this.getContentOfS3File(buildResponse.outputUrl);
78+
7779
const result = {
7880
stderr: buildResult.stderr,
7981
stdout: buildResult.stdout,
80-
fullOutput: buildResult.stdout,
82+
fullOutput: fullOutput,
8183
outputFilePath: localBuildResult,
8284
qrData: {
8385
originalUrl: buildResultUrl,
@@ -221,7 +223,8 @@ export class CloudBuildService extends EventEmitter implements ICloudBuildServic
221223
// The logs variable will contain the full build log and we need to log only the logs that we don't have.
222224
const contentToLog = this.$cloudBuildOutputFilter.filter(logs.substr(outputCursorPosition));
223225
if (contentToLog) {
224-
this.emit(constants.CLOUD_BUILD_EVENT_NAMES.OUTPUT, contentToLog);
226+
const data = { data: contentToLog, pipe: "stdout" };
227+
this.emit(constants.CLOUD_BUILD_EVENT_NAMES.BUILD_OUTPUT, data);
225228
this.$logger.info(contentToLog);
226229
}
227230

0 commit comments

Comments
 (0)