|
17 | 17 |
|
18 | 18 | import static com.google.common.base.Charsets.US_ASCII;
|
19 | 19 | import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_PATH;
|
| 20 | +import static com.google.common.base.StandardSystemProperty.OS_NAME; |
20 | 21 | import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR;
|
21 | 22 | import static com.google.common.truth.Truth.assertThat;
|
22 | 23 |
|
@@ -173,6 +174,13 @@ public void testToFile_AndroidIncompatible() throws Exception {
|
173 | 174 | @AndroidIncompatible // Android forbids null parent ClassLoader
|
174 | 175 | // https://github.com/google/guava/issues/2152
|
175 | 176 | public void testJarFileWithSpaces() throws Exception {
|
| 177 | + if (isWindows()) { |
| 178 | + /* |
| 179 | + * TODO: b/285742623 - Fix c.g.c.io.Files.createTempDir under Windows. Or use java.nio.files |
| 180 | + * instead? |
| 181 | + */ |
| 182 | + return; |
| 183 | + } |
176 | 184 | URL url = makeJarUrlWithName("To test unescaped spaces in jar file name.jar");
|
177 | 185 | URLClassLoader classloader = new URLClassLoader(new URL[] {url}, null);
|
178 | 186 | assertThat(ClassPath.from(classloader).getTopLevelClasses()).isNotEmpty();
|
@@ -215,6 +223,9 @@ public void testScanFromFile_notJarFile() throws IOException {
|
215 | 223 | }
|
216 | 224 |
|
217 | 225 | public void testGetClassPathEntry() throws MalformedURLException, URISyntaxException {
|
| 226 | + if (isWindows()) { |
| 227 | + return; // TODO: b/136041958 - We need to account for drive letters in the path. |
| 228 | + } |
218 | 229 | assertEquals(
|
219 | 230 | new File("/usr/test/dep.jar").toURI(),
|
220 | 231 | ClassPath.getClassPathEntry(new File("/home/build/outer.jar"), "file:/usr/test/dep.jar")
|
@@ -285,20 +296,29 @@ public void testGetClassPathFromManifest_jarInCurrentDirectory() throws IOExcept
|
285 | 296 | }
|
286 | 297 |
|
287 | 298 | public void testGetClassPathFromManifest_absoluteDirectory() throws IOException {
|
| 299 | + if (isWindows()) { |
| 300 | + return; // TODO: b/136041958 - We need to account for drive letters in the path. |
| 301 | + } |
288 | 302 | File jarFile = new File("base/some.jar");
|
289 | 303 | Manifest manifest = manifestClasspath("file:/with/absolute/dir");
|
290 | 304 | assertThat(ClassPath.getClassPathFromManifest(jarFile, manifest))
|
291 | 305 | .containsExactly(fullpath("/with/absolute/dir"));
|
292 | 306 | }
|
293 | 307 |
|
294 | 308 | public void testGetClassPathFromManifest_absoluteJar() throws IOException {
|
| 309 | + if (isWindows()) { |
| 310 | + return; // TODO: b/136041958 - We need to account for drive letters in the path. |
| 311 | + } |
295 | 312 | File jarFile = new File("base/some.jar");
|
296 | 313 | Manifest manifest = manifestClasspath("file:/with/absolute.jar");
|
297 | 314 | assertThat(ClassPath.getClassPathFromManifest(jarFile, manifest))
|
298 | 315 | .containsExactly(fullpath("/with/absolute.jar"));
|
299 | 316 | }
|
300 | 317 |
|
301 | 318 | public void testGetClassPathFromManifest_multiplePaths() throws IOException {
|
| 319 | + if (isWindows()) { |
| 320 | + return; // TODO: b/136041958 - We need to account for drive letters in the path. |
| 321 | + } |
302 | 322 | File jarFile = new File("base/some.jar");
|
303 | 323 | Manifest manifest = manifestClasspath("file:/with/absolute.jar relative.jar relative/dir");
|
304 | 324 | assertThat(ClassPath.getClassPathFromManifest(jarFile, manifest))
|
@@ -355,6 +375,9 @@ public void testGetPackageName() {
|
355 | 375 |
|
356 | 376 |
|
357 | 377 | public void testGetClassPathUrls() throws Exception {
|
| 378 | + if (isWindows()) { |
| 379 | + return; // TODO: b/136041958 - We need to account for drive letters in the path. |
| 380 | + } |
358 | 381 | String oldPathSeparator = PATH_SEPARATOR.value();
|
359 | 382 | String oldClassPath = JAVA_CLASS_PATH.value();
|
360 | 383 | System.setProperty(PATH_SEPARATOR.key(), ":");
|
@@ -572,4 +595,8 @@ private static ImmutableSet<String> scanResourceNames(ClassLoader loader) throws
|
572 | 595 | }
|
573 | 596 | return builder.build();
|
574 | 597 | }
|
| 598 | + |
| 599 | + private static boolean isWindows() { |
| 600 | + return OS_NAME.value().startsWith("Windows"); |
| 601 | + } |
575 | 602 | }
|
0 commit comments