#!/usr/bin/env bash help() { echo "" echo "Run this script if you want to add new IntelliJ IDEA version." echo "This will scan for libs and plugins and generate a list of commands for maven-installer-plugin" echo "for Maven clover-idea-libs/pom.xml file." echo "Next copy these dependencies into clover-idea-libs/pom.xml, maven-installer-plugin section." echo "" echo "Usage : $0 " echo "Example: $0 target/extract/idea-IC-141.3058.30 141.3058.30" echo "" } # $1 idea folder # $2 idea version scanLibraries() { groupId="org.openclover.idea.libs" libDir=$1/lib version=$2 for libFile in $libDir/*.jar; do artifactId=`echo $libFile | sed 's/\.jar//' | sed 's/.*\///'` echoCommand $groupId $artifactId $version $libFile done } # $1 idea folder # $2 idea version scanPlugins() { groupId="org.openclover.idea.plugins" pluginsDir=$1/plugins version=$2 pluginIncludes="properties devkit" for pluginDir in `ls $pluginsDir`; do if [ `echo $pluginIncludes | grep -w $pluginDir | wc -l` -ne 0 ]; then for pluginFile in `ls $pluginsDir/$pluginDir/lib/$pluginDir*.jar`; do pluginFileName=`echo $pluginFile | sed 's/\.jar//' | sed 's/.*\///'` artifactId=$pluginFileName echoCommand $groupId $artifactId $version $pluginFile done fi done } echoCommandStart() { echo "" } echoCommandEnd() { echo "" } echoCommand() { groupId=$1 artifactId=$2 version=$3 file=$4 echo "" echo " install-idea-$artifactIdinstallinstall-file" echo " " echo " $filejartrue" echo " $groupId$artifactId$version" echo " " echo "" } if [ "$#" -ne 2 ]; then help exit 1 fi echoCommandStart scanLibraries $1 $2 scanPlugins $1 $2 echoCommandEnd