diff --git a/Symfony/app/.htaccess b/Symfony/app/.htaccess index 3418e55..c9c4d1b 100644 --- a/Symfony/app/.htaccess +++ b/Symfony/app/.htaccess @@ -1 +1,2 @@ -deny from all \ No newline at end of file +deny from all + diff --git a/Symfony/app/AppKernel.php b/Symfony/app/AppKernel.php index 914db81..b9ecdfb 100644 --- a/Symfony/app/AppKernel.php +++ b/Symfony/app/AppKernel.php @@ -20,7 +20,6 @@ public function registerBundles() ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { - $bundles[] = new Acme\DemoBundle\AcmeDemoBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); diff --git a/Symfony/app/SymfonyRequirements.php b/Symfony/app/SymfonyRequirements.php index 30b1a9b..0f89996 100644 --- a/Symfony/app/SymfonyRequirements.php +++ b/Symfony/app/SymfonyRequirements.php @@ -554,6 +554,20 @@ function_exists('simplexml_import_dom'), 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.' ); + $this->addRecommendation( + version_compare($installedPhpVersion, '5.4.11', '>='), + 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)', + 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.' + ); + + $this->addRecommendation( + (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<')) + || + version_compare($installedPhpVersion, '5.4.8', '>='), + 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909', + 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.' + ); + if (null !== $pcreVersion) { $this->addRecommendation( $pcreVersion >= 8.0, @@ -564,8 +578,8 @@ function_exists('simplexml_import_dom'), $this->addRecommendation( class_exists('DomDocument'), - 'PHP-XML module should be installed', - 'Install and enable the PHP-XML module.' + 'PHP-DOM and PHP-XML modules should be installed', + 'Install and enable the PHP-DOM and the PHP-XML modules.' ); $this->addRecommendation( diff --git a/Symfony/app/config/routing_dev.yml b/Symfony/app/config/routing_dev.yml index c45f361..ff93a02 100644 --- a/Symfony/app/config/routing_dev.yml +++ b/Symfony/app/config/routing_dev.yml @@ -12,7 +12,3 @@ _configurator: _main: resource: routing.yml - -# AcmeDemoBundle routes (to be removed) -_acme_demo: - resource: "@AcmeDemoBundle/Resources/config/routing.yml" diff --git a/Symfony/app/config/security.yml b/Symfony/app/config/security.yml index 243aa71..e083cf3 100644 --- a/Symfony/app/config/security.yml +++ b/Symfony/app/config/security.yml @@ -1,39 +1,8 @@ security: - encoders: - Symfony\Component\Security\Core\User\User: plaintext - - role_hierarchy: - ROLE_ADMIN: ROLE_USER - ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] + firewalls: + anonymous: + anonymous: ~ providers: in_memory: memory: - users: - user: { password: userpass, roles: [ 'ROLE_USER' ] } - admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } - - firewalls: - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - - login: - pattern: ^/demo/secured/login$ - security: false - - secured_area: - pattern: ^/demo/secured/ - form_login: - check_path: _security_check - login_path: _demo_login - logout: - path: _demo_logout - target: _demo - #anonymous: ~ - #http_basic: - # realm: "Secured Demo Area" - - access_control: - - { path: ^/demo/secured/hello/admin/, roles: ROLE_ADMIN } - #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } diff --git a/Symfony/composer.json b/Symfony/composer.json index f660325..dae89f0 100644 --- a/Symfony/composer.json +++ b/Symfony/composer.json @@ -20,9 +20,12 @@ "sensio/generator-bundle": "2.3.*", "incenteev/composer-parameter-handler": "~2.0" }, - "require-dev": { - "satooshi/php-coveralls": "dev-master" - }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "satooshi/php-coveralls": "dev-master", + "sebastian/phpcpd": "*", + "phpmd/phpmd" : "2.0.*" + }, "scripts": { "post-install-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", diff --git a/Symfony/composer.lock b/Symfony/composer.lock index b32a4bf..2c168f5 100644 --- a/Symfony/composer.lock +++ b/Symfony/composer.lock @@ -4,34 +4,247 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "57b4d41eb88bf43c7921752ac91ddbb0", + "hash": "1b10e7b343722185585de0eb6b2b6a16", "packages": [ + { + "name": "doctrine/annotations", + "version": "v1.2.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/eeda578cbe24a170331a1cfdf78be723412df7a4", + "reference": "eeda578cbe24a170331a1cfdf78be723412df7a4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2014-12-20 20:49:38" + }, + { + "name": "doctrine/cache", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2014-09-17 14:24:04" + }, + { + "name": "doctrine/collections", + "version": "v1.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", + "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2014-02-03 23:07:43" + }, { "name": "doctrine/common", - "version": "2.3.0", + "version": "v2.4.2", "source": { "type": "git", - "url": "https://github.com/doctrine/common", - "reference": "2.3.0" + "url": "https://github.com/doctrine/common.git", + "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/common/zipball/2.3.0", - "reference": "2.3.0", + "url": "https://api.github.com/repos/doctrine/common/zipball/5db6ab40e4c531f14dad4ca96a394dfce5d4255b", + "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b", "shasum": "" }, "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.4.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\Common": "lib/" + "Doctrine\\Common\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -42,7 +255,8 @@ { "name": "Jonathan Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -60,7 +274,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -73,20 +287,20 @@ "persistence", "spl" ], - "time": "2012-09-19 22:55:18" + "time": "2014-05-21 19:28:51" }, { "name": "doctrine/dbal", - "version": "2.3.4", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "2.3.4" + "reference": "d5067b0b7e5ef59ba165dcc116c539400bf957ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/2.3.4", - "reference": "2.3.4", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d5067b0b7e5ef59ba165dcc116c539400bf957ff", + "reference": "d5067b0b7e5ef59ba165dcc116c539400bf957ff", "shasum": "" }, "require": { @@ -109,16 +323,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -126,6 +330,14 @@ { "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" } ], "description": "Database Abstraction Layer", @@ -136,7 +348,7 @@ "persistence", "queryobject" ], - "time": "2013-05-11 07:45:37" + "time": "2014-09-15 11:44:29" }, { "name": "doctrine/doctrine-bundle", @@ -209,41 +421,34 @@ "time": "2013-03-25 20:13:59" }, { - "name": "doctrine/orm", - "version": "2.3.4", + "name": "doctrine/inflector", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/doctrine/doctrine2.git", - "reference": "2.3.4" + "url": "https://github.com/doctrine/inflector.git", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/2.3.4", - "reference": "2.3.4", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", + "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", "shasum": "" }, "require": { - "doctrine/dbal": "2.3.*", - "ext-pdo": "*", - "php": ">=5.3.2", - "symfony/console": "2.*" + "php": ">=5.3.2" }, - "suggest": { - "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + "require-dev": { + "phpunit/phpunit": "4.*" }, - "bin": [ - "bin/doctrine", - "bin/doctrine.php" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\ORM": "lib/" + "Doctrine\\Common\\Inflector\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -252,63 +457,62 @@ ], "authors": [ { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" }, { "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" + "email": "guilhermeblanco@gmail.com" }, { - "name": "Roman Borschel", - "email": "roman@code-factory.org" + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" }, { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "Object-Relational-Mapper for PHP", + "description": "Common String Manipulations with regard to casing and singular/plural rules.", "homepage": "http://www.doctrine-project.org", "keywords": [ - "database", - "orm" + "inflection", + "pluralize", + "singularize", + "string" ], - "time": "2013-05-11 07:51:12" + "time": "2014-12-20 21:24:13" }, { - "name": "incenteev/composer-parameter-handler", - "version": "v2.0.0", - "target-dir": "Incenteev/ParameterHandler", + "name": "doctrine/lexer", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "v2.0.0" + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/v2.0.0", - "reference": "v2.0.0", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/yaml": ">=2.0,<3.0" - }, - "require-dev": { - "composer/composer": "*" + "php": ">=5.3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-0": { - "Incenteev\\ParameterHandler": "" + "Doctrine\\Common\\Lexer\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -317,48 +521,180 @@ ], "authors": [ { - "name": "Christophe Coevoet", - "email": "stof@notk.org" + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" } ], - "description": "Composer script handling your ignored parameter file", - "homepage": "https://github.com/Incenteev/ParameterHandler", + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", "keywords": [ - "parameters management" + "lexer", + "parser" ], - "time": "2013-04-06 17:15:44" + "time": "2014-09-09 13:34:57" }, { - "name": "jdorn/sql-formatter", - "version": "v1.2.9", + "name": "doctrine/orm", + "version": "v2.3.6", "source": { "type": "git", - "url": "https://github.com/jdorn/sql-formatter.git", - "reference": "v1.2.9" + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "c2135b38216c6c8a410e764792aa368e946f2ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/v1.2.9", - "reference": "v1.2.9", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/c2135b38216c6c8a410e764792aa368e946f2ae5", + "reference": "c2135b38216c6c8a410e764792aa368e946f2ae5", "shasum": "" }, "require": { - "php": ">=5.2.4" + "doctrine/dbal": "2.3.*", + "ext-pdo": "*", + "php": ">=5.3.2", + "symfony/console": "2.*" }, - "require-dev": { - "phpunit/phpunit": "3.7.*" + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { - "classmap": [ - "lib" - ] - }, + "psr-0": { + "Doctrine\\ORM": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2014-06-03 19:53:45" + }, + { + "name": "incenteev/composer-parameter-handler", + "version": "v2.1.0", + "target-dir": "Incenteev/ParameterHandler", + "source": { + "type": "git", + "url": "https://github.com/Incenteev/ParameterHandler.git", + "reference": "143272a0a09c62616a3c8011fc165a10c6b35241" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/143272a0a09c62616a3c8011fc165a10c6b35241", + "reference": "143272a0a09c62616a3c8011fc165a10c6b35241", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpspec/prophecy-phpunit": "~1.0", + "symfony/filesystem": "~2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Incenteev\\ParameterHandler": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Composer script handling your ignored parameter file", + "homepage": "https://github.com/Incenteev/ParameterHandler", + "keywords": [ + "parameters management" + ], + "time": "2013-12-07 10:10:39" + }, + { + "name": "jdorn/sql-formatter", + "version": "v1.2.17", + "source": { + "type": "git", + "url": "https://github.com/jdorn/sql-formatter.git", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/64990d96e0959dff8e059dfcdc1af130728d92bc", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "lib" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -376,25 +712,25 @@ "highlight", "sql" ], - "time": "2013-04-26 18:42:52" + "time": "2014-01-12 16:20:24" }, { "name": "kriswallsmith/assetic", - "version": "v1.1.1", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/kriswallsmith/assetic.git", - "reference": "v1.1.1" + "reference": "02105abcd35fb32933bc566e4c3bec84c612e9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/v1.1.1", - "reference": "v1.1.1", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/02105abcd35fb32933bc566e4c3bec84c612e9c1", + "reference": "02105abcd35fb32933bc566e4c3bec84c612e9c1", "shasum": "" }, "require": { "php": ">=5.3.1", - "symfony/process": ">=2.1,<3.0" + "symfony/process": "~2.1" }, "require-dev": { "cssmin/cssmin": "*", @@ -404,9 +740,9 @@ "leafo/scssphp": "*", "leafo/scssphp-compass": "*", "mrclay/minify": "*", - "phpunit/phpunit": ">=3.7,<4.0", + "phpunit/phpunit": "~3.7", "ptachoire/cssembed": "*", - "twig/twig": ">=1.6,<2.0" + "twig/twig": "~1.6" }, "suggest": { "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", @@ -447,47 +783,58 @@ "compression", "minification" ], - "time": "2013-06-01 22:13:43" + "time": "2014-12-12 05:37:00" }, { "name": "monolog/monolog", - "version": "1.5.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1.5.0" + "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1.5.0", - "reference": "1.5.0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1fbe8c2641f2b163addf49cc5e18f144bec6b19f", + "reference": "1fbe8c2641f2b163addf49cc5e18f144bec6b19f", "shasum": "" }, "require": { "php": ">=5.3.0", - "psr/log": ">=1.0,<2.0" + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" }, "require-dev": { - "doctrine/couchdb": "dev-master", - "mlehner/gelf-php": "1.0.*", - "raven/raven": "0.3.*" + "aws/aws-sdk-php": "~2.4, >2.4.8", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "phpunit/phpunit": "~4.0", + "raven/raven": "~0.5", + "ruflin/elastica": "0.90.*", + "videlalvaro/php-amqplib": "~2.4" }, "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", - "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server", - "raven/raven": "Allow sending log messages to a Sentry server" + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.12.x-dev" } }, "autoload": { - "psr-0": { - "Monolog": "src/" + "psr-4": { + "Monolog\\": "src/Monolog" } }, "notification-url": "https://packagist.org/downloads/", @@ -498,8 +845,7 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be", - "role": "Developer" + "homepage": "http://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", @@ -509,7 +855,7 @@ "logging", "psr-3" ], - "time": "2013-04-23 10:09:48" + "time": "2014-12-29 21:29:35" }, { "name": "psr/log", @@ -551,17 +897,17 @@ }, { "name": "sensio/distribution-bundle", - "version": "v2.3.2", + "version": "v2.3.8", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "v2.3.2" + "reference": "9a72f821957141ee3d9703da3fa8266d59ef4b1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/9a72f821957141ee3d9703da3fa8266d59ef4b1c", + "reference": "9a72f821957141ee3d9703da3fa8266d59ef4b1c", "shasum": "" }, "require": { @@ -593,21 +939,21 @@ "configuration", "distribution" ], - "time": "2013-07-17 06:24:17" + "time": "2015-01-07 07:11:03" }, { "name": "sensio/framework-extra-bundle", - "version": "v2.3.2", + "version": "v2.3.4", "target-dir": "Sensio/Bundle/FrameworkExtraBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "v2.3.2" + "reference": "cce05719041d952bbec856789ca18646a1891d03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/cce05719041d952bbec856789ca18646a1891d03", + "reference": "cce05719041d952bbec856789ca18646a1891d03", "shasum": "" }, "require": { @@ -632,7 +978,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "This bundle provides a way to configure your controllers with annotations", @@ -640,21 +988,21 @@ "annotations", "controllers" ], - "time": "2013-07-09 09:29:53" + "time": "2013-07-24 08:49:53" }, { "name": "sensio/generator-bundle", - "version": "v2.3.2", + "version": "v2.3.5", "target-dir": "Sensio/Bundle/GeneratorBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", - "reference": "v2.3.2" + "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/8b7a33aa3d22388443b6de0b0cf184122e9f60d2", + "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2", "shasum": "" }, "require": { @@ -684,33 +1032,38 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "This bundle generates code for you", - "time": "2013-07-04 12:20:59" + "time": "2014-04-28 14:01:06" }, { "name": "swiftmailer/swiftmailer", - "version": "v5.0.1", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "v5.0.1" + "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/v5.0.1", - "reference": "v5.0.1", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", + "reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -724,11 +1077,11 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Chris Corbyn" }, { - "name": "Chris Corbyn" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Swiftmailer, free feature-rich PHP mailer", @@ -737,36 +1090,36 @@ "mail", "mailer" ], - "time": "2013-06-17 13:32:32" + "time": "2014-12-05 14:17:14" }, { "name": "symfony/assetic-bundle", - "version": "v2.3.0", + "version": "v2.3.1", "target-dir": "Symfony/Bundle/AsseticBundle", "source": { "type": "git", "url": "https://github.com/symfony/AsseticBundle.git", - "reference": "v2.3.0" + "reference": "099e0bb5d80e7039af20db384a41017fde521f21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/v2.3.0", - "reference": "v2.3.0", + "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/099e0bb5d80e7039af20db384a41017fde521f21", + "reference": "099e0bb5d80e7039af20db384a41017fde521f21", "shasum": "" }, "require": { - "kriswallsmith/assetic": ">=1.1,<2.0", + "kriswallsmith/assetic": "1.1.x", "php": ">=5.3.0", - "symfony/framework-bundle": ">=2.1,<3.0" + "symfony/framework-bundle": "~2.1" }, "require-dev": { - "symfony/class-loader": ">=2.1,<3.0", - "symfony/console": ">=2.1,<3.0", - "symfony/css-selector": ">=2.1,<3.0", - "symfony/dom-crawler": ">=2.1,<3.0", - "symfony/form": ">=2.1,<3.0", - "symfony/twig-bundle": ">=2.1,<3.0", - "symfony/yaml": ">=2.1,<3.0" + "symfony/class-loader": "~2.1", + "symfony/console": "~2.1", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1", + "symfony/form": "~2.1", + "symfony/twig-bundle": "~2.1", + "symfony/yaml": "~2.1" }, "suggest": { "symfony/twig-bundle": "~2.1" @@ -774,7 +1127,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -800,54 +1153,7 @@ "compression", "minification" ], - "time": "2013-05-16 05:32:23" - }, - { - "name": "symfony/icu", - "version": "v1.0.0", - "target-dir": "Symfony/Component/Icu", - "source": { - "type": "git", - "url": "https://github.com/symfony/Icu.git", - "reference": "v1.0.0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.0.0", - "reference": "v1.0.0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/intl": ">=2.3,<3.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Symfony\\Component\\Icu\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Contains an excerpt of the ICU data and classes to load it.", - "homepage": "http://symfony.com", - "keywords": [ - "icu", - "intl" - ], - "time": "2013-06-03 18:32:07" + "time": "2013-11-25 16:34:50" }, { "name": "symfony/monolog-bundle", @@ -909,22 +1215,21 @@ }, { "name": "symfony/swiftmailer-bundle", - "version": "v2.3.2", - "target-dir": "Symfony/Bundle/SwiftmailerBundle", + "version": "v2.3.8", "source": { "type": "git", "url": "https://github.com/symfony/SwiftmailerBundle.git", - "reference": "v2.3.2" + "reference": "970b13d01871207e81d17b17ddda025e7e21e797" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/970b13d01871207e81d17b17ddda025e7e21e797", + "reference": "970b13d01871207e81d17b17ddda025e7e21e797", "shasum": "" }, "require": { "php": ">=5.3.2", - "swiftmailer/swiftmailer": ">=4.2.0,<5.1-dev", + "swiftmailer/swiftmailer": ">=4.2.0,~5.0", "symfony/swiftmailer-bridge": "~2.1" }, "require-dev": { @@ -933,15 +1238,18 @@ "symfony/http-kernel": "~2.1", "symfony/yaml": "~2.1" }, + "suggest": { + "psr/log": "Allows logging" + }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { - "psr-0": { - "Symfony\\Bundle\\SwiftmailerBundle": "" + "psr-4": { + "Symfony\\Bundle\\SwiftmailerBundle\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -949,39 +1257,38 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony SwiftmailerBundle", "homepage": "http://symfony.com", - "time": "2013-05-15 08:38:58" + "time": "2014-12-01 17:44:50" }, { "name": "symfony/symfony", - "version": "v2.3.2", + "version": "v2.3.24", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "v2.3.2" + "reference": "5b2c33be25fdb94233e2c2625ee2d69289f24300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/symfony/zipball/5b2c33be25fdb94233e2c2625ee2d69289f24300", + "reference": "5b2c33be25fdb94233e2c2625ee2d69289f24300", "shasum": "" }, "require": { - "doctrine/common": "~2.2", + "doctrine/common": "~2.3", "php": ">=5.3.3", "psr/log": "~1.0", - "symfony/icu": "~1.0", - "twig/twig": "~1.11" + "twig/twig": "~1.12,>=1.12.3" }, "replace": { "symfony/browser-kit": "self.version", @@ -1026,10 +1333,10 @@ "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.2", "doctrine/orm": "~2.2,>=2.2.3", - "ircmaxell/password-compat": "1.0.*", + "ircmaxell/password-compat": "~1.0", "monolog/monolog": "~1.3", - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev", - "propel/propel1": "1.6.*" + "ocramius/proxy-manager": "~0.3.1", + "propel/propel1": "~1.6" }, "type": "library", "extra": { @@ -1054,13 +1361,13 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "The Symfony PHP framework", @@ -1068,24 +1375,24 @@ "keywords": [ "framework" ], - "time": "2013-07-17 06:22:21" + "time": "2015-01-07 10:32:09" }, { "name": "twig/extensions", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig-extensions.git", - "reference": "v1.0.0" + "url": "https://github.com/twigphp/Twig-extensions.git", + "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/v1.0.0", - "reference": "v1.0.0", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/f91a82ec225e5bb108e01a0f93c9be04f84dcfa0", + "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0", "shasum": "" }, "require": { - "twig/twig": "1.*" + "twig/twig": "~1.0" }, "type": "library", "extra": { @@ -1115,20 +1422,20 @@ "i18n", "text" ], - "time": "2013-02-28 14:21:30" + "time": "2013-10-18 19:37:15" }, { "name": "twig/twig", - "version": "v1.13.1", + "version": "v1.16.3", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "v1.13.1" + "url": "https://github.com/twigphp/Twig.git", + "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.13.1", - "reference": "v1.13.1", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", + "reference": "6dc11a1e8ecfc30e2c68aaeb218148409d8e68af", "shasum": "" }, "require": { @@ -1137,7 +1444,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.16-dev" } }, "autoload": { @@ -1147,16 +1454,24 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3" + "BSD-3-Clause" ], "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -1164,7 +1479,7 @@ "keywords": [ "templating" ], - "time": "2013-06-06 06:06:01" + "time": "2014-12-25 19:58:19" } ], "packages-dev": [ @@ -1261,93 +1576,702 @@ "time": "2014-08-11 04:32:36" }, { - "name": "satooshi/php-coveralls", - "version": "dev-master", + "name": "pdepend/pdepend", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/satooshi/php-coveralls.git", - "reference": "94389a0ebdb64857d6899b5e0254dffa99e5aa96" + "url": "https://github.com/pdepend/pdepend.git", + "reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/94389a0ebdb64857d6899b5e0254dffa99e5aa96", - "reference": "94389a0ebdb64857d6899b5e0254dffa99e5aa96", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/dc582a3c0180664a8fbfc5a34efaf4cc13fccc60", + "reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60", "shasum": "" }, "require": { - "ext-json": "*", - "ext-simplexml": "*", - "guzzle/guzzle": ">=2.7", - "php": ">=5.3", - "psr/log": "1.0.0", - "symfony/config": ">=2.0", - "symfony/console": ">=2.0", - "symfony/stopwatch": ">=2.2", - "symfony/yaml": ">=2.0" + "symfony/config": "@stable", + "symfony/dependency-injection": "@stable", + "symfony/filesystem": "@stable" }, "require-dev": { - "apigen/apigen": "2.8.*@stable", - "pdepend/pdepend": "dev-master as 2.0.0", - "phpmd/phpmd": "dev-master", - "phpunit/php-invoker": ">=1.1.0,<1.2.0", - "phpunit/phpunit": "3.7.*@stable", - "sebastian/finder-facade": "dev-master", - "sebastian/phpcpd": "1.4.*@stable", - "squizlabs/php_codesniffer": "1.4.*@stable", - "theseer/fdomdocument": "dev-master" - }, - "suggest": { - "symfony/http-kernel": "Allows Symfony integration" + "phpunit/phpunit": "3.*@stable", + "squizlabs/php_codesniffer": "@stable" }, "bin": [ - "composer/bin/coveralls" + "src/bin/pdepend" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.7-dev" - } - }, "autoload": { "psr-0": { - "Satooshi\\Component": "src/", - "Satooshi\\Bundle": "src/" + "PDepend\\": "src/main/php/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], - "authors": [ - { - "name": "Kitamura Satoshi", - "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp" + "description": "Official version of pdepend to be handled with Composer", + "time": "2014-10-08 06:54:50" + }, + { + "name": "phpmd/phpmd", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "68ced5452910d3555a38720bd87f5f2356c5a003" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/68ced5452910d3555a38720bd87f5f2356c5a003", + "reference": "68ced5452910d3555a38720bd87f5f2356c5a003", + "shasum": "" + }, + "require": { + "pdepend/pdepend": "2.0.*", + "php": ">=5.3.0", + "symfony/config": "@stable", + "symfony/dependency-injection": "@stable", + "symfony/filesystem": "@stable" + }, + "bin": [ + "src/bin/phpmd" + ], + "type": "library", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php", + "PDepend\\": "vendor/pdepend/pdepend/src/main/php/" } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "../../pdepend/pdepend/src/main/php", + "src/main/php" ], - "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/satooshi/php-coveralls", - "keywords": [ - "ci", - "coverage", - "github", - "test" + "license": [ + "BSD-3-Clause" ], - "time": "2014-07-09 10:45:38" - } - ], - "aliases": [ - + "description": "Official version of PHPMD handled with Composer.", + "time": "2014-05-21 12:45:23" + }, + { + "name": "phpunit/php-code-coverage", + "version": "1.2.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": ">=1.3.0@stable", + "phpunit/php-text-template": ">=1.2.0@stable", + "phpunit/php-token-stream": ">=1.1.3,<1.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2014-09-02 10:13:14" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2013-10-10 15:34:57" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2014-01-30 17:20:04" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2014-03-03 05:10:30" + }, + { + "name": "phpunit/phpunit", + "version": "3.7.38", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.1", + "phpunit/php-timer": "~1.0", + "phpunit/phpunit-mock-objects": "~1.2", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear.php.net/pear": "1.9.4" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "composer/bin/phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2014-10-17 09:04:17" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-text-template": ">=1.1.1@stable" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2013-01-13 10:24:48" + }, + { + "name": "satooshi/php-coveralls", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/satooshi/php-coveralls.git", + "reference": "2fbf803803d179ab1082807308a67bbd5a760c70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/2fbf803803d179ab1082807308a67bbd5a760c70", + "reference": "2fbf803803d179ab1082807308a67bbd5a760c70", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-simplexml": "*", + "guzzle/guzzle": ">=2.7", + "php": ">=5.3", + "psr/log": "1.0.0", + "symfony/config": ">=2.0", + "symfony/console": ">=2.0", + "symfony/stopwatch": ">=2.2", + "symfony/yaml": ">=2.0" + }, + "require-dev": { + "apigen/apigen": "2.8.*@stable", + "pdepend/pdepend": "dev-master as 2.0.0", + "phpmd/phpmd": "dev-master", + "phpunit/php-invoker": ">=1.1.0,<1.2.0", + "phpunit/phpunit": "3.7.*@stable", + "sebastian/finder-facade": "dev-master", + "sebastian/phpcpd": "1.4.*@stable", + "squizlabs/php_codesniffer": "1.4.*@stable", + "theseer/fdomdocument": "dev-master" + }, + "suggest": { + "symfony/http-kernel": "Allows Symfony integration" + }, + "bin": [ + "composer/bin/coveralls" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.7-dev" + } + }, + "autoload": { + "psr-0": { + "Satooshi\\Component": "src/", + "Satooshi\\Bundle": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kitamura Satoshi", + "email": "with.no.parachute@gmail.com", + "homepage": "https://www.facebook.com/satooshi.jp" + } + ], + "description": "PHP client library for Coveralls API", + "homepage": "https://github.com/satooshi/php-coveralls", + "keywords": [ + "ci", + "coverage", + "github", + "test" + ], + "time": "2014-11-11 15:35:34" + }, + { + "name": "sebastian/finder-facade", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/finder-facade.git", + "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/1e396fda3449fce9df032749fa4fa2619e0347e0", + "reference": "1e396fda3449fce9df032749fa4fa2619e0347e0", + "shasum": "" + }, + "require": { + "symfony/finder": ">=2.2.0", + "theseer/fdomdocument": ">=1.3.1" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", + "homepage": "https://github.com/sebastianbergmann/finder-facade", + "time": "2013-05-28 06:10:03" + }, + { + "name": "sebastian/phpcpd", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpcpd.git", + "reference": "a9462153f2dd90466a010179901d31fbff598365" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/a9462153f2dd90466a010179901d31fbff598365", + "reference": "a9462153f2dd90466a010179901d31fbff598365", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-timer": ">=1.0.4", + "sebastian/finder-facade": ">=1.1.0", + "sebastian/version": ">=1.0.3", + "symfony/console": ">=2.2.0", + "theseer/fdomdocument": "~1.4" + }, + "bin": [ + "phpcpd" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Copy/Paste Detector (CPD) for PHP code.", + "homepage": "https://github.com/sebastianbergmann/phpcpd", + "time": "2014-03-31 09:25:30" + }, + { + "name": "sebastian/version", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", + "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2014-12-15 14:25:24" + }, + { + "name": "theseer/fdomdocument", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/fDOMDocument.git", + "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/d08cf070350f884c63fc9078d27893c2ab6c7cef", + "reference": "d08cf070350f884c63fc9078d27893c2ab6c7cef", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "lib-libxml": "*", + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "lead" + } + ], + "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", + "homepage": "https://github.com/theseer/fDOMDocument", + "time": "2014-09-13 10:57:19" + } ], + "aliases": [], "minimum-stability": "stable", "stability-flags": { "satooshi/php-coveralls": 20 }, "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.3.3" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/Symfony/src/.htaccess b/Symfony/src/.htaccess index 3418e55..c9c4d1b 100644 --- a/Symfony/src/.htaccess +++ b/Symfony/src/.htaccess @@ -1 +1,2 @@ -deny from all \ No newline at end of file +deny from all + diff --git a/Symfony/src/Acme/DemoBundle/AcmeDemoBundle.php b/Symfony/src/Acme/DemoBundle/AcmeDemoBundle.php deleted file mode 100644 index 269fc1e..0000000 --- a/Symfony/src/Acme/DemoBundle/AcmeDemoBundle.php +++ /dev/null @@ -1,9 +0,0 @@ - $name); - } - - /** - * @Route("/contact", name="_demo_contact") - * @Template() - */ - public function contactAction() - { - $form = $this->get('form.factory')->create(new ContactType()); - - $request = $this->get('request'); - if ($request->isMethod('POST')) { - $form->submit($request); - if ($form->isValid()) { - $mailer = $this->get('mailer'); - // .. setup a message and send it - // http://symfony.com/doc/current/cookbook/email.html - - $this->get('session')->getFlashBag()->set('notice', 'Message sent!'); - - return new RedirectResponse($this->generateUrl('_demo')); - } - } - - return array('form' => $form->createView()); - } -} diff --git a/Symfony/src/Acme/DemoBundle/Controller/SecuredController.php b/Symfony/src/Acme/DemoBundle/Controller/SecuredController.php deleted file mode 100644 index f6d3005..0000000 --- a/Symfony/src/Acme/DemoBundle/Controller/SecuredController.php +++ /dev/null @@ -1,68 +0,0 @@ -attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { - $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); - } else { - $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); - } - - return array( - 'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME), - 'error' => $error, - ); - } - - /** - * @Route("/login_check", name="_security_check") - */ - public function securityCheckAction() - { - // The security layer will intercept this request - } - - /** - * @Route("/logout", name="_demo_logout") - */ - public function logoutAction() - { - // The security layer will intercept this request - } - - /** - * @Route("/hello", defaults={"name"="World"}), - * @Route("/hello/{name}", name="_demo_secured_hello") - * @Template() - */ - public function helloAction($name) - { - return array('name' => $name); - } - - /** - * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin") - * @Template() - */ - public function helloadminAction($name) - { - return array('name' => $name); - } -} diff --git a/Symfony/src/Acme/DemoBundle/Controller/WelcomeController.php b/Symfony/src/Acme/DemoBundle/Controller/WelcomeController.php deleted file mode 100644 index acceedf..0000000 --- a/Symfony/src/Acme/DemoBundle/Controller/WelcomeController.php +++ /dev/null @@ -1,18 +0,0 @@ -render('AcmeDemoBundle:Welcome:index.html.twig'); - } -} diff --git a/Symfony/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php b/Symfony/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php deleted file mode 100644 index 6dfcc82..0000000 --- a/Symfony/src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php +++ /dev/null @@ -1,22 +0,0 @@ -load('services.xml'); - } - - public function getAlias() - { - return 'acme_demo'; - } -} diff --git a/Symfony/src/Acme/DemoBundle/EventListener/ControllerListener.php b/Symfony/src/Acme/DemoBundle/EventListener/ControllerListener.php deleted file mode 100644 index aa117d7..0000000 --- a/Symfony/src/Acme/DemoBundle/EventListener/ControllerListener.php +++ /dev/null @@ -1,24 +0,0 @@ -extension = $extension; - } - - public function onKernelController(FilterControllerEvent $event) - { - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->extension->setController($event->getController()); - } - } -} diff --git a/Symfony/src/Acme/DemoBundle/Form/ContactType.php b/Symfony/src/Acme/DemoBundle/Form/ContactType.php deleted file mode 100644 index 2c76cdb..0000000 --- a/Symfony/src/Acme/DemoBundle/Form/ContactType.php +++ /dev/null @@ -1,20 +0,0 @@ -add('email', 'email'); - $builder->add('message', 'textarea'); - } - - public function getName() - { - return 'contact'; - } -} diff --git a/Symfony/src/Acme/DemoBundle/Resources/config/routing.yml b/Symfony/src/Acme/DemoBundle/Resources/config/routing.yml deleted file mode 100644 index 3402ca1..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/config/routing.yml +++ /dev/null @@ -1,12 +0,0 @@ -_welcome: - pattern: / - defaults: { _controller: AcmeDemoBundle:Welcome:index } - -_demo_secured: - resource: "@AcmeDemoBundle/Controller/SecuredController.php" - type: annotation - -_demo: - resource: "@AcmeDemoBundle/Controller/DemoController.php" - type: annotation - prefix: /demo \ No newline at end of file diff --git a/Symfony/src/Acme/DemoBundle/Resources/config/services.xml b/Symfony/src/Acme/DemoBundle/Resources/config/services.xml deleted file mode 100644 index d6274ce..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/config/services.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/css/demo.css b/Symfony/src/Acme/DemoBundle/Resources/public/css/demo.css deleted file mode 100644 index 4dd2f16..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/public/css/demo.css +++ /dev/null @@ -1,101 +0,0 @@ -body { - font-size: 14px; - font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; -} -h1.title { - font-size: 45px; - padding-bottom: 30px; -} -.sf-reset h2 { - font-weight: bold; - color: #FFFFFF; - /* Font is duplicated of body (sans-serif) */ - font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; - - margin-bottom: 10px; - background-color: #aacd4e; - padding: 2px 4px; - display: inline-block; - text-transform: uppercase; - -} -p { - line-height: 20px; - padding-bottom: 20px; -} -ul#demo-list a { - background: url(../images/blue-arrow.png) no-repeat right 6px; - padding-right: 10px; - margin-right: 30px; -} -#symfony-header { - position: relative; - padding: 30px 30px 20px 30px; -} -.sf-reset .symfony-blocks-welcome { - overflow: hidden; -} -.sf-reset .symfony-blocks-welcome > div { - background-color: whitesmoke; - float: left; - width: 240px; - margin-right: 14px; - text-align: center; - padding: 26px 20px; -} -.sf-reset .symfony-blocks-welcome > div.block-demo { - margin-right: 0; -} -.sf-reset .symfony-blocks-welcome .illustration { - padding-bottom: 20px; -} -.sf-reset .symfony-blocks-help { - overflow: hidden; -} -.sf-reset .symfony-blocks-help { - margin-top: 30px; - padding: 18px; - border: 1px solid #E6E6E6; -} -.sf-reset .symfony-blocks-help > div { - width: 254px; - float: left; -} -.flash-message { - padding: 10px; - margin: 5px; - margin-top: 15px; - background-color: #ffe; -} -.sf-reset .error { - color: red; -} -#login label, #contact_form label { - display: block; - float: left; - width: 90px; -} -.sf-reset ul#menu { - float: right; - margin-bottom: 20px; - padding-left: 0; -} -.sf-reset #menu li { - padding-left: 0; - margin-right: 10px; - display: inline; -} -.sf-reset a, -.sf-reset li a { - color: #08C; - text-decoration: none; -} -.sf-reset a:hover, -.sf-reset li a:hover { - color: #08C; - text-decoration: underline; -} -.sf-reset .symfony-content pre { - white-space: pre; - font-family: monospace; -} diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png b/Symfony/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png deleted file mode 100644 index fa82d4b..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/blue-arrow.png and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/field-background.gif b/Symfony/src/Acme/DemoBundle/Resources/public/images/field-background.gif deleted file mode 100644 index 7c0efc1..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/field-background.gif and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/logo.gif b/Symfony/src/Acme/DemoBundle/Resources/public/images/logo.gif deleted file mode 100644 index 703cf45..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/logo.gif and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/search.png b/Symfony/src/Acme/DemoBundle/Resources/public/images/search.png deleted file mode 100644 index 3c88b6a..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/search.png and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif b/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif deleted file mode 100644 index 931179a..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif b/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif deleted file mode 100644 index 0623de5..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif b/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif deleted file mode 100644 index b9018b1..0000000 Binary files a/Symfony/src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif and /dev/null differ diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig deleted file mode 100644 index e5b7523..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Symfony - Contact form" %} - -{% block content %} -
- {{ form_errors(form) }} - - {{ form_row(form.email) }} - {{ form_row(form.message) }} - - {{ form_rest(form) }} - -
-{% endblock %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig deleted file mode 100644 index 3997ff6..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }}!

-{% endblock %} - -{% set code = code(_self) %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig deleted file mode 100644 index 454a320..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Demo/index.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block title "Symfony - Demos" %} - -{% block content_header '' %} - -{% block content %} -

Available demos

- -{% endblock %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig deleted file mode 100644 index faf95cf..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "AcmeDemoBundle:Secured:layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }}!

- - Hello resource secured for admin only. -{% endblock %} - -{% set code = code(_self) %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig deleted file mode 100644 index 4e3649f..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "AcmeDemoBundle:Secured:layout.html.twig" %} - -{% block title "Hello " ~ name %} - -{% block content %} -

Hello {{ name }} secured for Admins only!

-{% endblock %} - -{% set code = code(_self) %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig deleted file mode 100644 index aeea55c..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "AcmeDemoBundle::layout.html.twig" %} - -{% block content_header_more %} - {{ parent() }} -
  • logged in as {{ app.user ? app.user.username : 'Anonymous' }} - Logout
  • -{% endblock %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig deleted file mode 100644 index e74a5aa..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Secured/login.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{% extends 'AcmeDemoBundle::layout.html.twig' %} - -{% block content %} -

    Login

    - -

    - Choose between two default users: user/userpass (ROLE_USER) or admin/adminpass (ROLE_ADMIN) -

    - - {% if error %} -
    {{ error.message }}
    - {% endif %} - -
    -
    - - -
    - -
    - - -
    - - -
    -{% endblock %} - -{% set code = code(_self) %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig deleted file mode 100644 index ea3a729..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig +++ /dev/null @@ -1,83 +0,0 @@ -{% extends 'AcmeDemoBundle::layout.html.twig' %} - -{% block title %}Symfony - Welcome{% endblock %} - -{% block content_header '' %} - -{% block content %} - {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%} - -

    Welcome!

    - -

    Congratulations! You have successfully installed a new Symfony application.

    - -
    -
    -
    - Quick tour -
    - - - - Read the Quick Tour - - - -
    - {% if app.environment == 'dev' %} -
    -
    - Configure your application -
    - - - - Configure - - - -
    - {% endif %} -
    -
    - Demo -
    - - - - Run The Demo - - - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -{% endblock %} diff --git a/Symfony/src/Acme/DemoBundle/Resources/views/layout.html.twig b/Symfony/src/Acme/DemoBundle/Resources/views/layout.html.twig deleted file mode 100644 index d7e97d5..0000000 --- a/Symfony/src/Acme/DemoBundle/Resources/views/layout.html.twig +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "TwigBundle::layout.html.twig" %} - -{% block head %} - - -{% endblock %} - -{% block title 'Demo Bundle' %} - -{% block body %} - {% for flashMessage in app.session.flashbag.get('notice') %} -
    - Notice: {{ flashMessage }} -
    - {% endfor %} - - {% block content_header %} - - -
    - {% endblock %} - -
    - {% block content %}{% endblock %} -
    - - {% if code is defined %} -

    Code behind this page

    -
    -
    {{ code|raw }}
    -
    - {% endif %} -{% endblock %} diff --git a/Symfony/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php b/Symfony/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php deleted file mode 100644 index d720ce5..0000000 --- a/Symfony/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php +++ /dev/null @@ -1,17 +0,0 @@ -request('GET', '/demo/hello/Fabien'); -// -// $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count()); -// } -//} diff --git a/Symfony/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php b/Symfony/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php deleted file mode 100644 index a96a885..0000000 --- a/Symfony/src/Acme/DemoBundle/Twig/Extension/DemoExtension.php +++ /dev/null @@ -1,81 +0,0 @@ -loader = $loader; - } - - public function setController($controller) - { - $this->controller = $controller; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - 'code' => new \Twig_Function_Method($this, 'getCode', array('is_safe' => array('html'))), - ); - } - - public function getCode($template) - { - // highlight_string highlights php code only if 'getControllerCode(), true); - $controller = str_replace('<?php    ', '    ', $controller); - - $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8'); - - // remove the code block - $template = str_replace('{% set code = code(_self) %}', '', $template); - - return <<Controller Code

    -
    $controller
    - -

    Template Code

    -
    $template
    -EOF; - } - - protected function getControllerCode() - { - $class = get_class($this->controller[0]); - if (class_exists('CG\Core\ClassUtils')) { - $class = ClassUtils::getUserClass($class); - } - - $r = new \ReflectionClass($class); - $m = $r->getMethod($this->controller[1]); - - $code = file($r->getFilename()); - - return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1)); - } - - protected function getTemplateCode($template) - { - return $this->loader->getSource($template->getTemplateName()); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'demo'; - } -} diff --git a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php index ab79309..f419773 100644 --- a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php +++ b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php @@ -1,13 +1,13 @@ getRequest()->getContent(); - //Get the compiler service + //Get the compiler service + /** @var CompilerHandler $compiler */ $compiler = $this->get('compiler_handler'); $reply = $compiler->main($request, $params); @@ -69,126 +71,92 @@ public function indexAction($auth_key, $version) } } - public function deleteAllObjectsAction($auth_key, $version) - { - if ($this->container->getParameter('auth_key') != $auth_key) - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid authorization key."))); - - if ($version != "v1") - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid API version."))); - - $tempDir = $this->container->getParameter('temp_dir'); - $objectFilesDir = $this->container->getParameter('objdir'); - $fileCount = 0; - $undeletedFiles = ""; - $deletionStats = array("success_dot_a" => 0, - "failure_dot_a" => 0, - "success_dot_o" => 0, - "failure_dot_o" => 0, - "success_dot_d" => 0, - "failure_dot_d" => 0, - "success_dot_LOCK" => 0, - "failure_dot_LOCK" => 0); - - if ($handle = opendir("$tempDir/$objectFilesDir")) - { - - while (false !== ($entry = readdir($handle))) - { - if ($entry != "." && $entry != ".." && $entry != ".DS_Store") - { - $fileCount++; - $extension = pathinfo($entry, PATHINFO_EXTENSION); - - if (!in_array($extension, array("a", "o", "d", "LOCK"))) - continue; - - if (@unlink("$tempDir/$objectFilesDir/$entry") === false) - { - $deletionStats["failure_dot_$extension"]++; - $undeletedFiles .= $entry . "\n"; - } - else - $deletionStats["success_dot_$extension"]++; - } - } - closedir($handle); - }else - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Failed to access object files directory."))); - - return new Response(json_encode(array_merge(array("success" => true, - "message" => "Object files deletion complete. Found $fileCount files."), - $deletionStats, - array("Files not deleted" => $undeletedFiles)))); - } - - public function deleteSpecificObjectsAction($auth_key, $version, $option, $to_delete) - { - if ($this->container->getParameter('auth_key') != $auth_key) - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid authorization key."))); - - if ($version != "v1") - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Invalid API version."))); - - $tempDir = $this->container->getParameter('temp_dir'); - $objectFilesDir = $this->container->getParameter('objdir'); - - if ($option == "core") - $to_delete = str_replace(":", "_", $to_delete); - - $response = array(); - $response["deleted_files"] = ""; - $response["undeleted_files"] = ""; - - if ($handle = opendir("$tempDir/$objectFilesDir")) - { - while (false !== ($entry = readdir($handle))) - { - if ($entry == "." || $entry == ".." || $entry == ".DS_Store") - continue; - - if ($option == "library" && strpos($entry, "______" . $to_delete . "_______") === false) - continue; - - if ($option == "core" && strpos($entry, "_" . $to_delete . "_") === false) - continue; - - - if (@unlink("$tempDir/$objectFilesDir/$entry") === false) - $response["undeleted_files"] .= $entry . "\n"; - else - $response["deleted_files"] .= $entry . "\n"; - - } - closedir($handle); + public function deleteAllObjectsAction($auth_key, $version) + { + if ($this->container->getParameter('auth_key') != $auth_key) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid authorization key.') + )); } - else - { - return new Response(json_encode(array("success" => false, "step" => 0, "message" => "Failed to access object files directory."))); + + if ($version != 'v1') { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid API version.') + )); } - if ($response["undeleted_files"] != "") - { - $message = ($option == "library") ? "Failed to delete one or more of the specified library object files.": "Failed to delete one or more of the specified core object files."; - return new Response(json_encode(array_merge(array("success" => false, "step" => 0, "message" => $message), $response))); + //Get the compiler service + /** @var DeletionHandler $deleter */ + $deleter = $this->get('deletion_handler'); + + $response = $deleter->deleteAllObjects(); + + if ($response['success'] === false) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Failed to access object files directory.') + )); } - $message = ($option == "library") ? "Library deleted successfully.": "Core object files deleted successfully."; - return new Response(json_encode(array_merge(array("success" => true, "message" => $message), $response))); - } + return new Response(json_encode( + array_merge( + array( + 'success' => true, + 'message' => 'Object files deletion complete. Found ' . $response['fileCount'] . ' files.' + ), + $response['deletionStats'], + array("Files not deleted" => $response['notDeletedFiles']) + ))); + } - /** - \brief Creates a list of the configuration parameters to be used in the compilation process. + public function deleteSpecificObjectsAction($auth_key, $version, $option, $cachedObjectToDelete) + { + if ($this->container->getParameter('auth_key') != $auth_key) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid authorization key.') + )); + } - \return An array of the parameters. + if ($version != 'v1') { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Invalid API version.') + )); + } + + //Get the compiler service + /** @var DeletionHandler $deleter */ + $deleter = $this->get('deletion_handler'); + + $response = $deleter->deleteSpecificObjects($option, $cachedObjectToDelete); + + if ($response['success'] === false) { + return new Response(json_encode( + array('success' => false, 'step' => 0, 'message' => 'Failed to access object files directory.') + )); + } - This function accesses the Symfony global configuration parameters, and creates an array that our handlers (which - don't have access to them) can use them. + if ($response["notDeletedFiles"] != '') { + $message = ($option == 'library') ? 'Failed to delete one or more of the specified library object files.' : 'Failed to delete one or more of the specified core object files.'; + return new Response(json_encode( + array_merge(array('success' => false, 'step' => 0, 'message' => $message), $response) + )); + } + + $message = ($option == 'library') ? 'Library deleted successfully.' : 'Core object files deleted successfully.'; + return new Response(json_encode(array_merge(array('success' => true, 'message' => $message), $response))); + } + + /** + * \brief Creates a list of the configuration parameters to be used in the compilation process. + * + * \return An array of the parameters. + * + * This function accesses the Symfony global configuration parameters, and creates an array that our handlers (which + * don't have access to them) can use them. */ private function generateParameters() { - $parameters = array("binutils", "python", "clang", "logdir", "temp_dir", "archive_dir", "autocompletion_dir", "autocompleter", "cflags", "cppflags", "asflags", "arflags", "ldflags", "ldflags_tail", "clang_flags", "objcopy_flags", "size_flags", "output", "arduino_cores_dir", "external_core_files", "auth_key"); + $parameters = array("binutils", "python", "clang", "logdir", "temp_dir", "archive_dir", "autocompletion_dir", "autocompleter", "cflags", "cppflags", "asflags", "arflags", "ldflags", "ldflags_tail", "clang_flags", "objcopy_flags", "size_flags", "output", "arduino_cores_dir", "external_core_files", "auth_key"); $compiler_config = array(); diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php index 653c5cd..3498fc3 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php @@ -1,13 +1,13 @@ preproc = $preprocHandl; - $this->postproc = $postprocHandl; - $this->utility = $utilHandl; - $this->compiler_logger = $logger; - $this->object_directory = $objdir; - } - - /** - \brief Processes a compile request. - - \param string $request The body of the POST request. - \return A message to be JSON-encoded and sent back to the requestor. - */ - function main($request, $compiler_config) - { - error_reporting(E_ALL & ~E_STRICT); - - $this->set_values($compiler_config, - $BINUTILS, $CLANG, $CFLAGS, $CPPFLAGS, $ASFLAGS, $ARFLAGS, $LDFLAGS, $LDFLAGS_TAIL, - $CLANG_FLAGS, $OBJCOPY_FLAGS, $SIZE_FLAGS, $OUTPUT, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, + private $preproc; + private $postproc; + private $utility; + private $compiler_logger; + private $object_directory; + private $logger_id; + + function __construct(PreprocessingHandler $preprocHandl, PostprocessingHandler $postprocHandl, UtilityHandler $utilHandl, Logger $logger, $objdir) + { + $this->preproc = $preprocHandl; + $this->postproc = $postprocHandl; + $this->utility = $utilHandl; + $this->compiler_logger = $logger; + $this->object_directory = $objdir; + } + + /** + * \brief Processes a compile request. + * + * \param string $request The body of the POST request. + * \return A message to be JSON-encoded and sent back to the requestor. + */ + function main($request, $compiler_config) + { + error_reporting(E_ALL & ~E_STRICT); + + $this->setValues($compiler_config, + $BINUTILS, $CLANG, $CFLAGS, $CPPFLAGS, $ASFLAGS, $ARFLAGS, $LDFLAGS, $LDFLAGS_TAIL, + $CLANG_FLAGS, $OBJCOPY_FLAGS, $SIZE_FLAGS, $OUTPUT, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, $TEMP_DIR, $ARCHIVE_DIR, $AUTOCC_DIR, $PYTHON, $AUTOCOMPLETER); - $start_time = microtime(true); + $start_time = microtime(true); - // Step 0: Reject the request if the input data is not valid. - //TODO: Replace $tmp variable name - $tmp = $this->requestValid($request); - if($tmp["success"] === false) - return $tmp; + // Step 0: Reject the request if the input data is not valid. + $tmpVar = $this->requestValid($request); + if ($tmpVar["success"] === false) + return $tmpVar; - $this->set_variables($request, $format, $libraries, $version, $mcu, $f_cpu, $core, $variant, $vid, $pid, $compiler_config); + $this->setVariables($request, $format, $libraries, $version, $mcu, $f_cpu, $core, $variant, $vid, $pid, $compiler_config); - $this->set_avr($version, $ARDUINO_CORES_DIR, $BINUTILS, $CC, $CPP, $AS, $AR, $LD, $OBJCOPY, $SIZE); + $this->setAVR($version, $ARDUINO_CORES_DIR, $BINUTILS, $CC, $CPP, $AS, $AR, $LD, $OBJCOPY, $SIZE); - $target_arch = "-mmcu=$mcu -DARDUINO=$version -DF_CPU=$f_cpu -DUSB_VID=$vid -DUSB_PID=$pid"; - $clang_target_arch = "-D".MCUHandler::$MCU[$mcu]." -DARDUINO=$version -DF_CPU=$f_cpu"; + $target_arch = "-mmcu=$mcu -DARDUINO=$version -DF_CPU=$f_cpu -DUSB_VID=$vid -DUSB_PID=$pid"; + $clang_target_arch = "-D".MCUHandler::$MCU[$mcu]." -DARDUINO=$version -DF_CPU=$f_cpu"; $autocc_clang_target_arch = "-D".MCUHandler::$MCU[$mcu]." -DARDUINO=$version -DF_CPU=$f_cpu -DUSB_VID=$vid -DUSB_PID=$pid"; - // Step 1(part 1): Extract the project files included in the request. - $files = array(); - $tmp = $this->extractFiles($request["files"], $TEMP_DIR, $compiler_dir, $files["sketch_files"], "files"); - - if ($tmp["success"] == false) - return $tmp; - - // Add the compiler temp directory to the compiler_config struct. - $compiler_config["compiler_dir"] = $compiler_dir; - - // Step 1(part 2): Extract the library files included in the request. - $files["libs"] = array(); - foreach($libraries as $library => $library_files){ - - $tmp = $this->extractFiles($library_files, $TEMP_DIR, $compiler_dir, $files["libs"][$library], "libraries/$library", true); - if ($tmp["success"] == false) - return $tmp; - } - - if (!array_key_exists("archive", $request) || ($request["archive"] !== false && $request["archive"] !== true)) - $ARCHIVE_OPTION = false; - else - $ARCHIVE_OPTION = $request["archive"]; - //return array("success" => false, "archive option" => $ARCHIVE_OPTION); - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - return $arch_ret; - } - - //Set logging to true if requested, and create the directory where logfiles are stored. - //TODO: Replace $tmp variable name - $tmp = $this->setLoggingParams($request, $compiler_config, $TEMP_DIR, $compiler_dir); - if($tmp["success"] === false) - return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array()); - - // Step 2: Preprocess Arduino source files. - $tmp = $this->preprocessIno($files["sketch_files"]); - if ($tmp["success"] == false) - return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array()); - - // Step 3: Preprocess Header includes and determine which core files directory(CORE_DIR) will be used. - $tmp = $this->preprocessHeaders($libraries, $include_directories, $compiler_dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, $CORE_DIR, $CORE_OVERRIDE_DIR, $version, $core, $variant); - if ($tmp["success"] == false) - return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array()); - - // Log the names of the project files and the libraries used in it. - if ($format != "autocomplete") { - $user_id = $sketch_id = "null"; - $req_elements = array("Files: "); - - foreach ($request["files"] as $file) { - $req_elements[] = $file["filename"]; - if (strpos($file["filename"], ".txt") !== false) { - if (preg_match('/(?<=user_)[\d]+/', $file['filename'], $match)) $user_id = $match[0]; - if (preg_match('/(?<=project_)[\d]+/', $file['filename'], $match)) $sketch_id = $match[0]; - - } - } - - if ($request["libraries"]) { - $req_elements[] = "Libraries: "; - foreach ($request["libraries"] as $libname => $libfiles) { - foreach ($libfiles as $libfile) - $req_elements[] = $libname . "/" . $libfile["filename"]; - } - } - - $this->logger_id = microtime(true) . "_" . substr($compiler_config['compiler_dir'], -6) . "_user:$user_id" . "_project:$sketch_id"; - - $this->compiler_logger->addInfo($this->logger_id . " - " . implode(" ", $req_elements)); - if ($ARCHIVE_OPTION === true) - $this->compiler_logger->addInfo($this->logger_id . " - " . "Archive file: $ARCHIVE_PATH"); - } - - // Step 4: Syntax-check and compile source files. - //Use the include paths for the AVR headers that are bundled with each Arduino SDK version - //These may differ between linux and MAC OS versions of the Arduino core files, so check before including - $core_includes = ""; - if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include")) - $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include"; - if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed")) - $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed"; - if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/avr/include")) - $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/avr/include "; - elseif (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/avr/include")) - $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/avr/include "; - - if ($format == "autocomplete"){ + // Step 1(part 1): Extract the project files included in the request. + $files = array(); + $tmpVar = $this->extractFiles($request["files"], $TEMP_DIR, $compiler_dir, $files["sketch_files"], "files"); + + if ($tmpVar["success"] === false) + return $tmpVar; + + // Add the compiler temp directory to the compiler_config struct. + $compiler_config["compiler_dir"] = $compiler_dir; + + // Step 1(part 2): Extract the library files included in the request. + $files["libs"] = array(); + foreach ($libraries as $library => $library_files) + { + + $tmpVar = $this->extractFiles($library_files, $TEMP_DIR, $compiler_dir, $files["libs"][$library], "libraries/$library", true); + if ($tmpVar["success"] === false) + return $tmpVar; + } + + if (!array_key_exists("archive", $request) || ($request["archive"] !== false && $request["archive"] !== true)) + $ARCHIVE_OPTION = false; + else + $ARCHIVE_OPTION = $request["archive"]; + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + return $arch_ret; + } + + //Set logging to true if requested, and create the directory where logfiles are stored. + $tmpVar = $this->setLoggingParams($request, $compiler_config, $TEMP_DIR, $compiler_dir); + if ($tmpVar["success"] === false) + return array_merge($tmpVar, ($ARCHIVE_OPTION === true) ? array("archive" => $ARCHIVE_PATH) : array()); + + // Step 2: Preprocess Arduino source files. + $tmpVar = $this->preprocessIno($files["sketch_files"]); + if ($tmpVar["success"] === false) + return array_merge($tmpVar, ($ARCHIVE_OPTION === true) ? array("archive" => $ARCHIVE_PATH) : array()); + + // Step 3: Preprocess Header includes and determine which core files directory(CORE_DIR) will be used. + $tmpVar = $this->preprocessHeaders($libraries, $include_directories, $compiler_dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, $CORE_DIR, $CORE_OVERRIDE_DIR, $version, $core, $variant); + if ($tmpVar["success"] === false) + return array_merge($tmpVar, ($ARCHIVE_OPTION === true) ? array("archive" => $ARCHIVE_PATH) : array()); + + // Log the names of the project files and the libraries used in it. + if ($format != "autocomplete") + { + $user_id = $sketch_id = "null"; + $req_elements = array("Files: "); + + foreach ($request["files"] as $file) + { + $req_elements[] = $file["filename"]; + if (strpos($file["filename"], ".txt") !== false) + { + if (preg_match('/(?<=user_)[\d]+/', $file['filename'], $match)) $user_id = $match[0]; + if (preg_match('/(?<=project_)[\d]+/', $file['filename'], $match)) $sketch_id = $match[0]; + + } + } + + if ($request["libraries"]) + { + $req_elements[] = "Libraries: "; + foreach ($request["libraries"] as $libname => $libfiles) + { + foreach ($libfiles as $libfile) + $req_elements[] = $libname."/".$libfile["filename"]; + } + } + + $this->logger_id = microtime(true)."_".substr($compiler_config['compiler_dir'], -6)."_user:$user_id"."_project:$sketch_id"; + + $this->compiler_logger->addInfo($this->logger_id." - ".implode(" ", $req_elements)); + if ($ARCHIVE_OPTION === true) + $this->compiler_logger->addInfo($this->logger_id." - "."Archive file: $ARCHIVE_PATH"); + } + + // Step 4: Syntax-check and compile source files. + //Use the include paths for the AVR headers that are bundled with each Arduino SDK version + //These may differ between linux and MAC OS versions of the Arduino core files, so check before including + $core_includes = ""; + if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include")) + $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include"; + if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed")) + $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed"; + if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/avr/include")) + $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/avr/include "; + elseif (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/avr/include")) + $core_includes .= " -I$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/lib/avr/include "; + + if ($format == "autocomplete") + { $autocompleteRet = $this->handleAutocompletion($ARDUINO_CORES_DIR, "$compiler_dir/files", $include_directories["main"], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $core_includes, $autocc_clang_target_arch, $TEMP_DIR, $AUTOCC_DIR, $PYTHON, $AUTOCOMPLETER); - if ($ARCHIVE_OPTION === true){ + if ($ARCHIVE_OPTION === true) + { $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); if ($arch_ret["success"] === false) return $arch_ret; @@ -168,718 +174,785 @@ function main($request, $compiler_config) return array_merge($autocompleteRet, array("total_compiler_exec_time" => microtime(true) - $start_time)); } - //handleCompile sets any include directories needed and calls the doCompile function, which does the actual compilation - $ret = $this->handleCompile("$compiler_dir/files", $files["sketch_files"], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["main"], $format); - - $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); - if ($compiler_config['logging'] === true){ - if ($log_content !== false) { - $ret["log"] = $log_content; - file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content); - } - else - $ret["log"] = "Failed to access logfile."; - } - - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - $ret["archive"] = $arch_ret["message"]; - else - $ret["archive"] = $ARCHIVE_PATH; - } - - if (!$ret["success"]) - return $ret; - - if ($format == "syntax") - return array_merge(array( - "success" => true, - "time" => microtime(true) - $start_time), - ($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(), - ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); - - //Keep all object files urls needed for linking. - $objects_to_link = $files["sketch_files"]["o"]; - - //TODO: return objects if more than one file?? - if ($format == "object") - { - $content = base64_encode(file_get_contents($files["sketch_files"]["o"][0].".o")); - if (count($files["sketch_files"]["o"]) != 1 || !$content){ - return array_merge(array( - "success" => false, - "step" => -1, //TODO: Fix this step? - "message" => ""), - ($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(), - ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); - } - else - return array_merge(array( - "success" => true, - "time" => microtime(true) - $start_time, - "output" => $content), - ($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(), - ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); - } - - // Step 5: Create objects for core files (if core file does not already exist) - //Link all core object files to a core.a library. - - //TODO: Figure out why Symfony needs "@" to suppress mkdir wanring - if(!file_exists($this->object_directory)){ - //The code below was added to ensure that no error will be returned because of multithreaded execution. - $make_dir_success = @mkdir($this->object_directory, 0777, true); - if (!$make_dir_success && !is_dir($this->object_directory)) { - usleep(rand( 5000 , 10000 )); - $make_dir_success = @mkdir($this->object_directory, 0777, true); - } - if(!$make_dir_success){ - return array_merge(array( - "success" => false, - "step" => 5, - "message" => "Could not create object files directory."), - ($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(), - ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); - } - } - - //Generate full pathname of the cores library and then check if the library exists. - $core_library = $this->object_directory ."/". pathinfo(str_replace("/", "__", $CORE_DIR."_"), PATHINFO_FILENAME)."_______"."${mcu}_${f_cpu}_${core}_${variant}_${vid}_${pid}_______"."core.a"; - - $lock = fopen("$core_library.LOCK", "w"); - - flock($lock, LOCK_EX); - if (!file_exists($core_library)){ - //makeCoresTmp scans the core files directory and return list including the urls of the files included there. - $tmp = $this->makeCoresTmp($CORE_DIR, $CORE_OVERRIDE_DIR, $TEMP_DIR, $compiler_dir, $files); - - if(!$tmp["success"]){ - return array_merge($tmp, - ($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(), - ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); - } - - $ret = $this->handleCompile("$compiler_dir/core", $files["core"], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["core"], "object"); - - $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); - - if ($compiler_config['logging'] === true){ - if ($log_content !== false){ - $ret["log"] = $log_content; - file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content); - } - else - $ret["log"] = "Failed to access logfile."; - } - - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - $ret["archive"] = $arch_ret["message"]; - else - $ret["archive"] = $ARCHIVE_PATH; - } - - if (!$ret["success"]) - return $ret; - - foreach ($files["core"]["o"] as $core_object){ - //Link object file to library. - exec("$AR $ARFLAGS $core_library $core_object.o", $output); - - if ($compiler_config['logging']) - file_put_contents($compiler_config['logFileName'], "$AR $ARFLAGS $core_library $core_object.o"."\n", FILE_APPEND); - } - flock($lock, LOCK_UN); - fclose($lock); - } - else{ - flock($lock, LOCK_UN); - fclose($lock); - if($compiler_config['logging']) - file_put_contents($compiler_config['logFileName'],"\nUsing previously compiled version of $core_library\n", FILE_APPEND); - } - - // Step 6: Create objects for libraries. - // The elements of the "build" array are needed to build the unique name of every library object file. - $lib_object_naming_params = $request["build"]; - if (!array_key_exists("variant", $request["build"])) - $lib_object_naming_params["variant"] = ""; - $lib_object_naming_params["vid"] = $vid; - $lib_object_naming_params["pid"] = $pid; - - foreach ($files["libs"] as $library_name => $library_files){ - - $lib_object_naming_params["library"] = $library_name; - - $ret = $this->handleCompile("$compiler_dir/libraries/$library_name", $files["libs"][$library_name], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["main"], $format, true, $lib_object_naming_params); - - $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); - if ($compiler_config['logging'] === true){ - if ($log_content !== false) { - $ret["log"] = $log_content; - file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content); - } - else - $ret["log"] = "Failed to access logfile."; - } - - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - $ret["archive"] = $arch_ret["message"]; - else - $ret["archive"] = $ARCHIVE_PATH; - } - - if(!$ret["success"]) - return $ret; - - $objects_to_link = array_merge($objects_to_link, $files["libs"][$library_name]["o"]); - } - - // Step 7: Link all object files and create executable. - $object_files = ""; - foreach ($objects_to_link as $object) - $object_files .= " ".escapeshellarg("$object.o"); - - //Link core.a and every other object file to a .elf binary file - exec("$LD $LDFLAGS $target_arch $object_files $core_library -o $compiler_dir/files/$OUTPUT.elf $LDFLAGS_TAIL 2>&1", $output, $ret_link); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'], "$LD $LDFLAGS $target_arch $object_files $core_library -o $compiler_dir/files/$OUTPUT.elf $LDFLAGS_TAIL\n", FILE_APPEND); - } - - if ($ret_link){ - - // Log the fact that an error occurred during linking - $this->compiler_logger->addInfo($this->logger_id . " - An error occurred during linking: " . json_encode(implode("\n", $output))); - - $returner = array( - "success" => false, - "step" => 7, - "message" => implode("\n", $output)); - - if ($compiler_config['logging'] === true) { - $log_content = @file_get_contents($compiler_config['logFileName']); - if (!$log_content) - $returner["log"] = "Failed to access logfile."; - else { - file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content); - $returner["log"] = $log_content; - } - } - - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - $returner["archive"] = $arch_ret["message"]; - else - $returner["archive"] = $ARCHIVE_PATH; - } - return $returner; - } - - // Step 8: Convert the output to the requested format and measure its - // size. - $tmp = $this->convertOutput("$compiler_dir/files", $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config); - - if ($compiler_config['logging'] === true) { - $log_content = @file_get_contents($compiler_config['logFileName']); - if (!$log_content) - $tmp["log"] = "Failed to access logfile."; - else { - file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content); - $tmp["log"] = $log_content; - } - } - - if ($ARCHIVE_OPTION === true){ - $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); - if ($arch_ret["success"] === false) - $tmp["archive"] = $arch_ret["message"]; - else - $tmp["archive"] = $ARCHIVE_PATH; - } - return $tmp; - } - - private function requestValid(&$request) - { - $request = $this->preproc->validate_input($request); - if (!$request) - return array( - "success" => false, - "step" => 0, - "message" => "Invalid input."); - else return array("success" => true); - } - - private function createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, &$ARCHIVE_PATH) - { - if (!file_exists($ARCHIVE_PATH)){ - // Create a directory in tmp folder and store archive files there - if (!file_exists("$TEMP_DIR/$ARCHIVE_DIR")){ - //The code below was added to ensure that no error will be returned because of multithreaded execution. - $make_dir_success = @mkdir("$TEMP_DIR/$ARCHIVE_DIR", 0777, true); - if (!$make_dir_success && !is_dir("$TEMP_DIR/$ARCHIVE_DIR")) { - usleep(rand( 5000 , 10000 )); - $make_dir_success = @mkdir("$TEMP_DIR/$ARCHIVE_DIR", 0777, true); - } - if (!$make_dir_success) - return array("success" => false, "message" => "Failed to create archive directory."); - } - - do{ - $tar_random_name = uniqid(rand(), true) . '.tar.gz'; - }while (file_exists("$TEMP_DIR/$ARCHIVE_DIR/$tar_random_name")); - $ARCHIVE_PATH = "$TEMP_DIR/$ARCHIVE_DIR/$tar_random_name"; - } - - // The archive files include all the files of the project and the libraries needed to compile it - exec("tar -zcvf $ARCHIVE_PATH -C $TEMP_DIR/ ". pathinfo($compiler_dir, PATHINFO_BASENAME), $output, $ret_var); - - if ($ret_var !=0) - return array("success" => false, "message" => "Failed to archive project files."); - return array("success" => true); - } - - private function extractFiles($request, $temp_dir, &$dir, &$files, $suffix, $lib_extraction = false) - { - // Create a temporary directory to place all the files needed to process - // the compile request. This directory is created in $TMPDIR or /tmp by - // default and is automatically removed upon execution completion. - $cnt = 0; - if (!$dir) - do { - $dir = @System::mktemp("-t $temp_dir/ -d compiler."); - $cnt++; - } while (!$dir && $cnt <= 2); - - if (!$dir) - return array( - "success" => false, - "step" => 1, - "message" => "Failed to create temporary directory."); - - $response = $this->utility->extract_files("$dir/$suffix", $request, $lib_extraction); - - if ($response["success"] === false) - return $response; - $files = $response["files"]; - - return array("success" => true); - } - - private function preprocessIno(&$files) - { - foreach ($files["ino"] as $file) - { - $code = file_get_contents("$file.ino"); - $new_code = $this->preproc->ino_to_cpp($code, "$file.ino"); - $ret = file_put_contents("$file.cpp", $new_code); - - if ($code === false || !$new_code || !$ret) - return array( - "success" => false, - "step" => 2, - "message" => "Failed to preprocess file '$file.ino'."); - - $files["cpp"][] = array_shift($files["ino"]); - } - - return array("success" => true); - } - - public function preprocessHeaders($libraries, &$include_directories, $dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, &$CORE_DIR, &$CORE_OVERRIDE_DIR, $version, &$core, &$variant) - { - try - { - // Create command-line arguments for header search paths. Note that the - // current directory is added to eliminate the difference between <> - // and "" in include preprocessor directives. - - // Check if the core or variant contains a semicolon. - // When a semicolon exists both the core folder and the core itself are specified. - // The same applies to the variant specification. - - $core_specs = array('folder' => "arduino", 'name' => $core, 'modified' => false); - $variant_specs = array('folder' => "arduino", 'name' => $variant, 'modified' => false); - - $tmp = explode(":", $core); - if (count($tmp) == 2){ - $core_specs = array('folder' => $tmp[0], 'name' => $tmp[1], 'modified' => true); - $core = str_replace(":", "_", $core); //core name is used for object file naming, so it shouldn't contain any semicolons - } - elseif (count($tmp) != 1) - return array("success" => false, "step" => 3, "message" => "Invalid core specifier."); - - $tmp = explode(":", $variant); - if (count($tmp) == 2){ - $variant_specs = array('folder' => $tmp[0], 'name' => $tmp[1], 'modified' => true); - $variant = str_replace(":", "_", $variant); //variant name is used for object file naming, so it shouldn't contain any semicolons - } - elseif (count($tmp) != 1) - return array("success" => false, "step" => 3, "message" => "Invalid variant specifier."); - - - - $include_directories = array(); - - // Try to locate the core files - if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/".$core_specs['folder']."/cores/".$core_specs['name'])){ - $CORE_DIR = "$ARDUINO_CORES_DIR/v$version/hardware/".$core_specs['folder']."/cores/".$core_specs['name']; - } - elseif (is_dir($EXTERNAL_CORES_DIR)){ - if ($core_specs['modified'] === true){ - if (file_exists("$EXTERNAL_CORES_DIR/".$core_specs['folder']."/cores/".$core_specs['name'])) - $CORE_DIR = "$EXTERNAL_CORES_DIR/".$core_specs['folder']."/cores/".$core_specs['name']; - } - elseif (false !== ($externals = @scandir($EXTERNAL_CORES_DIR))){ - foreach ($externals as $dirname) - if (is_dir("$EXTERNAL_CORES_DIR/$dirname/") && $dirname != "." && $dirname != ".." && file_exists("$EXTERNAL_CORES_DIR/$dirname/cores/".$core_specs['name'])){ - $CORE_DIR = "$EXTERNAL_CORES_DIR/$dirname/cores/".$core_specs['name']; - break; - } - } - } - - if (empty($CORE_DIR)) - return array("success" => false, "step" => 3, "message" => "Failed to detect core files."); - - // Try to locate the variant - if ($variant != ""){ - if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/".$variant_specs['folder']."/variants/".$variant_specs['name'])) - $variant_dir = "$ARDUINO_CORES_DIR/v$version/hardware/".$variant_specs['folder']."/variants/".$variant_specs['name']; - else { - if (is_dir($EXTERNAL_CORES_DIR)){ - if ($variant_specs['modified'] === true){ - if (file_exists("$EXTERNAL_CORES_DIR/".$variant_specs['folder']."/variants/".$variant_specs['name'])) - $variant_dir = "$EXTERNAL_CORES_DIR/".$variant_specs['folder']."/variants/".$variant_specs['name']; - } - elseif (false !== ($externals = @scandir($EXTERNAL_CORES_DIR))){ - foreach ($externals as $dirname) - if (is_dir("$EXTERNAL_CORES_DIR/$dirname") && $dirname != "." && $dirname != "..") - if ($variant != "" && file_exists("$EXTERNAL_CORES_DIR/$dirname/variants/".$variant_specs['name'])){ - $variant_dir = "$EXTERNAL_CORES_DIR/$dirname/variants/".$variant_specs['name']; - break; - } - } - } - } - } - - if (!empty($variant) && empty($variant_dir)) - return array("success" => false, "step" => 3, "message" => "Failed to detect variant."); + //handleCompile sets any include directories needed and calls the doCompile function, which does the actual compilation + $ret = $this->handleCompile("$compiler_dir/files", $files["sketch_files"], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["main"], $format); + + $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); + if ($compiler_config['logging'] === true) + { + if ($log_content !== false) + { + $ret["log"] = $log_content; + file_put_contents($compiler_config["compiler_dir"]."/log", $log_content); + } + else + $ret["log"] = "Failed to access logfile."; + } + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + $ret["archive"] = $arch_ret["message"]; + else + $ret["archive"] = $ARCHIVE_PATH; + } + + if (!$ret["success"]) + return $ret; + + if ($format == "syntax") + return array_merge(array( + "success" => true, + "time" => microtime(true) - $start_time), + ($ARCHIVE_OPTION === true) ? array("archive" => $ret["archive"]) : array(), + ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); + + //Keep all object files urls needed for linking. + $objects_to_link = $files["sketch_files"]["o"]; + + //TODO: return objects if more than one file?? + if ($format == "object") + { + $content = base64_encode(file_get_contents($files["sketch_files"]["o"][0].".o")); + if (count($files["sketch_files"]["o"]) != 1 || !$content) + { + return array_merge(array( + "success" => false, + "step" => -1, //TODO: Fix this step? + "message" => ""), + ($ARCHIVE_OPTION === true) ? array("archive" => $ret["archive"]) : array(), + ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); + } + else + return array_merge(array( + "success" => true, + "time" => microtime(true) - $start_time, + "output" => $content), + ($ARCHIVE_OPTION === true) ? array("archive" => $ret["archive"]) : array(), + ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); + } + + // Step 5: Create objects for core files (if core file does not already exist) + //Link all core object files to a core.a library. + + //TODO: Figure out why Symfony needs "@" to suppress mkdir wanring + if (!file_exists($this->object_directory)) + { + //The code below was added to ensure that no error will be returned because of multithreaded execution. + $make_dir_success = @mkdir($this->object_directory, 0777, true); + if (!$make_dir_success && !is_dir($this->object_directory)) + { + usleep(rand(5000, 10000)); + $make_dir_success = @mkdir($this->object_directory, 0777, true); + } + if (!$make_dir_success) + { + return array_merge(array( + "success" => false, + "step" => 5, + "message" => "Could not create object files directory."), + ($ARCHIVE_OPTION === true) ? array("archive" => $ret["archive"]) : array(), + ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); + } + } + + //Generate full pathname of the cores library and then check if the library exists. + $core_library = $this->object_directory."/".pathinfo(str_replace("/", "__", $CORE_DIR."_"), PATHINFO_FILENAME)."_______"."${mcu}_${f_cpu}_${core}_${variant}_${vid}_${pid}_______"."core.a"; + + $lock = fopen("$core_library.LOCK", "w"); + + flock($lock, LOCK_EX); + if (!file_exists($core_library)) + { + //makeCoresTmp scans the core files directory and return list including the urls of the files included there. + $tmpVar = $this->makeCoresTmp($CORE_DIR, $CORE_OVERRIDE_DIR, $TEMP_DIR, $compiler_dir, $files); + + if (!$tmpVar["success"]) + { + return array_merge($tmpVar, + ($ARCHIVE_OPTION === true) ? array("archive" => $ret["archive"]) : array(), + ($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array()); + } + + $ret = $this->handleCompile("$compiler_dir/core", $files["core"], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["core"], "object"); + + $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); + + if ($compiler_config['logging'] === true) + { + if ($log_content !== false) + { + $ret["log"] = $log_content; + file_put_contents($compiler_config["compiler_dir"]."/log", $log_content); + } + else + $ret["log"] = "Failed to access logfile."; + } + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + $ret["archive"] = $arch_ret["message"]; + else + $ret["archive"] = $ARCHIVE_PATH; + } + + if (!$ret["success"]) + return $ret; + + foreach ($files["core"]["o"] as $core_object) + { + //Link object file to library. + exec("$AR $ARFLAGS $core_library $core_object.o", $output); + + if ($compiler_config['logging']) + file_put_contents($compiler_config['logFileName'], "$AR $ARFLAGS $core_library $core_object.o"."\n", FILE_APPEND); + } + flock($lock, LOCK_UN); + fclose($lock); + } + else + { + flock($lock, LOCK_UN); + fclose($lock); + if ($compiler_config['logging']) + file_put_contents($compiler_config['logFileName'], "\nUsing previously compiled version of $core_library\n", FILE_APPEND); + } + + // Step 6: Create objects for libraries. + // The elements of the "build" array are needed to build the unique name of every library object file. + $lib_object_naming_params = $request["build"]; + if (!array_key_exists("variant", $request["build"])) + $lib_object_naming_params["variant"] = ""; + $lib_object_naming_params["vid"] = $vid; + $lib_object_naming_params["pid"] = $pid; + + foreach ($files["libs"] as $library_name => $library_files) + { + + $lib_object_naming_params["library"] = $library_name; + + $ret = $this->handleCompile("$compiler_dir/libraries/$library_name", $files["libs"][$library_name], $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories["main"], $format, true, $lib_object_naming_params); + + $log_content = (($compiler_config['logging'] === true) ? @file_get_contents($compiler_config['logFileName']) : ""); + if ($compiler_config['logging'] === true) + { + if ($log_content !== false) + { + $ret["log"] = $log_content; + file_put_contents($compiler_config["compiler_dir"]."/log", $log_content); + } + else + $ret["log"] = "Failed to access logfile."; + } + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + $ret["archive"] = $arch_ret["message"]; + else + $ret["archive"] = $ARCHIVE_PATH; + } + + if (!$ret["success"]) + return $ret; + + $objects_to_link = array_merge($objects_to_link, $files["libs"][$library_name]["o"]); + } + + // Step 7: Link all object files and create executable. + $object_files = ""; + foreach ($objects_to_link as $object) + $object_files .= " ".escapeshellarg("$object.o"); + + //Link core.a and every other object file to a .elf binary file + exec("$LD $LDFLAGS $target_arch $object_files $core_library -o $compiler_dir/files/$OUTPUT.elf $LDFLAGS_TAIL 2>&1", $output, $ret_link); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$LD $LDFLAGS $target_arch $object_files $core_library -o $compiler_dir/files/$OUTPUT.elf $LDFLAGS_TAIL\n", FILE_APPEND); + } + + if ($ret_link) + { + + // Log the fact that an error occurred during linking + $this->compiler_logger->addInfo($this->logger_id." - An error occurred during linking: ".json_encode(implode("\n", $output))); + + $returner = array( + "success" => false, + "step" => 7, + "message" => implode("\n", $output)); + + if ($compiler_config['logging'] === true) + { + $log_content = @file_get_contents($compiler_config['logFileName']); + if (!$log_content) + $returner["log"] = "Failed to access logfile."; + else + { + file_put_contents($compiler_config["compiler_dir"]."/log", $log_content); + $returner["log"] = $log_content; + } + } + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + $returner["archive"] = $arch_ret["message"]; + else + $returner["archive"] = $ARCHIVE_PATH; + } + return $returner; + } + + // Step 8: Convert the output to the requested format and measure its + // size. + $tmpVar = $this->convertOutput("$compiler_dir/files", $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config); + + if ($compiler_config['logging'] === true) + { + $log_content = @file_get_contents($compiler_config['logFileName']); + if (!$log_content) + $tmpVar["log"] = "Failed to access logfile."; + else + { + file_put_contents($compiler_config["compiler_dir"]."/log", $log_content); + $tmpVar["log"] = $log_content; + } + } + + if ($ARCHIVE_OPTION === true) + { + $arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH); + if ($arch_ret["success"] === false) + $tmpVar["archive"] = $arch_ret["message"]; + else + $tmpVar["archive"] = $ARCHIVE_PATH; + } + return $tmpVar; + } + + private function requestValid(&$request) + { + $request = $this->preproc->validateInput($request); + if (!$request) + return array( + "success" => false, + "step" => 0, + "message" => "Invalid input."); + else return array("success" => true); + } + + private function createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, &$ARCHIVE_PATH) + { + if (!file_exists($ARCHIVE_PATH)) + { + // Create a directory in tmp folder and store archive files there + if (!file_exists("$TEMP_DIR/$ARCHIVE_DIR")) + { + //The code below was added to ensure that no error will be returned because of multithreaded execution. + $make_dir_success = @mkdir("$TEMP_DIR/$ARCHIVE_DIR", 0777, true); + if (!$make_dir_success && !is_dir("$TEMP_DIR/$ARCHIVE_DIR")) + { + usleep(rand(5000, 10000)); + $make_dir_success = @mkdir("$TEMP_DIR/$ARCHIVE_DIR", 0777, true); + } + if (!$make_dir_success) + return array("success" => false, "message" => "Failed to create archive directory."); + } + + do + { + $tar_random_name = uniqid(rand(), true).'.tar.gz'; + } while (file_exists("$TEMP_DIR/$ARCHIVE_DIR/$tar_random_name")); + $ARCHIVE_PATH = "$TEMP_DIR/$ARCHIVE_DIR/$tar_random_name"; + } + + // The archive files include all the files of the project and the libraries needed to compile it + exec("tar -zcvf $ARCHIVE_PATH -C $TEMP_DIR/ ".pathinfo($compiler_dir, PATHINFO_BASENAME), $output, $ret_var); + + if ($ret_var != 0) + return array("success" => false, "message" => "Failed to archive project files."); + return array("success" => true); + } + + private function extractFiles($request, $temp_dir, &$dir, &$files, $suffix, $lib_extraction = false) + { + // Create a temporary directory to place all the files needed to process + // the compile request. This directory is created in $TMPDIR or /tmp by + // default and is automatically removed upon execution completion. + $cnt = 0; + if (!$dir) + do + { + $dir = @System::mktemp("-t $temp_dir/ -d compiler."); + $cnt++; + } while (!$dir && $cnt <= 2); + + if (!$dir) + return array( + "success" => false, + "step" => 1, + "message" => "Failed to create temporary directory."); + + $response = $this->utility->extractFiles("$dir/$suffix", $request, $lib_extraction); + + if ($response["success"] === false) + return $response; + $files = $response["files"]; + + return array("success" => true); + } + + private function preprocessIno(&$files) + { + foreach ($files["ino"] as $file) + { + $code = file_get_contents("$file.ino"); + $new_code = $this->preproc->convertInoToCpp($code, "$file.ino"); + $ret = file_put_contents("$file.cpp", $new_code); + + if ($code === false || !$new_code || !$ret) + return array( + "success" => false, + "step" => 2, + "message" => "Failed to preprocess file '$file.ino'."); + + $files["cpp"][] = array_shift($files["ino"]); + } + + return array("success" => true); + } + + public function preprocessHeaders($libraries, &$include_directories, $dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, &$CORE_DIR, &$CORE_OVERRIDE_DIR, $version, &$core, &$variant) + { + try + { + // Create command-line arguments for header search paths. Note that the + // current directory is added to eliminate the difference between <> + // and "" in include preprocessor directives. + + // Check if the core or variant contains a semicolon. + // When a semicolon exists both the core folder and the core itself are specified. + // The same applies to the variant specification. + + $core_specs = array('folder' => "arduino", 'name' => $core, 'modified' => false); + $variant_specs = array('folder' => "arduino", 'name' => $variant, 'modified' => false); + + $tmp = explode(":", $core); + if (count($tmp) == 2) + { + $core_specs = array('folder' => $tmp[0], 'name' => $tmp[1], 'modified' => true); + $core = str_replace(":", "_", $core); //core name is used for object file naming, so it shouldn't contain any semicolons + } + elseif (count($tmp) != 1) + return array("success" => false, "step" => 3, "message" => "Invalid core specifier."); + + $tmp = explode(":", $variant); + if (count($tmp) == 2) + { + $variant_specs = array('folder' => $tmp[0], 'name' => $tmp[1], 'modified' => true); + $variant = str_replace(":", "_", $variant); //variant name is used for object file naming, so it shouldn't contain any semicolons + } + elseif (count($tmp) != 1) + return array("success" => false, "step" => 3, "message" => "Invalid variant specifier."); + + + $include_directories = array(); + + // Try to locate the core files + if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/".$core_specs['folder']."/cores/".$core_specs['name'])) + { + $CORE_DIR = "$ARDUINO_CORES_DIR/v$version/hardware/".$core_specs['folder']."/cores/".$core_specs['name']; + } + elseif (is_dir($EXTERNAL_CORES_DIR)) + { + if ($core_specs['modified'] === true) + { + if (file_exists("$EXTERNAL_CORES_DIR/".$core_specs['folder']."/cores/".$core_specs['name'])) + $CORE_DIR = "$EXTERNAL_CORES_DIR/".$core_specs['folder']."/cores/".$core_specs['name']; + } + elseif (false !== ($externals = @scandir($EXTERNAL_CORES_DIR))) + { + foreach ($externals as $dirname) + if (is_dir("$EXTERNAL_CORES_DIR/$dirname/") && $dirname != "." && $dirname != ".." && file_exists("$EXTERNAL_CORES_DIR/$dirname/cores/".$core_specs['name'])) + { + $CORE_DIR = "$EXTERNAL_CORES_DIR/$dirname/cores/".$core_specs['name']; + break; + } + } + } + + if (empty($CORE_DIR)) + return array("success" => false, "step" => 3, "message" => "Failed to detect core files."); + + // Try to locate the variant + if ($variant != "") + { + if (file_exists("$ARDUINO_CORES_DIR/v$version/hardware/".$variant_specs['folder']."/variants/".$variant_specs['name'])) + $variant_dir = "$ARDUINO_CORES_DIR/v$version/hardware/".$variant_specs['folder']."/variants/".$variant_specs['name']; + else + { + if (is_dir($EXTERNAL_CORES_DIR)) + { + if ($variant_specs['modified'] === true) + { + if (file_exists("$EXTERNAL_CORES_DIR/".$variant_specs['folder']."/variants/".$variant_specs['name'])) + $variant_dir = "$EXTERNAL_CORES_DIR/".$variant_specs['folder']."/variants/".$variant_specs['name']; + } + elseif (false !== ($externals = @scandir($EXTERNAL_CORES_DIR))) + { + foreach ($externals as $dirname) + if (is_dir("$EXTERNAL_CORES_DIR/$dirname") && $dirname != "." && $dirname != "..") + if ($variant != "" && file_exists("$EXTERNAL_CORES_DIR/$dirname/variants/".$variant_specs['name'])) + { + $variant_dir = "$EXTERNAL_CORES_DIR/$dirname/variants/".$variant_specs['name']; + break; + } + } + } + } + } + + if (!empty($variant) && empty($variant_dir)) + return array("success" => false, "step" => 3, "message" => "Failed to detect variant."); // Check the override file directories for files that override the requested cores - if (is_dir("$EXTERNAL_CORES_DIR/override_cores/".$core_specs['name']."/") ) + if (is_dir("$EXTERNAL_CORES_DIR/override_cores/".$core_specs['name']."/")) $CORE_OVERRIDE_DIR = "$EXTERNAL_CORES_DIR/override_cores/".$core_specs['name']."/"; else $CORE_OVERRIDE_DIR = ""; $include_directories["core"] = ((!empty($CORE_OVERRIDE_DIR)) && ($CORE_OVERRIDE_DIR != "")) ? " -I$CORE_OVERRIDE_DIR" : ""; - $include_directories["core"] .= " -I$CORE_DIR"; + $include_directories["core"] .= " -I$CORE_DIR"; $include_directories["core"] .= (!empty($variant_dir)) ? " -I$variant_dir" : ""; - $include_directories["main"] = $include_directories["core"]; - foreach ($libraries as $library_name => $library_files) - $include_directories["main"] .= " -I$dir/libraries/$library_name"; - } - catch(\Exception $e) - { - return array("success" => false, "step" => 3, "message" => "Unknown Error:\n".$e->getMessage()); - } - - return array("success" => true); - } - - private function doCompile($compiler_config, &$files, $dir, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching = false, $name_params = null) - { - if ($format == "syntax") - { - $CFLAGS .= " -fsyntax-only"; - $CPPFLAGS .= " -fsyntax-only"; - } - - foreach (array("c", "cpp", "S") as $ext) - { - foreach ($files[$ext] as $file) - { - if($caching){ - $name_params['core'] = str_replace(":", "_", $name_params['core']); - $name_params['variant'] = str_replace(":", "_", $name_params['variant']); - $object_filename = "$this->object_directory/${name_params['mcu']}_${name_params['f_cpu']}_${name_params['core']}_${name_params['variant']}_${name_params['vid']}_${name_params['pid']}______${name_params['library']}_______".((pathinfo(pathinfo($file, PATHINFO_DIRNAME), PATHINFO_FILENAME) == "utility") ? "utility_______" : "") .pathinfo($file, PATHINFO_FILENAME); - $object_file = $object_filename; - //Lock the file so that only one compiler instance (thread) will compile every library object file - $lock = fopen("$object_file.o.LOCK", "w"); - $lock_check = flock($lock, LOCK_EX); - } - else - $object_file = $file; - - if(!file_exists("$object_file.o")){ - // From hereon, $file is shell escaped and thus should only be used in calls - // to exec(). - $file = escapeshellarg($file); - $object_file = escapeshellarg($object_file); - - //replace exec() calls with $this->utility->debug_exec() for debugging - if ($ext == "c") - { - exec("$CC $CFLAGS $core_includes $target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$CC $CFLAGS $core_includes $target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); - } - } - elseif ($ext == "cpp") - { - exec("$CPP $CPPFLAGS $core_includes $target_arch -MMD $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$CPP $CPPFLAGS $core_includes $target_arch -MMD $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); - } - } - elseif ($ext == "S") - { - exec("$AS $ASFLAGS $target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$AS $ASFLAGS $target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); - } - } - if (isset($ret_compile) && $ret_compile) - { - $avr_output = implode("\n", $output); - unset($output); - exec("$CLANG $CLANG_FLAGS $core_includes $clang_target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$CLANG $CLANG_FLAGS $core_includes $clang_target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); - } - - $output = $this->postproc->ansi_to_html(implode("\n", $output)); - - $resp = array( - "success" => false, - "step" => 4, - "debug" => $avr_output); - - /** - * When an error occurs, compare the output of both avr-gcc and clang - * and if significant differences are detected, return a modified version of the clang output. - */ - $clangElements = $this->getClangErrorFileList ($output); - $this->compiler_logger->addInfo($this->logger_id . " - Clang reported files: " . implode(" | ", array_keys($clangElements))); - $gccElements = $this->getGccErrorFileList ($avr_output); - $this->compiler_logger->addInfo($this->logger_id . " - Gcc reported files: " . implode(" | ", array_keys($gccElements))); - - if (array_diff(array_keys($clangElements), array_keys($gccElements))) { - - $resp["old_message"] = $output; - $this->compiler_logger->addInfo($this->logger_id . " - Mismatch between clang and gcc output found."); - - $next_clang_output = $this->cleanUpClangOutput ($output, $compiler_config, "asm"); - - $clangElements = $this->getClangErrorFileList ($next_clang_output); - $this->compiler_logger->addInfo($this->logger_id . " - Clang reported files after removing asm: " . implode(" | ", array_keys($clangElements))); - - if (array_diff(array_keys($clangElements), array_keys($gccElements))) { - $this->compiler_logger->addInfo($this->logger_id . " - Mismatch between clang and gcc output found after removing assembly messages."); - $final_clang_output = $this->cleanUpClangOutput ($next_clang_output, $compiler_config, "non_asm"); - - $clangElements = $this->getClangErrorFileList ($final_clang_output); - if (array_diff(array_keys($clangElements), array_keys($gccElements))) { - $this->compiler_logger->addInfo($this->logger_id . " - Mismatch between clang and gcc output found after removing assembly/library/core messages."); - }else { - $this->compiler_logger->addInfo($this->logger_id . " - Clang and gcc issue solved. Both report same files with errors."); - } - $this->compiler_logger->addInfo($this->logger_id . " - Gcc output: " . json_encode($avr_output)); - $this->compiler_logger->addInfo($this->logger_id . " - Clang initial output: " . json_encode($output)); - $this->compiler_logger->addInfo($this->logger_id . " - Clang reformated output: " . json_encode($final_clang_output)); - $final_clang_output = $this->pathRemover ($final_clang_output, $compiler_config); - $resp["message"] = $final_clang_output; - if ($resp["message"] == "") - $resp["message"] = $this->pathRemover ($output, $compiler_config); - return $resp; - }else { - $this->compiler_logger->addInfo($this->logger_id . " - Gcc output: " . json_encode($avr_output)); - $this->compiler_logger->addInfo($this->logger_id . " - Clang initial output: " . json_encode($output)); - $this->compiler_logger->addInfo($this->logger_id . " - Clang reformated output: " . json_encode($next_clang_output)); - $next_clang_output = $this->pathRemover ($next_clang_output, $compiler_config); - $resp["message"] = $next_clang_output; - if ($resp["message"] == "") - $resp["message"] = $this->pathRemover ($output, $compiler_config); - return $resp; - } - } - - $resp["message"] = $this->pathRemover ($output, $compiler_config); - if ($resp["message"] == "") - $resp["message"] = $this->pathRemover($avr_output, $compiler_config); - return $resp; - } - unset($output); - if ($caching && $lock_check){ - flock($lock, LOCK_UN); - fclose($lock); - } - } - elseif ($caching && $lock_check){ - if($compiler_config['logging']) - file_put_contents($compiler_config['logFileName'],"Using previously compiled version of $object_file.o\n", FILE_APPEND); - flock($lock, LOCK_UN); - fclose($lock); - } - - if(!$caching){ - $files["o"][] = array_shift($files[$ext]); - } - else{ - $files["o"][] = $object_filename; - array_shift($files[$ext]); - } - } - } - - return array("success" => true); - } - - private function convertOutput($dir, $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config) - { - if ($format == "elf") - { - $ret_objcopy = false; - exec("$SIZE $SIZE_FLAGS --target=elf32-avr $dir/$OUTPUT.elf | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME - - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$SIZE $SIZE_FLAGS --target=elf32-avr $dir/$OUTPUT.elf | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); - } - $content = base64_encode(file_get_contents("$dir/$OUTPUT.elf")); - } - elseif ($format == "binary") - { - exec("$OBJCOPY $OBJCOPY_FLAGS -O binary $dir/$OUTPUT.elf $dir/$OUTPUT.bin", $dummy, $ret_objcopy); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$OBJCOPY $OBJCOPY_FLAGS -O binary $dir/$OUTPUT.elf $dir/$OUTPUT.bin\n", FILE_APPEND); - } - - exec("$SIZE $SIZE_FLAGS --target=binary $dir/$OUTPUT.bin | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$SIZE $SIZE_FLAGS --target=binary $dir/$OUTPUT.bin | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); - } - $content = base64_encode(file_get_contents("$dir/$OUTPUT.bin")); - } - elseif ($format == "hex") - { - exec("$OBJCOPY $OBJCOPY_FLAGS -O ihex $dir/$OUTPUT.elf $dir/$OUTPUT.hex", $dummy, $ret_objcopy); - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$OBJCOPY $OBJCOPY_FLAGS -O ihex $dir/$OUTPUT.elf $dir/$OUTPUT.hex\n", FILE_APPEND); - } - - exec("$SIZE $SIZE_FLAGS --target=ihex $dir/$OUTPUT.hex | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME - if($compiler_config['logging']){ - file_put_contents($compiler_config['logFileName'],"$SIZE $SIZE_FLAGS --target=ihex $dir/$OUTPUT.hex | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); - } - - $content = file_get_contents("$dir/$OUTPUT.hex"); - } - - // If everything went well, return the reply to the caller. - if ($ret_objcopy || $ret_size || $content === false) - return array( - "success" => false, - "step" => 8, - "message" => "There was a problem while generating the your binary file"); - else - return array( - "success" => true, - "time" => microtime(true) - $start_time, - "size" => $size[0], - "output" => $content); - - } - - private function set_avr($version, $ARDUINO_CORES_DIR, $BINUTILS, &$CC, &$CPP, &$AS, &$AR, &$LD, &$OBJCOPY, &$SIZE) - { - // External binaries. - $binaries = array("cc" => "-gcc", "cpp" => "-g++", "as" => "-gcc", "ar" => "-ar", "ld" => "-gcc", "objcopy" => "-objcopy", "size" => "-size"); - - $binpaths = array(); - foreach ($binaries as $key => $value){ - if (!file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/bin/avr$value")) - $binpaths[$key] = "$BINUTILS/avr$value"; - else - $binpaths[$key] = "$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/bin/avr$value"; - } - - $CC = $binpaths["cc"]; - $CPP = $binpaths["cpp"]; - $AS = $binpaths["as"]; - $AR = $binpaths["ar"]; - $LD = $binpaths["ld"]; - $OBJCOPY = $binpaths["objcopy"]; - $SIZE = $binpaths["size"]; - - } - private function set_values($compiler_config, - &$BINUTILS, &$CLANG, &$CFLAGS, &$CPPFLAGS, - &$ASFLAGS, &$ARFLAGS, &$LDFLAGS, &$LDFLAGS_TAIL, &$CLANG_FLAGS, &$OBJCOPY_FLAGS, &$SIZE_FLAGS, - &$OUTPUT, &$ARDUINO_CORES_DIR, &$EXTERNAL_CORES_DIR, &$TEMP_DIR, &$ARCHIVE_DIR, &$AUTOCC_DIR, &$PYTHON, &$AUTOCOMPLETER) - { - // External binaries. - //If the current version of the core files does not include its own binaries, then use the default - //ones included in the binutils parameter - $BINUTILS = $compiler_config["binutils"]; - //Clang is used to return the output in case of an error, it's version independent, so its - //value is set by set_values function. - - $LDLIBRARYPATH="LD_LIBRARY_PATH=" . $compiler_config["arduino_cores_dir"] . "/clang/v3_5/lib:\$LD_LIBRARY_PATH"; - $CLANG = $LDLIBRARYPATH . " " . $compiler_config["clang"]; + $include_directories["main"] = $include_directories["core"]; + foreach ($libraries as $library_name => $library_files) + $include_directories["main"] .= " -I$dir/libraries/$library_name"; + } catch (\Exception $e) + { + return array("success" => false, "step" => 3, "message" => "Unknown Error:\n".$e->getMessage()); + } + + return array("success" => true); + } + + private function doCompile($compiler_config, &$files, $dir, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching = false, $name_params = null) + { + if ($format == "syntax") + { + $CFLAGS .= " -fsyntax-only"; + $CPPFLAGS .= " -fsyntax-only"; + } + + foreach (array("c", "cpp", "S") as $ext) + { + foreach ($files[$ext] as $file) + { + if ($caching) + { + $name_params['core'] = str_replace(":", "_", $name_params['core']); + $name_params['variant'] = str_replace(":", "_", $name_params['variant']); + $object_filename = "$this->object_directory/${name_params['mcu']}_${name_params['f_cpu']}_${name_params['core']}_${name_params['variant']}_${name_params['vid']}_${name_params['pid']}______${name_params['library']}_______".((pathinfo(pathinfo($file, PATHINFO_DIRNAME), PATHINFO_FILENAME) == "utility") ? "utility_______" : "").pathinfo($file, PATHINFO_FILENAME); + $object_file = $object_filename; + //Lock the file so that only one compiler instance (thread) will compile every library object file + $lock = fopen("$object_file.o.LOCK", "w"); + $lock_check = flock($lock, LOCK_EX); + } + else + $object_file = $file; + + if (!file_exists("$object_file.o")) + { + // From hereon, $file is shell escaped and thus should only be used in calls + // to exec(). + $file = escapeshellarg($file); + $object_file = escapeshellarg($object_file); + + //replace exec() calls with $this->utility->execWithDebugging() for debugging + if ($ext == "c") + { + exec("$CC $CFLAGS $core_includes $target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$CC $CFLAGS $core_includes $target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); + } + } + elseif ($ext == "cpp") + { + exec("$CPP $CPPFLAGS $core_includes $target_arch -MMD $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$CPP $CPPFLAGS $core_includes $target_arch -MMD $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); + } + } + elseif ($ext == "S") + { + exec("$AS $ASFLAGS $target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$AS $ASFLAGS $target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); + } + } + if (isset($ret_compile) && $ret_compile) + { + $avr_output = implode("\n", $output); + unset($output); + exec("$CLANG $CLANG_FLAGS $core_includes $clang_target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$CLANG $CLANG_FLAGS $core_includes $clang_target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND); + } + + $output = $this->postproc->convertANSItoHTML(implode("\n", $output)); + + $resp = array( + "success" => false, + "step" => 4, + "debug" => $avr_output); + + /** + * When an error occurs, compare the output of both avr-gcc and clang + * and if significant differences are detected, return a modified version of the clang output. + */ + $clangElements = $this->getClangErrorFileList($output); + $this->compiler_logger->addInfo($this->logger_id." - Clang reported files: ".implode(" | ", array_keys($clangElements))); + $gccElements = $this->getGccErrorFileList($avr_output); + $this->compiler_logger->addInfo($this->logger_id." - Gcc reported files: ".implode(" | ", array_keys($gccElements))); + + if (array_diff(array_keys($clangElements), array_keys($gccElements))) + { + + $resp["old_message"] = $output; + $this->compiler_logger->addInfo($this->logger_id." - Mismatch between clang and gcc output found."); + + $next_clang_output = $this->cleanUpClangOutput($output, $compiler_config, "asm"); + + $clangElements = $this->getClangErrorFileList($next_clang_output); + $this->compiler_logger->addInfo($this->logger_id." - Clang reported files after removing asm: ".implode(" | ", array_keys($clangElements))); + + if (array_diff(array_keys($clangElements), array_keys($gccElements))) + { + $this->compiler_logger->addInfo($this->logger_id." - Mismatch between clang and gcc output found after removing assembly messages."); + $final_clang_output = $this->cleanUpClangOutput($next_clang_output, $compiler_config, "non_asm"); + + $clangElements = $this->getClangErrorFileList($final_clang_output); + if (array_diff(array_keys($clangElements), array_keys($gccElements))) + { + $this->compiler_logger->addInfo($this->logger_id." - Mismatch between clang and gcc output found after removing assembly/library/core messages."); + } + else + { + $this->compiler_logger->addInfo($this->logger_id." - Clang and gcc issue solved. Both report same files with errors."); + } + $this->compiler_logger->addInfo($this->logger_id." - Gcc output: ".json_encode($avr_output)); + $this->compiler_logger->addInfo($this->logger_id." - Clang initial output: ".json_encode($output)); + $this->compiler_logger->addInfo($this->logger_id." - Clang reformated output: ".json_encode($final_clang_output)); + $final_clang_output = $this->pathRemover($final_clang_output, $compiler_config); + $resp["message"] = $final_clang_output; + if ($resp["message"] == "") + $resp["message"] = $this->pathRemover($output, $compiler_config); + return $resp; + } + else + { + $this->compiler_logger->addInfo($this->logger_id." - Gcc output: ".json_encode($avr_output)); + $this->compiler_logger->addInfo($this->logger_id." - Clang initial output: ".json_encode($output)); + $this->compiler_logger->addInfo($this->logger_id." - Clang reformated output: ".json_encode($next_clang_output)); + $next_clang_output = $this->pathRemover($next_clang_output, $compiler_config); + $resp["message"] = $next_clang_output; + if ($resp["message"] == "") + $resp["message"] = $this->pathRemover($output, $compiler_config); + return $resp; + } + } + + $resp["message"] = $this->pathRemover($output, $compiler_config); + if ($resp["message"] == "") + $resp["message"] = $this->pathRemover($avr_output, $compiler_config); + return $resp; + } + unset($output); + if ($caching && $lock_check) + { + flock($lock, LOCK_UN); + fclose($lock); + } + } + elseif ($caching && $lock_check) + { + if ($compiler_config['logging']) + file_put_contents($compiler_config['logFileName'], "Using previously compiled version of $object_file.o\n", FILE_APPEND); + flock($lock, LOCK_UN); + fclose($lock); + } + + if (!$caching) + { + $files["o"][] = array_shift($files[$ext]); + } + else + { + $files["o"][] = $object_filename; + array_shift($files[$ext]); + } + } + } + + return array("success" => true); + } + + private function convertOutput($dir, $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config) + { + if ($format == "elf") + { + $ret_objcopy = false; + exec("$SIZE $SIZE_FLAGS --target=elf32-avr $dir/$OUTPUT.elf | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME + + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$SIZE $SIZE_FLAGS --target=elf32-avr $dir/$OUTPUT.elf | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); + } + $content = base64_encode(file_get_contents("$dir/$OUTPUT.elf")); + } + elseif ($format == "binary") + { + exec("$OBJCOPY $OBJCOPY_FLAGS -O binary $dir/$OUTPUT.elf $dir/$OUTPUT.bin", $dummy, $ret_objcopy); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$OBJCOPY $OBJCOPY_FLAGS -O binary $dir/$OUTPUT.elf $dir/$OUTPUT.bin\n", FILE_APPEND); + } + + exec("$SIZE $SIZE_FLAGS --target=binary $dir/$OUTPUT.bin | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$SIZE $SIZE_FLAGS --target=binary $dir/$OUTPUT.bin | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); + } + $content = base64_encode(file_get_contents("$dir/$OUTPUT.bin")); + } + elseif ($format == "hex") + { + exec("$OBJCOPY $OBJCOPY_FLAGS -O ihex $dir/$OUTPUT.elf $dir/$OUTPUT.hex", $dummy, $ret_objcopy); + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$OBJCOPY $OBJCOPY_FLAGS -O ihex $dir/$OUTPUT.elf $dir/$OUTPUT.hex\n", FILE_APPEND); + } + + exec("$SIZE $SIZE_FLAGS --target=ihex $dir/$OUTPUT.hex | awk 'FNR == 2 {print $1+$2}'", $size, $ret_size); // FIXME + if ($compiler_config['logging']) + { + file_put_contents($compiler_config['logFileName'], "$SIZE $SIZE_FLAGS --target=ihex $dir/$OUTPUT.hex | awk 'FNR == 2 {print $1+$2}'\n", FILE_APPEND); + } + + $content = file_get_contents("$dir/$OUTPUT.hex"); + } + + // If everything went well, return the reply to the caller. + if ($ret_objcopy || $ret_size || $content === false) + return array( + "success" => false, + "step" => 8, + "message" => "There was a problem while generating the your binary file"); + else + return array( + "success" => true, + "time" => microtime(true) - $start_time, + "size" => $size[0], + "output" => $content); + + } + + private function setAVR($version, $ARDUINO_CORES_DIR, $BINUTILS, &$CC, &$CPP, &$AS, &$AR, &$LD, &$OBJCOPY, &$SIZE) + { + // External binaries. + $binaries = array("cc" => "-gcc", "cpp" => "-g++", "as" => "-gcc", "ar" => "-ar", "ld" => "-gcc", "objcopy" => "-objcopy", "size" => "-size"); + + $binpaths = array(); + foreach ($binaries as $key => $value) + { + if (!file_exists("$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/bin/avr$value")) + $binpaths[$key] = "$BINUTILS/avr$value"; + else + $binpaths[$key] = "$ARDUINO_CORES_DIR/v$version/hardware/tools/avr/bin/avr$value"; + } + + $CC = $binpaths["cc"]; + $CPP = $binpaths["cpp"]; + $AS = $binpaths["as"]; + $AR = $binpaths["ar"]; + $LD = $binpaths["ld"]; + $OBJCOPY = $binpaths["objcopy"]; + $SIZE = $binpaths["size"]; + + } + + private function setValues($compiler_config, + &$BINUTILS, &$CLANG, &$CFLAGS, &$CPPFLAGS, + &$ASFLAGS, &$ARFLAGS, &$LDFLAGS, &$LDFLAGS_TAIL, &$CLANG_FLAGS, &$OBJCOPY_FLAGS, &$SIZE_FLAGS, + &$OUTPUT, &$ARDUINO_CORES_DIR, &$EXTERNAL_CORES_DIR, &$TEMP_DIR, &$ARCHIVE_DIR, &$AUTOCC_DIR, &$PYTHON, &$AUTOCOMPLETER) + { + // External binaries. + //If the current version of the core files does not include its own binaries, then use the default + //ones included in the binutils parameter + $BINUTILS = $compiler_config["binutils"]; + //Clang is used to return the output in case of an error, it's version independent, so its + //value is set by setValues function. + + $LDLIBRARYPATH = "LD_LIBRARY_PATH=".$compiler_config["arduino_cores_dir"]."/clang/v3_5/lib:\$LD_LIBRARY_PATH"; + $CLANG = $LDLIBRARYPATH." ".$compiler_config["clang"]; //Path to Python binaries, needed for the execution of the autocompletion script. - $PYTHONPATH="PYTHONPATH=" . $compiler_config["arduino_cores_dir"] . "/clang/v3_5/bindings/python:\$PYTHONPATH"; - $PYTHON = $LDLIBRARYPATH . " " . $PYTHONPATH . " " . $compiler_config["python"]; - - // Standard command-line arguments used by the binaries. - $CFLAGS = $compiler_config["cflags"]; - $CPPFLAGS = $compiler_config["cppflags"]; - $ASFLAGS = $compiler_config["asflags"]; - $ARFLAGS = $compiler_config["arflags"]; - $LDFLAGS = $compiler_config["ldflags"]; - $LDFLAGS_TAIL = $compiler_config["ldflags_tail"]; - $CLANG_FLAGS = $compiler_config["clang_flags"]; - $OBJCOPY_FLAGS = $compiler_config["objcopy_flags"]; - $SIZE_FLAGS = $compiler_config["size_flags"]; - // The default name of the output file. - $OUTPUT = $compiler_config["output"]; - // The tmp folder where logfiles and object files are placed - $TEMP_DIR = $compiler_config["temp_dir"]; - // The directory name where archive files are stored in $TEMP_DIR - $ARCHIVE_DIR = $compiler_config["archive_dir"]; + $PYTHONPATH = "PYTHONPATH=".$compiler_config["arduino_cores_dir"]."/clang/v3_5/bindings/python:\$PYTHONPATH"; + $PYTHON = $LDLIBRARYPATH." ".$PYTHONPATH." ".$compiler_config["python"]; + + // Standard command-line arguments used by the binaries. + $CFLAGS = $compiler_config["cflags"]; + $CPPFLAGS = $compiler_config["cppflags"]; + $ASFLAGS = $compiler_config["asflags"]; + $ARFLAGS = $compiler_config["arflags"]; + $LDFLAGS = $compiler_config["ldflags"]; + $LDFLAGS_TAIL = $compiler_config["ldflags_tail"]; + $CLANG_FLAGS = $compiler_config["clang_flags"]; + $OBJCOPY_FLAGS = $compiler_config["objcopy_flags"]; + $SIZE_FLAGS = $compiler_config["size_flags"]; + // The default name of the output file. + $OUTPUT = $compiler_config["output"]; + // The tmp folder where logfiles and object files are placed + $TEMP_DIR = $compiler_config["temp_dir"]; + // The directory name where archive files are stored in $TEMP_DIR + $ARCHIVE_DIR = $compiler_config["archive_dir"]; // The directory where autocompletion files are stored. $AUTOCC_DIR = $compiler_config["autocompletion_dir"]; // The name of the python script that will be executed for autocompletion. $AUTOCOMPLETER = $compiler_config["autocompleter"]; - // Path to arduino-core-files repository. - $ARDUINO_CORES_DIR = $compiler_config["arduino_cores_dir"]; - // Path to external core files (for example arduino ATtiny) - $EXTERNAL_CORES_DIR = $compiler_config["external_core_files"]; - } - - private function set_variables($request, &$format, &$libraries, &$version, &$mcu, &$f_cpu, &$core, &$variant, &$vid, &$pid, &$compiler_config) - { - // Extract the request options for easier access. - $format = $request["format"]; - $libraries = $request["libraries"]; - $version = $request["version"]; - $mcu = $request["build"]["mcu"]; - $f_cpu = $request["build"]["f_cpu"]; - $core = $request["build"]["core"]; - // Some cores do not specify any variants. In this case, set variant to be an empty string - if (!array_key_exists("variant", $request["build"])) - $variant = ""; - else - $variant = $request["build"]["variant"]; - - if ($format == "autocomplete") { + // Path to arduino-core-files repository. + $ARDUINO_CORES_DIR = $compiler_config["arduino_cores_dir"]; + // Path to external core files (for example arduino ATtiny) + $EXTERNAL_CORES_DIR = $compiler_config["external_core_files"]; + } + + private function setVariables($request, &$format, &$libraries, &$version, &$mcu, &$f_cpu, &$core, &$variant, &$vid, &$pid, &$compiler_config) + { + // Extract the request options for easier access. + $format = $request["format"]; + $libraries = $request["libraries"]; + $version = $request["version"]; + $mcu = $request["build"]["mcu"]; + $f_cpu = $request["build"]["f_cpu"]; + $core = $request["build"]["core"]; + // Some cores do not specify any variants. In this case, set variant to be an empty string + if (!array_key_exists("variant", $request["build"])) + $variant = ""; + else + $variant = $request["build"]["variant"]; + + if ($format == "autocomplete") + { $compiler_config["autocmpfile"] = $request["position"]["file"]; $compiler_config["autocmprow"] = $request["position"]["row"]; $compiler_config["autocmpcol"] = $request["position"]["column"]; @@ -887,136 +960,152 @@ private function set_variables($request, &$format, &$libraries, &$version, &$mcu $compiler_config["autocmpprefix"] = $request["prefix"]; } - // Set the appropriate variables for vid and pid (Leonardo). - - $vid = (isset($request["build"]["vid"])) ? $request["build"]["vid"] : "null"; - $pid = (isset($request["build"]["pid"])) ? $request["build"]["pid"] : "null"; - } - - private function setLoggingParams($request, &$compiler_config, $temp_dir, $compiler_dir) - { - //Check if $request['logging'] exists and is true, then make the logfile, otherwise set - //$compiler_config['logdir'] to false and return to caller - if(array_key_exists('logging', $request) && $request['logging']) - { - /* - Generate a random part for the log name based on current date and time, - in order to avoid naming different Blink projects for which we need logfiles - */ - $randPart = date('YmdHis'); - /* - Then find the name of the arduino file which usually is the project name itself - and mix them all together - */ - - foreach($request['files'] as $file){ - if(strcmp(pathinfo($file['filename'], PATHINFO_EXTENSION), "ino") == 0){$basename = pathinfo($file['filename'], PATHINFO_FILENAME);} - } - if(!isset($basename)){$basename="logfile";} - - $compiler_config['logging'] = true; - $directory = $temp_dir."/".$compiler_config['logdir']; - //The code below was added to ensure that no error will be returned because of multithreaded execution. - if(!file_exists($directory)){ - $make_dir_success = @mkdir($directory, 0777, true); - if (!$make_dir_success && !is_dir($directory)) { - usleep(rand( 5000 , 10000 )); - $make_dir_success = @mkdir($directory, 0777, true); - } - if(!$make_dir_success) - return array("success"=>false, "message"=>"Failed to create logfiles directory."); - } - - $compiler_part = str_replace(".", "_", substr($compiler_dir, strpos($compiler_dir, "compiler"))); - - $compiler_config['logFileName'] = $directory ."/". $basename ."_".$compiler_part."_". $randPart .".txt"; - - file_put_contents($compiler_config['logFileName'], ''); - } - elseif(!array_key_exists('logging', $request) or !$request['logging']) - $compiler_config['logging'] = false; - - return array("success"=>true); - } - - - /** - \brief Reads all core files from the respective directory and passes their contents to extractFiles function - which then writes them to the compiler temp directory - - \param string $core_files_directory The directory containing the core files. - \param string $tmp_compiler The tmp directory where the actual compilation process takes place. - \return array An array containing the function results. - */ - private function makeCoresTmp($core_files_directory, $core_overrd_directory, $temp_directory, $tmp_compiler, &$files){ - - $core = array(); - if(false === ($scanned_files = @scandir($core_files_directory))) - return array( "success"=>false, "step"=>5, "message"=>"Failed to read core files." ); - - // Get the contents of the core files - foreach ($scanned_files as $core_file) - if(!is_dir("$core_files_directory/$core_file")){ - if (!empty($core_overrd_directory) && $core_overrd_directory !="" && file_exists("$core_overrd_directory/$core_file")) + // Set the appropriate variables for vid and pid (Leonardo). + + $vid = (isset($request["build"]["vid"])) ? $request["build"]["vid"] : "null"; + $pid = (isset($request["build"]["pid"])) ? $request["build"]["pid"] : "null"; + } + + private function setLoggingParams($request, &$compiler_config, $temp_dir, $compiler_dir) + { + //Check if $request['logging'] exists and is true, then make the logfile, otherwise set + //$compiler_config['logdir'] to false and return to caller + if (array_key_exists('logging', $request) && $request['logging']) + { + /* + Generate a random part for the log name based on current date and time, + in order to avoid naming different Blink projects for which we need logfiles + */ + $randPart = date('YmdHis'); + /* + Then find the name of the arduino file which usually is the project name itself + and mix them all together + */ + + foreach ($request['files'] as $file) + { + if (strcmp(pathinfo($file['filename'], PATHINFO_EXTENSION), "ino") == 0) + { + $basename = pathinfo($file['filename'], PATHINFO_FILENAME); + } + } + if (!isset($basename)) + { + $basename = "logfile"; + } + + $compiler_config['logging'] = true; + $directory = $temp_dir."/".$compiler_config['logdir']; + //The code below was added to ensure that no error will be returned because of multithreaded execution. + if (!file_exists($directory)) + { + $make_dir_success = @mkdir($directory, 0777, true); + if (!$make_dir_success && !is_dir($directory)) + { + usleep(rand(5000, 10000)); + $make_dir_success = @mkdir($directory, 0777, true); + } + if (!$make_dir_success) + return array("success" => false, "message" => "Failed to create logfiles directory."); + } + + $compiler_part = str_replace(".", "_", substr($compiler_dir, strpos($compiler_dir, "compiler"))); + + $compiler_config['logFileName'] = $directory."/".$basename."_".$compiler_part."_".$randPart.".txt"; + + file_put_contents($compiler_config['logFileName'], ''); + } + elseif (!array_key_exists('logging', $request) || (!$request['logging'])) + $compiler_config['logging'] = false; + + return array("success" => true); + } + + + /** + * \brief Reads all core files from the respective directory and passes their contents to extractFiles function + * which then writes them to the compiler temp directory + * + * \param string $core_files_directory The directory containing the core files. + * \param string $tmp_compiler The tmp directory where the actual compilation process takes place. + * \return array An array containing the function results. + */ + private function makeCoresTmp($core_files_directory, $core_overrd_directory, $temp_directory, $tmp_compiler, &$files) + { + + $core = array(); + if (false === ($scanned_files = @scandir($core_files_directory))) + return array("success" => false, "step" => 5, "message" => "Failed to read core files."); + + // Get the contents of the core files + foreach ($scanned_files as $core_file) + if (!is_dir("$core_files_directory/$core_file")) + { + if (!empty($core_overrd_directory) && $core_overrd_directory != "" && file_exists("$core_overrd_directory/$core_file")) $core[] = array("filename" => $core_file, "content" => file_get_contents("$core_overrd_directory/$core_file"), "filepath" => "$core_overrd_directory/$core_file"); else $core[] = array("filename" => $core_file, "content" => file_get_contents("$core_files_directory/$core_file"), "filepath" => "$core_files_directory/$core_file"); } - // Check if the version of the core files includes an avr-libc directory and scan - if(file_exists("$core_files_directory/avr-libc")){ - if(false === ($scanned_avr_files = @scandir("$core_files_directory/avr-libc"))) - return array( "success"=>false, "step"=>5, "message"=>"Failed to read core files." ); - foreach($scanned_avr_files as $avr_file) - if(!is_dir("$core_files_directory/avr-libc/$avr_file")){ - if (!empty($core_overrd_directory) && $core_overrd_directory !="" && file_exists("$core_overrd_directory/avr-libc/$avr_file")) + // Check if the version of the core files includes an avr-libc directory and scan + if (file_exists("$core_files_directory/avr-libc")) + { + if (false === ($scanned_avr_files = @scandir("$core_files_directory/avr-libc"))) + return array("success" => false, "step" => 5, "message" => "Failed to read core files."); + foreach ($scanned_avr_files as $avr_file) + if (!is_dir("$core_files_directory/avr-libc/$avr_file")) + { + if (!empty($core_overrd_directory) && $core_overrd_directory != "" && file_exists("$core_overrd_directory/avr-libc/$avr_file")) $core[] = array("filename" => "avr-libc/$avr_file", "content" => file_get_contents("$core_overrd_directory/avr-libc/$avr_file"), "filepath" => "$core_overrd_directory/avr-libc/$avr_file"); else $core[] = array("filename" => "avr-libc/$avr_file", "content" => file_get_contents("$core_files_directory/avr-libc/$avr_file"), "filepath" => "$core_files_directory/avr-libc/$avr_file"); } - } + } - $tmp = $this->extractFiles($core, $temp_directory, $tmp_compiler, $files["core"], "core"); - if($tmp["success"] === false) - return array( "success"=>false, "step"=>5, "message"=>$tmp["message"] ); + $tmp = $this->extractFiles($core, $temp_directory, $tmp_compiler, $files["core"], "core"); + if ($tmp["success"] === false) + return array("success" => false, "step" => 5, "message" => $tmp["message"]); - return array('success' => true); - } + return array('success' => true); + } - private function handleCompile($compile_directory, &$files_array, $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching = false, $name_params = null){ + private function handleCompile($compile_directory, &$files_array, $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching = false, $name_params = null) + { - //Add any include directories needed - if (pathinfo($compile_directory, PATHINFO_BASENAME) !== "files") - $include_directories .= " -I$compile_directory "; + //Add any include directories needed + if (pathinfo($compile_directory, PATHINFO_BASENAME) !== "files") + $include_directories .= " -I$compile_directory "; - if(file_exists("$compile_directory/utility")) - $include_directories .= " -I$compile_directory/utility "; + if (file_exists("$compile_directory/utility")) + $include_directories .= " -I$compile_directory/utility "; - if (file_exists("$compile_directory/avr-libc")) - $include_directories .= " -I$compile_directory/avr-libc "; + if (file_exists("$compile_directory/avr-libc")) + $include_directories .= " -I$compile_directory/avr-libc "; - //Call doCompile, which will do the actual compilation. - $compile_res = $this->doCompile($compiler_config, $files_array, $compile_directory, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching, $name_params); + //Call doCompile, which will do the actual compilation. + $compile_res = $this->doCompile($compiler_config, $files_array, $compile_directory, $CC, $CFLAGS, $CPP, $CPPFLAGS, $AS, $ASFLAGS, $CLANG, $CLANG_FLAGS, $core_includes, $target_arch, $clang_target_arch, $include_directories, $format, $caching, $name_params); - if($compile_res['success']) - return array("success" => true); + if ($compile_res['success']) + return array("success" => true); - return $compile_res; - } + return $compile_res; + } - private function doAutocomplete($ARDUINO_CORES_DIR, $compiler_config, $compile_directory, $CC, $CFLAGS, $CPP, $CPPFLAGS, $core_includes, $target_arch, $include_directories, $autocompletionDir, $PYTHON, $AUTOCOMPLETER){ + private function doAutocomplete($ARDUINO_CORES_DIR, $compiler_config, $compile_directory, $CC, $CFLAGS, $CPP, $CPPFLAGS, $core_includes, $target_arch, $include_directories, $autocompletionDir, $PYTHON, $AUTOCOMPLETER) + { - $file = $compile_directory . "/" . $compiler_config["autocmpfile"]; + $file = $compile_directory."/".$compiler_config["autocmpfile"]; - $filename = pathinfo($file, PATHINFO_DIRNAME) . "/" . pathinfo($file, PATHINFO_FILENAME); + $filename = pathinfo($file, PATHINFO_DIRNAME)."/".pathinfo($file, PATHINFO_FILENAME); $ext = pathinfo($file, PATHINFO_EXTENSION); if (!in_array($ext, array("ino", "c", "cpp", "h", "hpp"))) return array("success" => false, "message" => "Sorry, autocompletion is only supported for .ino, .c, .cpp or .h files."); - if ($ext == "ino"){ + if ($ext == "ino") + { $ext = "cpp"; } $compiler_config["autocmpfile"] = "$filename.$ext"; @@ -1045,7 +1134,7 @@ private function doAutocomplete($ARDUINO_CORES_DIR, $compiler_config, $compile_d // Set the PYTHONPATH environment variable here, instead of setting a global variable in // every machine the compiler runs on. $SET_PYTHONPATH = "export PYTHONPATH=\"$ARDUINO_CORES_DIR/clang/v3_5/bindings/python:\$PYTHONPATH\""; - $result = exec("$SET_PYTHONPATH && $PYTHON $AUTOCOMPLETER " . $compiler_config["autocmpmaxresults"] . " $compile_directory/autocc.json", $output, $retval); + $result = exec("$SET_PYTHONPATH && $PYTHON $AUTOCOMPLETER ".$compiler_config["autocmpmaxresults"]." $compile_directory/autocc.json", $output, $retval); $exec_time = microtime(true) - $time; @@ -1059,11 +1148,13 @@ private function doAutocomplete($ARDUINO_CORES_DIR, $compiler_config, $compile_d return array("success" => true, "retval" => $retval, "message" => "Autocompletion was successful!", "autocomplete" => $command_output, "autocc_exec_time" => $exec_time); } - private function handleAutocompletion($ARDUINO_CORES_DIR, $compile_directory, $include_directories, $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $core_includes, $target_arch, $tmpDir, $autoccDir, $PYTHON, $AUTOCOMPLETER){ + private function handleAutocompletion($ARDUINO_CORES_DIR, $compile_directory, $include_directories, $compiler_config, $CC, $CFLAGS, $CPP, $CPPFLAGS, $core_includes, $target_arch, $tmpDir, $autoccDir, $PYTHON, $AUTOCOMPLETER) + { $make_dir_success = @mkdir("$tmpDir/$autoccDir", 0777, true); - if (!$make_dir_success && !is_dir("$tmpDir/$autoccDir")) { - usleep(rand( 5000 , 10000 )); + if (!$make_dir_success && !is_dir("$tmpDir/$autoccDir")) + { + usleep(rand(5000, 10000)); $make_dir_success = @mkdir("$tmpDir/$autoccDir", 0777, true); } if (!$make_dir_success && !is_dir("$tmpDir/$autoccDir")) @@ -1076,193 +1167,227 @@ private function handleAutocompletion($ARDUINO_CORES_DIR, $compile_directory, $i return $compile_res; } - private function getClangErrorFileList ($clang_output) { - /** - * Clang's output processing - */ - // Get all the 'filename.extension:line' elements. Include only those followed by an 'error' statement. - $tag_free_content = strip_tags($clang_output); // Remove color tags (as many as possible). - - $clang_matches = preg_split('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $tag_free_content, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - - $elements = array(); - foreach ($clang_matches as $key => $val ) { - if (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $val) - && array_key_exists($key + 1, $clang_matches) - && (strpos($clang_matches[$key +1 ],"error:") !== false - || strpos($clang_matches[$key +1 ],"note:") !== false - || strpos($clang_matches[$key +1 ],"in asm") !== false - || strpos($clang_matches[$key],"in asm") !== false)) { - if (strpos($val, "In file included from ") !== false) - $val = str_replace("In file included from ", "", $val); - $val = str_replace("In file included from ", "", $val); - $elements[] = $val; - } - } - - // Split the elements from above and get an associative array structure of [filename => lines] - $clang_elements = array(); - foreach ($elements as $element) { - - // The first part is filename.extension, the second represents the line, - // and the third one is the column number (not used for now). - $split = explode(':', $element); - - if (!array_key_exists($split[0], $clang_elements)) { - $clang_elements[$split[0]] = array(); - $clang_elements[$split[0]][] = $split[1]; - continue; - } - $clang_elements[$split[0]][] = $split[1]; - } - return $clang_elements; - } - - private function getGccErrorFileList ($avr_output) { - /** - * Avr gcc's output processing - */ - // Get all 'filename.extension:line' elements. - // Note that avr-gcc output only includes filenames and lines in error reporting, not collumns. - preg_match_all('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $avr_output, $gcc_matches, PREG_PATTERN_ORDER); - - $gcc_elements = array(); - foreach ($gcc_matches[0] as $element) { - - // The first part is filename.extension, the second represents the line. - $split = explode(':', $element); - if (!array_key_exists($split[0], $gcc_elements)) { - $gcc_elements[$split[0]] = array(); - $gcc_elements[$split[0]][] = $split[1]; - continue; - } - $gcc_elements[$split[0]][] = $split[1]; - } - return $gcc_elements; - } - - private function cleanUpClangOutput ($clang_output, $compiler_config, $option) { - - $content_line_array = explode("\n", $clang_output); - - $header = ""; - $body = ""; - $final = ""; - $header_found = false; - $libFound = false; - $coreFound = false; - $asmFound = false; - - foreach ($content_line_array as $key => $line) { - - if ((strpos($line, "In file included from") !== false - && preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line)) - || (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line) - && strpos($line, "error:") !== false)) { - - if ($header_found === false) { - if (($option == "non_asm" && preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) - || strpos($header, $compiler_config["arduino_cores_dir"]) !== false - || (array_key_exists("external_core_files", $compiler_config) - && strpos($header, $compiler_config["external_core_files"]) !== false)) - || ($option == "asm" - && (strpos($header, "in asm") !== false - || strpos($body, "in asm") !== false))) { - - if (preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) && $libFound === false && $option != "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports library issue."); - $libFound = true; - } - if ((strpos($header, $compiler_config["arduino_cores_dir"]) !== false - || (array_key_exists("external_core_files", $compiler_config) - && strpos($header, $compiler_config["external_core_files"]) !== false)) - && $coreFound === false && $option != "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports core issue."); - $coreFound = true; - } - if ((strpos($header, "in asm") !== false || strpos($body, "in asm") !== false) && $asmFound === false && $option == "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports assembly issue."); - $asmFound = true; - } - $header = ""; - $body = ""; - } - - if ($header != "") { - if (strpos($header, "") == 0) - $header = substr_replace($header, '', 0, 11); - if (array_key_exists($key + 1, $content_line_array) - && strpos($content_line_array[$key + 1], "") == 0) - $body = $body . ""; - $final .= $header ."\n"; - $final .= $body . "\n"; - $header = ""; - $body = ""; - } - } - - $header .= $line . "\n"; - $header_found = true; - continue; - } - - if (!array_key_exists($key + 1, $content_line_array)) { - if ((!preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) - && strpos($header, $compiler_config["arduino_cores_dir"]) === false - && (array_key_exists("external_core_files", $compiler_config) - && strpos($header, $compiler_config["external_core_files"]) === false) - && $option == "non_asm") - || ($option == "asm" - && strpos($header, "in asm") === false - && strpos($body, "in asm") === false)) { - if ($header != "") { - if (strpos($header, "") == 0) - $header = substr_replace($header, '', 0, 11); - $final .= $header ."\n"; - $final .= $body . "\n"; - } - }else { - if (preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) && $libFound === false && $option != "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports library issue."); - } - if ((strpos($header, $compiler_config["arduino_cores_dir"]) !== false - || (array_key_exists("external_core_files", $compiler_config) - && strpos($header, $compiler_config["external_core_files"]) !== false)) - && $coreFound === false && $option != "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports core issue."); - } - if ((strpos($header, "in asm") !== false || strpos($body, "in asm") !== false) && $asmFound === false && $option == "asm") { - $this->compiler_logger->addInfo($this->logger_id . " - Clang reports assembly issue."); - } - } - } - - $header_found = false; - $body .= $line . "\n"; - - } - - return $final; - } - - private function pathRemover ($output, $compiler_config) { - - // Remove any instance of "compiler.RANDOM/files/" folder name from the text - $modified = str_replace($compiler_config["compiler_dir"] . "/files/", '', $output); - - // Remove any remaining instance of "compiler.RANDOM/" folder name from the text. - $modified = str_replace($compiler_config["compiler_dir"] . "/", '', $modified); - - // Remove any instance of codebender arduino core files folder name from the text - $modified = str_replace($compiler_config["arduino_cores_dir"] . "/v105/", '', $modified); - - // Remove any instance of codebender external core file folder name from the text - if (isset($compiler_config["external_core_files"]) && $compiler_config["external_core_files"] != "") { - $modified = str_replace($compiler_config["external_core_files"], '', $modified); - $modified = str_replace("/override_cores/", '', $modified); - } - - return $modified; - } + private function getClangErrorFileList($clang_output) + { + /** + * Clang's output processing + */ + // Get all the 'filename.extension:line' elements. Include only those followed by an 'error' statement. + $tag_free_content = strip_tags($clang_output); // Remove color tags (as many as possible). + + $clang_matches = preg_split('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $tag_free_content, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + + $elements = array(); + foreach ($clang_matches as $key => $val) + { + if (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $val) + && array_key_exists($key + 1, $clang_matches) + && (strpos($clang_matches[$key + 1], "error:") !== false + || strpos($clang_matches[$key + 1], "note:") !== false + || strpos($clang_matches[$key + 1], "in asm") !== false + || strpos($clang_matches[$key], "in asm") !== false) + ) + { + if (strpos($val, "In file included from ") !== false) + $val = str_replace("In file included from ", "", $val); + $val = str_replace("In file included from ", "", $val); + $elements[] = $val; + } + } + + // Split the elements from above and get an associative array structure of [filename => lines] + $clang_elements = array(); + foreach ($elements as $element) + { + + // The first part is filename.extension, the second represents the line, + // and the third one is the column number (not used for now). + $split = explode(':', $element); + + if (!array_key_exists($split[0], $clang_elements)) + { + $clang_elements[$split[0]] = array(); + $clang_elements[$split[0]][] = $split[1]; + continue; + } + $clang_elements[$split[0]][] = $split[1]; + } + return $clang_elements; + } + + private function getGccErrorFileList($avr_output) + { + /** + * Avr gcc's output processing + */ + // Get all 'filename.extension:line' elements. + // Note that avr-gcc output only includes filenames and lines in error reporting, not collumns. + preg_match_all('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $avr_output, $gcc_matches, PREG_PATTERN_ORDER); + + $gcc_elements = array(); + foreach ($gcc_matches[0] as $element) + { + + // The first part is filename.extension, the second represents the line. + $split = explode(':', $element); + if (!array_key_exists($split[0], $gcc_elements)) + { + $gcc_elements[$split[0]] = array(); + $gcc_elements[$split[0]][] = $split[1]; + continue; + } + $gcc_elements[$split[0]][] = $split[1]; + } + return $gcc_elements; + } + + private function cleanUpClangOutput($clang_output, $compiler_config, $option) + { + + $content_line_array = explode("\n", $clang_output); + + $header = ""; + $body = ""; + $final = ""; + $header_found = false; + $libFound = false; + $coreFound = false; + $asmFound = false; + + foreach ($content_line_array as $key => $line) + { + + if ((strpos($line, "In file included from") !== false + && preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line)) + || (preg_match('/([\w*\s*(!@#$%^&*()-+;\'{}\[\])*]+\.\w+:\d+:[\d+:]?)/', $line) + && strpos($line, "error:") !== false) + ) + { + + if ($header_found === false) + { + if (($option == "non_asm" && preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) + || strpos($header, $compiler_config["arduino_cores_dir"]) !== false + || (array_key_exists("external_core_files", $compiler_config) + && strpos($header, $compiler_config["external_core_files"]) !== false)) + || ($option == "asm" + && (strpos($header, "in asm") !== false + || strpos($body, "in asm") !== false)) + ) + { + + if (preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) && $libFound === false && $option != "asm") + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports library issue."); + $libFound = true; + } + if ((strpos($header, $compiler_config["arduino_cores_dir"]) !== false + || (array_key_exists("external_core_files", $compiler_config) + && strpos($header, $compiler_config["external_core_files"]) !== false)) + && $coreFound === false && $option != "asm" + ) + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports core issue."); + $coreFound = true; + } + if ((strpos($header, "in asm") !== false || strpos($body, "in asm") !== false) && $asmFound === false && $option == "asm") + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports assembly issue."); + $asmFound = true; + } + $header = ""; + $body = ""; + } + + if ($header != "") + { + if (strpos($header, "") == 0) + $header = substr_replace($header, '', 0, 11); + if (array_key_exists($key + 1, $content_line_array) + && strpos($content_line_array[$key + 1], "") == 0 + ) + $body = $body.""; + $final .= $header."\n"; + $final .= $body."\n"; + $header = ""; + $body = ""; + } + } + + $header .= $line."\n"; + $header_found = true; + continue; + } + + if (!array_key_exists($key + 1, $content_line_array)) + { + if ((!preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) + && strpos($header, $compiler_config["arduino_cores_dir"]) === false + && (array_key_exists("external_core_files", $compiler_config) + && strpos($header, $compiler_config["external_core_files"]) === false) + && $option == "non_asm") + || ($option == "asm" + && strpos($header, "in asm") === false + && strpos($body, "in asm") === false) + ) + { + if ($header != "") + { + if (strpos($header, "") == 0) + $header = substr_replace($header, '', 0, 11); + $final .= $header."\n"; + $final .= $body."\n"; + } + } + else + { + if (preg_match('/(\/compiler\.\w+\/libraries\/)/', $header) && $libFound === false && $option != "asm") + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports library issue."); + } + if ((strpos($header, $compiler_config["arduino_cores_dir"]) !== false + || (array_key_exists("external_core_files", $compiler_config) + && strpos($header, $compiler_config["external_core_files"]) !== false)) + && $coreFound === false && $option != "asm" + ) + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports core issue."); + } + if ((strpos($header, "in asm") !== false || strpos($body, "in asm") !== false) && $asmFound === false && $option == "asm") + { + $this->compiler_logger->addInfo($this->logger_id." - Clang reports assembly issue."); + } + } + } + + $header_found = false; + $body .= $line."\n"; + + } + + return $final; + } + + private function pathRemover($output, $compiler_config) + { + + // Remove any instance of "compiler.RANDOM/files/" folder name from the text + $modified = str_replace($compiler_config["compiler_dir"]."/files/", '', $output); + + // Remove any remaining instance of "compiler.RANDOM/" folder name from the text. + $modified = str_replace($compiler_config["compiler_dir"]."/", '', $modified); + + // Remove any instance of codebender arduino core files folder name from the text + $modified = str_replace($compiler_config["arduino_cores_dir"]."/v105/", '', $modified); + + // Remove any instance of codebender external core file folder name from the text + if (isset($compiler_config["external_core_files"]) && $compiler_config["external_core_files"] != "") + { + $modified = str_replace($compiler_config["external_core_files"], '', $modified); + $modified = str_replace("/override_cores/", '', $modified); + } + + return $modified; + } } diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php new file mode 100644 index 0000000..83cfd0c --- /dev/null +++ b/Symfony/src/Codebender/CompilerBundle/Handler/DeletionHandler.php @@ -0,0 +1,116 @@ +$objectCacheDirectory = $objectFilesDirectory; + } + + function deleteAllObjects() + { + $fileCount = 0; + $notDeletedFiles = ''; + $deletionStats = array('success_dot_a' => 0, + 'failure_dot_a' => 0, + 'success_dot_o' => 0, + 'failure_dot_o' => 0, + 'success_dot_d' => 0, + 'failure_dot_d' => 0, + 'success_dot_LOCK' => 0, + 'failure_dot_LOCK' => 0); + + if ($handle = @opendir($this->$objectCacheDirectory)) { + + while (false !== ($entry = readdir($handle))) { + if ($entry == '.' || $entry == '..' || $entry != '.DS_Store') { + continue; + } + $fileCount++; + $extension = pathinfo($entry, PATHINFO_EXTENSION); + + if (!in_array($extension, array('a', 'o', 'd', 'LOCK'))) { + continue; + } + + if (@unlink($this->$objectCacheDirectory . '/' . $entry) === false) { + $deletionStats['failure_dot_$extension']++; + $notDeletedFiles .= $entry . "\n"; + continue; + } + + $deletionStats['success_dot_' . $extension]++; + } + closedir($handle); + + return array( + 'success' => true, + 'fileCount' => $fileCount, + 'notDeletedFiles' => $notDeletedFiles, + 'deletionStats' => $deletionStats + ); + } + + return array('success' => false); + } + + function deleteSpecificObjects($option, $cachedObjectToDelete) + { + if ($option == 'core') { + $cachedObjectToDelete = str_replace(':', '_', $cachedObjectToDelete); + } + + $deletedFiles = ''; + $notDeletedFiles = ''; + + if ($handle = @opendir($this->$objectCacheDirectory)) { + + while (false !== ($entry = readdir($handle))) { + + if ($entry == '.' || $entry == '..' || $entry == '.DS_Store') { + continue; + } + + if ($option == 'library' && strpos($entry, '______' . $cachedObjectToDelete . '_______') === false) { + continue; + } + + if ($option == 'core' && strpos($entry, '_' . $cachedObjectToDelete . '_') === false) { + continue; + } + + + if (@unlink($this->$objectCacheDirectory . '/' . $entry) === false) { + $notDeletedFiles .= $entry."\n"; + continue; + } + + $deletedFiles .= $entry . "\n"; + + } + closedir($handle); + + return array('success' => true, 'deletedFiles' => $deletedFiles, 'notDeletedFiles' => $notDeletedFiles); + } + + return array('success' => false); + } +} diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/MCUHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/MCUHandler.php index 297918f..5fad6a8 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/MCUHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/MCUHandler.php @@ -1,20 +1,20 @@ . - -\author Dimitrios Christidis -\author Vasilis Georgitzikis - -\copyright (c) 2012, The Codebender Development Team -\copyright Licensed under the Simplified BSD License + * \file + * \brief MCU macros for Clang. + * + * When compiling source code for ATMEL AVR, one must specify the MCU type + * (avr-gcc's -mmcu flag). This defines a macro that is used for conditional + * compilation. Clang has no such flag, and thus the macro has to be predefined + * by hand. + * + * See . + * + * \author Dimitrios Christidis + * \author Vasilis Georgitzikis + * + * \copyright (c) 2012, The Codebender Development Team + * \copyright Licensed under the Simplified BSD License */ namespace Codebender\CompilerBundle\Handler; @@ -206,4 +206,4 @@ class MCUHandler "attiny20" => "__AVR_ATtiny20__", "attiny40" => "__AVR_ATtiny40__"); -} \ No newline at end of file +} diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/PostprocessingHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/PostprocessingHandler.php index b64ab45..afbe798 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/PostprocessingHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/PostprocessingHandler.php @@ -13,21 +13,21 @@ class PostprocessingHandler { /** - \brief Converts text with ANSI color codes to HTML. - - \param string $text The string to convert. - \return A string with HTML tags. - - Takes a string with ANSI color codes and converts them to HTML tags. Can be - useful for displaying the output of terminal commands on a web page. Handles - codes that modify the color (foreground and background) as well as the format - (bold, italics, underline and strikethrough). Other codes are ignored. - - An ANSI escape sequence begins with the characters ^[ (hex 0x1B) and - [, and ends with m. The color code is placed in between. Multiple - color codes can be included, separated by semicolon. + * \brief Converts text with ANSI color codes to HTML. + * + * \param string $text The string to convert. + * \return A string with HTML tags. + * + * Takes a string with ANSI color codes and converts them to HTML tags. Can be + * useful for displaying the output of terminal commands on a web page. Handles + * codes that modify the color (foreground and background) as well as the format + * (bold, italics, underline and strikethrough). Other codes are ignored. + * + * An ANSI escape sequence begins with the characters ^[ (hex 0x1B) and + * [, and ends with m. The color code is placed in between. Multiple + * color codes can be included, separated by semicolon. */ - function ansi_to_html($text) + function convertANSItoHTML($text) { $FORMAT = array( 0 => NULL, // reset modes to default @@ -107,7 +107,7 @@ function ansi_to_html($text) array_push($stack, ""); break; default: - error_log(__FUNCTION__."(): Unhandled ANSI code '$mode' in ".__FILE__); + error_log(__FUNCTION__."(): Unhandled ANSI code '$mode'"); break; } } @@ -120,4 +120,4 @@ function ansi_to_html($text) return $text; } -} \ No newline at end of file +} diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php index 720c2dd..5d72597 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/PreprocessingHandler.php @@ -13,253 +13,283 @@ class PreprocessingHandler { /** - \brief The following functions generate valid C++ code from Arduino source code. - - Arduino source code files are simplified C++ files. Thus, some preprocessing has - to be done to convert them to valid C++ code for the compiler to read. Some of - these "simplifications" include: - - lack of a main() function - - lack of function prototypes - - A skeleton file is provided in the Arduino core files that contains a - main() function. Its contents have to be linked to the output file later. - The prototypes of the functions defined in the input file should be added - above the code. This is required to avoid compiler errors regarding undefined - functions. - - The programmer is not aware of this modifications to his code. In case of a - compiler error, the line numbering would be wrong. To avoid this issue, a - \#line preprocessor directive is used. Thus it is ensured that the line - numbering in the output file will be the same as the input file. - - A regular expression is used to match function definitions in the input file. - Consequently this process will never be as sophisticated as a lexical analyzer. - Thus, some valid constructs cannot be matched. These include: - - definitions that are split across multiple lines - - definitions for variadic functions - - typedefs for the return value or the parameters - - pointers to functions - - arrays, structs, and unions + * \brief The following functions generate valid C++ code from Arduino source code. + * + * Arduino source code files are simplified C++ files. Thus, some preprocessing has + * to be done to convert them to valid C++ code for the compiler to read. Some of + * these "simplifications" include: + * - lack of a main() function + * - lack of function prototypes + * + * A skeleton file is provided in the Arduino core files that contains a + * main() function. Its contents have to be linked to the output file later. + * The prototypes of the functions defined in the input file should be added + * above the code. This is required to avoid compiler errors regarding undefined + * functions. + * + * The programmer is not aware of this modifications to his code. In case of a + * compiler error, the line numbering would be wrong. To avoid this issue, a + * \#line preprocessor directive is used. Thus it is ensured that the line + * numbering in the output file will be the same as the input file. + * + * A regular expression is used to match function definitions in the input file. + * Consequently this process will never be as sophisticated as a lexical analyzer. + * Thus, some valid constructs cannot be matched. These include: + * - definitions that are split across multiple lines + * - definitions for variadic functions + * - typedefs for the return value or the parameters + * - pointers to functions + * - arrays, structs, and unions */ - /** - \param string $code The original code of the sketch - \return string A copy of the code with no comments, single- or double- quoted strings - or pre-processor directives - */ - function remove_comments_directives_quotes($code) - { - // Use a copy of the code and strip comments, pre-processor directives, single- and double-quoted strings - - $regex = "/(\'.\')|(\"(?:[^\"\\\\]|\\\\.)*\")|(\/\/.*?$)|(\/\*[^*]*(?:\*(?!\/)[^*]*)*\*\/)|(^\s*\#.*?$)/m"; - - // Replace every match of the regular expression with a whitespace - - $return_code = preg_replace($regex, " ", $code); - - return $return_code; - } - - /** - \param string $code The code returned from remove_comments_directives_quotes function - \return string The input code having all top level braces collapsed - */ - function empty_braces($code) - { - // For every line of the code remove all the contents of top level braces - - $nesting = 0; - $start = 0; - $return_code = ""; - // Use the code as an array of characters - for ($i=0; $iremove_comments_directives_quotes($code); - // Remove any code between all top level braces - $empty_braces_code = $this->empty_braces($no_comms_code); - // Find already existing prototypes - $existing_prototypes = $this->find_existing_prototypes($empty_braces_code); - // Generate prototypes that do not already exist - $function_prototypes = $this->generate_prototypes($empty_braces_code, $existing_prototypes); - // Find the right place to insert the function prototypes (after any preprocessor directives, comments, before any function declaration) - $insertion_position = $this->insertion_position($code); - - $new_code = ""; + function convertInoToCpp($code, $filename = null) + { + // Remove comments, preprocessor directives, single- and double- quotes + $no_comms_code = $this->removeCommentsDirectivesQuotes($code); + // Remove any code between all top level braces + $empty_braces_code = $this->emptyBraces($no_comms_code); + // Find already existing prototypes + $existing_prototypes = $this->findExistingPrototypes($empty_braces_code); + // Generate prototypes that do not already exist + $function_prototypes = $this->generatePrototypes($empty_braces_code, $existing_prototypes); + // Find the right place to insert the function prototypes (after any preprocessor directives, comments, + // before any function declaration) + $insertion_position = $this->insertionPosition($code); + + $new_code = "#line 1\n"; // Add a preprocessor directive for line numbering. - if ($filename) + if ($filename) { $new_code .= "#line 1 \"$filename\"\n"; - else - $new_code .= "#line 1\n"; - // Build the new code for the cpp file that will eventually be compiled - $new_code .= $this->build_code($code, $function_prototypes, $insertion_position); + } - return $new_code; + // Build the new code for the cpp file that will eventually be compiled + $new_code .= $this->buildCode($code, $function_prototypes, $insertion_position); - } + return $new_code; + } /** - \brief Decodes and performs validation checks on input data. - - \param string $request The JSON-encoded compile request. - \return The value encoded in JSON in appropriate PHP type or NULL. + * \brief Decodes and performs validation checks on input data. + * + * \param string $request The JSON-encoded compile request. + * \return The value encoded in JSON in appropriate PHP type or null. */ - function validate_input($request) + function validateInput($request) { $request = json_decode($request, true); // Request must be successfully decoded. - if ($request === NULL) - return NULL; + if ($request === null) + return null; // Request must contain certain entities. if (!(array_key_exists("format", $request) && array_key_exists("version", $request) @@ -272,25 +302,28 @@ function validate_input($request) && array_key_exists("core", $request["build"]) && is_array($request["files"])) ) - return NULL; + return null; // Leonardo-specific flags. if (array_key_exists("variant", $request["build"]) && $request["build"]["variant"] == "leonardo") if (!(array_key_exists("vid", $request["build"]) && array_key_exists("pid", $request["build"])) ) - return NULL; + return null; // Values used as command-line arguments may not contain any special // characters. This is a serious security risk. - $values = array("version", "mcu", "f_cpu", "core", "vid", "pid"); - if (array_key_exists("variant", $request["build"])) + $values = array("version", "mcu", "f_cpu", "core", "vid", "pid"); + if (array_key_exists("variant", $request["build"])) { $values[] = "variant"; - foreach ($values as $i) - if (isset($request["build"][$i]) && escapeshellcmd($request["build"][$i]) != $request["build"][$i]) - return NULL; + } + foreach ($values as $i) { + if (isset($request["build"][$i]) && escapeshellcmd($request["build"][$i]) != $request["build"][$i]) { + return null; + } + } // Request is valid. return $request; } -} \ No newline at end of file +} diff --git a/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php b/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php index b539f31..f674b6e 100644 --- a/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php +++ b/Symfony/src/Codebender/CompilerBundle/Handler/UtilityHandler.php @@ -13,51 +13,51 @@ class UtilityHandler { /** - \brief Extracts the files included in a compile request. - - \param string $directory The directory to extract the files to. - \param array $request_files The files structure, as taken from the JSON request. - \return A list of files or a reply message in case of error. - - Takes the files structure from a compile request and creates each file in a - specified directory. If requested, it may create additional directories and - have the files placed inside them accordingly. - - Also creates a new structure where each key is the file extension and the - associated value is an array containing the absolute paths of the file, minus - the extension. - - In case of error, the return value is an array that has a key success - and contains the response to be sent back to the user. + * \brief Extracts the files included in a compile request. + * + * \param string $directory The directory to extract the files to. + * \param array $request_files The files structure, as taken from the JSON request. + * \return A list of files or a reply message in case of error. + * + * Takes the files structure from a compile request and creates each file in a + * specified directory. If requested, it may create additional directories and + * have the files placed inside them accordingly. + * + * Also creates a new structure where each key is the file extension and the + * associated value is an array containing the absolute paths of the file, minus + * the extension. + * + * In case of error, the return value is an array that has a key success + * and contains the response to be sent back to the user. */ - function extract_files($directory, $request_files, $lib_extraction) + function extractFiles($directory, $request_files, $lib_extraction) { // File extensions used by Arduino projects. They are put in a string, // separated by "|" to be used in regular expressions. They are also // used as keys in an array that will contain the paths of all the // extracted files. - $EXTENSIONS = array("c", "cpp", "h", "inc", "ino", "o", "S"); + $allowedExtensions = array("c", "cpp", "h", "inc", "ino", "o", "S"); $files = array(); - foreach ($EXTENSIONS as $ext) + foreach ($allowedExtensions as $ext) $files[$ext] = array(); - $EXTENSIONS = implode("|", $EXTENSIONS); + $allowedExtensions = implode("|", $allowedExtensions); // Matches filename that end with an appropriate extension. The name // without the extension is stored in registerd 1, the extension itself // in register 2. // // Examples: foo.c bar.cpp - $REGEX = "/(.*)\.($EXTENSIONS)$/"; + $extensionsRegex = "/(.*)\.($allowedExtensions)$/"; - if(!file_exists($directory)) - mkdir($directory, 0777, true); + if (!file_exists($directory)) + mkdir($directory, 0777, true); foreach ($request_files as $file) { $filename = $file["filename"]; $content = $file["content"]; - $ignore = false; + $ignore = false; - $failure_response = array( + $failureResponse = array( "success" => false, "step" => 1, "message" => "Failed to extract file '$filename'."); @@ -66,33 +66,33 @@ function extract_files($directory, $request_files, $lib_extraction) // serious security risk. $directories = explode("/", "$directory/$filename"); if (in_array("..", $directories)) - return $failure_response; + return $failureResponse; if (strpos($filename, DIRECTORY_SEPARATOR)) { $new_directory = pathinfo($filename, PATHINFO_DIRNAME); - if (($lib_extraction === true) && ($new_directory !== "utility")) - $ignore = true; - if (!file_exists("$directory/$new_directory")) - mkdir("$directory/$new_directory", 0777, true); - // There is no reason to check whether mkdir() - // succeeded, given that the call to - // file_put_contents() that follows would fail - // as well. + if (($lib_extraction === true) && ($new_directory !== "utility")) + $ignore = true; + if (!file_exists("$directory/$new_directory")) + mkdir("$directory/$new_directory", 0777, true); + // There is no reason to check whether mkdir() + // succeeded, given that the call to + // file_put_contents() that follows would fail + // as well. } if (file_put_contents("$directory/$filename", $content) === false) - return $failure_response; + return $failureResponse; - if ($ignore) - continue; + if ($ignore) + continue; - if (preg_match($REGEX, $filename, $matches)) + if (preg_match($extensionsRegex, $filename, $matches)) $files[$matches[2]][] = "$directory/$matches[1]"; else - error_log(__FUNCTION__."(): Unhandled file extension '$filename' in ".__FILE__); + error_log(__FUNCTION__."(): Unhandled file extension '$filename'"); } // All files were extracted successfully. @@ -100,11 +100,11 @@ function extract_files($directory, $request_files, $lib_extraction) } /** - \brief Searches for files with specific extensions in a directory. - - \param string $directory The directory to search for files. - \param mixed $extensions An array of strings, the extensions to look for. - \return A list of files that have the appropriate extension. + * \brief Searches for files with specific extensions in a directory. + * + * \param string $directory The directory to search for files. + * \param mixed $extensions An array of strings, the extensions to look for. + * \return A list of files that have the appropriate extension. */ function get_files_by_extension($directory, $extensions) { @@ -120,26 +120,26 @@ function get_files_by_extension($directory, $extensions) } /** - \brief Executes a command and displays the command itself and its output. - - \param string $command The command to be executed. - - Simplifies the creation and debugging of pages that rely on multiple external - programs by "emulating" the execution of the requested command in a terminal - emulator. Can be useful during early stages of development. Replace with - exec() afterwards. - - To perform the command execution, passthru() is used. The string - 2\>&1 is appended to the command to ensure messages sent to standard - error are not lost. - - \warning It is not possible to redirect the standard error output to a file. + * \brief Executes a command and displays the command itself and its output. + * + * \param string $command The command to be executed. + * + * Simplifies the creation and debugging of pages that rely on multiple external + * programs by "emulating" the execution of the requested command in a terminal + * emulator. Can be useful during early stages of development. Replace with + * exec() afterwards. + * + * To perform the command execution, passthru() is used. The string + * 2\>&1 is appended to the command to ensure messages sent to standard + * error are not lost. + * + * \warning It is not possible to redirect the standard error output to a file. */ - function debug_exec($command, /** @noinspection PhpUnusedParameterInspection */ + function execWithDebugging($command, /** @noinspection PhpUnusedParameterInspection */ &$output, /** @noinspection PhpUnusedParameterInspection */ &$retval) { echo "$ $command\n"; passthru("$command 2>&1"); } -} \ No newline at end of file +} diff --git a/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml b/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml index 2aa6eb0..02e7c1f 100644 --- a/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml +++ b/Symfony/src/Codebender/CompilerBundle/Resources/config/routing.yml @@ -15,5 +15,5 @@ codebender_compiler_delete_all: defaults: { _controller: CodebenderCompilerBundle:Default:deleteAllObjects } codebender_compiler_delete_specific: - pattern: /{auth_key}/{version}/delete/{option}/{to_delete} - defaults: { _controller: CodebenderCompilerBundle:Default:deleteSpecificObjects } \ No newline at end of file + pattern: /{auth_key}/{version}/delete/{option}/{cachedObjectToDelete} + defaults: { _controller: CodebenderCompilerBundle:Default:deleteSpecificObjects } diff --git a/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml b/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml index 94a63ba..675bd9e 100644 --- a/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml +++ b/Symfony/src/Codebender/CompilerBundle/Resources/config/services.yml @@ -4,6 +4,7 @@ parameters: utility_handler.class: Codebender\CompilerBundle\Handler\UtilityHandler preprocessing_handler.class: Codebender\CompilerBundle\Handler\PreprocessingHandler postprocessing_handler.class: Codebender\CompilerBundle\Handler\PostprocessingHandler + deletion_handler.class: Codebender\CompilerBundle\Handler\DeletionHandler services: # codebender_compiler.example: @@ -18,6 +19,9 @@ services: class: "%preprocessing_handler.class%" postprocessing_handler: class: "%postprocessing_handler.class%" + deletion_handler: + class: "%deletion_handler.class%" + arguments: ["@compiler_logger", "%temp_dir%/%objdir%"] compiler_logger: class: Symfony\Bridge\Monolog\Logger arguments: [cmplr_log] @@ -25,4 +29,4 @@ services: - [pushHandler, [@compiler_log_handler]] compiler_log_handler: class: Monolog\Handler\StreamHandler - arguments: [%kernel.logs_dir%/compiler.log] \ No newline at end of file + arguments: [%kernel.logs_dir%/compiler.log] diff --git a/Symfony/src/Codebender/CompilerBundle/Tests/Controller/DefaultControllerTest.php b/Symfony/src/Codebender/CompilerBundle/Tests/Controller/DefaultControllerTest.php index bd8fef8..01727a9 100644 --- a/Symfony/src/Codebender/CompilerBundle/Tests/Controller/DefaultControllerTest.php +++ b/Symfony/src/Codebender/CompilerBundle/Tests/Controller/DefaultControllerTest.php @@ -64,7 +64,7 @@ public function testBlinkUnoSyntaxCheck() $auth_key = $client->getContainer()->getParameter("auth_key"); - $client->request('POST', '/'.$auth_key.'/v1', array(),array(),array(),$data); + $client->request('POST', '/'.$auth_key.'/v1', array(), array(), array(), $data); $response = json_decode($client->getResponse()->getContent(), true); diff --git a/Symfony/web/favicon.ico b/Symfony/web/favicon.ico index 8648036..41b8b6e 100644 Binary files a/Symfony/web/favicon.ico and b/Symfony/web/favicon.ico differ