project: Make it possible to skip injectors
This commit is contained in:
@@ -47,8 +47,9 @@ public class Injection extends InjectData implements InjectTaskHandler
|
||||
{
|
||||
private static final Logger log = Logging.getLogger(Injection.class);
|
||||
public static boolean development = true;
|
||||
public static String skips = "";
|
||||
|
||||
public Injection(File vanilla, File rsclient, File mixins, FileTree rsapi, boolean development)
|
||||
public Injection(File vanilla, File rsclient, File mixins, FileTree rsapi, boolean development, String skip)
|
||||
{
|
||||
super(
|
||||
load(vanilla),
|
||||
@@ -58,6 +59,7 @@ public class Injection extends InjectData implements InjectTaskHandler
|
||||
);
|
||||
|
||||
Injection.development = development;
|
||||
Injection.skips = skip;
|
||||
}
|
||||
|
||||
public void inject()
|
||||
@@ -142,15 +144,18 @@ public class Injection extends InjectData implements InjectTaskHandler
|
||||
{
|
||||
final String name = injector.getName();
|
||||
|
||||
injector.start();
|
||||
|
||||
injector.inject();
|
||||
|
||||
String completionMsg = injector.getCompletionMsg();
|
||||
|
||||
if (completionMsg != null)
|
||||
if (injector.shouldRun())
|
||||
{
|
||||
log.lifecycle("{} {}", name, completionMsg);
|
||||
injector.start();
|
||||
|
||||
injector.inject();
|
||||
|
||||
String completionMsg = injector.getCompletionMsg();
|
||||
|
||||
if (completionMsg != null)
|
||||
{
|
||||
log.lifecycle("{} {}", name, completionMsg);
|
||||
}
|
||||
}
|
||||
|
||||
if (injector instanceof Validator)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.openosrs.injector.injectors;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.openosrs.injector.Injection;
|
||||
import com.openosrs.injector.injection.InjectData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.gradle.api.logging.Logger;
|
||||
@@ -29,4 +30,9 @@ public abstract class AbstractInjector implements Injector
|
||||
{
|
||||
return "finished in " + stopwatch.toString();
|
||||
}
|
||||
|
||||
public boolean shouldRun()
|
||||
{
|
||||
return !Injection.skips.contains(this.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,9 @@ public interface Injector extends Named
|
||||
* Gets a message logged at quiet level when the injector ends
|
||||
*/
|
||||
String getCompletionMsg();
|
||||
|
||||
/**
|
||||
* Checks if this injector is in the skip list
|
||||
*/
|
||||
boolean shouldRun();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,14 @@ abstract class Inject : DefaultTask() {
|
||||
val mixins = extension.mixins.get().asFile
|
||||
val rsapi = project.zipTree(extension.rsapi)
|
||||
|
||||
val injector: InjectTaskHandler = Injection(vanilla, rsclient, mixins, rsapi, if (extension.development.isPresent) extension.development.get() else true)
|
||||
val injector: InjectTaskHandler = Injection(
|
||||
vanilla,
|
||||
rsclient,
|
||||
mixins,
|
||||
rsapi,
|
||||
if (extension.development.isPresent) extension.development.get() else true,
|
||||
if (extension.skip.isPresent) extension.skip.get() else ""
|
||||
)
|
||||
|
||||
injector.inject()
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ interface InjectExtension {
|
||||
@get:Optional
|
||||
val development: Property<Boolean>
|
||||
|
||||
@get:Input
|
||||
@get:Optional
|
||||
val skip: Property<String>
|
||||
|
||||
@get:[InputFile PathSensitive(PathSensitivity.NONE)]
|
||||
val vanilla: RegularFileProperty
|
||||
|
||||
|
||||
Reference in New Issue
Block a user