Commit b3bbbc93 authored by Gerson SUNYE's avatar Gerson SUNYE
Browse files

Merge branch 'RunConfImprovements' into 'master'

Improvement of the gen-launch-config.sh script

See merge request naomod/mde/projet-2019!98
parents 60bac72f f8ede959
......@@ -11,6 +11,6 @@ target/
/metrics.xmi
*.launch
analysis.launch
!analysis.launch
*.orig
*.orig
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2m.atl.adt.launching.atlTransformation">
<stringAttribute key="ATL File Name" value="/projet-2019/src/main/atl/analysis.atl"/>
<stringAttribute key="ATL VM" value="EMF-specific VM"/>
<stringAttribute key="ATL_COMPILER" value="atl2006"/>
<booleanAttribute key="IS_REFINING" value="false"/>
<mapAttribute key="Input">
<mapEntry key="IN" value="java"/>
</mapAttribute>
<mapAttribute key="Libs">
<mapEntry key="bestPractices" value="/projet-2019/src/main/atl/bestPractices.asm"/>
<mapEntry key="codestyle" value="/projet-2019/src/main/atl/codestyle.asm"/>
<mapEntry key="design" value="/projet-2019/src/main/atl/design.asm"/>
<mapEntry key="documentation" value="/projet-2019/src/main/atl/documentation.asm"/>
<mapEntry key="errorProne" value="/projet-2019/src/main/atl/errorProne.asm"/>
<mapEntry key="multithreading" value="/projet-2019/src/main/atl/multithreading.asm"/>
<mapEntry key="performance" value="/projet-2019/src/main/atl/performance.asm"/>
</mapAttribute>
<mapAttribute key="Model Handler">
<mapEntry key="java" value="EMF"/>
<mapEntry key="smm" value="EMF"/>
</mapAttribute>
<mapAttribute key="ModelType">
<mapEntry key="IN" value="MODELINPUT"/>
<mapEntry key="OUT" value="MODELOUTPUT"/>
<mapEntry key="java" value="METAMODELINPUT"/>
<mapEntry key="smm" value="METAMODELOUTPUT"/>
</mapAttribute>
<mapAttribute key="Options">
<mapEntry key="OPTION_CLEAR" value="true"/>
<mapEntry key="OPTION_CONTENT_TYPE" value="false"/>
<mapEntry key="OPTION_DERIVED" value="true"/>
<mapEntry key="allowInterModelReferences" value="false"/>
<mapEntry key="printExecutionTime" value="true"/>
<mapEntry key="step" value="false"/>
<mapEntry key="supportUML2Stereotypes" value="false"/>
</mapAttribute>
<listAttribute key="OrderedInput">
<listEntry value="IN"/>
</listAttribute>
<listAttribute key="OrderedOutput">
<listEntry value="OUT"/>
</listAttribute>
<mapAttribute key="Output">
<mapEntry key="OUT" value="smm"/>
</mapAttribute>
<mapAttribute key="Path">
<mapEntry key="IN" value="/projet-2019/input/example.xmi"/>
<mapEntry key="OUT" value="/projet-2019/output/metrics.xmi"/>
<mapEntry key="java" value="uri:http://www.eclipse.org/MoDisco/Java/0.2.incubation/java"/>
<mapEntry key="smm" value="uri:http://www.eclipse.org/MoDisco/SMM/1.0.Beta2/smm"/>
</mapAttribute>
<listAttribute key="Superimpose"/>
<stringAttribute key="bad_container_name" value="/projet-2019/analysis.launch"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
</launchConfiguration>
......@@ -2,24 +2,51 @@
# Pre-requisites : A correct analysis.launch file to serve as base
# This scripts generates for each input xmi, a corresponding ATL launch file
# Check parameter for current IN model name in analysis.launch
currentinput=""
base_file="build-tools/analysis.launch"
if [ -z "$1" ]
then
if [ ! -e $base_file ]
then
echo "Enter the name of current IN model in file analysis.launch (for e.g : ./gen-launch-config.sh comment-required)"
echo -e "No base file found. You can enter the name of a base file in parameter. For e.g.:\n./gen-launch-config.sh analysis.launch"
exit
fi
else
currentinput=$1
echo "Current input : $currentinput"
base_file=$1
fi
echo "Base file used: $base_file"
target_directory="launch_configurations" #Directory of all the launch configurations generated.
launch_group="atl_launch_group.launch" #Name of the Launch Group Configuration file.
delay=0 #Delay between each execution of the launch group, in seconds (must be an integer).
i=0 #Value used to distinguish the different configurations for the launch group
mkdir -p $target_directory
# These xml lines generates a Launch Group Configuration for Eclipse.
echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.debug.core.groups.GroupLaunchConfigurationType">' > $launch_group
# For each input file, generate the corresponding .launch file with this file's name as IN model
for file in input/*.xmi; do
filename=$(basename -- "$file") # get basename
filename="${filename%.*}" # remove extension
echo "$filename"
cp analysis.launch analysis-$filename.launch
sed -i "s/$currentinput/$filename/g" analysis-$filename.launch
echo "Replaced : $currentinput by $filename in file analysis-$filename.launch"
done
\ No newline at end of file
cp $base_file $target_directory/analysis-$filename.launch
echo "Created: analysis-$filename.launch"
sed -i "s/\/projet-2019\/input\/.*.xmi/\/projet-2019\/input\/$filename.xmi/g" $target_directory/analysis-$filename.launch # Replace the input in the .launch file.
echo '
<stringAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.action" value="DELAY"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.actionParam" value="'"$delay"'"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.adoptIfRunning" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.enabled" value="true"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.mode" value="run"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.'"$i"'.name" value="'"analysis-$filename"'"/>' >> $launch_group
((i++))
done
echo '
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
</launchConfiguration>' >> $launch_group
\ No newline at end of file
Markdown is supported
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