diff options
author | LexManos <LexManos@gmail.com> | 2021-01-17 17:35:01 -0800 |
---|---|---|
committer | LexManos <LexManos@gmail.com> | 2021-01-17 17:40:39 -0800 |
commit | 4089917696fffbd4b818fb90958d20f0714f93fb (patch) | |
tree | 1f5de4972d9afe0328d7d0ce929aac06c3bca15e /src/api/java/com | |
parent | 631cd05e726092c51e95b52bb8a8bb6a2ae2cc42 (diff) | |
download | Artifactural-4089917696fffbd4b818fb90958d20f0714f93fb.tar.gz Artifactural-4089917696fffbd4b818fb90958d20f0714f93fb.tar.bz2 Artifactural-4089917696fffbd4b818fb90958d20f0714f93fb.zip |
Move to net.minecraftforge package, and update license headers.
Diffstat (limited to 'src/api/java/com')
11 files changed, 0 insertions, 580 deletions
diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/Artifact.java b/src/api/java/com/amadornes/artifactural/api/artifact/Artifact.java deleted file mode 100644 index 1da3c90..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/Artifact.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -import com.amadornes.artifactural.api.cache.ArtifactCache; -import com.amadornes.artifactural.api.transform.ArtifactTransformer; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -public interface Artifact { - - static Artifact none() { - return Internal.NO_ARTIFACT; - } - - ArtifactIdentifier getIdentifier(); - - ArtifactMetadata getMetadata(); - - ArtifactType getType(); - - Artifact withMetadata(ArtifactMetadata metadata); - - Artifact apply(ArtifactTransformer transformer); - - Artifact.Cached cache(ArtifactCache cache); - - default Artifact.Cached optionallyCache(ArtifactCache cache) { - return this instanceof Artifact.Cached ? (Artifact.Cached) this : cache(cache); - } - - boolean isPresent(); - - InputStream openStream() throws IOException, MissingArtifactException; - - interface Cached extends Artifact { - - // Gets the file location, AND writes the file to disc if it hasn't already. - File asFile() throws IOException, MissingArtifactException; - - // Gets the file location, but doesn't guarantee that it exists. As the wrapped Artifact may not of been written. What's the point of this? - File getFileLocation() throws IOException, MissingArtifactException; - - } - -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactIdentifier.java b/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactIdentifier.java deleted file mode 100644 index e663c11..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactIdentifier.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -import java.util.function.Predicate; - -public interface ArtifactIdentifier { - - static ArtifactIdentifier none() { - return Internal.NO_IDENTIFIER; - } - - String getGroup(); - - String getName(); - - String getVersion(); - - String getClassifier(); - - String getExtension(); - - static Predicate<ArtifactIdentifier> groupMatches(String group) { - return identifier -> identifier.getGroup().matches(group); - } - - static Predicate<ArtifactIdentifier> nameMatches(String name) { - return identifier -> identifier.getName().matches(name); - } - - static Predicate<ArtifactIdentifier> versionMatches(String version) { - return identifier -> identifier.getVersion().matches(version); - } - - static Predicate<ArtifactIdentifier> classifierMatches(String classifier) { - return identifier -> identifier.getClassifier().matches(classifier); - } - - static Predicate<ArtifactIdentifier> extensionMatches(String extension) { - return identifier -> identifier.getExtension().matches(extension); - } - - static Predicate<ArtifactIdentifier> groupEquals(String group) { - return identifier -> identifier.getGroup().equals(group); - } - - static Predicate<ArtifactIdentifier> nameEquals(String name) { - return identifier -> identifier.getName().equals(name); - } - - static Predicate<ArtifactIdentifier> versionEquals(String version) { - return identifier -> identifier.getVersion().equals(version); - } - - static Predicate<ArtifactIdentifier> classifierEquals(String classifier) { - return identifier -> identifier.getClassifier().equals(classifier); - } - - static Predicate<ArtifactIdentifier> extensionEquals(String extension) { - return identifier -> identifier.getExtension().equals(extension); - } - -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactMetadata.java b/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactMetadata.java deleted file mode 100644 index af5e08a..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactMetadata.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -public interface ArtifactMetadata { - - ArtifactMetadata with(String key, String value); - - String getHash(); - -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactType.java b/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactType.java deleted file mode 100644 index 40e5aa6..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/ArtifactType.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -public enum ArtifactType { - BINARY, SOURCE, OTHER -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/Internal.java b/src/api/java/com/amadornes/artifactural/api/artifact/Internal.java deleted file mode 100644 index 39bc983..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/Internal.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -import com.amadornes.artifactural.api.cache.ArtifactCache; -import com.amadornes.artifactural.api.transform.ArtifactTransformer; - -import java.io.File; -import java.io.InputStream; - -final class Internal { - - static final ArtifactIdentifier NO_IDENTIFIER = new ArtifactIdentifier() { - - @Override - public String getGroup() { - return "missing"; - } - - @Override - public String getName() { - return "missing"; - } - - @Override - public String getVersion() { - return "0.0.0"; - } - - @Override - public String getClassifier() { - return ""; - } - - @Override - public String getExtension() { - return "missing"; - } - - @Override - public String toString() { - return "NO_IDENTIFIER"; - } - - }; - - static final Artifact NO_ARTIFACT = new Artifact.Cached() { - @Override - public String toString() { - return "NO_ARTIFACT"; - } - - @Override - public ArtifactIdentifier getIdentifier() { - return ArtifactIdentifier.none(); - } - - @Override - public ArtifactMetadata getMetadata() { - return new ArtifactMetadata() { - @Override - public ArtifactMetadata with(String key, String value) { - throw new UnsupportedOperationException(); - } - - @Override - public String getHash() { - return "ERROR"; - } - - @Override - public String toString() { - return "NO_METADATA"; - } - }; - } - - @Override - public ArtifactType getType() { - return ArtifactType.OTHER; - } - - @Override - public Artifact withMetadata(ArtifactMetadata metadata) { - return this; - } - - @Override - public Artifact apply(ArtifactTransformer transformer) { - return this; - } - - @Override - public Artifact.Cached cache(ArtifactCache cache) { - return this; - } - - @Override - public boolean isPresent() { - return false; - } - - @Override - public InputStream openStream() throws MissingArtifactException { - throw new MissingArtifactException(getIdentifier()); - } - - @Override - public File asFile() throws MissingArtifactException { - throw new MissingArtifactException(getIdentifier()); - } - - @Override - public File getFileLocation() throws MissingArtifactException { - throw new MissingArtifactException(getIdentifier()); - } - - }; - -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/MissingArtifactException.java b/src/api/java/com/amadornes/artifactural/api/artifact/MissingArtifactException.java deleted file mode 100644 index 3caa7ec..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/MissingArtifactException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -public class MissingArtifactException extends RuntimeException { - private static final long serialVersionUID = 4902516963452435653L; - - public MissingArtifactException(ArtifactIdentifier identifier) { - super("Could not find artifact: " + identifier); - } - -} diff --git a/src/api/java/com/amadornes/artifactural/api/artifact/Streamable.java b/src/api/java/com/amadornes/artifactural/api/artifact/Streamable.java deleted file mode 100644 index b8fcdf6..0000000 --- a/src/api/java/com/amadornes/artifactural/api/artifact/Streamable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.artifact; - -import java.io.IOException; -import java.io.InputStream; - -@FunctionalInterface -public interface Streamable { - - InputStream openStream() throws IOException; - -} diff --git a/src/api/java/com/amadornes/artifactural/api/cache/ArtifactCache.java b/src/api/java/com/amadornes/artifactural/api/cache/ArtifactCache.java deleted file mode 100644 index 00e2197..0000000 --- a/src/api/java/com/amadornes/artifactural/api/cache/ArtifactCache.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.cache; - -import com.amadornes.artifactural.api.artifact.Artifact; - -public interface ArtifactCache { - - Artifact.Cached store(Artifact artifact); - -} diff --git a/src/api/java/com/amadornes/artifactural/api/repository/ArtifactProvider.java b/src/api/java/com/amadornes/artifactural/api/repository/ArtifactProvider.java deleted file mode 100644 index d48856f..0000000 --- a/src/api/java/com/amadornes/artifactural/api/repository/ArtifactProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.repository; - -import com.amadornes.artifactural.api.artifact.Artifact; - -import java.util.function.Function; -import java.util.function.Predicate; - -public interface ArtifactProvider<I> { - - Artifact getArtifact(I info); - - interface Builder<S, I> { - - Builder<S, I> filter(Predicate<I> filter); - - <D> Builder<S, D> mapInfo(Function<I, D> mapper); - - Complete<S, I> provide(ArtifactProvider<I> provider); - - interface Complete<S, I> extends ArtifactProvider<S> { - - Complete<S, I> provide(ArtifactProvider<I> provider); - - } - - } - -} diff --git a/src/api/java/com/amadornes/artifactural/api/repository/Repository.java b/src/api/java/com/amadornes/artifactural/api/repository/Repository.java deleted file mode 100644 index 2e1de79..0000000 --- a/src/api/java/com/amadornes/artifactural/api/repository/Repository.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.repository; - -import java.io.File; - -import com.amadornes.artifactural.api.artifact.Artifact; -import com.amadornes.artifactural.api.artifact.ArtifactIdentifier; - -public interface Repository { - - Artifact getArtifact(ArtifactIdentifier identifier); - - /** - * Returns a file in maven-metadata.xml format for the specified artifact, - * this is used by gradle to list all known versions, so that it can resolve wildcard - * dependencies such as foo:bar:1.+ - * - * @param group Group - * @param name Artifact name - * @return maven-metadata.xml file listing all versions of the artifact this repo can provide. Or null if you don't want to list any. - */ - default File getMavenMetadata(String group, String name) { - return null; - } - -} diff --git a/src/api/java/com/amadornes/artifactural/api/transform/ArtifactTransformer.java b/src/api/java/com/amadornes/artifactural/api/transform/ArtifactTransformer.java deleted file mode 100644 index b129d5b..0000000 --- a/src/api/java/com/amadornes/artifactural/api/transform/ArtifactTransformer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package com.amadornes.artifactural.api.transform; - -import com.amadornes.artifactural.api.artifact.Artifact; -import com.amadornes.artifactural.api.artifact.ArtifactMetadata; - -import java.util.function.UnaryOperator; - -public interface ArtifactTransformer { - - static ArtifactTransformer of(UnaryOperator<Artifact> operator) { - return new ArtifactTransformer() { - @Override - public Artifact transform(Artifact artifact) { - return operator.apply(artifact); - } - - @Override - public ArtifactMetadata withInfo(ArtifactMetadata metadata) { - return metadata; - } - }; - } - - default boolean appliesTo(Artifact artifact) { - return true; - } - - Artifact transform(Artifact artifact); - - ArtifactMetadata withInfo(ArtifactMetadata metadata); - - default ArtifactTransformer andThen(ArtifactTransformer other) { - ArtifactTransformer current = this; - return new ArtifactTransformer() { - - @Override - public Artifact transform(Artifact artifact) { - return other.transform(current.transform(artifact)); - } - - @Override - public ArtifactMetadata withInfo(ArtifactMetadata metadata) { - return other.withInfo(current.withInfo(metadata)); - } - - }; - } - -} |