Skip to content

Commit

Permalink
now with perl
Browse files Browse the repository at this point in the history
  • Loading branch information
victordrose committed Dec 20, 2023
1 parent 5cf6d19 commit e3e300d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions scripts/pipelines/common/pipeline_generator.lib
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,7 @@ function add_jacoco_dependency {
</executions>
</plugin>"

# Create a Python script to add the Jacoco plugin to the pom.xml file
python_script=$(mktemp)
echo "import xml.etree.ElementTree as ET" >> "$python_script"
echo "tree = ET.parse('${localDirectory}/pom.xml')" >> "$python_script"
echo "root = tree.getroot()" >> "$python_script"
echo "plugins = root.find('.//build/plugins')" >> "$python_script"
echo "jacoco_plugin = ET.fromstring('''$jacoco_plugin''')" >> "$python_script"
echo "plugins.append(jacoco_plugin)" >> "$python_script"
echo "tree.write('${localDirectory}/pom.xml')" >> "$python_script"

# Run the Python script
python "$python_script"
# Insert the Jacoco plugin into the pom.xml file
perl -i -pe "s|</plugins>|${jacoco_plugin}\n</plugins>|g" "${localDirectory}/pom.xml"
fi
}

0 comments on commit e3e300d

Please sign in to comment.