Commit 1bdb5a59 authored by Jussi Koskela's avatar Jussi Koskela
Browse files

Moved SCL compiler warming up to SimanticsPlatform startup

gitlab #856
parent be2bb726
package org.simantics.scl.osgi.internal;
import java.util.Hashtable;
import java.util.concurrent.ForkJoinPool;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.simantics.scl.compiler.errors.Failable;
import org.simantics.scl.compiler.module.Module;
import org.simantics.scl.compiler.module.repository.ModuleRepository;
import org.simantics.scl.compiler.module.repository.UpdateListener;
import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;
import org.simantics.scl.compiler.source.repository.ProceduralModuleSourceRepository;
import org.simantics.scl.compiler.source.repository.SourceRepositories;
import org.simantics.scl.osgi.SCLOsgi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Activator implements BundleActivator {
private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class);
public static final String PLUGIN_ID = "org.simantics.scl.osgi";
private static BundleContext context;
......@@ -44,13 +37,6 @@ public class Activator implements BundleActivator {
}
},
properties);
// Let's try to compile StandardLibrary asynchronously to speed up
// the compilation when we actually need it the first time
LOGGER.info("Warming up SCL-compiler with StandardLibrary");
ForkJoinPool.commonPool().submit(() -> {
Failable<Module> module = SCLOsgi.MODULE_REPOSITORY.getModule("StandardLibrary");
LOGGER.info("StandardLibrary compiled {}", module);
});
}
public void stop(BundleContext bundleContext) throws Exception {
......
......@@ -31,6 +31,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProduct;
......@@ -114,6 +115,7 @@ import org.simantics.project.management.PlatformUtil;
import org.simantics.project.management.ServerManager;
import org.simantics.project.management.ServerManagerFactory;
import org.simantics.project.management.WorkspaceUtil;
import org.simantics.scl.compiler.errors.Failable;
import org.simantics.scl.compiler.module.repository.ModuleRepository;
import org.simantics.scl.osgi.SCLOsgi;
import org.simantics.utils.FileUtils;
......@@ -792,6 +794,14 @@ public class SimanticsPlatform implements LifecycleListener {
StartupExtensions.consultStartupExtensions();
LOGGER.info("Consulted platform pre-startup extensions");
// 0.0.1. Let's try to compile StandardLibrary asynchronously to speed up
// the compilation when we actually need it the first time
LOGGER.info("Warming up SCL-compiler with StandardLibrary");
ForkJoinPool.commonPool().submit(() -> {
Failable<org.simantics.scl.compiler.module.Module> module = SCLOsgi.MODULE_REPOSITORY.getModule("StandardLibrary");
LOGGER.info("StandardLibrary compiled {}", module);
});
// 0.1. Clear all temporary files
Simantics.clearTemporaryDirectory();
LOGGER.info("Cleared temporary directory");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment