Skip to content

Commit

Permalink
Fix lib architectures in language SDKs (#498)
Browse files Browse the repository at this point in the history
- Rename `ubuntu-x64` to `linux-x64` to better match the usage.
- Resolve java using the wrong prefixes. It should be `x86_64` for
architecture, and windows should use `win32`.

Resolves #491
  • Loading branch information
Hinton authored Jan 18, 2024
1 parent b75b5d8 commit 8b435e5
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: languages/csharp/Bitwarden.Sdk/ubuntu-x64
path: languages/csharp/Bitwarden.Sdk/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/build-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
generate_schemas:
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-apple-darwin
path: languages/java/src/main/resources/darwin-x64
path: languages/java/src/main/resources/darwin-x86-64

- name: Download aarch64-apple-darwin files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand All @@ -51,13 +52,13 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: languages/java/src/main/resources/ubuntu-x64
path: languages/java/src/main/resources/linux-x86-64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-pc-windows-msvc
path: languages/java/src/main/resources/windows-x64
path: languages/java/src/main/resources/win32-x86-64

- name: Publish Maven
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: languages/csharp/Bitwarden.Sdk/ubuntu-x64
path: languages/csharp/Bitwarden.Sdk/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: temp/ubuntu-x64
path: temp/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand All @@ -59,11 +59,11 @@ jobs:
- name: Copy lib files
run: |
mkdir -p languages/php/src/lib/macos-arm64
mkdir -p languages/php/src/lib/ubuntu-x64
mkdir -p languages/php/src/lib/linux-x64
mkdir -p languages/php/src/lib/macos-x64
mkdir -p languages/php/src/lib/windows-x64
platforms=("macos-arm64" "ubuntu-x64" "macos-x64" "windows-x64")
platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64")
files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll")
for ((i=0; i<${#platforms[@]}; i++)); do
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: temp/ubuntu-x64
path: temp/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
Expand All @@ -60,11 +60,11 @@ jobs:
- name: Copy lib files
run: |
mkdir -p languages/ruby/bitwarden_sdk/lib/macos-arm64
mkdir -p languages/ruby/bitwarden_sdk/lib/ubuntu-x64
mkdir -p languages/ruby/bitwarden_sdk/lib/linux-x64
mkdir -p languages/ruby/bitwarden_sdk/lib/macos-x64
mkdir -p languages/ruby/bitwarden_sdk/lib/windows-x64
platforms=("macos-arm64" "ubuntu-x64" "macos-x64" "windows-x64")
platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64")
files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll")
for ((i=0; i<${#platforms[@]}; i++)); do
Expand Down
2 changes: 1 addition & 1 deletion languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<PackageCopyToOutput>true</PackageCopyToOutput>
<PackagePath>runtimes/osx-arm64/native</PackagePath>
</Content>
<Content Include="ubuntu-x64/libbitwarden_c*.so">
<Content Include="linux-x64/libbitwarden_c*.so">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<PackageCopyToOutput>true</PackageCopyToOutput>
<PackagePath>runtimes/linux-x64/native</PackagePath>
Expand Down
2 changes: 1 addition & 1 deletion languages/php/src/BitwardenLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
$lib_file = __DIR__.'/../../../target/debug/bitwarden_c.dll';
}
} elseif (PHP_OS === 'Linux') {
$lib_file = '/lib/ubuntu-x64/libbitwarden_c.so';
$lib_file = '/lib/linux-x64/libbitwarden_c.so';
if (file_exists($lib_file) == false) {
$lib_file = __DIR__.'/../../../target/debug/libbitwarden_c.so';
}
Expand Down
2 changes: 1 addition & 1 deletion languages/ruby/bitwarden_sdk/bitwarden-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
end
end

spec.files += Dir.glob('lib/ubuntu-x64/**/*')
spec.files += Dir.glob('lib/linux-x64/**/*')
spec.files += Dir.glob('lib/macos-x64/**/*')
spec.files += Dir.glob('lib/windows-x64/**/*')
spec.files += Dir.glob('lib/macos-arm64/**/*')
Expand Down
2 changes: 1 addition & 1 deletion languages/ruby/bitwarden_sdk/lib/bitwarden_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.mac_with_intel?
end
File.exist?(local_file) ? local_file : File.expand_path('../../../../target/debug/libbitwarden_c.dylib', __dir__)
when /linux/
local_file = File.expand_path('ubuntu-x64/libbitwarden_c.so', __dir__)
local_file = File.expand_path('linux-x64/libbitwarden_c.so', __dir__)
File.exist?(local_file) ? local_file : File.expand_path('../../../../target/debug/libbitwarden_c.so', __dir__)
when /mswin|mingw/
local_file = File.expand_path('windows-x64/bitwarden_c.dll', __dir__)
Expand Down

0 comments on commit 8b435e5

Please sign in to comment.