setup-php 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -141
- package/lib/config.d.ts +3 -0
- package/lib/config.js +76 -0
- package/lib/config.js.map +1 -0
- package/lib/coverage.d.ts +5 -0
- package/lib/coverage.js +102 -0
- package/lib/coverage.js.map +1 -0
- package/lib/extensions.d.ts +4 -0
- package/lib/extensions.js +219 -0
- package/lib/extensions.js.map +1 -0
- package/lib/fetch.d.ts +1 -0
- package/lib/fetch.js +67 -0
- package/lib/fetch.js.map +1 -0
- package/lib/install.d.ts +2 -0
- package/lib/install.js +80 -0
- package/lib/install.js.map +1 -0
- package/lib/tools.d.ts +23 -0
- package/lib/tools.js +378 -0
- package/lib/tools.js.map +1 -0
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +266 -0
- package/lib/utils.js.map +1 -0
- package/package.json +21 -20
- package/src/config.ts +8 -8
- package/src/configs/brew_extensions +1 -0
- package/src/configs/composer.env +2 -0
- package/src/configs/ini/jit.ini +3 -0
- package/src/configs/ini/php.ini +2 -0
- package/src/configs/ini/xdebug.ini +1 -0
- package/src/configs/os_releases.csv +2 -0
- package/src/configs/php_packages +12 -0
- package/src/configs/tools.json +48 -26
- package/src/configs/tools_schema.json +11 -0
- package/src/coverage.ts +24 -49
- package/src/extensions.ts +28 -24
- package/src/fetch.ts +54 -0
- package/src/install.ts +28 -41
- package/src/scripts/darwin.sh +81 -33
- package/src/scripts/extensions/add_extensions.ps1 +194 -0
- package/src/scripts/extensions/add_extensions.sh +198 -0
- package/src/scripts/{ext → extensions}/blackfire.ps1 +0 -0
- package/src/scripts/{ext → extensions}/blackfire.sh +0 -0
- package/src/scripts/{ext → extensions}/couchbase.sh +0 -0
- package/src/scripts/{ext → extensions}/cubrid.sh +3 -3
- package/src/scripts/{ext → extensions}/extension_map.php +36 -13
- package/src/scripts/{ext → extensions}/firebird.ps1 +0 -0
- package/src/scripts/{ext → extensions}/firebird.sh +0 -0
- package/src/scripts/{ext → extensions}/gearman.sh +0 -0
- package/src/scripts/{ext → extensions}/geos.sh +0 -0
- package/src/scripts/{ext → extensions}/http.ps1 +1 -0
- package/src/scripts/{ext → extensions}/http.sh +13 -20
- package/src/scripts/{ext → extensions}/intl.sh +0 -0
- package/src/scripts/{ext → extensions}/ioncube.ps1 +2 -2
- package/src/scripts/{ext → extensions}/ioncube.sh +2 -2
- package/src/scripts/{ext → extensions}/oci.ps1 +39 -14
- package/src/scripts/{ext → extensions}/oci.sh +3 -3
- package/src/scripts/{ext → extensions}/patches/firebird.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/geos.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/http.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/pdo_oci.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/phpize.sh +0 -0
- package/src/scripts/{ext → extensions}/patches/protobuf.sh +0 -0
- package/src/scripts/{ext → extensions}/phalcon.ps1 +0 -0
- package/src/scripts/{ext → extensions}/phalcon.sh +4 -5
- package/src/scripts/{ext → extensions}/source.sh +36 -22
- package/src/scripts/extensions/sqlsrv.sh +15 -0
- package/src/scripts/linux.sh +76 -36
- package/src/scripts/tools/add_tools.ps1 +220 -10
- package/src/scripts/tools/add_tools.sh +164 -17
- package/src/scripts/tools/grpc_php_plugin.ps1 +4 -4
- package/src/scripts/tools/grpc_php_plugin.sh +3 -3
- package/src/scripts/tools/ppa.sh +12 -9
- package/src/scripts/tools/protoc.ps1 +2 -2
- package/src/scripts/tools/protoc.sh +2 -2
- package/src/scripts/tools/symfony.ps1 +18 -0
- package/src/scripts/tools/symfony.sh +18 -0
- package/src/scripts/unix.sh +186 -0
- package/src/scripts/win32.ps1 +137 -336
- package/src/tools.ts +62 -82
- package/src/utils.ts +57 -145
- package/src/scripts/common.sh +0 -366
|
@@ -1,29 +1,239 @@
|
|
|
1
|
+
# Variables
|
|
2
|
+
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
|
|
3
|
+
$composer_json = "$env:APPDATA\Composer\composer.json"
|
|
4
|
+
$composer_lock = "$env:APPDATA\Composer\composer.lock"
|
|
5
|
+
|
|
6
|
+
# Function to configure composer.
|
|
7
|
+
Function Edit-ComposerConfig() {
|
|
8
|
+
Param(
|
|
9
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
10
|
+
[ValidateNotNull()]
|
|
11
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
12
|
+
[string]
|
|
13
|
+
$tool_path
|
|
14
|
+
)
|
|
15
|
+
Copy-Item $tool_path -Destination "$tool_path.phar"
|
|
16
|
+
php -r "try {`$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception `$e) {exit(1);}"
|
|
17
|
+
if ($? -eq $False) {
|
|
18
|
+
Add-Log "$cross" "composer" "Could not download composer"
|
|
19
|
+
exit 1;
|
|
20
|
+
}
|
|
21
|
+
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
|
22
|
+
if (-not(Test-Path $composer_json)) {
|
|
23
|
+
Set-Content -Path $composer_json -Value "{}"
|
|
24
|
+
}
|
|
25
|
+
Add-EnvPATH $src\configs\composer.env
|
|
26
|
+
Add-Path $composer_bin
|
|
27
|
+
if (Test-Path env:COMPOSER_TOKEN) {
|
|
28
|
+
Add-Env COMPOSER_AUTH ('{"github-oauth": {"github.com": "' + $env:COMPOSER_TOKEN + '"}}')
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Function to extract tool version.
|
|
33
|
+
Function Get-ToolVersion() {
|
|
34
|
+
Param (
|
|
35
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
36
|
+
$tool,
|
|
37
|
+
[Parameter(Position = 1, Mandatory = $true)]
|
|
38
|
+
$param
|
|
39
|
+
)
|
|
40
|
+
$alp = "[a-zA-Z0-9]"
|
|
41
|
+
$version_regex = "[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
|
42
|
+
if($tool -eq 'composer') {
|
|
43
|
+
$composer_branch_alias = Select-String -Pattern "const\sBRANCH_ALIAS_VERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
|
44
|
+
if ($composer_branch_alias) {
|
|
45
|
+
$composer_version = $composer_branch_alias + '+' + (Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern "[a-zA-Z0-9]+" -AllMatches | ForEach-Object { $_.matches[2].Value })
|
|
46
|
+
} else {
|
|
47
|
+
$composer_version = Select-String -Pattern "const\sVERSION" -Path $bin_dir\composer -Raw | Select-String -Pattern $version_regex | ForEach-Object { $_.matches.Value }
|
|
48
|
+
}
|
|
49
|
+
Set-Variable -Name 'composer_version' -Value $composer_version -Scope Global
|
|
50
|
+
return "$composer_version"
|
|
51
|
+
}
|
|
52
|
+
return . $tool $param 2> $null | ForEach-Object { $_ -replace "composer $version_regex", '' } | Select-String -Pattern $version_regex | Select-Object -First 1 | ForEach-Object { $_.matches.Value }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Helper function to configure tools.
|
|
1
56
|
Function Add-ToolsHelper() {
|
|
2
57
|
Param (
|
|
3
58
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
4
59
|
[ValidateNotNull()]
|
|
5
60
|
$tool
|
|
6
61
|
)
|
|
62
|
+
$extensions = @();
|
|
7
63
|
if($tool -eq "codeception") {
|
|
8
|
-
|
|
64
|
+
$extensions += @('json', 'mbstring')
|
|
65
|
+
Copy-Item $env:codeception_bin\codecept.bat -Destination $env:codeception_bin\codeception.bat
|
|
9
66
|
} elseif($tool -eq "composer") {
|
|
10
67
|
Edit-ComposerConfig $bin_dir\$tool
|
|
11
68
|
} elseif($tool -eq "cs2pr") {
|
|
12
69
|
(Get-Content $bin_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $bin_dir/cs2pr
|
|
13
70
|
} elseif($tool -eq "phan") {
|
|
14
|
-
|
|
15
|
-
|
|
71
|
+
$extensions += @('fileinfo', 'ast')
|
|
72
|
+
} elseif($tool -eq "phinx") {
|
|
73
|
+
$extensions += @('mbstring')
|
|
16
74
|
} elseif($tool -eq "phive") {
|
|
17
|
-
|
|
75
|
+
$extensions += @('curl', 'mbstring', 'xml')
|
|
76
|
+
} elseif($tool -match "phpc(df|s)") {
|
|
77
|
+
$extensions += @('tokenizer', 'xmlwriter', 'simplexml')
|
|
78
|
+
} elseif($tool -match "php-cs-fixer") {
|
|
79
|
+
$extensions += @('json', 'tokenizer')
|
|
18
80
|
} elseif($tool -eq "phpDocumentor") {
|
|
81
|
+
$extensions+=('ctype', 'hash', 'json', 'fileinfo', 'iconv', 'mbstring', 'simplexml', 'xml')
|
|
19
82
|
Add-Extension fileinfo >$null 2>&1
|
|
20
83
|
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
|
21
|
-
} elseif($tool -eq "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
84
|
+
} elseif($tool -eq "phpunit") {
|
|
85
|
+
$extensions += @('dom', 'json', 'libxml', 'mbstring', 'xml', 'xmlwriter')
|
|
86
|
+
} elseif($tool -eq "phpunit-bridge") {
|
|
87
|
+
$extensions += @('dom', 'pdo', 'tokenizer', 'xmlwriter')
|
|
88
|
+
} elseif($tool -eq "vapor-cli") {
|
|
89
|
+
$extensions += @('fileinfo', 'json', 'mbstring', 'zip', 'simplexml')
|
|
90
|
+
Copy-Item $env:vapor_cli_bin\vapor.bat -Destination $env:vapor_cli_bin\vapor-cli.bat
|
|
26
91
|
} elseif($tool -eq "wp-cli") {
|
|
27
92
|
Copy-Item $bin_dir\wp-cli.bat -Destination $bin_dir\wp.bat
|
|
28
93
|
}
|
|
29
|
-
|
|
94
|
+
foreach($extension in $extensions) {
|
|
95
|
+
Add-Extension $extension >$null 2>&1
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# Function to add tools.
|
|
100
|
+
Function Add-Tool() {
|
|
101
|
+
Param (
|
|
102
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
103
|
+
[ValidateNotNull()]
|
|
104
|
+
$urls,
|
|
105
|
+
[Parameter(Position = 1, Mandatory = $true)]
|
|
106
|
+
[ValidateNotNull()]
|
|
107
|
+
$tool,
|
|
108
|
+
[Parameter(Position = 2, Mandatory = $true)]
|
|
109
|
+
[ValidateNotNull()]
|
|
110
|
+
$ver_param
|
|
111
|
+
)
|
|
112
|
+
if (Test-Path $bin_dir\$tool) {
|
|
113
|
+
Copy-Item $bin_dir\$tool -Destination $bin_dir\$tool.old -Force
|
|
114
|
+
}
|
|
115
|
+
$tool_path = "$bin_dir\$tool"
|
|
116
|
+
foreach ($url in $urls){
|
|
117
|
+
if (($url | Split-Path -Extension) -eq ".exe") {
|
|
118
|
+
$tool_path = "$tool_path.exe"
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
|
|
122
|
+
} catch {
|
|
123
|
+
if($url -match '.*github.com.*releases.*latest.*') {
|
|
124
|
+
try {
|
|
125
|
+
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Invoke-WebRequest -Uri ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
|
126
|
+
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
|
|
127
|
+
} catch { }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if($status_code -eq 200 -and (Test-Path $tool_path)) {
|
|
131
|
+
break
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (((Get-ChildItem -Path $bin_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
|
136
|
+
$bat_content = @()
|
|
137
|
+
$bat_content += "@ECHO off"
|
|
138
|
+
$bat_content += "setlocal DISABLEDELAYEDEXPANSION"
|
|
139
|
+
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
|
140
|
+
$bat_content += "php %BIN_TARGET% %*"
|
|
141
|
+
Set-Content -Path $bin_dir\$tool.bat -Value $bat_content
|
|
142
|
+
Add-ToolsHelper $tool
|
|
143
|
+
Add-ToProfile $current_profile $tool "New-Alias $tool $bin_dir\$tool.bat" >$null 2>&1
|
|
144
|
+
$tool_version = Get-ToolVersion $tool $ver_param
|
|
145
|
+
Add-Log $tick $tool "Added $tool $tool_version"
|
|
146
|
+
} else {
|
|
147
|
+
if($tool -eq "composer") {
|
|
148
|
+
$env:fail_fast = 'true'
|
|
149
|
+
} elseif (Test-Path $bin_dir\$tool.old) {
|
|
150
|
+
Copy-Item $bin_dir\$tool.old -Destination $bin_dir\$tool -Force
|
|
151
|
+
}
|
|
152
|
+
Add-Log $cross $tool "Could not add $tool"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Function Add-ComposertoolHelper() {
|
|
157
|
+
Param (
|
|
158
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
159
|
+
[string]
|
|
160
|
+
$tool,
|
|
161
|
+
[Parameter(Position = 1, Mandatory = $true)]
|
|
162
|
+
[string]
|
|
163
|
+
$release,
|
|
164
|
+
[Parameter(Position = 2, Mandatory = $true)]
|
|
165
|
+
[string]
|
|
166
|
+
$prefix,
|
|
167
|
+
[Parameter(Position = 3, Mandatory = $true)]
|
|
168
|
+
[string]
|
|
169
|
+
$scope,
|
|
170
|
+
[Parameter(Position = 4, Mandatory = $false)]
|
|
171
|
+
[string]
|
|
172
|
+
$composer_args
|
|
173
|
+
)
|
|
174
|
+
if($scope -eq 'global') {
|
|
175
|
+
if(Test-Path $composer_lock) {
|
|
176
|
+
Remove-Item -Path $composer_lock -Force
|
|
177
|
+
}
|
|
178
|
+
composer global require $prefix$release $composer_args >$null 2>&1
|
|
179
|
+
return composer global show $prefix$tool 2>&1 | findstr '^versions'
|
|
180
|
+
} else {
|
|
181
|
+
$release_stream = [System.IO.MemoryStream]::New([System.Text.Encoding]::ASCII.GetBytes($release))
|
|
182
|
+
$scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash
|
|
183
|
+
$scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix"
|
|
184
|
+
$unix_scoped_dir = $scoped_dir.replace('\', '/')
|
|
185
|
+
if(-not(Test-Path $scoped_dir)) {
|
|
186
|
+
New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1
|
|
187
|
+
composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1
|
|
188
|
+
}
|
|
189
|
+
[System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")
|
|
190
|
+
Add-Path $scoped_dir\vendor\bin
|
|
191
|
+
return composer show $prefix$tool -d $unix_scoped_dir 2>&1 | findstr '^versions'
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# Function to setup a tool using composer.
|
|
196
|
+
Function Add-Composertool() {
|
|
197
|
+
Param (
|
|
198
|
+
[Parameter(Position = 0, Mandatory = $true)]
|
|
199
|
+
[ValidateNotNull()]
|
|
200
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
201
|
+
[string]
|
|
202
|
+
$tool,
|
|
203
|
+
[Parameter(Position = 1, Mandatory = $true)]
|
|
204
|
+
[ValidateNotNull()]
|
|
205
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
206
|
+
[string]
|
|
207
|
+
$release,
|
|
208
|
+
[Parameter(Position = 2, Mandatory = $true)]
|
|
209
|
+
[ValidateNotNull()]
|
|
210
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
211
|
+
[string]
|
|
212
|
+
$prefix,
|
|
213
|
+
[Parameter(Position = 3, Mandatory = $true)]
|
|
214
|
+
[ValidateNotNull()]
|
|
215
|
+
[ValidateLength(1, [int]::MaxValue)]
|
|
216
|
+
[string]
|
|
217
|
+
$scope
|
|
218
|
+
)
|
|
219
|
+
if($composer_version.split('.')[0] -ne "1") {
|
|
220
|
+
$composer_args = "--ignore-platform-req=ext-*"
|
|
221
|
+
if($tool -match "prestissimo|composer-prefetcher") {
|
|
222
|
+
Write-Output "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
|
|
223
|
+
Add-Log $cross $tool "Skipped"
|
|
224
|
+
Return
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
Enable-PhpExtension -Extension curl, mbstring, openssl -Path $php_dir
|
|
228
|
+
$log = Add-ComposertoolHelper $tool $release $prefix $scope $composer_args
|
|
229
|
+
if(Test-Path $composer_bin\composer) {
|
|
230
|
+
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
|
231
|
+
}
|
|
232
|
+
Add-ToolsHelper $tool
|
|
233
|
+
if($log) {
|
|
234
|
+
$tool_version = Get-ToolVersion "Write-Output" "$log"
|
|
235
|
+
Add-Log $tick $tool "Added $tool $tool_version"
|
|
236
|
+
} else {
|
|
237
|
+
Add-Log $cross $tool "Could not setup $tool"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -1,28 +1,175 @@
|
|
|
1
|
+
# Variables
|
|
2
|
+
export tool_path_dir="/usr/local/bin"
|
|
3
|
+
export composer_home="$HOME/.composer"
|
|
4
|
+
export composer_bin="$composer_home/vendor/bin"
|
|
5
|
+
export composer_json="$composer_home/composer.json"
|
|
6
|
+
export composer_lock="$composer_home/composer.lock"
|
|
7
|
+
|
|
8
|
+
# Function to extract tool version.
|
|
9
|
+
get_tool_version() {
|
|
10
|
+
tool=$1
|
|
11
|
+
param=$2
|
|
12
|
+
alp="[a-zA-Z0-9]"
|
|
13
|
+
version_regex="[0-9]+((\.{1}$alp+)+)(\.{0})(-$alp+){0,1}"
|
|
14
|
+
if [ "$tool" = "composer" ]; then
|
|
15
|
+
composer_alias_version="$(grep -Ea "const\sBRANCH_ALIAS_VERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
|
16
|
+
if [[ -n "$composer_alias_version" ]]; then
|
|
17
|
+
composer_version="$composer_alias_version+$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$alp+" | tail -n 1)"
|
|
18
|
+
else
|
|
19
|
+
composer_version="$(grep -Ea "const\sVERSION" "$tool_path_dir/composer" | grep -Eo "$version_regex")"
|
|
20
|
+
fi
|
|
21
|
+
echo "$composer_version" | sudo tee /tmp/composer_version
|
|
22
|
+
else
|
|
23
|
+
$tool "$param" 2>/dev/null | sed -Ee "s/[Cc]omposer(.)?$version_regex//g" | grep -Eo "$version_regex" | head -n 1
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Function to configure composer
|
|
28
|
+
configure_composer() {
|
|
29
|
+
tool_path=$1
|
|
30
|
+
sudo ln -sf "$tool_path" "$tool_path.phar"
|
|
31
|
+
php -r "try {\$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception \$e) {exit(1);}"
|
|
32
|
+
if [ $? -eq 1 ]; then
|
|
33
|
+
add_log "${cross:?}" "composer" "Could not download composer"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
if ! [ -d "$composer_home" ]; then
|
|
37
|
+
sudo -u "$(id -un)" -g "$(id -gn)" mkdir -p -m=00755 "$composer_home"
|
|
38
|
+
else
|
|
39
|
+
sudo chown -R "$(id -un)":"$(id -gn)" "$composer_home"
|
|
40
|
+
fi
|
|
41
|
+
if ! [ -e "$composer_json" ]; then
|
|
42
|
+
echo '{}' | tee "$composer_json" >/dev/null
|
|
43
|
+
chmod 644 "$composer_json"
|
|
44
|
+
fi
|
|
45
|
+
add_env_path "${src:?}"/configs/composer.env
|
|
46
|
+
add_path "$composer_bin"
|
|
47
|
+
if [ -n "$COMPOSER_TOKEN" ]; then
|
|
48
|
+
add_env COMPOSER_AUTH '{"github-oauth": {"github.com": "'"$COMPOSER_TOKEN"'"}}'
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Helper function to configure tools.
|
|
1
53
|
add_tools_helper() {
|
|
2
54
|
tool=$1
|
|
55
|
+
extensions=()
|
|
3
56
|
if [ "$tool" = "codeception" ]; then
|
|
4
|
-
|
|
57
|
+
extensions+=(json mbstring)
|
|
58
|
+
sudo ln -s "$scoped_dir"/vendor/bin/codecept "$scoped_dir"/vendor/bin/codeception
|
|
5
59
|
elif [ "$tool" = "composer" ]; then
|
|
6
|
-
configure_composer "$
|
|
60
|
+
configure_composer "$tool_path"
|
|
7
61
|
elif [ "$tool" = "cs2pr" ]; then
|
|
8
|
-
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$
|
|
9
|
-
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$
|
|
62
|
+
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" 2>/dev/null ||
|
|
63
|
+
sudo sed -i '' 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
|
10
64
|
elif [ "$tool" = "phan" ]; then
|
|
11
|
-
|
|
12
|
-
|
|
65
|
+
extensions+=(fileinfo ast)
|
|
66
|
+
elif [ "$tool" = "phinx" ]; then
|
|
67
|
+
extensions+=(mbstring)
|
|
13
68
|
elif [ "$tool" = "phive" ]; then
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
69
|
+
extensions+=(curl mbstring xml)
|
|
70
|
+
elif [[ "$tool" =~ phpc(bf|s) ]]; then
|
|
71
|
+
extensions+=(tokenizer simplexml xmlwriter)
|
|
72
|
+
elif [[ "$tool" =~ phpc(bf|s) ]]; then
|
|
73
|
+
extensions+=(tokenizer xmlwriter simplexml)
|
|
74
|
+
elif [ "$tool" = "php-cs-fixer" ]; then
|
|
75
|
+
extensions+=(json tokenizer)
|
|
17
76
|
elif [ "$tool" = "phpDocumentor" ]; then
|
|
18
|
-
|
|
19
|
-
sudo ln -s "$
|
|
20
|
-
sudo ln -s "$
|
|
77
|
+
extensions+=(ctype hash json fileinfo iconv mbstring simplexml xml)
|
|
78
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/phpdocumentor 2>/dev/null || true
|
|
79
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/phpdoc
|
|
80
|
+
elif [ "$tool" = "phpunit" ]; then
|
|
81
|
+
extensions+=(dom json libxml mbstring xml xmlwriter)
|
|
82
|
+
elif [ "$tool" = "phpunit-bridge" ]; then
|
|
83
|
+
extensions+=(dom pdo tokenizer xmlwriter xmlreader)
|
|
21
84
|
elif [[ "$tool" =~ phpunit(-polyfills)?$ ]]; then
|
|
22
|
-
if [ -e "$
|
|
23
|
-
sudo cp "$
|
|
85
|
+
if [ -e "$tool_path_dir"/phpunit ] && [ -d "$composer_bin" ]; then
|
|
86
|
+
sudo cp "$tool_path_dir"/phpunit "$composer_bin"
|
|
87
|
+
fi
|
|
88
|
+
elif [ "$tool" = "vapor-cli" ]; then
|
|
89
|
+
extensions+=(fileinfo json mbstring zip simplexml)
|
|
90
|
+
sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli
|
|
91
|
+
elif [ "$tool" = wp-cli ]; then
|
|
92
|
+
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
|
93
|
+
fi
|
|
94
|
+
for extension in "${extensions[@]}"; do
|
|
95
|
+
add_extension "$extension" extension >/dev/null 2>&1
|
|
96
|
+
done
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# Function to setup a remote tool.
|
|
100
|
+
add_tool() {
|
|
101
|
+
url=$1
|
|
102
|
+
tool=$2
|
|
103
|
+
ver_param=$3
|
|
104
|
+
tool_path="$tool_path_dir/$tool"
|
|
105
|
+
add_path "$tool_path_dir"
|
|
106
|
+
if [ -e "$tool_path" ]; then
|
|
107
|
+
sudo cp -aL "$tool_path" /tmp/"$tool"
|
|
108
|
+
fi
|
|
109
|
+
IFS="," read -r -a url <<<"$url"
|
|
110
|
+
status_code=$(get -v -e "$tool_path" "${url[@]}")
|
|
111
|
+
if [ "$status_code" != "200" ] && [[ "${url[0]}" =~ .*github.com.*releases.*latest.* ]]; then
|
|
112
|
+
url[0]="${url[0]//releases\/latest\/download/releases/download/$(get -s -n "" "$(echo "${url[0]}" | cut -d '/' -f '1-5')/releases" | grep -Eo -m 1 "([0-9]+\.[0-9]+\.[0-9]+)/$(echo "${url[0]}" | sed -e "s/.*\///")" | cut -d '/' -f 1)}"
|
|
113
|
+
status_code=$(get -v -e "$tool_path" "${url[0]}")
|
|
114
|
+
fi
|
|
115
|
+
if [ "$status_code" = "200" ]; then
|
|
116
|
+
add_tools_helper "$tool"
|
|
117
|
+
tool_version=$(get_tool_version "$tool" "$ver_param")
|
|
118
|
+
add_log "${tick:?}" "$tool" "Added $tool $tool_version"
|
|
119
|
+
else
|
|
120
|
+
if [ "$tool" = "composer" ]; then
|
|
121
|
+
export fail_fast=true
|
|
122
|
+
elif [ -e /tmp/"$tool" ]; then
|
|
123
|
+
sudo cp -a /tmp/"$tool" "$tool_path"
|
|
124
|
+
fi
|
|
125
|
+
add_log "$cross" "$tool" "Could not setup $tool"
|
|
126
|
+
fi
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# Function to setup a tool using composer in a different scope.
|
|
130
|
+
add_composertool_helper() {
|
|
131
|
+
tool=$1
|
|
132
|
+
release=$2
|
|
133
|
+
prefix=$3
|
|
134
|
+
scope=$4
|
|
135
|
+
composer_args=$5
|
|
136
|
+
enable_extensions curl mbstring openssl
|
|
137
|
+
if [ "$scope" = "global" ]; then
|
|
138
|
+
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
|
139
|
+
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
|
140
|
+
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
|
141
|
+
else
|
|
142
|
+
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
|
143
|
+
if ! [ -d "$scoped_dir" ]; then
|
|
144
|
+
mkdir -p "$scoped_dir"
|
|
145
|
+
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
|
146
|
+
composer show "$prefix$tool" -d "$scoped_dir" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
|
24
147
|
fi
|
|
25
|
-
|
|
26
|
-
|
|
148
|
+
add_path "$scoped_dir"/vendor/bin
|
|
149
|
+
fi
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Function to setup a tool using composer.
|
|
153
|
+
add_composertool() {
|
|
154
|
+
tool=$1
|
|
155
|
+
release=$2
|
|
156
|
+
prefix=$3
|
|
157
|
+
scope=$4
|
|
158
|
+
composer_major_version=$(cut -d'.' -f 1 /tmp/composer_version)
|
|
159
|
+
if [ "$composer_major_version" != "1" ]; then
|
|
160
|
+
composer_args="--ignore-platform-req=ext-*"
|
|
161
|
+
if [[ "$tool" =~ prestissimo|composer-prefetcher ]]; then
|
|
162
|
+
echo "::warning:: Skipping $tool, as it does not support Composer $composer_version. Specify composer:v1 in tools to use $tool"
|
|
163
|
+
add_log "$cross" "$tool" "Skipped"
|
|
164
|
+
return
|
|
165
|
+
fi
|
|
166
|
+
fi
|
|
167
|
+
add_composertool_helper "$tool" "$release" "$prefix" "$scope" "$composer_args"
|
|
168
|
+
tool_version=$(get_tool_version cat /tmp/composer.log)
|
|
169
|
+
([ -s /tmp/composer.log ] && add_log "$tick" "$tool" "Added $tool $tool_version"
|
|
170
|
+
) || add_log "$cross" "$tool" "Could not setup $tool"
|
|
171
|
+
add_tools_helper "$tool"
|
|
172
|
+
if [ -e "$composer_bin/composer" ]; then
|
|
173
|
+
sudo cp -a "$tool_path_dir/composer" "$composer_bin"
|
|
27
174
|
fi
|
|
28
|
-
}
|
|
175
|
+
}
|
|
@@ -11,11 +11,11 @@ Function Add-Grpc_php_plugin() {
|
|
|
11
11
|
$msys_location = Add-Msys2
|
|
12
12
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
|
13
13
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Add-Path $msys_location\mingw64\bin
|
|
15
|
+
Set-Output grpc_php_plugin_path "$msys_location\mingw64\bin\grpc_php_plugin.exe"
|
|
16
16
|
Add-ToProfile $current_profile 'grpc_php_plugin' "New-Alias grpc_php_plugin $msys_location\mingw64\bin\grpc_php_plugin.exe"
|
|
17
17
|
Add-Log $tick "grpc_php_plugin" "Added grpc_php_plugin $grpc_version"
|
|
18
|
-
printf "
|
|
18
|
+
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
|
19
19
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/grpc/grpc/master/LICENSE).Content
|
|
20
|
-
Write-Output "
|
|
20
|
+
Write-Output "$env:END_GROUP"
|
|
21
21
|
}
|
|
@@ -50,9 +50,9 @@ add_grpc_php_plugin() {
|
|
|
50
50
|
else
|
|
51
51
|
add_grpc_php_plugin_compile >/dev/null 2>&1
|
|
52
52
|
fi
|
|
53
|
-
|
|
53
|
+
set_output grpc_php_plugin_path "$(command -v grpc_php_plugin)"
|
|
54
54
|
add_log "${tick:?}" "grpc_php_plugin" "Added grpc_php_plugin ${grpc_tag:1}"
|
|
55
|
-
printf "
|
|
55
|
+
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "grpc_php_plugin" "Click to read the grpc_php_plugin related license information"
|
|
56
56
|
cat "$license_path"
|
|
57
|
-
echo "
|
|
57
|
+
echo "$END_GROUP"
|
|
58
58
|
}
|
package/src/scripts/tools/ppa.sh
CHANGED
|
@@ -54,14 +54,17 @@ update_lists_helper() {
|
|
|
54
54
|
update_lists() {
|
|
55
55
|
local ppa=${1:-}
|
|
56
56
|
local ppa_search=${2:-}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
local list=
|
|
58
|
+
status_file=/tmp/os_lists
|
|
59
|
+
if [[ -n "$ppa" && -n "$ppa_search" ]]; then
|
|
60
|
+
list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
|
|
61
|
+
status_file=/tmp/"${ppa/\//_}"
|
|
62
|
+
elif grep -Eq '^deb ' "$list_file"; then
|
|
63
|
+
list="$list_file"
|
|
64
|
+
fi
|
|
65
|
+
if [ ! -e "$status_file" ]; then
|
|
63
66
|
update_lists_helper "$list" >/dev/null 2>&1
|
|
64
|
-
echo '' | tee
|
|
67
|
+
echo '' | tee "$status_file" >/dev/null 2>&1
|
|
65
68
|
fi
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -156,9 +159,9 @@ add_ppa() {
|
|
|
156
159
|
else
|
|
157
160
|
add_list "$ppa"
|
|
158
161
|
fi
|
|
159
|
-
|
|
162
|
+
exit_code="$?"
|
|
160
163
|
. /etc/os-release
|
|
161
|
-
return $
|
|
164
|
+
return $exit_code
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
# Function to update a PPA.
|
|
@@ -32,7 +32,7 @@ Function Add-Protoc() {
|
|
|
32
32
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
|
33
33
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
|
34
34
|
Add-Log $tick "protoc" "Added protoc $($protobuf_tag -replace 'v', '')"
|
|
35
|
-
printf "
|
|
35
|
+
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
|
36
36
|
Write-Output (Invoke-WebRequest https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE).Content
|
|
37
|
-
Write-Output "
|
|
37
|
+
Write-Output "$env:END_GROUP"
|
|
38
38
|
}
|
|
@@ -22,7 +22,7 @@ add_protoc() {
|
|
|
22
22
|
sudo chmod -R 777 /usr/local/bin/protoc /usr/local/include/google
|
|
23
23
|
) >/dev/null 2>&1
|
|
24
24
|
add_log "${tick:?}" "protoc" "Added protoc ${protobuf_tag:1}"
|
|
25
|
-
printf "
|
|
25
|
+
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "protoc" "Click to read the protoc related license information"
|
|
26
26
|
curl "${curl_opts[@]:?}" https://raw.githubusercontent.com/protocolbuffers/protobuf/master/LICENSE
|
|
27
|
-
echo "
|
|
27
|
+
echo "$END_GROUP"
|
|
28
28
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Function Add-Symfony() {
|
|
2
|
+
$arch_name ='amd64'
|
|
3
|
+
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
|
4
|
+
$arch_name = '386'
|
|
5
|
+
}
|
|
6
|
+
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
|
7
|
+
Invoke-WebRequest -Uri $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
|
8
|
+
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
9
|
+
if(Test-Path $bin_dir\symfony.exe) {
|
|
10
|
+
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
|
11
|
+
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
|
12
|
+
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
|
13
|
+
$tool_version = Get-ToolVersion symfony "-V"
|
|
14
|
+
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
|
|
15
|
+
} else {
|
|
16
|
+
Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
add_symfony() {
|
|
2
|
+
if [ "$(uname -s)" = "Linux" ]; then
|
|
3
|
+
echo 'deb [trusted=yes] https://repo.symfony.com/apt/ /' | sudo tee /etc/apt/sources.list.d/symfony-cli.list >/dev/null 2>&1
|
|
4
|
+
update_lists symfony repo.symfony.com
|
|
5
|
+
install_packages symfony-cli
|
|
6
|
+
elif [ "$(uname -s)" = "Darwin" ]; then
|
|
7
|
+
add_brew_tap symfony-cli/homebrew-tap
|
|
8
|
+
brew install symfony-cli/tap/symfony-cli >/dev/null 2>&1
|
|
9
|
+
fi
|
|
10
|
+
symfony_path="$(command -v symfony)"
|
|
11
|
+
if [[ -n "$symfony_path" ]]; then
|
|
12
|
+
sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
|
|
13
|
+
tool_version=$(get_tool_version "symfony" "-V")
|
|
14
|
+
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
|
|
15
|
+
else
|
|
16
|
+
add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
|
|
17
|
+
fi
|
|
18
|
+
}
|