Faster build time
Opened this issue · 1 comments
Info
When building on the Travis CI server the travis-install-dependencies.sh
script is called. This downloads and installs the MPLAB X IDE and compiler, where the IDE is around 550 MB and takes about a minute to install (strongly depending on the workload of the servers).
It would be nice to make shorten the time needed to download and install this IDE. To clarify, from the downloaded IDE only Java, the prjMakefilesGenerator.sh
script and the config file are used. This is about 200 MB and it would be quicker to install just the files that are needed for the build.
Generate make files script
#!/bin/sh
export here=`dirname $0`
export mplabx_dir=$here/..
export netbeans_dir=$mplabx_dir
export development_netbeans_dir=$mplabx_dir/mplabide-nb-platform/nbbuild/netbeans
if [ -d $development_netbeans_dir ];
then export netbeans_dir=$development_netbeans_dir
fi
export gen_jar=$mplabx_dir/lib/PrjMakefilesGenerator.jar
export os=`uname`
# the file ../mplab_ide.conf contains the jdkhome. Extract this value.
# if you are using bash you can simply do:
# source ../etc/mplab_ide.conf
# instead of the following line
export eval `cat $here/../etc/mplab_ide.conf | sed -n /^jdkhome/p | sed -e 's/\"//g' -e 's/\/$//'`
export jvm=$jdkhome/bin/java
$jvm -jar $gen_jar "$@"
In this make file script the following variables are used.
Variable | Path (in my example build) | Additional information |
---|---|---|
here |
/opt/microchip/mplabx/v3.15/mplab_ide/bin |
|
mplabx_dir |
/opt/microchip/mplabx/v3.15/mplab_ide |
|
netbeans_dir |
/opt/microchip/mplabx/v3.15/mplab_ide |
|
development_netbeans_dir |
/opt/microchip/mplabx/v3.15/mplab_ide/mplabide-nb-platform/nbbuild/netbeans |
non existing directory |
gen_jar |
opt/microchip/mplabx/v3.15/mplab_ide/lib/PrjMakefilesGenerator.jar |
|
os |
Linux |
|
jdkhome |
/opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60 |
|
jvm |
/opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60/bin/java |
So at least the following files/folders would be needed to run this script.
File/folder | Path | Used for |
---|---|---|
mplab_ide.conf |
/opt/microchip/mplabx/v3.15/mplab_ide/etc/mplab_ide.conf |
extracting the jdkhome variable |
JDK home | /opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60 |
maby running the JVM |
jvm |
/opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60/bin/java |
running the JVM |
Which would result in a size of around 200 MB.
Possible solution
In order to reduce the time needed for downloading and installing this IDE a custom package for the IDE would need to be made. This package needs to contain at least the files and folders listed in the table above Along with the files of that script obviously. This would result in the following files and folders.
/opt/microchip/mplabx/v3.15/mplab_ide/bin/prjMakefilesGenerator.sh
/opt/microchip/mplabx/v3.15/mplab_ide/lib/PrjMakefilesGenerator.jar
/opt/microchip/mplabx/v3.15/mplab_ide/mplabide-nb-platform/nbbuild/netbeans *if it exists*
/opt/microchip/mplabx/v3.15/mplab_ide/etc/mplab_ide.conf
/opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60 *or maybe just the bin/java folder which is listed below*
/opt/microchip/mplabx/v3.15/sys/java/jre1.8.0_60/bin/java
It those files and folders could be placed in a .tar.gz
archive which would only need to be extracted it could result in reducing the time needed for the build with about 80 seconds, which would be about 40 % (based on a build time of 3 minutes).
Steps
- Create a clean Linux VM with the MPLAB X IDE installed and this MPLAB X project to test the make files generator script;
- Find out whether the list above is complete by removing all the other files on the Linux machine and checking whether the
prjMakefilesGenerator.sh
script still works; - Create a custom
.tar.gz
archive containing the files and folders listed above; - Create a new clean Linux VM and clone this MPLAB X project on it;
- Put the previously made
.tar.gz
archive on the new clean Linux VM and extract it; - Check whether the
prjMakefilesGenerator.sh
script works; - Adjust the
prjMakefilesGenerator.sh
script if needed and test again; - Test the created
.tar.gz
archive on a Travis CI build and measure the time needed for downloading and extracting the archive to see if the time is improved; - Release the
.tar.gz
archive and create instructions on how to use it.
I have done a base test on the time needed for downloading and installing the IDE and compiler, of which the results can be found in the table below.
Description | Size [MB] (optional) | Time [s] |
---|---|---|
Downloading IDE | 548 | 47 |
Unpacking IDE | 0 | |
Installing IDE | 61 | |
Downloading compiler | 59 | 3.5 |
Installing compiler | 37 | |
Total | 149.51 |
These times are based on this build.