diff options
author | Henrik Rentz-Reichert | 2013-10-29 13:40:16 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2013-10-29 13:40:16 +0000 |
commit | 619bc3be673c49a45856aa739f196f4703867f6f (patch) | |
tree | 9ec4d4e2f448aebd31653898e55e6a1a30a4857d /plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend | |
parent | f5f099374af7b1ad816fc336db8cb5edd859adec (diff) | |
download | org.eclipse.etrice-619bc3be673c49a45856aa739f196f4703867f6f.tar.gz org.eclipse.etrice-619bc3be673c49a45856aa739f196f4703867f6f.tar.xz org.eclipse.etrice-619bc3be673c49a45856aa739f196f4703867f6f.zip |
[generator.ui] Bug 420608: add Maven support for Java projects
https://bugs.eclipse.org/420608
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend')
-rw-r--r-- | plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend new file mode 100644 index 000000000..28fe946a5 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.ui.wizard + +/** + * @author Henrik Rentz-Reichert + * + */ +class ProjectFileFragments { + + def static String getBasicRoomModel(String baseName) { + ''' + RoomModel «baseName» { + LogicalSystem LogSys1 { + SubSystemRef subSysRef1:SubSysClass1 + } + SubSystemClass SubSysClass1 { + ActorRef actorRef1:ActorClass1 + LogicalThread defaultThread + } + ActorClass ActorClass1 { + } + } + ''' + } + + def static String getBasicPhysicalModel(String baseName) { + ''' + PhysicalModel «baseName» { + + PhysicalSystem PhysSys1 { + NodeRef nodeRef1 : NodeClass1 + } + + NodeClass NodeClass1 { + runtime = RuntimeClass1 + priomin = -10 + priomax = 10 + + DefaultThread PhysicalThread1 { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 32 + msgpoolsize = 10 + } + } + + RuntimeClass RuntimeClass1 { + model = multiThreaded + } + } + ''' + } + + def static String getBasicMappingModel(String baseName) { + ''' + MappingModel «baseName» { + import «baseName».* from "«baseName».room" + import «baseName».* from "«baseName».etphys" + Mapping LogSys1 -> PhysSys1 { + SubSystemMapping subSysRef1 -> nodeRef1 { + ThreadMapping defaultThread -> PhysicalThread1 + } + } + } + ''' + } + + def static String getGeneratorLaunchConfig(String targetLanguage, String modelPath, String baseName, String[] addLines) { + ''' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <launchConfiguration type="org.eclipse.etrice.generator.launch.«targetLanguage».launchConfigurationType"> + <booleanAttribute key="MSC" value="true"/> + <listAttribute key="ModelFiles"> + <listEntry value="${workspace_loc:«modelPath»/«baseName».etmap}"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> + <listEntry value="org.eclipse.debug.ui.launchGroup.run"/> + </listAttribute> + «FOR line : addLines» + «line» + «ENDFOR» + </launchConfiguration> + ''' + } + + def static String getLaunchJavaApplicationConfig(String project, String mdlName, String mainClass) { + ''' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/«project»/src-gen/«mdlName.replace('.', '/')»/«mainClass».java"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="1"/> + </listAttribute> + <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> + <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="«mdlName».«mainClass»"/> + <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="«project»"/> + </launchConfiguration> + ''' + } + + def static String getLaunchCApplicationConfig(String project) { + ''' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> + <booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/> + <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> + <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> + <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/«project».exe"/> + <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="«project»"/> + <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/«project»"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="4"/> + </listAttribute> + </launchConfiguration> + ''' + } + + def static String getMavenPOM(String project, String mdlName, String mainClass) { + ''' + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>«project»</groupId> + <artifactId>«mdlName»</artifactId> + <version>0.0.1</version> + <build> + <sourceDirectory>src-gen</sourceDirectory> + <resources> + <resource> + <directory>src-gen</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source /> + <target /> + </configuration> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + <archive> + <manifest> + <mainClass>«mdlName».«mainClass»</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.eclipse.etrice.runtime.java</groupId> + <artifactId>org.eclipse.etrice.runtime.java</artifactId> + <version>0.0.4</version> + </dependency> + <dependency> + <groupId>org.eclipse.etrice.modellib.java</groupId> + <artifactId>org.eclipse.etrice.modellib.java</artifactId> + <version>0.0.4</version> + </dependency> + </dependencies> + </project>" + ''' + } + + def static String getMavenBuilder(String project) { + ''' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType"> + <booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/> + <stringAttribute key="M2_GOALS" value="package"/> + <booleanAttribute key="M2_NON_RECURSIVE" value="false"/> + <booleanAttribute key="M2_OFFLINE" value="false"/> + <stringAttribute key="M2_PROFILES" value=""/> + <listAttribute key="M2_PROPERTIES"/> + <stringAttribute key="M2_RUNTIME" value="EMBEDDED"/> + <booleanAttribute key="M2_SKIP_TESTS" value="false"/> + <intAttribute key="M2_THREADS" value="1"/> + <booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/> + <booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/> + <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/«project»}"/> + </launchConfiguration> + ''' + } + + def static String getMavenLauncher(String project, String mdlName) { + ''' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"> + <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:JAVA_HOME}/bin/java.exe"/> + <stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-jar target/«mdlName»-0.0.1-jar-with-dependencies.jar"/> + <stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/«project»}"/> + </launchConfiguration> + ''' + } +}
\ No newline at end of file |