Skip to content

Commit 188bc75

Browse files
author
Dimitar Tachev
authored
Merge pull request #5204 from NativeScript/tachev/build-hooks
feat: expose before build hooks in order to support cloud builds without an extension
2 parents 27d7638 + 98ee34f commit 188bc75

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

lib/services/android-project-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as semver from "semver";
55
import * as projectServiceBaseLib from "./platform-project-service-base";
66
import { DeviceAndroidDebugBridge } from "../common/mobile/android/device-android-debug-bridge";
77
import { Configurations, LiveSyncPaths } from "../common/constants";
8+
import { hook } from "../common/helpers";
89
import { performanceLog } from ".././common/decorators";
910

1011
export class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
@@ -242,6 +243,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
242243
}
243244

244245
@performanceLog()
246+
@hook('buildAndroid')
245247
public async buildProject(projectRoot: string, projectData: IProjectData, buildData: IAndroidBuildData): Promise<void> {
246248
const platformData = this.getPlatformData(projectData);
247249
await this.$gradleBuildService.buildProject(platformData.projectRoot, buildData);

lib/services/ios-project-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { IOSEntitlementsService } from "./ios-entitlements-service";
1414
import { IOSBuildData } from "../data/build-data";
1515
import { IOSPrepareData } from "../data/prepare-data";
1616
import { BUILD_XCCONFIG_FILE_NAME, IosProjectConstants } from "../constants";
17+
import { hook } from "../common/helpers";
1718

1819
interface INativeSourceCodeGroup {
1920
name: string;
@@ -193,6 +194,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
193194
path.join(projectRoot, projectData.projectName));
194195
}
195196

197+
@hook('buildIOS')
196198
public async buildProject(projectRoot: string, projectData: IProjectData, iOSBuildData: IOSBuildData): Promise<void> {
197199
const platformData = this.getPlatformData(projectData);
198200

npm-shrinkwrap.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nativescript",
33
"preferGlobal": true,
4-
"version": "6.3.2",
4+
"version": "6.3.3",
55
"author": "Telerik <[email protected]>",
66
"description": "Command-line interface for building NativeScript projects",
77
"bin": {
@@ -141,4 +141,4 @@
141141
"engines": {
142142
"node": ">=10.0.0 <14.0.0"
143143
}
144-
}
144+
}

test/services/android-project-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { GradleBuildArgsService } from "../../lib/services/android/gradle-build-
1111
const createTestInjector = (): IInjector => {
1212
const testInjector = new Yok();
1313
testInjector.register("androidProjectService", AndroidProjectService);
14+
testInjector.register("hooksService", stubs.HooksServiceStub);
1415
testInjector.register("childProcess", stubs.ChildProcessStub);
1516
testInjector.register("hostInfo", {});
1617
testInjector.register("projectDataService", stubs.ProjectDataService);

0 commit comments

Comments
 (0)