blob: 529a9f86cce3826d3478e8750981d121a2440067 [file] [log] [blame]
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Usage: $0 IDEA_HOME"
echo "Example: $0 /opt/jetbrains/idea-IU-141.178.9"
exit 1
fi
if [[ ! -d "$1" ]]; then
echo "$1 is not a directory"
exit 1
fi
ideaHomeDir=$1
ideaHomeName=$(basename $ideaHomeDir)
ideaHomeRegex="idea-I[CU]-([0-9]+\.[0-9]+(\.[0-9]+)?)"
if [[ ! $ideaHomeName =~ $ideaHomeRegex ]]; then
echo "$ideaHomeDir does not appear to be an IDEA directory"
exit 1
fi
ideaVersion="${BASH_REMATCH[1]}"
if [[ ! -d $ideaHomeDir/lib ]]; then
echo "$ideaHomeDir/lib does not exist or is not a directory"
exit 1
fi
for artifactPath in $ideaHomeDir/lib/*.jar; do
artifact=$(basename $artifactPath .jar)
if [[ -f $artifactPath ]]; then
mvn install:install-file \
-DgroupId=com.jetbrains.intellij.platform \
-DartifactId=$artifact \
-Dversion=$ideaVersion \
-Dpackaging=jar \
-Dfile=$artifactPath
else
echo "$artifactPath not found"
fi
done