Skip to content

Commit

Permalink
use maven central by default, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Dec 16, 2024
1 parent 895aaed commit f9f4dd7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build.gradle:
```groovy
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'io.github.revxrsal.zapper' version '0.0.1'
id 'io.github.revxrsal.zapper' version '1.0.0'
}
```

Expand All @@ -42,7 +42,7 @@ build.gradle.kts:
```groovy
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.github.revxrsal.zapper") version "0.0.1"
id("io.github.revxrsal.zapper") version "1.0.0"
}
```

Expand Down Expand Up @@ -118,7 +118,7 @@ To add the Zapper API:
<dependency>
<groupId>io.github.revxrsal</groupId>
<artifactId>zapper.api</artifactId>
<version>0.0.1</version>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/revxrsal/zapper/DependencyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import java.io.File;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;

public final class DependencyManager implements DependencyScope {
Expand All @@ -45,19 +47,17 @@ public final class DependencyManager implements DependencyScope {
private final URLClassLoaderWrapper loaderWrapper;

private final List<Dependency> dependencies = new ArrayList<>();
private final List<Repository> repositories = new ArrayList<>();
private final Set<Repository> repositories = new LinkedHashSet<>();
private final List<Relocation> relocations = new ArrayList<>();

public DependencyManager(@NotNull File directory, @NotNull URLClassLoaderWrapper loaderWrapper) {
this.directory = directory;
this.loaderWrapper = loaderWrapper;
this.repositories.add(Repository.mavenCentral());
}

public void load() {
try {
if (repositories.isEmpty()) {
throw new IllegalArgumentException("No repositories were specified.");
}
for (Dependency dep : dependencies) {
File file = new File(directory, String.format("%s.%s-%s.jar", dep.getGroupId(), dep.getArtifactId(), dep.getVersion()));
File relocated = new File(directory, String.format("%s.%s-%s-relocated.jar", dep.getGroupId(),
Expand Down
13 changes: 13 additions & 0 deletions api/src/main/java/revxrsal/zapper/repository/MavenRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import revxrsal.zapper.Dependency;

import java.net.URL;
import java.util.Objects;

/**
* Represents a Maven repository with a URL
Expand Down Expand Up @@ -78,4 +79,16 @@ public String toString() {
public @NotNull URL resolve(@NotNull Dependency dependency) throws Exception {
return new URL(repoURL + dependency.getMavenPath());
}

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
MavenRepository that = (MavenRepository) o;
return Objects.equals(repoURL, that.repoURL);
}

@Override
public int hashCode() {
return Objects.hashCode(repoURL);
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

group = "io.github.revxrsal"
version = "0.0.2"
version = "1.0.0"

subprojects {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.io.File
/**
* The plugin version
*/
private const val PLUGIN_VERSION: String = "0.0.2"
private const val PLUGIN_VERSION: String = "1.0.0"

/**
* The Zapper Gradle plugin collects information about the zapped dependencies
Expand Down

0 comments on commit f9f4dd7

Please sign in to comment.