<commit_before>#!/bin/sh

echo "Installing Palladio plugin JARs..."
echo "Checking given palladio source directory: ${1}"

# sanity checks
if [ ! -d $1 ]; then
    echo "Error: the Palladio directory does not exist"
    exit 1
fi
if [ ! -d $1/plugins ]; then
    echo "Error: the Palladio directory does not contain a plugins directory. Please provide the path to the Palladio installation."
    exit 1
fi
echo "  Palladio Directory OK"


# build maven repo
mkdir -p ./pathing/.m2/

for plugin in $(find $1/plugins -maxdepth 1 -type f -name '*.jar' ); do
    name=$(echo $plugin | sed -rn 's/^.+\/([^_]+)\_.*?$/\1/p')
    version=$(echo $plugin | sed -rn 's/^[^_]+\_(.*?)\.jar$/\1/p')

    if [ -f ./pathing/.m2/de/fabiankeller/palladio/$name/$version/$name-$version.pom ]; then
        echo "  Skipping >>> $name :: $version, as pom is already present"
        continue
    fi

    echo "  Adding >>> $name :: $version"
    mvn install:install-file \
        -Dfile=$plugin \
        -DgroupId="de.fabiankeller.palladio" \
        -DartifactId=$name \
        -Dversion=$version \
        -Dpackaging=jar \
        -DlocalRepositoryPath=./pathing/.m2/
done<commit_msg>Update: only import actual dependencies into local maven repository<commit_after>#!/bin/sh

echo "Installing Palladio plugin JARs..."
echo "Checking given palladio source directory: ${1}"

# sanity checks
if [ ! -d $1 ]; then
    echo "Error: the Palladio directory does not exist"
    exit 1
fi
if [ ! -d $1/plugins ]; then
    echo "Error: the Palladio directory does not contain a plugins directory. Please provide the path to the Palladio installation."
    exit 1
fi
echo "  Palladio Directory OK"


# build maven repo
mkdir -p ./pathing/.m2/

#for name in $(cat pom.xml | sed -rn "s/^\s*<artifactId>([^<]+).+$/\1/p"); do
for name in $(cat pom.xml | sed -rn '
    /^.*de\.fabiankeller\.palladio<\/groupId>\s*$/{    # if line matches group
        N                                              # read next line into pattern space
        s/.*<artifactId>([^<]+).*/\1/p                 # print artifactId
    }'); do

    # try to find plugin jar file with the given name
    plugin=$(find $1/plugins -maxdepth 1 -type f -name "$name\_*.jar" | tail -n 1)

    if [ -z "$plugin" ]; then
        echo "  WARNING >>> $name could not be found in any version in $1/plugins. Please install the appropriate Palladio extension containing the JAR."
        continue
    fi
    version=$(echo $plugin | sed -rn 's/^[^_]+\_(.*?)\.jar$/\1/p')

    # check if it is already imported
    if [ -f ./pathing/.m2/de/fabiankeller/palladio/$name/$version/$name-$version.pom ]; then
        echo "  Skipping >>> $name :: $version, as pom is already present"
        continue
    fi

    # import as maven dependency
    echo "  Adding >>> $name :: $version"
    mvn install:install-file \
        -Dfile=$plugin \
        -DgroupId="de.fabiankeller.palladio" \
        -DartifactId=$name \
        -Dversion=$version \
        -Dpackaging=jar \
        -DlocalRepositoryPath=./pathing/.m2/
done
{'fraction_non_alphanumeric': 0.14768624876928127, 'fraction_numerical': 0.008861174926156876, 'mean_word_length': 2.3866666666666667, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5692422', 'n_tokens_mistral': 1017, 'n_tokens_neox': 976, 'n_words': 312}