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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user