mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-11 18:26:08 +00:00
manifest addon config stuff
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
package com.dfsek.terra.addons.manifest;
|
||||
|
||||
public class ManifestLoaderEntry {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.dfsek.terra.addons.manifest.api;
|
||||
|
||||
|
||||
public interface AddonInitializer {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.dfsek.terra.addons.manifest.impl;
|
||||
|
||||
import com.dfsek.terra.addons.manifest.impl.config.AddonManifest;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
|
||||
|
||||
public class ManifestAddon implements BaseAddon {
|
||||
private final AddonManifest manifest;
|
||||
|
||||
public ManifestAddon(AddonManifest manifest) {
|
||||
this.manifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return manifest.getID();
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.dfsek.terra.addons.manifest.impl;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.addon.bootstrap.BootstrapBaseAddon;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
|
||||
|
||||
public class ManifestAddonLoader implements BootstrapBaseAddon {
|
||||
@Override
|
||||
public Iterable<BaseAddon> loadAddons(Path addonsFolder, ClassLoader parent) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "MANIFEST";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.dfsek.terra.addons.manifest.impl.config;
|
||||
|
||||
import ca.solostudios.strata.version.Version;
|
||||
import com.dfsek.tectonic.annotations.Default;
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.tectonic.config.ConfigTemplate;
|
||||
|
||||
import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
public class AddonManifest implements ConfigTemplate, StringIdentifiable {
|
||||
@Value("schema-version")
|
||||
private int schemaVersion;
|
||||
|
||||
@Value("id")
|
||||
private String id;
|
||||
|
||||
@Value("version")
|
||||
private Version version;
|
||||
|
||||
@Value("license")
|
||||
private String license;
|
||||
|
||||
@Value("contributors")
|
||||
private List<String> contributors;
|
||||
|
||||
@Value("entrypoints")
|
||||
private List<String> entryPoints;
|
||||
|
||||
@Value("depends")
|
||||
@Default
|
||||
private List<DependencyConfig> dependencies = Collections.emptyList();
|
||||
|
||||
@Value("website")
|
||||
private WebsiteConfig website;
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getSchemaVersion() {
|
||||
return schemaVersion;
|
||||
}
|
||||
|
||||
public Version getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public List<String> getContributors() {
|
||||
return contributors;
|
||||
}
|
||||
|
||||
public List<String> getEntryPoints() {
|
||||
return entryPoints;
|
||||
}
|
||||
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
public WebsiteConfig getWebsite() {
|
||||
return website;
|
||||
}
|
||||
|
||||
public List<DependencyConfig> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.dfsek.terra.addons.manifest.impl.config;
|
||||
|
||||
public class DependencyConfig {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.dfsek.terra.addons.manifest.impl.config;
|
||||
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.tectonic.loading.object.ObjectTemplate;
|
||||
|
||||
|
||||
public class WebsiteConfig implements ObjectTemplate<WebsiteConfig> {
|
||||
@Value("issues")
|
||||
private String issues;
|
||||
|
||||
@Value("source")
|
||||
private String source;
|
||||
|
||||
@Value("docs")
|
||||
private String docs;
|
||||
|
||||
public String getDocs() {
|
||||
return docs;
|
||||
}
|
||||
|
||||
public String getIssues() {
|
||||
return issues;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebsiteConfig get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
Bootstrap-Addon-Entry-Point: com.dfsek.terra.addons.manifest.ManifestLoaderEntry
|
||||
Bootstrap-Addon-Entry-Point: com.dfsek.terra.addons.manifest.impl.ManifestAddonLoader
|
||||
|
||||
Reference in New Issue
Block a user