Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Mar 25, 2024
1 parent f26c7ba commit a08d474
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import eu.maveniverse.maven.toolbox.shared.internal.ArtifactMapper;
import eu.maveniverse.maven.toolbox.shared.internal.ArtifactMatcher;
import eu.maveniverse.maven.toolbox.shared.internal.ArtifactNameMapper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -51,7 +50,7 @@ public static DirectorySink repository(Output output, Path path) throws IOExcept
ArtifactMatcher.and(ArtifactMatcher.not(ArtifactMatcher.snapshot()), ArtifactMatcher.unique()),
true,
a -> a,
ArtifactNameMapper.repositoryDefault(File.separator),
ArtifactNameMapper.repositoryDefault(),
false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ public boolean test(Artifact artifact) {
};
}

/**
* Examples:
* <ul>
* <li>any</li>
* <li>or(artifact("g:*"),artifact("*:a"))</li>
* </ul>
*/
static ArtifactMatcher parse(String spec) {
// TODO: do it
throw new RuntimeException("not yet implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import static java.util.Objects.requireNonNull;

import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.function.Function;
Expand Down Expand Up @@ -79,7 +80,11 @@ static ArtifactNameMapper optionalSuffix(String suffix, ArtifactNameMapper artif
};
}

static ArtifactNameMapper repositoryDefault(String fs) {
static ArtifactNameMapper repositoryDefault() {
return repository(File.separator);
}

static ArtifactNameMapper repository(String fs) {
return artifact -> {
StringBuilder path = new StringBuilder(128);
path.append(artifact.getGroupId().replace(".", fs)).append(fs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,16 @@ public ArtifactSink artifactSink(Output output, String spec) throws IOException
return DirectorySink.repository(
output, context.basedir().resolve(spec.substring("repository:".length())));
case "install":
return InstallingSink.installing(
output,
context.repositorySystem(),
context.repositorySystemSession());
return InstallingSink.installing(output, context.repositorySystem(), context.repositorySystemSession());
case "deploy":
return DeployingSink.deploying(
output,
context.repositorySystem(),
context.repositorySystemSession(),
toolboxResolver.parseRemoteRepository(spec.substring("deploy:".length())));
case "purge":
return PurgingSink.purging(output,
return PurgingSink.purging(
output,
context.repositorySystem(),
context.repositorySystemSession(),
context.remoteRepositories());
Expand Down

0 comments on commit a08d474

Please sign in to comment.