Skip to content

Commit

Permalink
Some fixes in the build scripts:
Browse files Browse the repository at this point in the history
- various assemble tasks work again;
- upgraded the JarBundler library to the newest version available;
- other dings and dents fixed.
  • Loading branch information
Jan Willem Janssen committed May 6, 2014
1 parent ece4d47 commit 03f939b
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 47 deletions.
89 changes: 89 additions & 0 deletions build/app-bundle-osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash
#
# Script to create a disk image from an OSX App. Based on <http://stackoverflow.com/a/1513578/229140>

# Include current version & name...
. ./ols.version

src_dir=generated/osx
tmp_dmg=generated/ols-tmp.dmg
out_dmg=generated/ols-${ols_version}-full.dmg
mnt_pnt=/Volumes/${ols_shortName}

# Clean up stuff from earlier runs...
if [ -f ${tmp_dmg} ]; then
rm -f ${tmp_dmg}
fi
if [ -f ${out_dmg} ]; then
rm -f ${out_dmg}
fi

size=$((2 + $(du -mc "${src_dir}" | tail -1 | awk '{print $1}')))

echo "Creating temporary disk image of $size MB..."
hdiutil create -srcfolder "${src_dir}" -volname "${ols_shortName}" -fs 'HFS+' -fsargs "-c c=64,a=16,e=16" -format UDRW -size "${size}M" ${tmp_dmg} -quiet

echo "Mounting temporary disk image & arranging stuff..."
device=$(hdiutil attach -readwrite -noverify -noautoopen "${tmp_dmg}" | egrep '^/dev/' | sed 1q | awk '{print $1}')

osascript <<EOF
tell application "Finder"
repeat until exists disk "${ols_shortName}"
delay 1
end repeat
tell disk "${ols_shortName}"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 430}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 96
set background picture of theViewOptions to file ".background:background.png"
-- make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
do shell script "ln -s /Applications /Volumes/LogicSniffer/Applications"
set position of item "${ols_shortName}" of container window to {90, 165}
set position of item "Applications" of container window to {395, 165}
close
open
update with necessity without registering applications
update without registering applications
delay 5
close
end tell
end tell
EOF

icon="resources/Package.icns"
tmp_icon="generated/icon-resource.r"

echo "read 'icns' (-16455) \"${icon}\";" > ${tmp_icon}
ifile="`printf \"${mnt_pnt}/Icon\r\"`"
Rez -o "${ifile}" ${tmp_icon} || exit $?
#rm -f ${tmp_icon}
SetFile -a C "${mnt_pnt}"
SetFile -a V "${ifile}"

sync && sync

if [ -d ${mnt_pnt} ]; then
echo "Unmounting disk..."
hdiutil detach "${device}" -quiet || hdiutil detach -force "${device}" -quiet

if [ -d ${mnt_pnt} ]; then
echo "Forcing unmount of disk..."
diskutil unmount force ${mnt_pnt}
fi
fi

# echo "Resizing temporary disk image..."
# hdiutil resize -shrinkonly -size min -nofinalgap "${tmp_dmg}"

echo "Converting temporary disk image to final disk image..."
hdiutil convert "${tmp_dmg}" -format UDZO -o "${out_dmg}" -quiet && rm -f "${tmp_dmg}"

echo "Internet-enabling final disk image..."
hdiutil internet-enable -yes ${out_dmg} -quiet

###EOF###
112 changes: 112 additions & 0 deletions build/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import org.apache.tools.ant.taskdefs.condition.Os
import org.apache.tools.ant.filters.ReplaceTokens

assert(project != rootProject)

loadProperties "ols.version"

def loadProperties(String sourceFileName) {
def config = new Properties()
def propFile = new File(sourceFileName)
if (propFile.canRead()) {
config.load(new FileInputStream(propFile))
for (Map.Entry property in config) {
ext[property.key] = property.value;
}
}
}

def createDir(String name) {
def dir = file(name)
if ((!dir.exists() && !dir.mkdirs()) || !dir.isDirectory()) {
throw new GradleException("Could not create directory $dir")
}
dir
}

// Preparation
def releaseBase = createDir('generated/release')
def releaseBin = createDir("$releaseBase/bin")
def releasePlugins = createDir("$releaseBase/plugins")

task packageRelease {
description "Assembles release artifacts."
group "Release"

doLast {
ant.taskdef(name: 'createDist', classname: 'aQute.bnd.ant.RunconfigToDistributionTask', classpath: "../cnf/gradle/dependencies/biz.aQute.bnd.jar")

delete "$releasePlugins"

ant.createDist(rootDir: '..', allowSnapshots: 'true', bndFile: 'local.bndrun', outputdir: "$releasePlugins")

/* The actual runner + fw */
copy {
into "$releaseBin"
include '*.jar'
from '../runner/generated'
from 'resources/lib'
}

/* the run scripts */
copy {
into "$releaseBase"
filter(ReplaceTokens, tokens: ['ols_shortName': ols_shortName, 'ols_version': ols_version])
from('resources/run') {
include '*.sh'
fileMode 0755
}
from('resources/run') {
exclude '*.sh'
fileMode 0644
}
}
}
}

task createZipball(type: Zip) {
destinationDir = file('generated')
archiveName = "ols-${ols_version}-full.zip"
from "$releaseBase"
}

task createTarball(type: Tar) {
destinationDir = file('generated')
archiveName = "ols-${ols_version}-full.tar.gz"
compression = "gzip"
from "$releaseBase"
}

task createDiskImage {
onlyIf {
/* only run this task on OSX/Darwin */
Os.isFamily(Os.FAMILY_MAC)
}
doLast {
ant.taskdef(name: 'jarBundler', classname: 'net.sourceforge.jarbundler.JarBundler', classpath: "../cnf/buildrepo/net.sourceforge.jarbundler/jarbundler-2.3.0.jar")

def osxBase = createDir('generated/osx')
def bgDir = createDir("$osxBase/.background")

copy {
from('resources')
into "$bgDir"
include 'background.png'
}

ant.jarBundler(dir: "$osxBase", bundleid: 'nl.lxtreme.ols', name: "$ols_shortName", shortname: "$ols_shortName", mainclass: 'nl.lxtreme.ols.runner.Runner', version: "$ols_version", build: '1', jvmversion: '1.6+', workingdirectory: '$APP_PACKAGE/Contents/Resources/Java', vmoptions: '-Xmx1024m', icon: 'resources/LogicSniffer.icns', arguments: '-logToFile') {
/* put all bin/*.jar files on the class path */
jarfileset(dir: "$releaseBase", includes: "bin/*.jar", excludes: "bin/jgoodies*.jar")
javafileset(dir: "$releaseBase", includes: "plugins/*.*", excludes: "plugins/*gogo*.jar")
}
}
}

createZipball.mustRunAfter packageRelease
createTarball.mustRunAfter packageRelease
createDiskImage.mustRunAfter packageRelease

assemble.dependsOn packageRelease
assemble.dependsOn createZipball
assemble.dependsOn createTarball
assemble.dependsOn createDiskImage
2 changes: 1 addition & 1 deletion build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<fail message="No release version is defined! Cannot continue..." unless="release.version" />

<taskdef name="createDist" classname="aQute.bnd.ant.RunconfigToDistributionTask" classpath="../cnf/gradle/dependencies/biz.aQute.bnd.jar" />
<taskdef name="jarBundler" classname="net.sourceforge.jarbundler.JarBundler" classpath="../cnf/buildrepo/net.sourceforge.jarbundler/jarbundler-2.1.0.jar" />
<taskdef name="jarBundler" classname="net.sourceforge.jarbundler.JarBundler" classpath="../cnf/buildrepo/net.sourceforge.jarbundler/jarbundler-2.3.0.jar" />

<condition property="isMac">
<and>
Expand Down
2 changes: 1 addition & 1 deletion build/local.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
ols.tool.spi;version=latest,\
ols.tool.state;version=latest,\
ols.tool.uart;version=latest,\
org.apache.felix.configadmin;version=latest,\
org.apache.felix.configadmin;version='[1.4,1.6)',\
org.apache.felix.dependencymanager;version='[3.1.0,3.1.1)',\
org.apache.felix.dependencymanager.shell;version='[3.0.1,3.0.2)',\
org.apache.felix.eventadmin;version='[1.3.2,1.3.3)',\
Expand Down
4 changes: 2 additions & 2 deletions build/ols.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ols.shortName=LogicSniffer
ols.version=0.9.8.snapshot
ols_shortName=LogicSniffer
ols_version=0.9.8.snapshot
37 changes: 0 additions & 37 deletions build/resources/app-bundle-osx.sh

This file was deleted.

4 changes: 2 additions & 2 deletions build/resources/run/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenBench LogicSniffer Client
#############################
OpenBench LogicSniffer Client - @ols_version@
######################################
J.W. Janssen, <[email protected]>


Expand Down
2 changes: 1 addition & 1 deletion build/resources/run/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ platformOpts=
java -Xdock:name="test" -version 1>/dev/null 2>&1
if [ "$?" -eq "0" ]; then
# running on OSX
platformOpts="-Xdock:name=@ols.shortName@ -Dcom.apple.mrj.application.apple.menu.about.name=@ols.shortName@"
platformOpts="-Xdock:name=@ols_shortName@ -Dcom.apple.mrj.application.apple.menu.about.name=@ols_shortName@"
else
# running on other platforms
platformOpts="-DPlastic.defaultTheme=SkyBluer -Dswing.defaultlaf=com.jgoodies.looks.plastic.Plastic3DLookAndFeel"
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion ols.client/project.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Bundle-License: GPLv2;link=http://www.gnu.org/licenses/gpl-2.0.html
Bundle-Activator: nl.lxtreme.ols.client.project.impl.Activator
Private-Package: nl.lxtreme.ols.client.project.impl
Export-Package: nl.lxtreme.ols.client.project
X-ClientVersion = ${ols.version}
X-ClientVersion = ${ols_version}
4 changes: 2 additions & 2 deletions ols.client/ui.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Private-Package: \
nl.lxtreme.ols.client2.session,\
nl.lxtreme.ols.client2.usersettings,\
nl.lxtreme.ols.client2.views.*
X-ClientVersion = ${ols.version}
X-ClientIncidentAddress = info+v${ols.version}@lxtreme.nl
X-ClientVersion = ${ols_version}
X-ClientIncidentAddress = info+v${ols_version}@lxtreme.nl

0 comments on commit 03f939b

Please sign in to comment.