Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libpsl-native/src/setdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int32_t SetDate(struct private_tm* time)

static int32_t GetTimeVal(struct private_tm& time, struct timeval& tv)
{
struct tm nativeTime = 0;
struct tm nativeTime = {0};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should migrate to stime #6962

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we eventually move to a dotnet api, I don't think it's worth the effort to change to stime now. I need this change as the native build portion for Alpine fails here.

nativeTime.tm_hour = static_cast<int>(time.Hour);
nativeTime.tm_isdst = static_cast<int>(time.IsDst);
nativeTime.tm_mday = static_cast<int>(time.DayOfMonth);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/bin/sh

set -e

# this script needs to be run from within Alpine with dotnet 2.1 SDK installed, example:
# docker run -it -v ~/repos/PowerShell:/PowerShell microsoft/dotnet:2.1-sdk-alpine

# build tools required:
# apk update
# apk add build-base gcc abuild binutils git python bash cmake

# run from root of PowerShell repo:
# tools/releaseBuild/Images/microsoft_powershell_alpine3/build-and-run-pwsh.sh /PowerShell /PowerShell 6.1.0

repoRoot=$1
destination=$2
releaseTag=$3
Expand Down Expand Up @@ -37,10 +49,10 @@ esac
# remove v from release tag (v3.5 => 3.5)
if [ "${releaseTag:0:1}" = "v" ]; then
releaseTag=${releaseTag:1}
tarName=$destination/powershell-$releaseTag-alpine.3-$arch.tar.gz
tarName=$destination/powershell-$releaseTag-linux-musl-$arch.tar.gz
dotnetArguments=/p:ReleaseTag=$releaseTag;
else
tarName=$destination/powershell-alpine.3-$arch.tar.gz
tarName=$destination/powershell-linux-musl-$arch.tar.gz
fi

# Build libpsl-native
Expand All @@ -62,13 +74,13 @@ cd ..
targetFile="Microsoft.PowerShell.SDK/obj/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets"
cat > $targetFile <<-"EOF"
<Project>
<Target Name="_GetDependencies"
DependsOnTargets="ResolveAssemblyReferencesDesignTime">
<ItemGroup>
<_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " />
</ItemGroup>
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
</Target>
<Target Name="_GetDependencies"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: Are the white space diffs really needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent 4 spaces indentation (was copied from build.psm1)

DependsOnTargets="ResolveAssemblyReferencesDesignTime">
<ItemGroup>
<_RefAssemblyPath Include="%(_ReferencesFromRAR.HintPath)%3B" Condition=" '%(_ReferencesFromRAR.NuGetPackageId)' != 'Microsoft.Management.Infrastructure' "/>
</ItemGroup>
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
</Target>
</Project>
EOF

Expand All @@ -79,12 +91,14 @@ dotnet run ../System.Management.Automation/CoreCLR/CorePsTypeCatalog.cs powershe

# build PowerShell
cd ../powershell-unix
dotnet publish --configuration Linux --runtime linux-x64 $dotnetArguments
dotnet publish --configuration Release --runtime linux-musl-x64 $dotnetArguments

# add libpsl-native to build
mv libpsl-native.so bin/Linux/netcoreapp2.0/linux-x64
mv libpsl-native.so bin/Release/netcoreapp2.1/linux-musl-x64/publish

# tar build for output
cd bin/Linux/netcoreapp2.0/linux-x64
cd bin/Release/netcoreapp2.1/linux-musl-x64/publish

tar -czvf $tarName .

echo "Created $tarName"