-
Notifications
You must be signed in to change notification settings - Fork 46
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 #266 from owncloud/release/2.0.3
Release/2.0.3
- Loading branch information
Showing
29 changed files
with
2,509 additions
and
1,304 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ build/artifacts | |
.rvm | ||
report | ||
clover.xml | ||
build | ||
|
||
# just sane ignores | ||
.*.sw[po] | ||
|
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
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,106 +1,175 @@ | ||
# This file is licensed under the Affero General Public License version 3 or | ||
# later. See the COPYING file. | ||
# @author Bernhard Posselt <[email protected]> | ||
# @copyright Bernhard Posselt 2016 | ||
# @author Georg Ehrke <[email protected]> | ||
# @copyright Georg Ehrke 2016 | ||
|
||
# Generic Makefile for building and packaging a ownCloud app which uses npm and | ||
# Composer. | ||
# | ||
# ownCloud scaffolder tool | ||
# Dependencies: | ||
# * make | ||
# * which | ||
# * curl: used if phpunit and composer are not installed to fetch them from the web | ||
# * tar: for building the archive | ||
# * npm: for building and testing everything JS | ||
# | ||
# Copyright (C) 2013 Bernhard Posselt, <[email protected]> | ||
# If no composer.json is in the app root directory, the Composer step | ||
# will be skipped. The same goes for the package.json which can be located in | ||
# the app root or the js/ directory. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# The npm command by launches the npm build script: | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# npm run build | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
# Makefile for building the project | ||
app_name=notes | ||
project_dir=$(CURDIR)/../$(app_name) | ||
build_dir=$(CURDIR)/build/artifacts | ||
appstore_dir=$(build_dir)/appstore | ||
package_name=$(app_name) | ||
|
||
# binary directories for running the CI tests | ||
firefox_bin=/usr/bin/firefox | ||
chrome_bin=/usr/bin/chromium | ||
phantomjs_bin=/usr/bin/phantomjs | ||
|
||
js_dir=$(CURDIR)/js | ||
js_public_dir=$(js_dir)/public | ||
|
||
# common directories | ||
grunt_dir=$(js_dir)/node_modules/grunt-cli/bin/grunt | ||
bower_dir=$(js_dir)/node_modules/bower/bin/bower | ||
gruntfile_dir=$(js_dir)/Gruntfile.js | ||
|
||
php_unit_tests_dir=$(CURDIR)/tests/unit | ||
php_integration_tests_dir=$(CURDIR)/tests/integration | ||
php_acceptance_tests_dir=$(CURDIR)/tests/acceptance | ||
|
||
|
||
# The npm test command launches the npm test script: | ||
# | ||
# npm run test | ||
# | ||
# The idea behind this is to be completely testing and build tool agnostic. All | ||
# build tools and additional package managers should be installed locally in | ||
# your project, since this won't pollute people's global namespace. | ||
# | ||
# The following npm scripts in your package.json install and update the bower | ||
# and npm dependencies and use gulp as build system (notice how everything is | ||
# run from the node_modules folder): | ||
# | ||
# "scripts": { | ||
# "test": "node node_modules/gulp-cli/bin/gulp.js karma", | ||
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update", | ||
# "build": "node node_modules/gulp-cli/bin/gulp.js" | ||
# }, | ||
|
||
app_name=$(notdir $(CURDIR)) | ||
build_tools_directory=$(CURDIR)/build/tools | ||
source_build_directory=$(CURDIR)/build/source/notes | ||
source_artifact_directory=$(CURDIR)/build/artifacts/source | ||
source_package_name=$(source_artifact_directory)/$(app_name) | ||
appstore_build_directory=$(CURDIR)/build/appstore/notes | ||
appstore_artifact_directory=$(CURDIR)/build/artifacts/appstore | ||
appstore_package_name=$(appstore_artifact_directory)/$(app_name) | ||
npm=$(shell which npm 2> /dev/null) | ||
gcp=$(shell which gcp 2> /dev/null) | ||
|
||
ifeq (, $(gcp)) | ||
copy_command=cp | ||
else | ||
copy_command=gcp | ||
endif | ||
|
||
# code signing | ||
# assumes the following: | ||
# * the app is inside the owncloud/apps folder | ||
# * the private key is located in ~/.owncloud/notes.key | ||
# * the certificate is located in ~/.owncloud/notes.crt | ||
occ=$(CURDIR)/../../occ | ||
phpunit_oc10=$(CURDIR)/../../lib/composer/bin/phpunit | ||
configdir=$(CURDIR)/../../config | ||
private_key=$(HOME)/.owncloud/certificates/$(app_name).key | ||
certificate=$(HOME)/.owncloud/certificates/$(app_name).crt | ||
sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)" | ||
sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)" | ||
ifneq (,$(wildcard $(private_key))) | ||
ifneq (,$(wildcard $(certificate))) | ||
ifneq (,$(wildcard $(occ))) | ||
CAN_SIGN=true | ||
endif | ||
endif | ||
endif | ||
|
||
# building the javascript | ||
all: build | ||
|
||
build: deps | ||
mkdir -p $(js_public_dir) | ||
$(grunt_dir) --config $(gruntfile_dir) build | ||
|
||
watch: build | ||
$(grunt_dir) --config $(gruntfile_dir) watch:concat | ||
|
||
update: deps | ||
$(bower_dir) update | ||
# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json | ||
# is present, the composer step is skipped, if no package.json or js/package.json | ||
# is present, the npm step is skipped | ||
.PHONY: build | ||
build: | ||
make npm | ||
|
||
# testing | ||
tests: js-unit-tests php-unit-tests php-integration-tests php-acceptance-tests | ||
|
||
unit-tests: js-unit-tests php-unit-tests | ||
|
||
|
||
# testing js | ||
js-unit-tests: deps | ||
export PHANTOMJS_BIN=$(phantomjs_bin) && \ | ||
$(grunt_dir) --config $(gruntfile_dir) karma:continuous | ||
|
||
watch-js-unit-tests: deps | ||
export CHROME_BIN=$(chrome_bin) && export FIREFOX_BIN=$(firefox_bin) && \ | ||
$(grunt_dir) --config $(gruntfile_dir) karma:unit | ||
|
||
|
||
# testing php | ||
php-unit-tests: deps | ||
phpunit $(php_unit_tests_dir) | ||
|
||
watch-php-unit-tests: deps | ||
$(grunt_dir) --config $(gruntfile_dir) watch:phpunit | ||
|
||
php-integration-tests: deps | ||
phpunit $(php_integration_tests_dir) | ||
|
||
php-acceptance-tests: deps | ||
cd $(php_acceptance_tests_dir); make headless | ||
|
||
|
||
# general | ||
deps: | ||
cd js | ||
npm install --deps | ||
cd .. | ||
# Installs npm dependencies | ||
.PHONY: npm | ||
npm: | ||
cd js && $(npm) run build | ||
|
||
# Removes the appstore build | ||
.PHONY: clean | ||
clean: | ||
rm -rf $(CURDIR)/node_modules | ||
rm -rf $(build_dir) | ||
|
||
dist: appstore | ||
|
||
appstore: clean | ||
mkdir -p $(appstore_dir) | ||
tar cvzf $(appstore_dir)/$(package_name).tar.gz $(project_dir) \ | ||
--exclude-vcs --exclude=$(project_dir)/build/artifacts #\ | ||
# --exclude=$(project_dir)/tests \ | ||
#--exclude=$(project_dir)/.travis.yml | ||
rm -rf ./build | ||
rm -rf css/public | ||
rm -rf js/public | ||
|
||
# Same as clean but also removes dependencies installed by composer, bower and | ||
# npm | ||
.PHONY: distclean | ||
distclean: clean | ||
rm -rf vendor | ||
rm -rf node_modules | ||
rm -rf js/vendor | ||
rm -rf js/node_modules | ||
|
||
# Builds the source and appstore package | ||
.PHONY: dist | ||
dist: | ||
make source | ||
make appstore | ||
|
||
# Builds the source package | ||
.PHONY: source | ||
source: | ||
rm -rf $(source_build_directory) $(source_artifact_directory) | ||
mkdir -p $(source_build_directory) $(source_artifact_directory) | ||
rsync -rv . $(source_build_directory) \ | ||
--exclude=/.git/ \ | ||
--exclude=/.idea/ \ | ||
--exclude=/build/ \ | ||
--exclude=/js/node_modules/ \ | ||
--exclude=*.log | ||
ifdef CAN_SIGN | ||
$(sign) --path "$(source_build_directory)" | ||
else | ||
@echo $(sign_skip_msg) | ||
endif | ||
tar -cvzf $(source_package_name).tar.gz -C $(source_build_directory)/../ $(app_name) | ||
|
||
# Builds the source package for the app store, ignores php and js tests | ||
.PHONY: appstore | ||
appstore: build | ||
rm -rf $(appstore_build_directory) $(appstore_artifact_directory) | ||
mkdir -p $(appstore_build_directory) $(appstore_artifact_directory) | ||
$(copy_command) --parents -r \ | ||
"appinfo" \ | ||
"controller" \ | ||
"css" \ | ||
"db" \ | ||
"img" \ | ||
"js/vendor" \ | ||
"js/public" \ | ||
"l10n" \ | ||
"service" \ | ||
"templates" \ | ||
"COPYING" \ | ||
"CHANGELOG.md" \ | ||
$(appstore_build_directory) | ||
ifdef CAN_SIGN | ||
mv $(configdir)/config.php $(configdir)/config-2.php | ||
$(sign) --path="$(appstore_build_directory)" | ||
mv $(configdir)/config-2.php $(configdir)/config.php | ||
else | ||
@echo $(sign_skip_msg) | ||
endif | ||
tar -czf $(appstore_package_name).tar.gz -C $(appstore_build_directory)/../ $(app_name) | ||
|
||
|
||
# Command for running JS and PHP tests. Works for package.json files in the js/ | ||
# and root directory. If phpunit is not installed systemwide, a copy is fetched | ||
# from the internet | ||
.PHONY: test | ||
test: | ||
cd js && $(npm) run test | ||
ifneq ("$(wildcard $(phpunit_oc10))","") | ||
php $(phpunit_oc10) -c phpunit.xml --coverage-clover coverage.clover | ||
else | ||
phpunit -c phpunit.xml --coverage-clover coverage.clover | ||
# phpunit -c phpunit.integration.xml --coverage-clover build/php-unit.clover | ||
endif |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.