package org.metaborg.sunshine;

import org.metaborg.sunshine.drivers.SunshineMainDriver;
import org.metaborg.sunshine.environment.LaunchConfiguration;
import org.metaborg.sunshine.services.RuntimeService;
import org.metaborg.sunshine.services.StrategoCallService;
import org.metaborg.sunshine.services.analyzer.AnalysisService;
import org.metaborg.sunshine.services.parser.ParserService;
import org.metaborg.sunshine.statistics.Statistics;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;

public class SunshineModule extends AbstractModule {
	private final LaunchConfiguration launchConfig;

	public SunshineModule(LaunchConfiguration launchConfig) {
		this.launchConfig = launchConfig;
	}

	@Override
	protected void configure() {
		bind(LaunchConfiguration.class).toInstance(launchConfig);
		bind(SunshineMainDriver.class).asEagerSingleton();
		bind(RuntimeService.class).asEagerSingleton();
		bind(StrategoCallService.class).asEagerSingleton();
		bind(ParserService.class).asEagerSingleton();
		bind(AnalysisService.class).asEagerSingleton();
		bind(Statistics.class).asEagerSingleton();

		bind(String.class).annotatedWith(
				Names.named("LanguageDiscoveryAnalysisOverride")).toInstance(
				"analysis-cmd");
	}
}

@@ -1239,13 +1239,145 @@
 -cmd%22);%0A
+%09%09bind(ClassLoader.class).annotatedWith(%0A%09%09%09%09Names.named(%22ResourceClassLoader%22)).toInstance(%0A%09%09%09%09this.getClass().getClassLoader());%0A
 %09%7D%0A%7D%0A

Set resources class loader.