Skip to content

Commit 067255c

Browse files
committed
Merge pull request #1469 from NativeScript/remove-ant
Remove ANT support
2 parents 8c20836 + 8409d91 commit 067255c

File tree

1 file changed

+3
-42
lines changed

1 file changed

+3
-42
lines changed

lib/services/android-project-service.ts

+3-42
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as semver from "semver";
88
import * as projectServiceBaseLib from "./platform-project-service-base";
99
import * as androidDebugBridgePath from "../common/mobile/android/android-debug-bridge";
1010
import {AndroidDeviceHashService} from "../common/mobile/android/android-device-hash-service";
11+
import {EOL} from "os";
1112

1213
export class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
1314
private static VALUES_DIRNAME = "values";
@@ -233,12 +234,8 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
233234
}
234235
this.spawn(gradleBin, buildOptions, { stdio: "inherit", cwd: this.platformData.projectRoot }).wait();
235236
} else {
236-
this.checkAnt().wait();
237-
238-
let args = this.getAntArgs(this.$options.release ? "release" : "debug", projectRoot);
239-
this.spawn('ant', args).wait();
240-
241-
this.platformData.deviceBuildOutputPath = path.join(this.platformData.projectRoot, "bin");
237+
this.$errors.failWithoutHelp("Cannot complete build because this project is ANT-based." + EOL +
238+
"Run `tns platform remove android && tns platform add android` to switch to Gradle and try again.");
242239
}
243240
}).future<void>()();
244241
}
@@ -416,32 +413,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
416413
return this.$childProcess.spawnFromEvent(command, args, "close", opts || { stdio: "inherit"});
417414
}
418415

419-
private getAntArgs(configuration: string, projectRoot: string): string[] {
420-
let args = [configuration, "-f", path.join(projectRoot, "build.xml")];
421-
if(configuration === "release") {
422-
if(this.$options.keyStorePath) {
423-
args = args.concat(["-Dkey.store", path.resolve(this.$options.keyStorePath)]);
424-
}
425-
426-
if(this.$options.keyStorePassword) {
427-
args = args.concat(["-Dkey.store.password", this.$options.keyStorePassword]);
428-
}
429-
430-
if(this.$options.keyStoreAlias) {
431-
args = args.concat(["-Dkey.alias", this.$options.keyStoreAlias]);
432-
}
433-
434-
if(this.$options.keyStoreAliasPassword) {
435-
args = args.concat(["-Dkey.alias.password", this.$options.keyStoreAliasPassword]);
436-
}
437-
}
438-
439-
// metadata generation support
440-
args = args.concat(["-Dns.resources", path.join(__dirname, "../../resources/tools")]);
441-
442-
return args;
443-
}
444-
445416
private validatePackageName(packageName: string): void {
446417
//Make the package conform to Java package types
447418
//Enforce underscore limitation
@@ -483,16 +454,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
483454
}).future<string>()();
484455
}
485456

486-
private checkAnt(): IFuture<void> {
487-
return (() => {
488-
try {
489-
this.$childProcess.exec("ant -version").wait();
490-
} catch(error) {
491-
this.$errors.fail("Error executing commands 'ant', make sure you have ant installed and added to your PATH.");
492-
}
493-
}).future<void>()();
494-
}
495-
496457
private symlinkDirectory(directoryName: string, projectRoot: string, frameworkDir: string): IFuture<void> {
497458
return (() => {
498459
this.$fs.createDirectory(path.join(projectRoot, directoryName)).wait();

0 commit comments

Comments
 (0)