mieliespoor commented on issue #207:
URL:
https://github.com/apache/incubator-devlake/issues/207#issuecomment-1781915619
Here is a rough script to build using Windows. Few things still outstanding,
but mostly there.
```
$SCRIPT_DIR = $PSScriptRoot
$PLUGIN_SRC_DIR = "$SCRIPT_DIR\..\plugins"
$PLUGIN_OUTPUT_DIR = "$SCRIPT_DIR\..\bin\plugins"
$PLUGINS = @()
if ( -not $PLUGIN ) {
#Write-Information "Building all plugins"
Write-Host "Building all plugins"
$PLUGINS = $(Get-ChildItem -Path $PLUGIN_SRC_DIR -Directory -Depth 0)
} else {
Write-Information "Building the following plugins: $PLUGIN"
foreach ($p in $($PLUGIN.Split(','))){
$PLUGINS+="$PLUGIN_SRC_DIR\$p"
}
}
if (Test-Path -Path $PLUGIN_OUTPUT_DIR) {
Remove-Item -Path $PLUGIN_OUTPUT_DIR -Recurse -Force -ErrorAction
Continue
}
$JOBS = @()
foreach ($PLUG in $PLUGINS) {
$NAME = (Get-Item -Path $PLUG).BaseName
Write-Host "Building plugin $NAME to bin/plugins/$NAME/$NAME.so with
args: $*"
$j = Start-Job -ScriptBlock { go build -o
"$($args[0])\$($args[1])\$($args[1]).so" } -WorkingDirectory
$PLUGIN_SRC_DIR\$NAME -ArgumentList $PLUGIN_OUTPUT_DIR, $NAME
$JOBS += $j
# get the number of processing units
# we limit the number plugin builds to that.
$totalLogicalCores = ((Get-CimInstance –ClassName
Win32_Processor).NumberOfLogicalProcessors | Measure-Object -Sum).Sum
# do a quick sleep to try prevent waiting for the jobs below
Start-Sleep -Seconds 1
if ($($JOBS | Where-Object { $_.State -eq "Running" }).Count -eq
$totalLogicalCores) {
Wait-Job -Job $JOBS
}
}
if ($($JOBS | Where-Object { $_.State -eq "Running" }).Count -gt 0){
# we wait for any jobs that might still be running
Wait-Job -Job $($JOBS | Where-Object { $_.State -eq "Running" })
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]