[FIX] Double ProGuard task

This commit is contained in:
Gravita 2021-04-30 00:39:25 +07:00
parent 7724c904e5
commit 8ab1dda430

View file

@ -28,16 +28,22 @@ public class ProGuardComponent extends Component implements AutoCloseable, Recon
public boolean enabled = true; public boolean enabled = true;
public boolean mappings = true; public boolean mappings = true;
public transient ProguardConf proguardConf; public transient ProguardConf proguardConf;
private transient LaunchServer launchServer;
private transient ProGuardBuildTask buildTask;
private transient static final Logger logger = LogManager.getLogger(); private transient static final Logger logger = LogManager.getLogger();
@Override @Override
public void init(LaunchServer launchServer) { public void init(LaunchServer launchServer) {
this.launchServer = launchServer;
proguardConf = new ProguardConf(launchServer, this); proguardConf = new ProguardConf(launchServer, this);
launchServer.launcherBinary.addAfter((v) -> v.getName().startsWith(modeAfter), new ProGuardBuildTask(launchServer, proguardConf, this)); this.buildTask = new ProGuardBuildTask(launchServer, proguardConf, this);
launchServer.launcherBinary.addAfter((v) -> v.getName().startsWith(modeAfter), buildTask);
} }
@Override @Override
public void close() throws Exception { public void close() throws Exception {
if(launchServer != null && buildTask != null) {
launchServer.launcherBinary.tasks.remove(buildTask);
}
} }
@Override @Override