-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from vokseverk/update-build-system
Preparation for version 1.0
- Loading branch information
Showing
22 changed files
with
612 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
PACKAGE_NAME=ImageHotspot | ||
|
||
# Get the current version | ||
VERSION=`grep -o ' packageVersion \"\(.*\)\"' src/version.ent | awk '{print $2}' | sed 's/"//g'` | ||
VERSION=`grep -o ' packageVersion \"\(.*\)\"' src/package.ent | awk '{print $2}' | sed 's/"//g'` | ||
NAMESPACE=`grep -o ' orgNamespace \"\(.*\)\"' src/package.ent | awk '{print $2}' | sed 's/"//g'` | ||
PACKAGE=`grep -o ' propertyEditorAlias \"\(.*\)\"' src/package.ent | awk '{print $2}' | sed 's/"//g'` | ||
PKG_NAME="${NAMESPACE}.${PACKAGE}" | ||
|
||
# Create the dist directory if needed | ||
if [[ ! -d dist ]] | ||
then mkdir dist | ||
fi | ||
# Likewise, create the package dir | ||
if [[ ! -d package ]] | ||
then mkdir package | ||
then mkdir -p dist/package | ||
else | ||
rm dist/package/*.* | ||
fi | ||
|
||
# Transform the package.xml file, pulling in the README | ||
xsltproc --novalid --xinclude --output package/package.xml lib/packager.xslt src/package.xml | ||
# Copy files | ||
cp src/*.css dist/package/ | ||
cp src/*.js dist/package/ | ||
cp src/*.html dist/package/ | ||
# cp src/lang/*.xml dist/package/ | ||
|
||
# Copy files into package | ||
cp src/*.js package/ | ||
cp src/*.css package/ | ||
cp src/*.html package/ | ||
cp src/*.manifest package/ | ||
# Copy the Value Converters to the dist/ folder | ||
cp src/*.cs dist/ | ||
|
||
# Build the ZIP file | ||
zip -j "dist/Vokseverk.$PACKAGE_NAME-$VERSION.zip" package/* -x \*.DS_Store | ||
# Transform the package.xml file | ||
xsltproc --novalid --xinclude --output dist/package/package.xml lib/packager.xslt src/package.xml | ||
|
||
# Copy the PropertyConverter file for manual distribution | ||
cp src/*.cs dist/ | ||
# Transform the manifest.xml file | ||
xsltproc --novalid --xinclude --output dist/package/package.manifest lib/manifester.xslt src/manifest.xml | ||
|
||
|
||
# Build the ZIP file | ||
zip -j "dist/${PKG_NAME}-${VERSION}.zip" dist/package/* -x \*.DS_Store |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!DOCTYPE xsl:stylesheet [ | ||
<!ENTITY % packageInfo SYSTEM "../src/package.ent"> | ||
%packageInfo; | ||
]> | ||
<!-- | ||
This stylesheet transforms a `manifest.xml` file into the `package.manifest`. | ||
Yes, this is XSLT building JSON so don't look if you're not into either :) | ||
You're welcome to ask me anything about this though. | ||
--> | ||
<xsl:stylesheet | ||
version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:str="http://exslt.org/strings" | ||
exclude-result-prefixes="str" | ||
> | ||
<xsl:output method="text" | ||
indent="yes" | ||
omit-xml-declaration="yes" | ||
/> | ||
|
||
<xsl:variable name="packageAlias" select="'&packageAlias;'" /> | ||
<xsl:variable name="version" select="'v&packageVersion;'" /> | ||
|
||
<xsl:variable name="quot">"</xsl:variable> | ||
<xsl:variable name="objStart">{</xsl:variable> | ||
<xsl:variable name="objEnd">}</xsl:variable> | ||
<xsl:variable name="newline">__NEWLINE__</xsl:variable> | ||
<xsl:variable name="indent">__INDENT__</xsl:variable> | ||
|
||
<xsl:template match="manifest"> | ||
<xsl:value-of select="$objStart" /> | ||
<xsl:text>propertyEditors: [</xsl:text> | ||
<xsl:apply-templates select="propertyEditor" /> | ||
<xsl:text>],</xsl:text> | ||
|
||
<xsl:text>css: [</xsl:text> | ||
<xsl:for-each select="css"> | ||
<xsl:apply-templates select="." mode="quoted" /> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:for-each> | ||
<xsl:text>],</xsl:text> | ||
|
||
<xsl:text>javascript: [</xsl:text> | ||
<xsl:for-each select="javascript"> | ||
<xsl:apply-templates select="." mode="quoted" /> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:for-each> | ||
<xsl:text>]</xsl:text> | ||
<xsl:text>}</xsl:text> | ||
</xsl:template> | ||
|
||
<xsl:template match="propertyEditor | field"> | ||
<xsl:text>{</xsl:text> | ||
<xsl:apply-templates select="*" mode="json" /> | ||
<xsl:text>}</xsl:text> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="prevalues" mode="json"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: {</xsl:text> | ||
<xsl:text>fields: [</xsl:text> | ||
<xsl:apply-templates select="field" /> | ||
<xsl:text>]</xsl:text> | ||
<xsl:text>}</xsl:text> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<!-- == == == == == == --> | ||
|
||
<xsl:template match="view[contains(., '.')]" mode="json"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: "</xsl:text> | ||
<xsl:apply-templates select="." mode="versioned" /> | ||
<xsl:text>"</xsl:text> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="*" mode="array"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: [</xsl:text> | ||
<xsl:apply-templates select="*" mode="json" /> | ||
<xsl:text>]</xsl:text> | ||
</xsl:template> | ||
|
||
<xsl:template match="*" mode="json" priority="-1"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: </xsl:text> | ||
<xsl:apply-templates select="text()" mode="quoted" /> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="*[. = 'true'] | *[. = 'false']" mode="json"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: </xsl:text> | ||
<xsl:value-of select="." /> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="*[not(text()) and not(*)]" mode="json"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: ""</xsl:text> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="@*" mode="json" priority="-1"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: </xsl:text> | ||
<xsl:apply-templates select="text()" mode="quoted" /> | ||
</xsl:template> | ||
|
||
<xsl:template match="*[@type = 'int'] | *[@type = 'bool']" mode="json" priority="-1"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: </xsl:text> | ||
<xsl:value-of select="." /> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="*[*]" mode="json" priority="-1"> | ||
<xsl:value-of select="name()" /> | ||
<xsl:text>: {</xsl:text> | ||
<xsl:apply-templates select="*" mode="json" /> | ||
<xsl:text>}</xsl:text> | ||
<xsl:if test="not(position() = last())">, </xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="css | javascript" mode="quoted"> | ||
<xsl:text>"</xsl:text> | ||
<xsl:apply-templates select="." mode="versioned" /> | ||
<xsl:text>"</xsl:text> | ||
</xsl:template> | ||
|
||
<xsl:template match="text()" mode="quoted"> | ||
<xsl:value-of select="concat($quot, ., $quot)" /> | ||
</xsl:template> | ||
|
||
<xsl:template match="*" mode="versioned"> | ||
<xsl:variable name="pluginpath" select="concat('~/App_Plugins/', $packageAlias, '/')" /> | ||
<xsl:variable name="parts" select="str:split(., '.')" /> | ||
<xsl:value-of select="$pluginpath" /> | ||
<xsl:for-each select="$parts"> | ||
<xsl:if test="not(position() = 1) and not(position() = last())">.</xsl:if> | ||
<xsl:if test="not(position() = last())"> | ||
<xsl:value-of select="." /> | ||
</xsl:if> | ||
<xsl:if test="position() = last()"> | ||
<xsl:value-of select="concat('-', $version, '.', .)" /> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
Oops, something went wrong.