-
Notifications
You must be signed in to change notification settings - Fork 10
/
extract-sdk.sh
executable file
·106 lines (75 loc) · 2.76 KB
/
extract-sdk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
IDEA_HOME="$1"
version="$2"
mkdir -p idea-sdk-$version
cat << HEADER | tee idea-sdk-$version/pom.xml > idea-sdk-$version/install-libs.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is a generated file, do not edit manually unless you know what you are doing.
To regenerate the file issue following command in the ali-idea-plugin directory (bash needed):
$ ant extract-sdk -DIDEA_HOME=<Idea $version Directory>
-->
HEADER
cat << ANT_HEADER >> idea-sdk-$version/install-libs.xml
<project name="install-libs">
<import file="../build.xml"/>
<target name="install-libs" depends="setup-maven-linux,setup-maven-win">
ANT_HEADER
cat << POM_HEADER >> idea-sdk-$version/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ali-parent</artifactId>
<groupId>com.hp.alm.ali</groupId>
<version>3.17</version>
<relativePath>../ali-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>\${project.artifactId}:\${project.version}</name>
<artifactId>idea-sdk-$version</artifactId>
<dependencies>
POM_HEADER
function addDependency {
fullPath="$1"
groupId="$2"
prefix="$3"
file=`basename "$fullPath" .jar`
{
echo ' <exec executable="${maven.executable}">'
echo ' <arg value="install:install-file"/>'
echo ' <arg value="-DgroupId='$groupId'"/>'
echo ' <arg value="-Dpackaging=jar"/>'
echo ' <arg value="-Dfile=${IDEA_HOME}/'${prefix}'/'${file}'.jar"/>'
echo ' <arg value="-Dversion='$version'"/>'
echo ' <arg value="-DartifactId='${file}'"/>'
echo ' </exec>'
} >> idea-sdk-$version/install-libs.xml
cat <<DEPENDENCY >> idea-sdk-$version/pom.xml
<dependency>
<groupId>$groupId</groupId>
<artifactId>$file</artifactId>
<version>$version</version>
</dependency>
DEPENDENCY
}
for i in "$IDEA_HOME"/lib/*.jar ; do
addDependency "$i" "com.intellij" "lib"
done
for i in "$IDEA_HOME"/plugins/tasks/lib/*.jar ; do
addDependency "$i" "com.intellij.plugins.tasks" "plugins/tasks/lib"
done
for i in "$IDEA_HOME"/plugins/git4idea/lib/*.jar ; do
addDependency "$i" "com.intellij.plugins.git4idea" "plugins/git4idea/lib"
done
for i in "$IDEA_HOME"/plugins/svn4idea/lib/*.jar ; do
addDependency "$i" "com.intellij.plugins.svn4idea" "plugins/svn4idea/lib"
done
cat << FOOTER >> idea-sdk-$version/install-libs.xml
</target>
</project>
FOOTER
cat << POM_FOOTER >> idea-sdk-$version/pom.xml
</dependencies>
</project>
POM_FOOTER