-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.xml
90 lines (72 loc) · 3.43 KB
/
install.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="WPILib Installation" default="install">
<!-- Load the build properties file. -->
<property file="build.properties"/>
<!-- Set these to the same values that are in build.xml, defaults should be fine. -->
<property name="wpilib" value="wpilib"/>
<property name="userLibs.dir" value="${wpilib}/userLibs"/>
<target name="clean" depends="wpilib.check" if="wpilib.exists">
<delete dir="${wpilib}"/>
<echo>WPILib Removed</echo>
</target>
<!-- Main target, chains the installation of WPILib, and user libraries as needed. -->
<target name="install" depends="doInstall, installCtre"/>
<!-- Install the WPILib library, but check to see if it's installed first, and abort if it is. -->
<target name="doInstall" depends="wpilib.check" unless="wpilib.exists">
<!-- Make the WPILib directory. -->
<mkdir dir="${wpilib}"/>
<!-- Get the WPILib Eclipse Java Plugin - the URL should be in build.properties. -->
<get src="${wpilib.pluginURL}" dest="${wpilib}/plugin.jar"/>
<!-- Unzip the Plugin, extracting only the java.zip file contained in it. This file has the
WPILib libraries and ANT scripts in it. Delete the plugin when done. -->
<unzip src="${wpilib}/plugin.jar" dest="${wpilib}">
<patternset>
<include name="resources/java.zip"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<delete file="${wpilib}/plugin.jar"/>
<!-- Unzip the java.zip file from the plugin to the WPILib directory, deleting when done. -->
<unzip src="${wpilib}/java.zip" dest="${wpilib}"/>
<delete file="${wpilib}/java.zip"/>
<!-- Make the user library and docs directories. -->
<mkdir dir="${userLibs.dir}"/>
<mkdir dir="${userLibs.dir}/docs"/>
<echo>WPILib Installed</echo>
</target>
<!-- Target to install the CTRE Libraries for the CAN Talon, HERO board and other hardware.
Only executes if the userLibInstallCtre property is set to true or yes. Will overwrite
any existing versions. -->
<target name="installCtre" depends="wpilib.check" if="wpilib.installCtre">
<!-- Get the CTRE Library - the URL should be in build.properties. -->
<get src="${userLibInstallCtre.URL}" dest="${wpilib}/CTRE.zip"/>
<!-- Unzip the java portion of the library only, and delete when done. -->
<unzip src="${wpilib}/CTRE.zip" dest="${userLibs.dir}">
<patternset>
<include name="java/lib/*"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<delete file="${wpilib}/CTRE.zip"/>
<!-- Get the CTRE Documentation - the URL should be in build.properties. -->
<get src="${userLibInstallCtre.docURL}" dest="${wpilib}/CTRE_docs.zip"/>
<!-- Create the CTRE documentation directory, and unzip the java docs into it, deleting when done. -->
<mkdir dir="${userLibs.dir}/docs/ctre"/>
<unzip src="${wpilib}/CTRE_docs.zip" dest="${userLibs.dir}/docs/ctre">
<patternset>
<include name="CTRE Toolsuite API Documentation/java/**"/>
</patternset>
<cutdirsmapper dirs="2"/>
</unzip>
<delete file="${wpilib}/CTRE_docs.zip"/>
<echo>CTRE Library and Documentation Installed</echo>
</target>
<target name="wpilib.check">
<condition property="wpilib.exists">
<available file="${wpilib}" type="dir"/>
</condition>
<condition property="wpilib.installCtre">
<istrue value="${userLibInstallCtre}"/>
</condition>
</target>
</project>