Skip to content

Commit

Permalink
Merge pull request #150 from ascopes/task/move-MavenArtifact-class
Browse files Browse the repository at this point in the history
Move MavenArtifact class to base package since it is part of the public API
  • Loading branch information
ascopes authored Apr 5, 2024
2 parents 92a334b + a4a46cd commit 8b690bc
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static java.util.Objects.requireNonNullElseGet;

import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionDepth;
import io.github.ascopes.protobufmavenplugin.dependency.MavenArtifact;
import io.github.ascopes.protobufmavenplugin.dependency.ResolutionException;
import io.github.ascopes.protobufmavenplugin.generate.ImmutableGenerationRequest;
import io.github.ascopes.protobufmavenplugin.generate.SourceCodeGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import io.github.ascopes.protobufmavenplugin.generate.SourceRootRegistrar;
import java.nio.file.Path;
import java.util.Set;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
* limitations under the License.
*/

package io.github.ascopes.protobufmavenplugin.dependency;
package io.github.ascopes.protobufmavenplugin;

import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.plugins.annotations.Parameter;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
Expand All @@ -34,8 +33,6 @@
*/
public final class MavenArtifact {

private static final Logger log = LoggerFactory.getLogger(MavenArtifact.class);

private @Nullable String groupId;
private @Nullable String artifactId;
private @Nullable String version;
Expand Down Expand Up @@ -78,20 +75,11 @@ public Optional<String> getType() {
return Optional.ofNullable(type);
}

@Parameter(alias = "extension")
public void setType(@Nullable String type) {
this.type = type;
}

// Alias to enable compatibility with Dependency objects. This avoids a breaking
// change in v1.x.
// This should be totally removed in v2.0 to avoid ambiguity.
@Deprecated(forRemoval = true, since = "1.2.0")
public void setExtension(@Nullable String extension) {
log.warn("MavenArtifact.extension is deprecated for removal in v2.0.0. "
+ "Please use MavenArtifact.type instead for future compatibility.");
type = extension;
}

@Override
public boolean equals(@Nullable Object other) {
if (!(other instanceof MavenArtifact)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import io.github.ascopes.protobufmavenplugin.generate.SourceRootRegistrar;
import java.nio.file.Path;
import java.util.Set;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.github.ascopes.protobufmavenplugin.dependency;

import io.github.ascopes.protobufmavenplugin.MavenArtifact;
import io.github.ascopes.protobufmavenplugin.platform.Digests;
import io.github.ascopes.protobufmavenplugin.platform.FileUtils;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.github.ascopes.protobufmavenplugin.dependency;

import io.github.ascopes.protobufmavenplugin.MavenArtifact;
import io.github.ascopes.protobufmavenplugin.generate.TemporarySpace;
import io.github.ascopes.protobufmavenplugin.platform.Digests;
import io.github.ascopes.protobufmavenplugin.platform.FileUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.github.ascopes.protobufmavenplugin.dependency;

import io.github.ascopes.protobufmavenplugin.MavenArtifact;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static java.util.Objects.requireNonNullElse;
import static java.util.Objects.requireNonNullElseGet;

import io.github.ascopes.protobufmavenplugin.MavenArtifact;
import io.github.ascopes.protobufmavenplugin.platform.HostSystem;
import javax.inject.Inject;
import javax.inject.Named;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package io.github.ascopes.protobufmavenplugin.generate;

import io.github.ascopes.protobufmavenplugin.MavenArtifact;
import io.github.ascopes.protobufmavenplugin.dependency.DependencyResolutionDepth;
import io.github.ascopes.protobufmavenplugin.dependency.MavenArtifact;
import java.net.URL;
import java.nio.file.Path;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static java.util.function.Predicate.not;

import io.github.ascopes.protobufmavenplugin.platform.FileUtils;
import io.github.ascopes.protobufmavenplugin.platform.HostSystem;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down

0 comments on commit 8b690bc

Please sign in to comment.