Re-organize flutter_tools code to better support proper layering. (#12957)

* executable.dart#main() depends on runner.dart#run()
* Refactor code such that non-commands don't depend on commands.

No code was actually changed in this PR - code was merely moved from
point A to point B.
This commit is contained in:
Todd Volkert
2017-11-09 21:45:31 -08:00
committed by GitHub
parent 5af7b423dd
commit 454db9d47c
10 changed files with 451 additions and 441 deletions

View File

@@ -7,6 +7,7 @@ import 'dart:convert';
import '../android/android_sdk.dart';
import '../android/android_workflow.dart';
import '../android/apk.dart';
import '../application_package.dart';
import '../base/common.dart' show throwToolExit;
import '../base/file_system.dart';
@@ -17,7 +18,6 @@ import '../base/process.dart';
import '../base/process_manager.dart';
import '../base/utils.dart';
import '../build_info.dart';
import '../commands/build_apk.dart';
import '../device.dart';
import '../globals.dart';
import '../protocol_discovery.dart';

View File

@@ -0,0 +1,37 @@
// 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';
import '../base/common.dart';
import '../build_info.dart';
import '../globals.dart';
import 'android_sdk.dart';
import 'gradle.dart';
Future<Null> buildApk({
String target,
BuildInfo buildInfo: BuildInfo.debug
}) async {
if (!isProjectUsingGradle()) {
throwToolExit(
'The build process for Android has changed, and the current project configuration\n'
'is no longer valid. Please consult\n\n'
' https://github.com/flutter/flutter/wiki/Upgrading-Flutter-projects-to-build-with-gradle\n\n'
'for details on how to upgrade the project.'
);
}
// Validate that we can find an android sdk.
if (androidSdk == null)
throwToolExit('No Android SDK found. Try setting the ANDROID_HOME environment variable.');
final List<String> validationResult = androidSdk.validateSdkWellFormed();
if (validationResult.isNotEmpty) {
validationResult.forEach(printError);
throwToolExit('Try re-installing or updating your Android SDK.');
}
return buildGradleProject(buildInfo, target);
}