Skip to content

Commit be5efb0

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #660 from NativeScript/fatme/fix-library-add
Fix library add
2 parents 26a2c3f + 292231b commit be5efb0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/commands/add-library.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import Future = require("fibers/future");
66

77
export class AddLibraryCommand implements ICommand {
88
constructor(private $platformService: IPlatformService,
9-
private $errors: IErrors) { }
9+
private $errors: IErrors,
10+
private $logger: ILogger) { }
1011

1112
allowedParameters: ICommandParameter[] = [];
1213

1314
execute(args: string[]): IFuture<void> {
14-
var platform = args[0];
15-
var libraryPath = path.resolve(args[1]);
16-
return this.$platformService.addLibrary(platform, libraryPath);
15+
return (() => {
16+
var platform = args[0];
17+
var libraryPath = path.resolve(args[1]);
18+
this.$platformService.addLibrary(platform, libraryPath).wait();
19+
this.$logger.info(`Library ${libraryPath} was successfully added for ${platform} platform.`);
20+
}).future<void>()();
1721
}
1822

1923
canExecute(args: string[]): IFuture<boolean> {

lib/services/android-project-service.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,6 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
202202

203203
private parseProjectProperties(projDir: string, destDir: string): IFuture<void> { // projDir is libraryPath, targetPath is the path to lib folder
204204
return (() => {
205-
let projProp = path.join(projDir, "project.properties");
206-
if (!this.$fs.exists(projProp).wait()) {
207-
this.$logger.warn("Warning: File %s does not exist", projProp);
208-
return;
209-
}
210-
211205
let projectPropertiesManager = this.getProjectPropertiesManager(projDir);
212206
let references = projectPropertiesManager.getProjectReferences().wait();
213207
_.each(references, reference => {
@@ -233,7 +227,9 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
233227
let targetPath = path.dirname(targetLibPath);
234228
this.$fs.ensureDirectoryExists(targetPath).wait();
235229

236-
this.parseProjectProperties(libraryPath, targetPath).wait();
230+
if(this.$fs.exists(path.join(libraryPath, "project.properties")).wait()) {
231+
this.parseProjectProperties(libraryPath, targetPath).wait();
232+
}
237233

238234
shell.cp("-f", path.join(libraryPath, "*.jar"), targetPath);
239235
let projectLibsDir = path.join(this.platformData.projectRoot, "libs");

0 commit comments

Comments
 (0)