Skip to content
Closed
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
11 changes: 9 additions & 2 deletions .azure-pipelines/templates/linux/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ steps:
version: 3.1.x

- task: DotNetCoreCLI@2
displayName: Compile common code
displayName: Compile common code (amd64)
inputs:
command: build
projects: 'Git-Credential-Manager.sln'
arguments: '--configuration=Linux$(configuration)'
arguments: '--configuration=Linux$(configuration) -r linux-x64'

- task: DotNetCoreCLI@2
displayName: Compile common code (arm64)
inputs:
command: build
projects: 'Git-Credential-Manager.sln'
arguments: '--configuration=Linux$(configuration) -r linux-arm64'

- task: DotNetCoreCLI@2
displayName: Run common unit tests
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
run: dotnet restore --force

- name: Build Linux Payloads
run: dotnet build -c Release src/linux/Packaging.Linux/Packaging.Linux.csproj
run: |
dotnet build -c Release -r linux-x64 src/linux/Packaging.Linux/Packaging.Linux.csproj
dotnet build -c Release -r linux-arm64 src/linux/Packaging.Linux/Packaging.Linux.csproj

- name: Upload Installers
uses: actions/upload-artifact@v2
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-signed-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
run: dotnet restore --force

- name: Build Linux Payloads
run: dotnet build -c Release src/linux/Packaging.Linux/Packaging.Linux.csproj
run: |
dotnet build -c Release -r linux-x64 src/linux/Packaging.Linux/Packaging.Linux.csproj
dotnet build -c Release -r linux-arm64 src/linux/Packaging.Linux/Packaging.Linux.csproj

- name: Upload Installers
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -90,4 +92,4 @@ jobs:
with:
name: DebianInstallerSigned
path: |
Signed/*.deb
Signed/*.deb
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ jobs:

- name: Build Linux
if: contains(matrix.os, 'ubuntu')
run: dotnet build --configuration LinuxRelease
run: |
dotnet build --configuration LinuxRelease -r linux-x64
dotnet build --configuration LinuxRelease -r linux-arm64

- name: Build macOS
if: contains(matrix.os, 'macos')
Expand Down
6 changes: 6 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ To build from the command line, run:
dotnet build -c LinuxDebug
```

If you want to build for a specific architecture, you can provide `linux-x64` or `linux-arm64` as the runtime:

```shell
dotnet build -c LinuxDebug -r linux-arm64
```

You can find a copy of the Debian package (.deb) file in `out/linux/Packaging.Linux/deb/Debug`.

The flat binaries can also be found in `out/linux/Packaging.Linux/payload/Debug`.
Expand Down
4 changes: 2 additions & 2 deletions src/linux/Packaging.Linux/Packaging.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="CoreCompile" DependsOnTargets="GetBuildVersion" Condition="'$(OSPlatform)'=='linux'">
<Message Text="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersion)'" Importance="High" />
<Exec Command="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersion)'" />
<Message Text="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersion)' --runtime='$(RuntimeIdentifier)'" Importance="High" />
<Exec Command="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersion)' --runtime='$(RuntimeIdentifier)'" />
</Target>

<Target Name="CoreClean">
Expand Down
40 changes: 34 additions & 6 deletions src/linux/Packaging.Linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,33 @@ case "$i" in
VERSION="${i#*=}"
shift # past argument=value
;;
--runtime=*)
RUNTIME="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done

# Fall back to host architecture if no explicit runtime is given.
if test -z "$RUNTIME"; then
HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"

case $HOST_ARCH in
amd64)
RUNTIME="linux-x64"
;;
arm64)
RUNTIME="linux-arm64"
;;
*)
die "Could not determine host architecture!"
;;
esac
fi

# Directories
THISDIR="$( cd "$(dirname "$0")" ; pwd -P )"
ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )"
Expand All @@ -48,19 +69,26 @@ PROJ_OUT="$OUT/linux/Packaging.Linux"

# Build parameters
FRAMEWORK=netcoreapp3.1
RUNTIME=linux-x64
case $RUNTIME in
linux-x64)
ARCH="amd64"
;;
linux-arm64)
ARCH="arm64"
;;
*)
die "Incompatible runtime architecture given for build.sh"
;;
esac

echo "Building for runtime ${RUNTIME} and arch ${ARCH}"

# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"
if [ -z "$VERSION" ]; then
die "--version was not set"
fi

ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"
if test -z "$ARCH"; then
die "Could not determine host architecture!"
fi

# Outputs
PAYLOAD="$PROJ_OUT/payload/$CONFIGURATION"
SYMBOLOUT="$PROJ_OUT/payload.sym/$CONFIGURATION"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OSPlatform)'=='windows'">net461;netcoreapp3.1</TargetFrameworks>
<RuntimeIdentifiers>win-x86;osx-x64;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x86;osx-x64;linux-x64;linux-arm64</RuntimeIdentifiers>
<PlatformTarget Condition="'$(OSPlatform)'=='windows'">x86</PlatformTarget>
<AssemblyName>git-credential-manager-core</AssemblyName>
<RootNamespace>Microsoft.Git.CredentialManager</RootNamespace>
Expand Down