Commit f8ede959 authored by Glenn PLOUHINEC's avatar Glenn PLOUHINEC Committed by Gerson SUNYE
Browse files

Improvement of the script

parent 60bac72f
...@@ -11,6 +11,6 @@ target/ ...@@ -11,6 +11,6 @@ target/
/metrics.xmi /metrics.xmi
*.launch *.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 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 key="Model Handler">
<mapEntry key="java" value="EMF"/>
<mapEntry key="smm" value="EMF"/>
<mapAttribute key="ModelType">
<mapEntry key="IN" value="MODELINPUT"/>
<mapEntry key="OUT" value="MODELOUTPUT"/>
<mapEntry key="java" value="METAMODELINPUT"/>
<mapEntry key="smm" value="METAMODELOUTPUT"/>
<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"/>
<listAttribute key="OrderedInput">
<listEntry value="IN"/>
<listAttribute key="OrderedOutput">
<listEntry value="OUT"/>
<mapAttribute key="Output">
<mapEntry key="OUT" value="smm"/>
<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:"/>
<mapEntry key="smm" value="uri:"/>
<listAttribute key="Superimpose"/>
<stringAttribute key="bad_container_name" value="/projet-2019/analysis.launch"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value=""/>
...@@ -2,24 +2,51 @@ ...@@ -2,24 +2,51 @@
# Pre-requisites : A correct analysis.launch file to serve as base # Pre-requisites : A correct analysis.launch file to serve as base
# This scripts generates for each input xmi, a corresponding ATL launch file # This scripts generates for each input xmi, a corresponding ATL launch file
# Check parameter for current IN model name in analysis.launch base_file="build-tools/analysis.launch"
if [ -z "$1" ] if [ -z "$1" ]
if [ ! -e $base_file ]
then then
echo "Enter the name of current IN model in file analysis.launch (for e.g : ./ comment-required)" echo -e "No base file found. You can enter the name of a base file in parameter. For e.g.:\n./ analysis.launch"
exit exit
else else
currentinput=$1 base_file=$1
echo "Current input : $currentinput"
fi 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 each input file, generate the corresponding .launch file with this file's name as IN model
for file in input/*.xmi; do for file in input/*.xmi; do
filename=$(basename -- "$file") # get basename filename=$(basename -- "$file") # get basename
filename="${filename%.*}" # remove extension filename="${filename%.*}" # remove extension
echo "$filename" cp $base_file $target_directory/analysis-$filename.launch
cp analysis.launch analysis-$filename.launch echo "Created: analysis-$filename.launch"
sed -i "s/$currentinput/$filename/g" 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 "Replaced : $currentinput by $filename in file analysis-$filename.launch"
done echo '
\ No newline at end of file <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
echo '
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value=""/>
</launchConfiguration>' >> $launch_group
\ No newline at end of file
Supports Markdown
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