Skip to content

Commit d86a41b

Browse files
committed
Merge pull request #268 from fat-troll/master
Fixed build with `make xpi`
2 parents 9324a3b + daee299 commit d86a41b

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

Makefile

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
PROJECT="seleniumbuilder"
2-
PWD=`pwd`
3-
BUILD="build"
4-
JS_VERSION=$(shell cat `find . -name loader.js` | grep 'builder.version = ".*"' | cut -d '"' -f 2 )
5-
RDF_VERSION=$(shell grep -Go 'em:version\>\(.*\)\<' seleniumbuilder/install.rdf | grep -Go '>\(.*\)<' | sed -e 's/[><]*//g' )
6-
NAME="${PROJECT}-${JS_VERSION}.xpi"
7-
XPI="${PWD}/${BUILD}/${NAME}"
8-
INSTALL_RDF=$(shell find . -name install.rdf)
2+
BUILD_PATH="build"
3+
PWD=$(shell pwd)
4+
LOADER_JS=$(shell find . -name loader.js)
5+
RDF_PATH=$(shell find . -name *.rdf)
6+
BUILDER_VERSION=$(shell cat ${LOADER_JS} | grep -m1 'builder\.version' | cut -d '"' -f 2)
7+
XPI_NAME="${PROJECT}-${BUILDER_VERSION}.xpi"
8+
XPI_PATH="${PWD}/${BUILD_PATH}/${XPI_NAME}"
9+
910
.PHONY: xpi clean
1011

1112
help:
12-
@echo "Selenium Builder - v${JS_VERSION}\n"
13-
13+
@echo "Selenium Builder - v${BUILDER_VERSION}\n"
1414
@echo "Available targets:"
1515
@echo "xpi: creates the plugin file"
16-
@echo "clean: deletes the generated artifacts"
16+
@echo "clean: deletes generated build folder"
1717

1818
xpi:
19-
@echo "Building latest '${XPI}'..."
20-
@mkdir -p ${BUILD}
21-
@find . -iname "*.rdf" | xargs grep -l "em:version" | xargs sed -i "" -e 's#<em:version>\([^<][^<]*\)</em:version>#<em:version>${JS_VERSION}</em:version>#'
22-
@cd seleniumbuilder; zip -r ../build/${NAME} .
23-
@echo "File generated at: build/${NAME}"
19+
@echo "Building latest '${XPI_PATH}':\n"
20+
@mkdir -p ${BUILD_PATH}
21+
@sed -i.bak "s#\(em:version>\)[^<>]*\(</em:version\)#\1${BUILDER_VERSION}\2#" ${RDF_PATH}
22+
@rm -f ${RDF_PATH}.bak
23+
@cd ${PROJECT} && zip -r ../${BUILD_PATH}/${XPI_NAME} .
24+
@echo "File generated at: ${PWD}/${BUILD_PATH}/${XPI_NAME}"
2425

2526
clean:
26-
@echo "Removing '${PWD}/${BUILD}'..."
27-
@rm -rf ${BUILD}
27+
@rm -rf ${BUILD_PATH}
28+
@echo "'${PWD}/${BUILD_PATH}' cleaned"

0 commit comments

Comments
 (0)