build_apk.dart 1.35 KB
Newer Older
1 2 3 4 5 6
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';

7
import '../android/apk.dart';
8
import 'build.dart';
9

10
class BuildApkCommand extends BuildSubCommand {
11
  BuildApkCommand({bool verboseHelp: false}) {
12
    usesTargetOption();
13
    addBuildModeFlags();
14
    usesFlavorOption();
15
    usesPubOption();
16 17

    argParser
18 19
      ..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp)
      ..addFlag('strong', negatable: false, hide: !verboseHelp)
20
      ..addFlag('prefer-shared-library', negatable: false,
21 22 23 24
          help: 'Whether to prefer compiling to a *.so file (android only).')
      ..addOption('target-platform',
        defaultsTo: 'android-arm',
        allowed: <String>['android-arm', 'android-arm64']);
25 26
  }

27 28 29 30
  @override
  final String name = 'apk';

  @override
31
  final String description = 'Build an Android APK file from your app.\n\n'
32 33
    'This command can build debug and release versions of your application. \'debug\' builds support\n'
    'debugging and a quick development cycle. \'release\' builds don\'t support debugging and are\n'
34
    'suitable for deploying to app stores.';
35

36
  @override
37
  Future<Null> runCommand() async {
38
    await super.runCommand();
39
    await buildApk(buildInfo: getBuildInfo(), target: targetFile);
40
  }
41
}