Search in sources :

Example 1 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project mechanoid by robotoworks.

the class Compiler method compile.

public void compile(String source, String sourceFolder, String stubFolder, boolean recurse) {
    Map<String, OutputConfiguration> outputConfigurations = createOutputConfigurations(sourceFolder, stubFolder);
    mFileSystemAccess.setOutputConfigurations(outputConfigurations);
    File file = new File(System.getProperty("user.dir"), source);
    if (!file.exists()) {
        throw new IllegalStateException("invalid input source");
    }
    ArrayList<String> resourcePaths = new ArrayList<String>();
    getResourcePaths(resourcePaths, file, recurse);
    loadResources(resourcePaths);
    List<Issue> issues = validate();
    for (Issue issue : issues) {
        System.out.println(issue.getCode() + ":" + issue.getMessage());
    }
    if (issues.size() == 0) {
        generate();
    }
}
Also used : Issue(org.eclipse.xtext.validation.Issue) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) ArrayList(java.util.ArrayList) File(java.io.File)

Example 2 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project mechanoid by robotoworks.

the class Compiler method createStubGenOutputConfiguration.

private OutputConfiguration createStubGenOutputConfiguration(String outDir) {
    OutputConfiguration out = new OutputConfiguration("DEFAULT_STUB_OUTPUT");
    out.setDescription("Generated Source Stubs");
    out.setOutputDirectory(outDir);
    out.setOverrideExistingResources(false);
    out.setCreateOutputDirectory(true);
    out.setCleanUpDerivedResources(false);
    out.setSetDerivedProperty(false);
    out.setCanClearOutputDirectory(false);
    return out;
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Example 3 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project mechanoid by robotoworks.

the class Compiler method createSourceGenOutputConfiguration.

private OutputConfiguration createSourceGenOutputConfiguration(String outDir) {
    OutputConfiguration out = new OutputConfiguration("DEFAULT_OUTPUT");
    out.setDescription("Generated Source");
    out.setOutputDirectory(outDir);
    out.setOverrideExistingResources(true);
    out.setCreateOutputDirectory(true);
    out.setCleanUpDerivedResources(true);
    out.setSetDerivedProperty(true);
    out.setCanClearOutputDirectory(true);
    return out;
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Example 4 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project mechanoid by robotoworks.

the class MechanoidOutputConfigurationProvider method getOutputConfigurations.

@Override
public Set<OutputConfiguration> getOutputConfigurations() {
    Set<OutputConfiguration> outputConfigurations = super.getOutputConfigurations();
    OutputConfiguration defaultOutput = new OutputConfiguration(DEFAULT_STUB_OUTPUT);
    defaultOutput.setDescription("Stub Folder");
    defaultOutput.setOutputDirectory("./src");
    defaultOutput.setOverrideExistingResources(false);
    defaultOutput.setCreateOutputDirectory(false);
    defaultOutput.setCleanUpDerivedResources(false);
    defaultOutput.setSetDerivedProperty(false);
    defaultOutput.setCanClearOutputDirectory(false);
    outputConfigurations.add(defaultOutput);
    return outputConfigurations;
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Example 5 with OutputConfiguration

use of org.eclipse.xtext.generator.OutputConfiguration in project applause by applause.

the class ApplauseBuilderParticipant method getGeneratorMarkers.

/**
	 * @since 2.4
	 */
protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject, Collection<OutputConfiguration> outputConfigurations) throws CoreException {
    Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap();
    for (OutputConfiguration config : outputConfigurations) {
        if (config.isCleanUpDerivedResources()) {
            IContainer container = getContainer(builtProject, config.getOutputDirectory());
            final Iterable<IMarker> markers = derivedResourceMarkers.findDerivedResourceMarkers(container, generatorIdProvider.getGeneratorIdentifier());
            generatorMarkers.put(config, markers);
        }
    }
    return generatorMarkers;
}
Also used : OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) IMarker(org.eclipse.core.resources.IMarker) IContainer(org.eclipse.core.resources.IContainer)

Aggregations

OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)29 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)9 Test (org.junit.Test)9 IgnoredBySmokeTest (org.eclipse.xtext.testing.smoketest.IgnoredBySmokeTest)7 FileProjectConfig (org.eclipse.xtext.workspace.FileProjectConfig)7 FileSourceFolder (org.eclipse.xtext.workspace.FileSourceFolder)6 IContainer (org.eclipse.core.resources.IContainer)4 IFile (org.eclipse.core.resources.IFile)4 File (java.io.File)3 IMarker (org.eclipse.core.resources.IMarker)3 IProject (org.eclipse.core.resources.IProject)3 CoreException (org.eclipse.core.runtime.CoreException)3 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)3 IOException (java.io.IOException)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.core.runtime.Path)2 SubMonitor (org.eclipse.core.runtime.SubMonitor)2 URI (org.eclipse.emf.common.util.URI)2 BuildRequest (org.eclipse.xtext.build.BuildRequest)2 AbstractIncrementalBuilderTest (org.eclipse.xtext.testing.builder.AbstractIncrementalBuilderTest)2