| // Copyright (c) 2022, the R8 project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| package com.android.tools.r8.desugar.desugaredlibrary.jdktests; |
| |
| import static com.android.tools.r8.ToolHelper.JDK_TESTS_BUILD_DIR; |
| |
| import com.android.tools.r8.ToolHelper; |
| import java.nio.file.Path; |
| import java.nio.file.Paths; |
| import java.util.Arrays; |
| |
| // Provides convenience to use Paths/SafeVarargs which are missing on old Android but |
| // required by some Jdk tests, and for java.base extensions. |
| |
| public class Jdk11Paths { |
| |
| private static final Path ANDROID_PATHS_FILES_DIR = |
| Paths.get("third_party/android_jar/lib-v26/xxx/"); |
| private static final Path ANDROID_SAFE_VAR_ARGS_LOCATION = |
| Paths.get("third_party/android_jar/lib-v26/java/lang/SafeVarargs.class"); |
| private static final Path[] ANDROID_PATHS_FILES = |
| new Path[] { |
| Paths.get("java/nio/file/Files.class"), |
| Paths.get("java/nio/file/OpenOption.class"), |
| Paths.get("java/nio/file/Watchable.class"), |
| Paths.get("java/nio/file/Path.class"), |
| Paths.get("java/nio/file/Paths.class") |
| }; |
| |
| public static Path[] getPathsFiles() { |
| return Arrays.stream(ANDROID_PATHS_FILES) |
| .map(ANDROID_PATHS_FILES_DIR::resolve) |
| .toArray(Path[]::new); |
| } |
| |
| public static Path getSafeVarArgsFile() { |
| return ANDROID_SAFE_VAR_ARGS_LOCATION; |
| } |
| |
| public static Path[] testNGSupportProgramFiles() { |
| return new Path[] { |
| Paths.get(JDK_TESTS_BUILD_DIR + "testng-6.10.jar"), |
| Paths.get(JDK_TESTS_BUILD_DIR + "jcommander-1.48.jar"), |
| Paths.get(ToolHelper.JAVA_CLASSES_DIR + "examplesTestNGRunner/TestNGMainRunner.class") |
| }; |
| } |
| } |