Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scoper to namespace dependencies #237

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 142 additions & 56 deletions .drone.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ $config
->exclude('.composer')
->exclude('vendor-bin')
->notPath('/^c3.php/')
->notPath('/^scoper.inc.php/')
->notPath('/^scoper-fix-autoloader.php/')
->in(__DIR__);

return $config;
46 changes: 37 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ endif

app_name=$(notdir $(CURDIR))
project_directory=$(CURDIR)/../$(app_name)
build_tools_directory=$(CURDIR)/build/tools
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
build_directory=$(CURDIR)/build
scoper_directory=$(build_directory)/scoper
build_tools_directory=$(build_directory)/tools
appstore_build_directory=$(build_directory)/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)

acceptance_test_deps=vendor-bin/behat/vendor
Expand All @@ -40,7 +42,9 @@ PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../l
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
PHPSCOPER=php vendor-bin/php-scoper/vendor/bin/php-scoper
BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
ACCEPTANCE_RUNNER?=../../tests/acceptance/run.sh

# start with displaying help
help: ## Show this help message
Expand All @@ -51,27 +55,45 @@ all: vendor

.PHONY: clean
clean: ## Remove appstore build
rm -rf ./build/artifacts
rm -rf $(build_directory)
rm -rf ./vendor
rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock

.PHONY: dist
dist: ## Builds the appstore package
make appstore

.PHONY: dist-qa
dist-qa: ## Builds the qa package
dist-qa: vendor scope
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_package_name)
cp --parents -r appinfo LICENSE CHANGELOG.md tests $(appstore_package_name)
cp -r $(scoper_directory)/lib $(appstore_package_name)/lib
cp -r $(scoper_directory)/vendor $(appstore_package_name)/vendor
tar --format=gnu -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name)

.PHONY: scope
scope: ## Scoper
scope: vendor-bin/php-scoper/vendor
mkdir -p $(scoper_directory)
$(PHPSCOPER) add-prefix --output-dir $(scoper_directory) --force --config=./scoper.inc.php
$(COMPOSER_BIN) dump-autoload --working-dir $(scoper_directory) --classmap-authoritative
php scoper-fix-autoloader.php

# Builds the package for the app store, ignores php and js tests
.PHONY: appstore
appstore: ## Builds the package for app store
appstore: vendor
appstore: vendor scope
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_package_name)
cp --parents -r \
appinfo \
lib \
vendor \
LICENSE \
CHANGELOG.md \
$(appstore_package_name)
cp -r $(scoper_directory)/lib $(appstore_package_name)/lib
cp -r $(scoper_directory)/vendor $(appstore_package_name)/vendor

ifdef CAN_SIGN
$(sign) --path="$(appstore_package_name)"
Expand Down Expand Up @@ -122,17 +144,17 @@ test-php-phpstan: vendor-bin/phpstan/vendor
.PHONY: test-acceptance-api
test-acceptance-api: ## Run API acceptance tests
test-acceptance-api: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api
BEHAT_BIN=$(BEHAT_BIN) $(ACCEPTANCE_RUNNER) --remote --type api

.PHONY: test-acceptance-cli
test-acceptance-cli: ## Run CLI acceptance tests
test-acceptance-cli: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type cli
BEHAT_BIN=$(BEHAT_BIN) $(ACCEPTANCE_RUNNER) --remote --type cli

.PHONY: test-acceptance-webui
test-acceptance-webui: ## Run webUI acceptance tests
test-acceptance-webui: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type webUI
BEHAT_BIN=$(BEHAT_BIN) $(ACCEPTANCE_RUNNER) --remote --type webUI

#
# Dependency management
Expand Down Expand Up @@ -170,3 +192,9 @@ vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/com

vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json
@echo behat composer.lock is not up to date.

vendor-bin/php-scoper/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php-scoper/composer.lock
$(COMPOSER_BIN) bin php-scoper install --no-progress

vendor-bin/php-scoper/composer.lock: vendor-bin/php-scoper/composer.json
@echo php-scoper composer.lock is not up to date.
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
"description": "ownCloud primary storage integration using S3 protocol",
"require": {
"dg/composer-cleaner": "^2.0",
"aws/aws-sdk-php": "^3.48"
},
"replace": {
"guzzlehttp/guzzle": "*"
"aws/aws-sdk-php": "^3.48",
"guzzlehttp/guzzle": "^5.3"
},
"license": "GPL-2.0",
"config": {
Expand Down
212 changes: 206 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/s3storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function __construct($params) {
if (!isset($params['options']) || !isset($params['bucket'])) {
throw new \Exception('Connection options and bucket must be configured.');
}

$this->params = $params;
}

Expand Down
Loading