Skip to content

Commit 4e172cf

Browse files
Mihail Slavchevfealebenpae
authored andcommitted
move logic to platform specific services
1 parent 29ce268 commit 4e172cf

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

lib/definitions/project.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ interface IPlatformProjectService {
2929
prepareProject(platformData: IPlatformData): IFuture<string>;
3030
buildProject(projectRoot: string): IFuture<void>;
3131
isPlatformPrepared(projectRoot: string): IFuture<boolean>;
32-
addLibrary(projectRoot: string, libraryPath: string): IFuture<void>;
32+
addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void>;
3333
}

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class AndroidProjectService implements IPlatformProjectService {
132132
return this.$fs.exists(path.join(projectRoot, "assets", constants.APP_FOLDER_NAME));
133133
}
134134

135-
public addLibrary(projectRoot: string, libraryPath: string): IFuture<void> {
135+
public addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void> {
136136
this.$errors.fail("Implement me!");
137137
return Future.fromResult();
138138
}

lib/services/ios-project-service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ class IOSProjectService implements IPlatformProjectService {
169169
return this.$fs.exists(path.join(projectRoot, this.$projectData.projectName, constants.APP_FOLDER_NAME));
170170
}
171171

172-
public addLibrary(projectRoot: string, libraryPath: string): IFuture<void> {
172+
public addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void> {
173+
var name = path.basename(libraryPath);
174+
var targetPath = path.join(this.$projectData.projectDir, "lib", platformData.normalizedPlatformName, path.basename(name, path.extname(name)));
175+
this.$fs.ensureDirectoryExists(targetPath).wait();
176+
177+
shell.cp("-R", libraryPath, targetPath);
178+
173179
this.$errors.fail("Implement me!");
174180
return Future.fromResult();
175181
}

lib/services/platform-service.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,8 @@ export class PlatformService implements IPlatformService {
327327
if (!this.$fs.exists(libraryPath).wait()) {
328328
this.$errors.fail("The path %s does not exist", libraryPath);
329329
} else {
330-
var name = path.basename(libraryPath);
331-
var targetPath = path.join(this.$projectData.projectDir, "lib", platformData.normalizedPlatformName, path.basename(name, path.extname(name)));
332-
this.$fs.ensureDirectoryExists(targetPath).wait();
333-
334-
shell.cp("-R", libraryPath, targetPath);
335-
336330
var platformData = this.$platformsData.getPlatformData(platform);
337-
platformData.platformProjectService.addLibrary(platformData.projectRoot, path.join(targetPath, name)).wait();
331+
platformData.platformProjectService.addLibrary(platformData, libraryPath).wait();
338332
}
339333
}).future<void>()();
340334
}

0 commit comments

Comments
 (0)