• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import '../project.dart';
6
7// The setting that controls the executable name in the linux makefile.
8const String _kBinaryNameVariable = 'BINARY_NAME=';
9
10/// Extracts the `BINARY_NAME` from a linux project Makefile.
11///
12/// Returns `null` if it cannot be found.
13String makefileExecutableName(LinuxProject project) {
14  for (String line in project.makeFile.readAsLinesSync()) {
15    if (line.startsWith(_kBinaryNameVariable)) {
16      return line.split(_kBinaryNameVariable).last.trim();
17    }
18  }
19  return null;
20}
21