Created
August 25, 2018 09:10
-
-
Save sunnyneo/c3769c1c6b7386a362a91477b63da501 to your computer and use it in GitHub Desktop.
Clone all repositories in GhostPack and Build Them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get repositories git url and clone them | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$req = 'https://api.github.com/users/GhostPack/repos?page=$PAGE&per_page=100' | |
$respObj = Invoke-WebRequest $req | ConvertFrom-Json | |
$respObj | select -Property git_url | ForEach { git clone $_.git_url -q } | |
# Replace all Build Output to current location | |
Get-ChildItem '*.csproj' -Recurse | ForEach { | |
(Get-Content $_ | ForEach { $_ -replace '<OutputPath>bin\\Release\\<\/OutputPath>', '<OutputPath>..\..\</OutputPath>' }) | | |
Set-Content $_ | |
} | |
# MSBuild Template | |
# https://stackoverflow.com/questions/22131757/build-multiple-visual-studio-solutions-simultaneously | |
$msbuildTemplate = '<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup> | |
<Solution Include="**/*.sln"> | |
<Properties>Configuration=Release;Platform=Any CPU</Properties> | |
</Solution> | |
</ItemGroup> | |
<PropertyGroup> | |
<Configuration Condition=" ''$(Configuration)'' == '''' ">Release</Configuration> | |
<Platform Condition=" ''$(Platform)'' == '''' ">AnyCPU</Platform> | |
</PropertyGroup> | |
<Target Name="Build"> | |
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Build" /> | |
</Target> | |
<Target Name="Clean"> | |
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Clean" /> | |
</Target> | |
<Target Name="Rebuild"> | |
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Rebuild" /> | |
</Target> | |
</Project>' | |
$fileName = 'build_every_solution.csproj' | |
# Create MSBuild Template | |
Set-Content -Value $msbuildTemplate -Path $fileName | |
# Build solutions | |
msbuild $fileName /m:4 /ds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment