Java Code Examples for org.eclipse.xtext.generator.OutputConfiguration#setOutputDirectory()

The following examples show how to use org.eclipse.xtext.generator.OutputConfiguration#setOutputDirectory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N4IDLSubGenerator.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private static CompilerDescriptor createDescriptor() {
	final CompilerDescriptor result = new CompilerDescriptor();
	result.setIdentifier(COMPILER_ID);
	result.setName("N4IDL to ECMAScript transpiler");
	result.setDescription(
			"Transpiles N4IDL to ECMAScript, currently ES5 plus some selected ES6 features supported by V8.");
	result.setActive(true);
	result.setCompiledFileExtension("js");
	result.setCompiledFileSourceMapExtension("map");
	final OutputConfiguration outCfg = new OutputConfiguration(COMPILER_ID);
	outCfg.setDescription("N4IDL to ECMAScript transpiler");
	outCfg.setOutputDirectory(N4JSLanguageConstants.DEFAULT_PROJECT_OUTPUT);
	outCfg.setOverrideExistingResources(true);
	outCfg.setCreateOutputDirectory(true);
	outCfg.setCleanUpDerivedResources(true);
	outCfg.setSetDerivedProperty(true);
	outCfg.setKeepLocalHistory(true);
	outCfg.setCanClearOutputDirectory(true);
	result.setOutputConfiguration(outCfg);
	return result;
}
 
Example 2
Source File: CheckOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the service registry output configuration.
 *
 * @return the service registry configuration
 */
private OutputConfiguration getServiceRegistryConfig() {
  OutputConfiguration config = new OutputConfiguration(CheckGeneratorConstants.CHECK_REGISTRY_OUTPUT);
  config.setDescription("Output configuration for service registry use");
  config.setOutputDirectory("META-INF/services");
  config.setOverrideExistingResources(true);
  config.setCreateOutputDirectory(true);
  config.setCleanUpDerivedResources(false);
  config.setSetDerivedProperty(true);
  return config;
}
 
Example 3
Source File: EcmaScriptSubGenerator.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Creates a default OutputConfiguration */
public static OutputConfiguration createDefaultOutputConfiguration() {
	final OutputConfiguration outCfg = new OutputConfiguration(COMPILER_ID);
	outCfg.setDescription("N4JS to ECMAScript transpiler");
	outCfg.setOutputDirectory(N4JSLanguageConstants.DEFAULT_PROJECT_OUTPUT);
	outCfg.setOverrideExistingResources(true);
	outCfg.setCreateOutputDirectory(true);
	outCfg.setCleanUpDerivedResources(true);
	outCfg.setSetDerivedProperty(true);
	outCfg.setKeepLocalHistory(true);
	outCfg.setCanClearOutputDirectory(true);
	return outCfg;
}
 
Example 4
Source File: CheckOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the check documentation output configuration.
 *
 * @return the check documentation configuration
 */
private OutputConfiguration getCheckDocumentationConfig() {
  OutputConfiguration config = new OutputConfiguration(CheckGeneratorConstants.CHECK_DOC_OUTPUT);
  config.setDescription("Output configuration for check documentation use");
  config.setOutputDirectory(DOCS_PATH);
  config.setCreateOutputDirectory(true);
  config.setCanClearOutputDirectory(true);
  return config;
}
 
Example 5
Source File: ExportOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates output configuration for regular generated files.
 *
 * @return output configuration
 */
private OutputConfiguration getDefaultConfig() {
  OutputConfiguration config = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
  config.setDescription("Output configuration for generated classes"); //$NON-NLS-1$
  config.setOverrideExistingResources(true);
  config.setOutputDirectory("src-gen"); //$NON-NLS-1$
  return config;
}
 
Example 6
Source File: ExportOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates output configuration for generated stubs.
 *
 * @return output configuration
 */
private OutputConfiguration getStubConfig() {
  OutputConfiguration config = new OutputConfiguration(STUB_OUTPUT);
  config.setDescription("Output configuration for stubs"); //$NON-NLS-1$
  config.setOverrideExistingResources(false);
  config.setCanClearOutputDirectory(false);
  config.setCleanUpDerivedResources(false);
  config.setOutputDirectory("src"); //$NON-NLS-1$
  return config;
}
 
Example 7
Source File: FormatOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates output configuration for a AbstractFormatter.
 *
 * @return output configuration
 */
private OutputConfiguration getAbstractFormatterConfig() {
  OutputConfiguration config = new OutputConfiguration(FormatConstants.ABSTRACT_FORMATTER);
  config.setDescription("Output configuration for a abstract formatter");
  config.setOverrideExistingResources(true);
  config.setOutputDirectory("src-gen");
  return config;
}
 
Example 8
Source File: FormatOutputConfigurationProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates output configuration for a Formatter.
 *
 * @return output configuration
 */
private OutputConfiguration getFormatterConfig() {
  OutputConfiguration config = new OutputConfiguration(FormatConstants.FORMATTER);
  config.setDescription("Output configuration for a formatter");
  config.setOverrideExistingResources(false);
  config.setCanClearOutputDirectory(false);
  config.setCleanUpDerivedResources(false);
  config.setOutputDirectory("src");
  return config;
}
 
Example 9
Source File: URIBasedFileSystemAccessTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void before() throws Exception {
	Path tmpPath = Paths.get(StandardSystemProperty.JAVA_IO_TMPDIR.value());
	Path output = Files.createTempDirectory(tmpPath, "tempFolder_" + UUID.randomUUID());
	Path resource = Files.createFile(output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME));
	resource.toFile().deleteOnExit();
	output.toFile().deleteOnExit();
	OutputConfiguration config = configProvider.getOutputConfigurations().iterator().next();
	config.setOutputDirectory(output.toString());
	Map<String, OutputConfiguration> cfgMap = new HashMap<>();
	cfgMap.put(IFileSystemAccess.DEFAULT_OUTPUT, config);
	fsa.setOutputConfigurations(cfgMap);
	fsa.setConverter(uriConverter);
}
 
Example 10
Source File: XsemanticsOutputConfigurationProvider.java    From xsemantics with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
	Set<OutputConfiguration> outputconfigurations = super
			.getOutputConfigurations();
	OutputConfiguration outputConfiguration = outputconfigurations
			.iterator().next();
	outputConfiguration.setOutputDirectory(XSEMANTICS_GEN);
	return outputconfigurations;
}
 
Example 11
Source File: EclipseOutputConfigurationProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #createAndOverlayOutputConfiguration(IProject, IPreferenceStore, OutputConfiguration)}
 */
@Deprecated
protected OutputConfiguration createAndOverlayOutputConfiguration(IPreferenceStore store, OutputConfiguration output) {
	OutputConfiguration result = new OutputConfiguration(output.getName());
	boolean clearOutputDirectory = getBoolean(output, OUTPUT_CLEAN_DIRECTORY, store, output.isCanClearOutputDirectory());
	result.setCanClearOutputDirectory(clearOutputDirectory);
	boolean cleanUpDerivedResources = getBoolean(output, OUTPUT_CLEANUP_DERIVED, store, output.isCleanUpDerivedResources());
	result.setCleanUpDerivedResources(cleanUpDerivedResources);
	boolean createOutputDirectory = getBoolean(output, OUTPUT_CREATE_DIRECTORY, store, output.isCreateOutputDirectory());
	result.setCreateOutputDirectory(createOutputDirectory);
	boolean overrideExistingResources = getBoolean(output, OUTPUT_OVERRIDE, store, output.isOverrideExistingResources());
	result.setOverrideExistingResources(overrideExistingResources);
	boolean setDerivedProperty = getBoolean(output, OUTPUT_DERIVED, store, output.isSetDerivedProperty());
	result.setSetDerivedProperty(setDerivedProperty);
	boolean installDslAsPrimarySource = getBoolean(output, INSTALL_DSL_AS_PRIMARY_SOURCE, store, output.isInstallDslAsPrimarySource());
	result.setInstallDslAsPrimarySource(installDslAsPrimarySource);
	boolean hideSyntheticLocalVariables = getBoolean(output, HIDE_LOCAL_SYNTHETIC_VARIABLES, store, output.isHideSyntheticLocalVariables());
	result.setHideSyntheticLocalVariables(hideSyntheticLocalVariables);
	String description = getString(output, OUTPUT_DESCRIPTION, store, output.getDescription());
	result.setDescription(description);
	String directory = getString(output, OUTPUT_DIRECTORY, store, output.getOutputDirectory());
	result.setOutputDirectory(directory);
	boolean keepLocalHistory = getBoolean(output, OUTPUT_KEEP_LOCAL_HISTORY, store, output.isKeepLocalHistory());
	result.setKeepLocalHistory(keepLocalHistory);
	boolean useOutputPerSourceFolder = getBoolean(output, USE_OUTPUT_PER_SOURCE_FOLDER, store, output.isUseOutputPerSourceFolder());
	result.setUseOutputPerSourceFolder(useOutputPerSourceFolder);
	return result;
}
 
Example 12
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_Plain_1() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}
 
Example 13
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_Plain() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}
 
Example 14
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath_4() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	OutputConfiguration.SourceMapping sourceMapping2 = new OutputConfiguration.SourceMapping("src/test/xtend_gen");
	output.getSourceMappings().add(sourceMapping2);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/test/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}
 
Example 15
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath_3() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/main/src/org/eclipse/test/foo.bar"), null);
	Assert.assertFalse(classNameValidator.isDerived(file));
}
 
Example 16
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath_2() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/main/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertFalse(classNameValidator.isDerived(file));
}
 
Example 17
Source File: SarlOutputConfigurationProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Create the unit test output configuration.
 *
 * @return the configuration, never {@code null}.
 * @since 0.8
 */
@SuppressWarnings("static-method")
protected OutputConfiguration createTestOutputConfiguration() {
	final OutputConfiguration testOutput = new OutputConfiguration(SARLConfig.TEST_OUTPUT_CONFIGURATION);
	testOutput.setDescription(Messages.SarlOutputConfigurationProvider_1);
	testOutput.setOutputDirectory(SARLConfig.FOLDER_TEST_SOURCE_GENERATED);
	testOutput.setOverrideExistingResources(true);
	testOutput.setCreateOutputDirectory(true);
	testOutput.setCanClearOutputDirectory(false);
	testOutput.setCleanUpDerivedResources(true);
	testOutput.setSetDerivedProperty(true);
	testOutput.setKeepLocalHistory(false);
	return testOutput;
}
 
Example 18
Source File: PyOutputConfigurationProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
	final OutputConfiguration pythonOutput = new OutputConfiguration(OUTPUT_CONFIGURATION_NAME);
	pythonOutput.setDescription(Messages.PyOutputConfigurationProvider_0);
	pythonOutput.setOutputDirectory(OUTPUT_FOLDER);
	pythonOutput.setOverrideExistingResources(true);
	pythonOutput.setCreateOutputDirectory(true);
	pythonOutput.setCanClearOutputDirectory(true);
	pythonOutput.setCleanUpDerivedResources(true);
	pythonOutput.setSetDerivedProperty(true);
	pythonOutput.setKeepLocalHistory(false);
	return newHashSet(pythonOutput);
}
 
Example 19
Source File: StandaloneBuilderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
	OutputConfiguration config = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
	config.setOutputDirectory("src-gen");
	if (useOutputPerSource) {
		SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src2");
		sourceMapping.setOutputDirectory("src2-gen");
		config.getSourceMappings().add(sourceMapping);
		config.setUseOutputPerSourceFolder(true);
	}
	return ImmutableSet.of(config);
}
 
Example 20
Source File: N4JSOutputConfigurationProvider.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private OutputConfiguration getOutputConfiguration(IN4JSProject project) {
	String outputPath = null;
	if (project != null) {
		outputPath = project.getOutputPath();
	}

	OutputConfiguration defaultOutputConfig = EcmaScriptSubGenerator.createDefaultOutputConfiguration();
	if (outputPath != null) {
		defaultOutputConfig.setOutputDirectory(outputPath);
	}
	return defaultOutputConfig;
}