Skip to content

Commit

Permalink
Add script to build boards manager package, update .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Oct 30, 2015
1 parent 17e7893 commit 4bd694b
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 78 deletions.
84 changes: 6 additions & 78 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,79 +1,7 @@
app/bin/
app/pde.jar
build/macosx/work/
arduino-core/bin/
arduino-core/arduino-core.jar
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.o
hardware/arduino/bootloaders/caterina_LUFA/Descriptors.lst
hardware/arduino/bootloaders/caterina_LUFA/Caterina.sym
hardware/arduino/bootloaders/caterina_LUFA/Caterina.o
hardware/arduino/bootloaders/caterina_LUFA/Caterina.map
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lst
hardware/arduino/bootloaders/caterina_LUFA/Caterina.lss
hardware/arduino/bootloaders/caterina_LUFA/Caterina.elf
hardware/arduino/bootloaders/caterina_LUFA/Caterina.eep
hardware/arduino/bootloaders/caterina_LUFA/.dep/
build/*.zip
build/windows/work/
build/windows/*.zip
build/windows/*.tgz
build/windows/libastylej*
build/windows/arduino-*.zip
build/windows/dist/*.tar.gz
build/windows/dist/*.tar.bz2
build/windows/launch4j-*.tgz
build/windows/launch4j-*.zip
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
build/macosx/arduino-*.zip
build/macosx/dist/*.tar.gz
build/macosx/dist/*.tar.bz2
build/macosx/*.tar.bz2
build/macosx/libastylej*
build/macosx/appbundler*.jar
build/macosx/appbundler*.zip
build/macosx/appbundler
build/macosx/appbundler-1.0ea-arduino2
build/macosx/appbundler-1.0ea-upstream1
build/linux/work/
build/linux/dist/*.tar.gz
build/linux/dist/*.tar.bz2
build/linux/*.tgz
build/linux/*.tar.xz
build/linux/*.tar.bz2
build/linux/*.zip
build/linux/libastylej*
build/shared/reference*.zip
build/shared/Edison*.zip
build/shared/Galileo*.zip
test-bin
*.iml
.idea
.DS_Store
.directory
hardware/arduino/avr/libraries/Bridge/examples/XivelyClient/passwords.h
avr-toolchain-*.zip
/hardware/tools/esp8266/utils/
/hardware/tools/esp8266/xtensa-lx106-elf
/hardware/tools/esp8266/esptool.exe
/hardware/esp8266com/esp8266/tools/xtensa*
/hardware/esp8266com/esp8266/tools/esptool*
/hardware/esp8266com/esp8266/tools/utils
/hardware/tools/avr/
/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/
/hardware/tools/bossac.exe
/hardware/tools/listComPorts.exe

/app/nbproject/private/
/arduino-core/nbproject/private/
/app/build/
/arduino-core/build/

manifest.mf
nbbuild.xml
nbproject
build/macosx/esptool-*-osx.zip

build/macosx/dist/osx-xtensa-lx106-elf.tgz
/docs/lib_dump/full
/docs/lib_dump
tools/dist/
tools/xtensa-lx106-elf/
tools/esptool/
tools/mkspiffs/
versions/
exclude.txt
146 changes: 146 additions & 0 deletions build_boards_manager_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/bin/bash
#

# Set REMOTE_URL environment variable to the address where the package will be
# available for download. This gets written into package json file.
if [ -z "$REMOTE_URL" ]; then
REMOTE_URL="http://localhost:8000"
echo "REMOTE_URL not defined, using default"
fi
echo "Remote: $REMOTE_URL"

# Figure out how will the package be called
ver=`git describe --tags --always`
package_name=esp8266-$ver
echo "Version: $ver"
echo "Package name: $package_name"

# Create directory for the package
outdir=versions/$ver/$package_name
srcdir=$PWD
rm -rf versions/$ver
mkdir -p $outdir

# Some files should be excluded from the package
cat << EOF > exclude.txt
versions
.git
.gitignore
.travis.yml
build_boards_manager_package.sh
EOF
# Also include all files which are ignored by git
git ls-files --other --ignored --exclude-standard --directory >> exclude.txt
# Now copy files to $outdir
rsync -a --exclude-from 'exclude.txt' $srcdir/ $outdir/
rm exclude.txt

# Get additional libraries (TODO: add them as git submodule or subtree?)
wget -q -O SoftwareSerial.zip https://github.com/plerup/espsoftwareserial/archive/38259afcab9c291dbb6216f827d9a3738abf1868.zip
unzip -q SoftwareSerial.zip
rm -rf SoftwareSerial.zip
mv espsoftwareserial-* SoftwareSerial
mv SoftwareSerial $outdir/libraries

# For compatibility, on OS X we need GNU sed which is usually called 'gsed'
if [ "$(uname)" == "Darwin" ]; then
SED=gsed
else
SED=sed
fi

# Do some replacements in platform.txt file, which are required because IDE
# handles tool paths differently when package is installed in hardware folder
cat $srcdir/platform.txt | \
$SED 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \
$SED 's/runtime.tools.esptool.path={runtime.platform.path}\/tools\/esptool//g' | \
$SED 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' | \
$SED 's/tools.mkspiffs.path={runtime.platform.path}\/tools\/mkspiffs/tools.mkspiffs.path=\{runtime.tools.mkspiffs.path\}/g' \
> $outdir/platform.txt

# Zip the package
pushd versions/$ver
echo "Making $package_name.zip"
zip -qr $package_name.zip $package_name
rm -rf $package_name

# Calculate SHA sum and size
sha=`shasum -a 256 $package_name.zip | cut -f 1 -d ' '`
size=`/bin/ls -l $package_name.zip | awk '{print $5}'`
echo Size: $size
echo SHA-256: $sha

echo "Making package_esp8266com_index.json"
cat << EOF > package_esp8266com_index.json
{
"packages": [ {
"name":"esp8266",
"maintainer":"ESP8266 Community",
"websiteURL":"https://github.com/esp8266/Arduino",
"email":"[email protected]",
"help":{
"online":"$REMOTE_URL/versions/$ver/doc/reference.html"
},
"platforms": [ {
"name":"esp8266",
"architecture":"esp8266",
"version":"$ver",
"category":"ESP8266",
"url":"$REMOTE_URL/versions/$ver/$package_name.zip",
"archiveFileName":"$package_name.zip",
"checksum":"SHA-256:$sha",
"size":"$size",
"help":{
"online":"$REMOTE_URL/versions/$ver/doc/reference.html"
},
"boards":[
{
"name":"Generic ESP8266 Module"
},
{
"name":"Olimex MOD-WIFI-ESP8266(-DEV)"
},
{
"name":"NodeMCU 0.9 (ESP-12 Module)"
},
{
"name":"NodeMCU 1.0 (ESP-12E Module)"
},
{
"name":"Adafruit HUZZAH ESP8266 (ESP-12)"
},
{
"name":"SparkFun Thing"
},
{
"name":"SweetPea ESP-210"
}
],
"toolsDependencies":[ {
"packager":"esp8266",
"name":"esptool",
"version":"0.4.6"
},
{
"packager":"esp8266",
"name":"xtensa-lx106-elf-gcc",
"version":"1.20.0-26-gb404fb9-2"
},
{
"packager":"esp8266",
"name":"mkspiffs",
"version":"0.1.2"
} ]
} ],
"tools":
EOF

cat $srcdir/tools/tools.json >> package_esp8266com_index.json

cat << EOF >> package_esp8266com_index.json
} ]
}
EOF

popd

0 comments on commit 4bd694b

Please sign in to comment.