54fa658e31
- FullCLR build is disabled in this change. - FullCLR build related functionalities in `build.psm1` and `AppVeyor.psm1` are disabled. They are not cleaned up from `build.psm1` and `AppVeyor.psm1` yet. We need to adopt .NET Core 2.0 to verify the portable module concept, and if that works well, we will remove the Windows PowerShell source code and clean up our scripts. - `dnxcore50` and `portable-net5+win8` target framework monikers are removed. - Dependency on `Microsoft.NETCore.Portable.Compatibility` is removed. It's not necessary, but it may come back when we work on supporting the `portable module`. Its necessity can be reviewed at that time. - I didn't spend the time to try building powershell in Visual Studio 2017. We should have a separate issue for that. It's tracked by #3400 The `TypeCatalogParser` project is replaced by a MSBuild target to gather the dependency information. Due to .NET Core SDK issue [#1021](https://github.com/dotnet/sdk/issues/1021), our meta-package project `Microsoft.PowerShell.SDK` starts to generate an empty assembly during the build and that results in an empty assembly `Microsoft.PowerShell.SDK.dll` appear in `publish` folder and in `.deps.json` file. We cannot simply remove the assembly because it's now part of the TPA, and removing it will cause powershell to crash at startup. We have to live with this empty assembly until that .NET Core SDK issue is fixed. It's tracked by #3401.
57 lines
2.2 KiB
Bash
Executable File
57 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if hash powershell 2>/dev/null; then
|
|
echo 'Continuing with `powershell -noprofile -c Start-PSBuild`'
|
|
powershell -noprofile -c "Import-Module ./build.psm1; Start-PSBuild"
|
|
else
|
|
echo 'Continuing with full manual build'
|
|
|
|
## Restore
|
|
dotnet restore src/powershell-unix
|
|
dotnet restore src/ResGen
|
|
dotnet restore src/TypeCatalogGen
|
|
|
|
## Setup the build target to gather dependency information
|
|
targetFile="$(pwd)/src/Microsoft.PowerShell.SDK/obj/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets"
|
|
cat > $targetFile <<-"EOF"
|
|
<Project>
|
|
<Target Name="_GetDependencies"
|
|
DependsOnTargets="ResolvePackageDependenciesDesignTime">
|
|
<ItemGroup>
|
|
<_DependentAssemblyPath Include="%(_DependenciesDesignTime.Path)%3B" Condition=" '%(_DependenciesDesignTime.Type)' == 'Assembly' And '%(_DependenciesDesignTime.Name)' != 'Microsoft.Management.Infrastructure.Native.dll' And '%(_DependenciesDesignTime.Name)' != 'Microsoft.Management.Infrastructure.dll' " />
|
|
</ItemGroup>
|
|
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_DependentAssemblyPath)" Overwrite="true" />
|
|
</Target>
|
|
</Project>
|
|
EOF
|
|
dotnet msbuild src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$(pwd)/src/TypeCatalogGen/powershell.inc" /nologo
|
|
|
|
## Generate 'powershell.version'
|
|
git --git-dir="$(pwd)/.git" describe --dirty --abbrev=60 > "$(pwd)/powershell.version"
|
|
|
|
## Generate resource binding C# files
|
|
pushd src/ResGen
|
|
dotnet run
|
|
popd
|
|
|
|
## Generate 'CorePsTypeCatalog.cs'
|
|
pushd src/TypeCatalogGen
|
|
dotnet run ../Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs powershell.inc
|
|
popd
|
|
|
|
## Build native component
|
|
pushd src/libpsl-native
|
|
cmake -DCMAKE_BUILD_TYPE=Debug .
|
|
make -j
|
|
make test
|
|
popd
|
|
|
|
## Build powershell core
|
|
rawRid="$(dotnet --info | grep RID)"
|
|
rid=${rawRid##* } # retain the part after the last space
|
|
dotnet publish --configuration Linux src/powershell-unix/ --output bin --runtime $rid
|
|
|
|
echo 'You can run powershell from bin/, but some modules that are normally added by the Restore-PSModule step will not be available.'
|
|
fi
|