Skip to content

Commit

Permalink
Merge pull request #3915 from maxonfjvipon/bug/#3507/dont-cache-on-sn…
Browse files Browse the repository at this point in the history
…apshot

bug(#3507): don't cache on snapshot
  • Loading branch information
yegor256 authored Feb 13, 2025
2 parents 2c24de0 + e3e92df commit 621d246
Show file tree
Hide file tree
Showing 65 changed files with 291 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.tojos;
package org.eolang.maven;

/**
* If the attributes were not found in the Tojo.
* @since 0.35.0
*/
public class AttributeNotFoundException extends RuntimeException {
final class AttributeNotFoundException extends RuntimeException {

/**
* Ctor.
* @param attribute The attribute of Tojo.
*/
AttributeNotFoundException(final ForeignTojos.Attribute attribute) {
AttributeNotFoundException(final TjsForeign.Attribute attribute) {
super(
String.format(
"There is no '%s' attribute in the tojo", attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import org.cactoos.scalar.Sticky;
import org.cactoos.scalar.Unchecked;
Expand All @@ -31,7 +31,7 @@
*
* @since 0.28.11
*/
public final class ChCached implements CommitHash {
final class ChCached implements CommitHash {

/**
* Cache.
Expand All @@ -43,7 +43,7 @@ public final class ChCached implements CommitHash {
*
* @param delegate Delegate
*/
public ChCached(final CommitHash delegate) {
ChCached(final CommitHash delegate) {
this.delegate = new Unchecked<>(new Sticky<>(delegate::value));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

/**
* Short version of hash.
*
* @since 0.28.11
*/
public final class ChNarrow implements CommitHash {
final class ChNarrow implements CommitHash {

/**
* Delegate.
Expand All @@ -40,7 +40,7 @@ public final class ChNarrow implements CommitHash {
*
* @param full Delegate
*/
public ChNarrow(final CommitHash full) {
ChNarrow(final CommitHash full) {
this.full = full;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import java.util.Comparator;
import java.util.LinkedList;
Expand All @@ -41,7 +41,7 @@
*
* @since 0.28.11
*/
public final class ChPattern implements CommitHash {
final class ChPattern implements CommitHash {

/**
* Pattern like *.*.* or 'master'.
Expand All @@ -59,7 +59,7 @@ public final class ChPattern implements CommitHash {
* @param pattern Pattern like *.*.* or 'master'.
* @param tag Particular tag to match.
*/
public ChPattern(
ChPattern(
final String pattern,
final String tag
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import com.jcabi.log.Logger;
import org.cactoos.Text;
Expand All @@ -31,7 +31,7 @@
*
* @since 0.26
*/
public final class ChRemote implements CommitHash {
final class ChRemote implements CommitHash {

/**
* Cached text of hashes.
Expand All @@ -48,7 +48,7 @@ public final class ChRemote implements CommitHash {
*
* @param tag Tag
*/
public ChRemote(final String tag) {
ChRemote(final String tag) {
this.tag = tag;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import java.nio.file.Path;
import org.cactoos.Scalar;
Expand All @@ -40,7 +40,7 @@
*
* @since 0.28.11
*/
public final class ChText implements CommitHash {
final class ChText implements CommitHash {

/**
* Commit Hash text source.
Expand All @@ -58,7 +58,7 @@ public final class ChText implements CommitHash {
* @param file Path to offline file with hashes and tags.
* @param tag Lookup tag.
*/
public ChText(final Path file, final String tag) {
ChText(final Path file, final String tag) {
this(() -> new TextOf(new InputOf(file)).asString(), tag);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import org.cactoos.Scalar;

Expand All @@ -31,7 +31,11 @@
* @since 0.28.11
*/
@FunctionalInterface
public interface CommitHash extends Scalar<String> {
interface CommitHash extends Scalar<String> {
/**
* Fake commit hash for testing.
*/
CommitHash FAKE = new CommitHash.ChConstant("abcdef");

/**
* SHA Hash.
Expand All @@ -57,7 +61,7 @@ final class ChConstant implements CommitHash {
*
* @param hash Hardcoded value.
*/
public ChConstant(final String hash) {
ChConstant(final String hash) {
this.hash = hash;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import java.util.Map;
import java.util.regex.Pattern;
Expand All @@ -39,7 +39,7 @@
*
* @since 0.29.6
*/
public final class CommitHashesMap extends MapEnvelope<String, CommitHash> {
final class CommitHashesMap extends MapEnvelope<String, CommitHash> {

/**
* Fake hashes.
Expand Down Expand Up @@ -74,7 +74,7 @@ public final class CommitHashesMap extends MapEnvelope<String, CommitHash> {
/**
* Constructor.
*/
public CommitHashesMap() {
CommitHashesMap() {
this(new CommitHashesText()::asString);
}

Expand Down Expand Up @@ -125,11 +125,11 @@ private static Map<String, CommitHash> fromTable(final Scalar<String> table) {
*
* @since 0.29.6
*/
public static final class Fake extends MapEnvelope<String, CommitHash> {
static final class Fake extends MapEnvelope<String, CommitHash> {
/**
* Ctor.
*/
public Fake() {
Fake() {
super(new CommitHashesMap(CommitHashesMap.FAKES));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.hash;
package org.eolang.maven;

import com.jcabi.aspects.RetryOnFailure;
import com.jcabi.log.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.dependencies;
package org.eolang.maven;

import com.github.lombrozo.xnav.Filter;
import com.github.lombrozo.xnav.Xnav;
Expand All @@ -34,22 +34,18 @@
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.maven.model.Dependency;
import org.eolang.maven.Coordinates;
import org.eolang.maven.ParseMojo;
import org.eolang.maven.tojos.ForeignTojo;
import org.eolang.maven.tojos.ForeignTojos;

/**
* It is a list of dependencies that are needed by the build.
*
* @since 0.29.0
*/
public final class DcsDefault implements Iterable<Dependency> {
final class DcsDefault implements Iterable<Dependency> {

/**
* List of tojos.
*/
private final ForeignTojos tojos;
private final TjsForeign tojos;

/**
* Discover self too.
Expand All @@ -67,8 +63,8 @@ public final class DcsDefault implements Iterable<Dependency> {
* @param self Self
* @param skip Skip
*/
public DcsDefault(
final ForeignTojos tjs,
DcsDefault(
final TjsForeign tjs,
final boolean self,
final boolean skip
) {
Expand All @@ -79,13 +75,13 @@ public DcsDefault(

@Override
public Iterator<Dependency> iterator() {
final Collection<ForeignTojo> list = this.tojos.dependencies();
final Collection<TjForeign> list = this.tojos.dependencies();
Logger.debug(
this, "%d suitable tojo(s) found out of %d",
list.size(), this.tojos.size()
);
final Collection<Dependency> deps = new HashSet<>(0);
for (final ForeignTojo tojo : list) {
for (final TjForeign tojo : list) {
if (ParseMojo.ZERO.equals(tojo.version())
&& !this.discover) {
Logger.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.dependencies;
package org.eolang.maven;

import com.jcabi.log.Logger;
import java.io.IOException;
Expand Down Expand Up @@ -53,7 +53,7 @@
* @since 0.28.11
* @checkstyle NoJavadocForOverriddenMethodsCheck (200 lines)
*/
public final class DcsDepgraph implements Iterable<Dependency> {
final class DcsDepgraph implements Iterable<Dependency> {

/**
* Maven project.
Expand Down Expand Up @@ -90,7 +90,7 @@ public final class DcsDepgraph implements Iterable<Dependency> {
* @param dep Dependency
* @checkstyle ParameterNumberCheck (10 lines)
*/
public DcsDepgraph(
DcsDepgraph(
final MavenProject pkt,
final MavenSession ssn,
final BuildPluginManager mgr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.dependencies;
package org.eolang.maven;

import java.util.Iterator;
import java.util.Objects;
import org.apache.maven.model.Dependency;
import org.cactoos.Func;
import org.cactoos.iterable.Filtered;
import org.cactoos.iterable.Mapped;
import org.eolang.maven.Coordinates;
import org.eolang.maven.ResolveMojo;

/**
* Dependencies without transitive dependencies.
*
* @since 0.29.0
*/
public final class DcsEachWithoutTransitive implements Iterable<Dependency> {
final class DcsEachWithoutTransitive implements Iterable<Dependency> {

/**
* Original dependencies.
Expand All @@ -54,7 +52,7 @@ public final class DcsEachWithoutTransitive implements Iterable<Dependency> {
* @param dependencies Dependencies
* @param strategy Strategy
*/
public DcsEachWithoutTransitive(
DcsEachWithoutTransitive(
final Iterable<Dependency> dependencies,
final Func<? super Dependency, ? extends Iterable<Dependency>> strategy
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.maven.dependencies;
package org.eolang.maven;

import java.security.SecureRandom;
import java.util.Arrays;
Expand All @@ -38,7 +38,7 @@
*
* @since 0.30
*/
public final class DcsFake implements Iterable<Dependency> {
final class DcsFake implements Iterable<Dependency> {

/**
* Dependencies.
Expand Down
Loading

0 comments on commit 621d246

Please sign in to comment.