blob: 7f09b81e985c966cfc3aee983a104589dfbf94c5 [file] [log] [blame]
Mads Ager418d1ca2017-05-22 09:35:49 +02001// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4package utils;
5
Ian Zernya8b7d422022-03-31 11:20:49 +02006import java.nio.file.Path;
7import java.nio.file.Paths;
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +02008
Mads Ager418d1ca2017-05-22 09:35:49 +02009public class Utils {
10 public static String toolsDir() {
Jean-Marie Henaff39587a82017-06-08 15:20:13 +020011 String osName = System.getProperty("os.name");
12 if (osName.equals("Mac OS X")) {
13 return "mac";
14 } else if (osName.contains("Windows")) {
15 return "windows";
16 } else {
17 return "linux";
18 }
Mads Ager418d1ca2017-05-22 09:35:49 +020019 }
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +020020
Ian Zernya8b7d422022-03-31 11:20:49 +020021 public static boolean isWindows() {
22 return toolsDir().equals("windows");
Jake Wharton2d7aab82019-09-13 10:24:26 -040023 }
24
Ian Zernya8b7d422022-03-31 11:20:49 +020025 public static Path dxExecutable() {
26 String dxExecutableName = isWindows() ? "dx.bat" : "dx";
27 return Paths.get("tools", toolsDir(), "dx", "bin", dxExecutableName);
28 }
29
30 public static Path dexMergerExecutable() {
31 String executableName = isWindows() ? "dexmerger.bat" : "dexmerger";
32 return Paths.get("tools", toolsDir(), "dx", "bin", executableName);
Jean-Marie Henaff34d85f72017-06-14 10:32:04 +020033 }
Jake Wharton2d7aab82019-09-13 10:24:26 -040034}