jdbruijn / MPLABX_Travis-CI_Example.X

Example MPLABX project with automated build on Travis CI
MIT License
9 stars 1 forks source link

Faster build time #1

Open vidavidorra opened 8 years ago

vidavidorra commented 8 years ago

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

vidavidorra commented 8 years ago

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.