Skip to content

Commit

Permalink
PROD-7243 - implement scoper for the build
Browse files Browse the repository at this point in the history
  • Loading branch information
KartikSuthar committed May 24, 2024
1 parent d8413e2 commit 6f333e7
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 65 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ src/vendor
vendor
includes/Library/Composer/*.php
includes/Library/Composer/[!Src]
src/includes/Library/Composer/*.php
src/includes/Library/Composer/[!Src]
scoped_vendor
src/scoped_vendor

node_modules
npm-debug.log
Expand Down
5 changes: 3 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ module.exports = function (grunt) {
all: [BUILD_DIR],
bp_rest: [SOURCE_DIR + 'buddyboss-platform-api/'],
bb_icons: [SOURCE_DIR + 'bp-templates/bp-nouveau/icons/bb-icons/'],
composer: [ BUILD_DIR + 'composer.json', BUILD_DIR + 'composer.lock', BUILD_DIR + 'scoper.inc.php', BUILD_DIR + 'apidoc.json' ],
},
copy: {
files: {
Expand Down Expand Up @@ -446,7 +447,7 @@ module.exports = function (grunt) {
stdout: false,
},
composer: {
command: 'composer update',
command: 'composer update; composer scoper;',
cwd: SOURCE_DIR,
stdout: false
}
Expand Down Expand Up @@ -554,7 +555,7 @@ module.exports = function (grunt) {
grunt.registerTask('src', ['checkDependencies', 'jsvalidate', 'jshint', 'stylelint', 'sass', 'rtlcss', 'checktextdomain', /*'imagemin',*/ 'uglify', 'cssmin', 'makepot:src']);
grunt.registerTask('bp_rest', ['clean:bp_rest', 'exec:rest_api', 'copy:bp_rest_components', 'copy:bp_rest_core', 'clean:bp_rest', 'apidoc' ]);
grunt.registerTask('bp_performance', ['clean:bp_rest', 'exec:rest_performance', 'copy:bp_rest_performance', 'copy:bp_rest_mu', 'clean:bp_rest']);
grunt.registerTask('build', ['string-replace:dist', 'exec:composer', 'exec:cli', 'clean:all', 'copy:files', 'compress', 'clean:all']);
grunt.registerTask('build', ['string-replace:dist', 'exec:composer', 'exec:cli', 'clean:all', 'copy:files', 'clean:composer', 'compress', 'clean:all']);
grunt.registerTask('release', ['src', 'build']);

// Testing tasks.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"lint": ["@lint-php", "@lint-js", "@lint-css"],
"scoper": [
"rm -rf vendor",
"rm -rf scoped_vendor",
"composer install --no-dev",
"php-scoper add-prefix vendor includes/Library/Composer/Src --output-dir=scoped_vendor --prefix BuddyBossPlatform",
"rm -rf vendor",
Expand Down
10 changes: 5 additions & 5 deletions includes/Library/Composer/Src/FFMpeg.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function instance() {
/**
* This Function Is Used To Get Instance From Scoped Vendor
*
* @since [BBVERSION]
* @since 2.6.11
*
* @param \FFMpeg\Driver\FFMpegDriver $ffmpeg.
* @param \FFMpeg\FFProbe $ffprobe.
Expand All @@ -37,7 +37,7 @@ function ffmpeg( $ffmpeg, $ffprobe ) {
/**
* This Function Is Used To Get Instance From Scoped Vendor
*
* @since [BBVERSION]
* @since 2.6.11
*
* @param \FFMpeg\Driver\FFProbeDriver $ffprobe.
* @param \Doctrine\Common\Cache\Cache $cache.
Expand All @@ -51,7 +51,7 @@ function ffprobe( $ffprobe, $cache ) {
/**
* Creates an FFMpeg.
*
* @since [BBVERSION]
* @since 2.6.11
*
* @param array|\Alchemy\BinaryDriver\ConfigurationInterface $configuration
* @param \Psr\Log\LoggerInterface $logger
Expand All @@ -66,7 +66,7 @@ function ffmpeg_create( $configuration = array(), $logger = null, $probe = null
/**
* Creates an FFProbe.
*
* @since [BBVERSION]
* @since 2.6.11
*
* @param array|\Alchemy\BinaryDriver\ConfigurationInterface $configuration
* @param \Psr\Log\LoggerInterface $logger
Expand All @@ -81,7 +81,7 @@ function ffprobe_create( $configuration = array(), $logger = null, $cache = null
/**
* Create timecode from number of seconds From Scoped Vendor
*
* @since [BBVERSION]
* @since 2.6.11
*
* @param float $seconds Seconds value.
*
Expand Down
6 changes: 0 additions & 6 deletions scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
'whitelist' => [
// Excludes specific namespaces from being prefixed.
'Composer\\*',
'Humbug\\PhpScoper\\*', // Namespace for PHP-Scoper.
'Humbug\\PhpScoper',
'PHPUnit\\*',
'PHPUnit\\Framework\TestCase', // A specific class.
// 'MyCLabs',
// 'MyCLabs\\*',
],
'finders' => [],
'patchers' => [],
Expand Down
21 changes: 18 additions & 3 deletions src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@
"php-ffmpeg/php-ffmpeg": "^0.16.0",
"maennchen/zipstream-php": "^2.1"
},
"autoload": {
},
"autoload": {
"classmap": [
"../includes/"
]
},
"scripts": {
"remove-ffmpeg-docs": ["rm -rf vendor/php-ffmpeg/php-ffmpeg/docs && rm -rf vendor/php-ffmpeg/php-ffmpeg/tests"],
"post-install-cmd": ["@remove-ffmpeg-docs"],
"post-update-cmd": ["@remove-ffmpeg-docs"]
"post-update-cmd": ["@remove-ffmpeg-docs"],
"scoper": [
"rm -rf vendor",
"rm -rf scoped_vendor",
"composer install --no-dev",
"php-scoper add-prefix vendor includes/Library/Composer/Src --output-dir=scoped_vendor --prefix BuddyBossPlatform",
"rm -rf vendor",
"mv scoped_vendor/vendor vendor/",
"cp -r scoped_vendor/includes/Library/Composer/Src/* includes/Library/Composer",
"rm -rf scoped_vendor",
"composer remove-ffmpeg-docs",
"composer dumpautoload --optimize"
]
},
"config": {
"allow-plugins": {
Expand Down
90 changes: 41 additions & 49 deletions src/composer.lock

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

Loading

0 comments on commit 6f333e7

Please sign in to comment.