mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-26 08:37:11 -07:00
More Windows tweaks
This commit is contained in:
parent
35887e7d06
commit
7face792f2
2 changed files with 19 additions and 1 deletions
|
@ -161,7 +161,9 @@ public record Repository(String location, String username, String password) {
|
||||||
var separator = "/";
|
var separator = "/";
|
||||||
var result = new StringBuilder();
|
var result = new StringBuilder();
|
||||||
if (isLocal()) {
|
if (isLocal()) {
|
||||||
separator = File.separator;
|
if (isWindowsLocation()) {
|
||||||
|
separator = File.separator;
|
||||||
|
}
|
||||||
if (location().startsWith("file://")) {
|
if (location().startsWith("file://")) {
|
||||||
result.append(location().substring("file://".length()));
|
result.append(location().substring("file://".length()));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
package rife.bld.dependencies;
|
package rife.bld.dependencies;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.condition.EnabledOnOs;
|
||||||
|
import org.junit.jupiter.api.condition.OS;
|
||||||
import rife.ioc.HierarchicalProperties;
|
import rife.ioc.HierarchicalProperties;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -78,11 +80,25 @@ public class TestRepository {
|
||||||
assertEquals("/local/repo/groupId3/artifactId3/", repository3.getArtifactLocation("groupId3", "artifactId3"));
|
assertEquals("/local/repo/groupId3/artifactId3/", repository3.getArtifactLocation("groupId3", "artifactId3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnabledOnOs(OS.WINDOWS)
|
||||||
|
void testArtifactLocationWindows() {
|
||||||
|
var repository1 = new Repository("c:\\local\\repo");
|
||||||
|
assertNotNull(repository1);
|
||||||
|
assertEquals("c:\\local\\repo\\groupId1\\artifactId1\\", repository1.getArtifactLocation("groupId1", "artifactId1"));
|
||||||
|
|
||||||
|
var repository2 = new Repository("E:\\local\\repo");
|
||||||
|
assertNotNull(repository2);
|
||||||
|
assertEquals("E:\\local\\repo\\groupId2\\artifactId2\\", repository2.getArtifactLocation("groupId2", "artifactId2"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIsLocal() {
|
void testIsLocal() {
|
||||||
assertFalse(new Repository("http://my.repo").isLocal());
|
assertFalse(new Repository("http://my.repo").isLocal());
|
||||||
assertTrue(new Repository("file:///local/repo").isLocal());
|
assertTrue(new Repository("file:///local/repo").isLocal());
|
||||||
assertTrue(new Repository("//local/repo").isLocal());
|
assertTrue(new Repository("//local/repo").isLocal());
|
||||||
|
assertTrue(new Repository("c:\\local\\repo").isLocal());
|
||||||
|
assertTrue(new Repository("E:\\local\\repo").isLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue