From 2fce8c673a9829551a3710de69342f98766f3677 Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 7 Nov 2024 15:44:48 +0100 Subject: [PATCH 1/5] Move languages/js to live under the relevant crate --- .github/workflows/build-wasm-internal.yml | 2 +- .github/workflows/publish-wasm-internal.yml | 4 ++-- .prettierignore | 4 ---- .../bitwarden-wasm-internal/npm}/.gitignore | 0 .../bitwarden-wasm-internal/npm}/LICENSE | 0 .../bitwarden-wasm-internal/npm}/README.md | 0 .../bitwarden-wasm-internal/npm}/index.js | 0 .../bitwarden-wasm-internal/npm}/package.json | 0 8 files changed, 3 insertions(+), 7 deletions(-) rename {languages/js/sdk-internal => crates/bitwarden-wasm-internal/npm}/.gitignore (100%) rename {languages/js/sdk-internal => crates/bitwarden-wasm-internal/npm}/LICENSE (100%) rename {languages/js/sdk-internal => crates/bitwarden-wasm-internal/npm}/README.md (100%) rename {languages/js/sdk-internal => crates/bitwarden-wasm-internal/npm}/index.js (100%) rename {languages/js/sdk-internal => crates/bitwarden-wasm-internal/npm}/package.json (100%) diff --git a/.github/workflows/build-wasm-internal.yml b/.github/workflows/build-wasm-internal.yml index b4a40c25..30b8adce 100644 --- a/.github/workflows/build-wasm-internal.yml +++ b/.github/workflows/build-wasm-internal.yml @@ -72,7 +72,7 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: sdk-internal - path: ${{ github.workspace }}/languages/js/sdk-internal/* + path: ${{ github.workspace }}/crates/bitwarden-wasm-internal/npm/* if-no-files-found: error trigger-wasm-publish: diff --git a/.github/workflows/publish-wasm-internal.yml b/.github/workflows/publish-wasm-internal.yml index 9202efdd..24a53a93 100644 --- a/.github/workflows/publish-wasm-internal.yml +++ b/.github/workflows/publish-wasm-internal.yml @@ -18,7 +18,7 @@ on: defaults: run: - working-directory: languages/js/sdk-internal + working-directory: crates/bitwarden-wasm-internal/npm jobs: setup: @@ -83,7 +83,7 @@ jobs: workflow_conclusion: success branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: sdk-internal - path: languages/js/sdk-internal + path: crates/bitwarden-wasm-internal/npm - name: Set version run: | diff --git a/.prettierignore b/.prettierignore index 13f89e9c..ba9a8bd2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,9 +1,5 @@ target languages/* -!languages/js -languages/js/* -!languages/js/sdk-internal -languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js schemas about.hbs diff --git a/languages/js/sdk-internal/.gitignore b/crates/bitwarden-wasm-internal/npm/.gitignore similarity index 100% rename from languages/js/sdk-internal/.gitignore rename to crates/bitwarden-wasm-internal/npm/.gitignore diff --git a/languages/js/sdk-internal/LICENSE b/crates/bitwarden-wasm-internal/npm/LICENSE similarity index 100% rename from languages/js/sdk-internal/LICENSE rename to crates/bitwarden-wasm-internal/npm/LICENSE diff --git a/languages/js/sdk-internal/README.md b/crates/bitwarden-wasm-internal/npm/README.md similarity index 100% rename from languages/js/sdk-internal/README.md rename to crates/bitwarden-wasm-internal/npm/README.md diff --git a/languages/js/sdk-internal/index.js b/crates/bitwarden-wasm-internal/npm/index.js similarity index 100% rename from languages/js/sdk-internal/index.js rename to crates/bitwarden-wasm-internal/npm/index.js diff --git a/languages/js/sdk-internal/package.json b/crates/bitwarden-wasm-internal/npm/package.json similarity index 100% rename from languages/js/sdk-internal/package.json rename to crates/bitwarden-wasm-internal/npm/package.json From ea00397b82b4840d8dfde26805d769d522d7d2e0 Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 7 Nov 2024 15:53:53 +0100 Subject: [PATCH 2/5] Update build file --- .prettierignore | 1 + crates/bitwarden-wasm-internal/build.sh | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.prettierignore b/.prettierignore index ba9a8bd2..165b1f70 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,6 +2,7 @@ target languages/* schemas about.hbs +crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm.js # Test fixtures crates/bitwarden-exporters/resources/* diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh index 109037e8..ffd5a70b 100755 --- a/crates/bitwarden-wasm-internal/build.sh +++ b/crates/bitwarden-wasm-internal/build.sh @@ -5,21 +5,21 @@ cd ../../ if [ "$1" != "-r" ]; then # Dev cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown - wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm + wasm-bindgen --target bundler --out-dir crates/bitwarden-wasm-internal/npm ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir crates/bitwarden-wasm-internal/npm/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm else # Release cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown --release - wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm + wasm-bindgen --target bundler --out-dir crates/bitwarden-wasm-internal/npm ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir crates/bitwarden-wasm-internal/npm/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm fi # Format -npx prettier --write ./languages/js/sdk-internal +npx prettier --write ./crates/bitwarden-wasm-internal/npm # Optimize size -wasm-opt -Os ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm +wasm-opt -Os ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm -o ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm # Transpile to JS -wasm2js ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js -npx terser ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js +wasm2js ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm -o ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm.js +npx terser ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm.js -o ./crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm.js From fb36fa0398b5239b4249a38fd2e7299464dfaf78 Mon Sep 17 00:00:00 2001 From: Hinton Date: Fri, 8 Nov 2024 12:54:56 +0100 Subject: [PATCH 3/5] Move kotlin and swift --- .github/workflows/build-android.yml | 6 +++--- .github/workflows/build-swift.yml | 6 +++--- .github/workflows/release-swift.yml | 16 ++++++++-------- .github/workflows/scan.yml | 2 +- .gitignore | 10 +++++----- .prettierignore | 5 ++++- README.md | 7 ++++++- .../bitwarden-uniffi}/kotlin/.gitignore | 0 .../bitwarden-uniffi}/kotlin/README.md | 8 ++++---- .../bitwarden-uniffi}/kotlin/app/.gitignore | 0 .../bitwarden-uniffi}/kotlin/app/build.gradle | 0 .../kotlin/app/proguard-rules.pro | 0 .../kotlin/app/src/main/AndroidManifest.xml | 0 .../com/bitwarden/myapplication/Biometrics.kt | 0 .../com/bitwarden/myapplication/MainActivity.kt | 2 +- .../bitwarden/myapplication/ui/theme/Color.kt | 0 .../bitwarden/myapplication/ui/theme/Theme.kt | 0 .../bitwarden/myapplication/ui/theme/Type.kt | 0 .../res/drawable-v24/ic_launcher_foreground.xml | 0 .../res/drawable/ic_launcher_background.xml | 0 .../main/res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin .../main/res/mipmap-hdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin .../main/res/mipmap-mdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.webp | Bin .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xxhdpi/ic_launcher.webp | Bin .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin .../kotlin/app/src/main/res/values/colors.xml | 0 .../kotlin/app/src/main/res/values/strings.xml | 0 .../kotlin/app/src/main/res/values/themes.xml | 0 .../app/src/main/res/xml/backup_rules.xml | 0 .../src/main/res/xml/data_extraction_rules.xml | 0 .../main/res/xml/network_security_config.xml | 0 .../bitwarden-uniffi}/kotlin/build-schemas.sh | 0 .../bitwarden-uniffi}/kotlin/build.gradle | 0 .../bitwarden-uniffi}/kotlin/gradle.properties | 0 .../kotlin/gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 .../bitwarden-uniffi}/kotlin/gradlew | 0 .../bitwarden-uniffi}/kotlin/gradlew.bat | 0 .../bitwarden-uniffi}/kotlin/publish-local.sh | 0 .../bitwarden-uniffi}/kotlin/sdk/.gitignore | 0 .../bitwarden-uniffi}/kotlin/sdk/build.gradle | 0 .../kotlin/sdk/consumer-rules.pro | 0 .../kotlin/sdk/lint-baseline.xml | 0 .../kotlin/sdk/proguard-rules.pro | 0 .../kotlin/sdk/src/main/AndroidManifest.xml | 0 .../kotlin/sdk/src/main/jniLibs/.gitignore | 0 .../src/main/resources/META-INF/LICENSE_GPL.txt | 0 .../java/com/bitwarden/sdk/ExampleUnitTest.kt | 0 .../bitwarden-uniffi}/kotlin/settings.gradle | 0 .../bitwarden-uniffi}/swift/LICENSE_GPL.txt | 0 .../bitwarden-uniffi}/swift/Package.swift | 0 .../bitwarden-uniffi}/swift/README.md | 0 .../swift/Sources/BitwardenSdk/.gitignore | 0 .../BitwardenSdkTests/BitwardenSdkTests.swift | 0 .../bitwarden-uniffi}/swift/build.sh | 8 ++++---- .../swift/iOS/App.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 7 +++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../swift/iOS/App/Assets.xcassets/Contents.json | 0 .../swift/iOS/App/Biometrics.swift | 0 .../swift/iOS/App/ContentView.swift | 0 .../Preview Assets.xcassets/Contents.json | 0 .../swift/iOS/App/testApp.swift | 0 .../swift/iOS/swift-format.json | 0 .../contents.xcworkspacedata | 7 ------- 74 files changed, 46 insertions(+), 38 deletions(-) rename {languages => crates/bitwarden-uniffi}/kotlin/.gitignore (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/README.md (68%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/.gitignore (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/build.gradle (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/proguard-rules.pro (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/AndroidManifest.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt (99%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/drawable/ic_launcher_background.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/values/colors.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/values/strings.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/values/themes.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/xml/backup_rules.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/xml/data_extraction_rules.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/app/src/main/res/xml/network_security_config.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/build-schemas.sh (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/build.gradle (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/gradle.properties (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/gradle/wrapper/gradle-wrapper.jar (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/gradle/wrapper/gradle-wrapper.properties (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/gradlew (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/gradlew.bat (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/publish-local.sh (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/.gitignore (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/build.gradle (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/consumer-rules.pro (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/lint-baseline.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/proguard-rules.pro (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/src/main/AndroidManifest.xml (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/src/main/jniLibs/.gitignore (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/src/main/resources/META-INF/LICENSE_GPL.txt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt (100%) rename {languages => crates/bitwarden-uniffi}/kotlin/settings.gradle (100%) rename {languages => crates/bitwarden-uniffi}/swift/LICENSE_GPL.txt (100%) rename {languages => crates/bitwarden-uniffi}/swift/Package.swift (100%) rename {languages => crates/bitwarden-uniffi}/swift/README.md (100%) rename {languages => crates/bitwarden-uniffi}/swift/Sources/BitwardenSdk/.gitignore (100%) rename {languages => crates/bitwarden-uniffi}/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift (100%) rename {languages => crates/bitwarden-uniffi}/swift/build.sh (80%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App.xcodeproj/project.pbxproj (100%) create mode 100644 crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename {languages => crates/bitwarden-uniffi}/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/Assets.xcassets/Contents.json (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/Biometrics.swift (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/ContentView.swift (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/App/testApp.swift (100%) rename {languages => crates/bitwarden-uniffi}/swift/iOS/swift-format.json (100%) delete mode 100644 languages/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index ba8d6e94..94b182be 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -88,7 +88,7 @@ jobs: uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - name: Move artifacts - working-directory: languages/kotlin/sdk/src/main/jniLibs + working-directory: crates/bitwarden-uniffi/kotlin/sdk/src/main/jniLibs run: | mkdir armeabi-v7a arm64-v8a x86 x86_64 mv /home/runner/work/sdk-internal/sdk-internal/android-armv7-linux-androideabi/libbitwarden_uniffi.so ./armeabi-v7a/libbitwarden_uniffi.so @@ -97,7 +97,7 @@ jobs: mv /home/runner/work/sdk-internal/sdk-internal/android-x86_64-linux-android/libbitwarden_uniffi.so ./x86_64/libbitwarden_uniffi.so - name: Generate bindings - working-directory: languages/kotlin + working-directory: crates/bitwarden-uniffi/kotlin run: ./build-schemas.sh - name: Setup gradle @@ -105,6 +105,6 @@ jobs: - name: Publish run: ./gradlew sdk:publish - working-directory: languages/kotlin + working-directory: crates/bitwarden-uniffi/kotlin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 9c1c8bb0..d5313171 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -52,7 +52,7 @@ jobs: - name: Build shell: bash - working-directory: languages/swift + working-directory: crates/bitwarden-uniffi/swift id: build run: | ./build.sh @@ -63,7 +63,7 @@ jobs: - name: Zip BitwardenFFI.xcframework run: | mkdir artifacts - cp -rf languages/swift/BitwardenFFI.xcframework artifacts + cp -rf crates/bitwarden-uniffi/swift/BitwardenFFI.xcframework artifacts - name: Upload BitwardenFFI.xcframework artifact uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 @@ -76,7 +76,7 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: BitwardenSdk-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}-sources - path: languages/swift/Sources/BitwardenSdk + path: crates/bitwarden-uniffi/swift/Sources/BitwardenSdk if-no-files-found: error trigger-swift-release: diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 7e665ac4..7886dccb 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -171,7 +171,7 @@ jobs: workflow_conclusion: success artifacts: "BitwardenSdk-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}-sources" run_id: ${{ env._BUILD_RUN_ID }} - path: sdk/languages/swift/Sources/BitwardenSdk + path: sdk/crates/bitwarden-uniffi/swift/Sources/BitwardenSdk - name: Install Swift formatter run: | @@ -186,21 +186,21 @@ jobs: sed -i 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ name: "BitwardenFFI",\ url: "https://github.com/bitwarden/sdk-swift/releases/download/v${{ env._RELEASE_NAME }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",\ - checksum: "${{ env._SWIFT_CHECKSUM }}" )|' sdk/languages/swift/Package.swift + checksum: "${{ env._SWIFT_CHECKSUM }}" )|' sdk/crates/bitwarden-uniffi/swift/Package.swift # Run swiftformat - swiftformat sdk/languages/swift/Package.swift + swiftformat sdk/crates/bitwarden-uniffi/swift/Package.swift - find sdk/languages/swift/Sources/ -name ".gitignore" -exec rm -f {} \; + find sdk/crates/bitwarden-uniffi/swift/Sources/ -name ".gitignore" -exec rm -f {} \; rm -rf sdk-swift/Sources rm -rf sdk-swift/Tests # Copy files to local sdk-swift repo path - cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md - cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift - cp --verbose -rf sdk/languages/swift/Sources sdk-swift - cp --verbose -rf sdk/languages/swift/Tests sdk-swift + cp --verbose -rf sdk/crates/bitwarden-uniffi/swift/README.md sdk-swift/README.md + cp --verbose -rf sdk/crates/bitwarden-uniffi/swift/Package.swift sdk-swift/Package.swift + cp --verbose -rf sdk/crates/bitwarden-uniffi/swift/Sources sdk-swift + cp --verbose -rf sdk/crates/bitwarden-uniffi/swift/Tests sdk-swift - name: Push changes working-directory: sdk-swift diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index f337e17a..9b50e0b6 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -74,4 +74,4 @@ jobs: args: > -Dsonar.organization=${{ github.repository_owner }} -Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }} - -Dsonar.exclusions=languages/** + -Dsonar.exclusions=crates/bitwarden-uniffi/kotlin/**,crates/bitwarden-uniffi/swift/** diff --git a/.gitignore b/.gitignore index cea87ccb..b1274686 100644 --- a/.gitignore +++ b/.gitignore @@ -37,8 +37,8 @@ node_modules/ THIRDPARTY.html # Uniffi -languages/swift/BitwardenFFI.xcframework -languages/swift/tmp -languages/swift/.build -languages/swift/.swiftpm -languages/kotlin/sdk/src/main/java/com/bitwarden/**/*.kt +crates/bitwarden-uniffi/swift/BitwardenFFI.xcframework +crates/bitwarden-uniffi/swift/tmp +crates/bitwarden-uniffi/swift/.build +crates/bitwarden-uniffi/swift/.swiftpm +crates/bitwarden-uniffi/kotlin/sdk/src/main/java/com/bitwarden/**/*.kt diff --git a/.prettierignore b/.prettierignore index 165b1f70..741c6405 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,8 +1,11 @@ target -languages/* schemas about.hbs + +# Language bindings crates/bitwarden-wasm-internal/npm/bitwarden_wasm_internal_bg.wasm.js +crates/bitwarden-uniffi/kotlin/* +crates/bitwarden-uniffi/swift/* # Test fixtures crates/bitwarden-exporters/resources/* diff --git a/README.md b/README.md index 0c09619b..0538d5ce 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,16 @@ You can also browse the latest published documentation: The project is structured as a monorepo using cargo workspaces. Some of the more noteworthy crates are: -- [`bitwarden`](./crates/bitwarden/): Rust friendly API for interacting with the secrets manager. - [`bitwarden-api-api`](./crates/bitwarden-api-api/): Auto-generated API bindings for the API server. - [`bitwarden-api-identity`](./crates/bitwarden-api-identity/): Auto-generated API bindings for the Identity server. +- [`bitwarden-core`](./crates/bitwarden-core/): The core functionality consumed by the other crates. +- [`bitwarden-crypto`](./crates/bitwarden-crypto/): Crypto library. +- [`bitwarden-wasm-internal`](./crates/bitwarden-wasm-internal/): WASM bindings for the internal + SDK. +- [`bitwarden-uniffi`](./crates/bitwarden-uniffi/): Mobile bindings for swift and kotlin using + [UniFFI](https://github.com/mozilla/uniffi-rs/). ## API Bindings diff --git a/languages/kotlin/.gitignore b/crates/bitwarden-uniffi/kotlin/.gitignore similarity index 100% rename from languages/kotlin/.gitignore rename to crates/bitwarden-uniffi/kotlin/.gitignore diff --git a/languages/kotlin/README.md b/crates/bitwarden-uniffi/kotlin/README.md similarity index 68% rename from languages/kotlin/README.md rename to crates/bitwarden-uniffi/kotlin/README.md index 4d7f537e..42ba38b5 100644 --- a/languages/kotlin/README.md +++ b/crates/bitwarden-uniffi/kotlin/README.md @@ -18,16 +18,16 @@ Depending on which CPU architecture you will need to specify different targets. mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86} cross build -p bitwarden-uniffi --release --target=aarch64-linux-android -mv ../../target/aarch64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/arm64-v8a/libbitwarden_uniffi.so +mv ../../../target/aarch64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/arm64-v8a/libbitwarden_uniffi.so cross build -p bitwarden-uniffi --release --target=armv7-linux-androideabi -mv ../../target/armv7-linux-androideabi/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/armeabi-v7a/libbitwarden_uniffi.so +mv ../../../target/armv7-linux-androideabi/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/armeabi-v7a/libbitwarden_uniffi.so cross build -p bitwarden-uniffi --release --target=x86_64-linux-android -mv ../../target/x86_64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86_64/libbitwarden_uniffi.so +mv ../../../target/x86_64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86_64/libbitwarden_uniffi.so cross build -p bitwarden-uniffi --release --target=i686-linux-android -mv ../../target/i686-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86/libbitwarden_uniffi.so +mv ../../../target/i686-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86/libbitwarden_uniffi.so ``` ### Schemas diff --git a/languages/kotlin/app/.gitignore b/crates/bitwarden-uniffi/kotlin/app/.gitignore similarity index 100% rename from languages/kotlin/app/.gitignore rename to crates/bitwarden-uniffi/kotlin/app/.gitignore diff --git a/languages/kotlin/app/build.gradle b/crates/bitwarden-uniffi/kotlin/app/build.gradle similarity index 100% rename from languages/kotlin/app/build.gradle rename to crates/bitwarden-uniffi/kotlin/app/build.gradle diff --git a/languages/kotlin/app/proguard-rules.pro b/crates/bitwarden-uniffi/kotlin/app/proguard-rules.pro similarity index 100% rename from languages/kotlin/app/proguard-rules.pro rename to crates/bitwarden-uniffi/kotlin/app/proguard-rules.pro diff --git a/languages/kotlin/app/src/main/AndroidManifest.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/AndroidManifest.xml similarity index 100% rename from languages/kotlin/app/src/main/AndroidManifest.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/AndroidManifest.xml diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt similarity index 100% rename from languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt rename to crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt similarity index 99% rename from languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt rename to crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt index e421416d..236c8bb5 100644 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt +++ b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt @@ -66,7 +66,7 @@ import javax.net.ssl.X509TrustManager * * Note that this SDK uses the system trust store to perform TLS certificate validation. If you want to use this SDK with * self hosted servers using self-signed certificates, make sure to configure the Android Network Security Config correctly. - * We provide an example configuration in `languages/kotlin/app/src/main/res/xml/network_security_config.xml` + * We provide an example configuration in `crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/network_security_config.xml` * https://developer.android.com/privacy-and-security/security-config */ diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt similarity index 100% rename from languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt rename to crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt similarity index 100% rename from languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt rename to crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt b/crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt similarity index 100% rename from languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt rename to crates/bitwarden-uniffi/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt diff --git a/languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/drawable/ic_launcher_background.xml diff --git a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp similarity index 100% rename from languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/languages/kotlin/app/src/main/res/values/colors.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/values/colors.xml similarity index 100% rename from languages/kotlin/app/src/main/res/values/colors.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/values/colors.xml diff --git a/languages/kotlin/app/src/main/res/values/strings.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/values/strings.xml similarity index 100% rename from languages/kotlin/app/src/main/res/values/strings.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/values/strings.xml diff --git a/languages/kotlin/app/src/main/res/values/themes.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/values/themes.xml similarity index 100% rename from languages/kotlin/app/src/main/res/values/themes.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/values/themes.xml diff --git a/languages/kotlin/app/src/main/res/xml/backup_rules.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/backup_rules.xml similarity index 100% rename from languages/kotlin/app/src/main/res/xml/backup_rules.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/backup_rules.xml diff --git a/languages/kotlin/app/src/main/res/xml/data_extraction_rules.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/data_extraction_rules.xml similarity index 100% rename from languages/kotlin/app/src/main/res/xml/data_extraction_rules.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/data_extraction_rules.xml diff --git a/languages/kotlin/app/src/main/res/xml/network_security_config.xml b/crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/network_security_config.xml similarity index 100% rename from languages/kotlin/app/src/main/res/xml/network_security_config.xml rename to crates/bitwarden-uniffi/kotlin/app/src/main/res/xml/network_security_config.xml diff --git a/languages/kotlin/build-schemas.sh b/crates/bitwarden-uniffi/kotlin/build-schemas.sh similarity index 100% rename from languages/kotlin/build-schemas.sh rename to crates/bitwarden-uniffi/kotlin/build-schemas.sh diff --git a/languages/kotlin/build.gradle b/crates/bitwarden-uniffi/kotlin/build.gradle similarity index 100% rename from languages/kotlin/build.gradle rename to crates/bitwarden-uniffi/kotlin/build.gradle diff --git a/languages/kotlin/gradle.properties b/crates/bitwarden-uniffi/kotlin/gradle.properties similarity index 100% rename from languages/kotlin/gradle.properties rename to crates/bitwarden-uniffi/kotlin/gradle.properties diff --git a/languages/kotlin/gradle/wrapper/gradle-wrapper.jar b/crates/bitwarden-uniffi/kotlin/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from languages/kotlin/gradle/wrapper/gradle-wrapper.jar rename to crates/bitwarden-uniffi/kotlin/gradle/wrapper/gradle-wrapper.jar diff --git a/languages/kotlin/gradle/wrapper/gradle-wrapper.properties b/crates/bitwarden-uniffi/kotlin/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from languages/kotlin/gradle/wrapper/gradle-wrapper.properties rename to crates/bitwarden-uniffi/kotlin/gradle/wrapper/gradle-wrapper.properties diff --git a/languages/kotlin/gradlew b/crates/bitwarden-uniffi/kotlin/gradlew similarity index 100% rename from languages/kotlin/gradlew rename to crates/bitwarden-uniffi/kotlin/gradlew diff --git a/languages/kotlin/gradlew.bat b/crates/bitwarden-uniffi/kotlin/gradlew.bat similarity index 100% rename from languages/kotlin/gradlew.bat rename to crates/bitwarden-uniffi/kotlin/gradlew.bat diff --git a/languages/kotlin/publish-local.sh b/crates/bitwarden-uniffi/kotlin/publish-local.sh similarity index 100% rename from languages/kotlin/publish-local.sh rename to crates/bitwarden-uniffi/kotlin/publish-local.sh diff --git a/languages/kotlin/sdk/.gitignore b/crates/bitwarden-uniffi/kotlin/sdk/.gitignore similarity index 100% rename from languages/kotlin/sdk/.gitignore rename to crates/bitwarden-uniffi/kotlin/sdk/.gitignore diff --git a/languages/kotlin/sdk/build.gradle b/crates/bitwarden-uniffi/kotlin/sdk/build.gradle similarity index 100% rename from languages/kotlin/sdk/build.gradle rename to crates/bitwarden-uniffi/kotlin/sdk/build.gradle diff --git a/languages/kotlin/sdk/consumer-rules.pro b/crates/bitwarden-uniffi/kotlin/sdk/consumer-rules.pro similarity index 100% rename from languages/kotlin/sdk/consumer-rules.pro rename to crates/bitwarden-uniffi/kotlin/sdk/consumer-rules.pro diff --git a/languages/kotlin/sdk/lint-baseline.xml b/crates/bitwarden-uniffi/kotlin/sdk/lint-baseline.xml similarity index 100% rename from languages/kotlin/sdk/lint-baseline.xml rename to crates/bitwarden-uniffi/kotlin/sdk/lint-baseline.xml diff --git a/languages/kotlin/sdk/proguard-rules.pro b/crates/bitwarden-uniffi/kotlin/sdk/proguard-rules.pro similarity index 100% rename from languages/kotlin/sdk/proguard-rules.pro rename to crates/bitwarden-uniffi/kotlin/sdk/proguard-rules.pro diff --git a/languages/kotlin/sdk/src/main/AndroidManifest.xml b/crates/bitwarden-uniffi/kotlin/sdk/src/main/AndroidManifest.xml similarity index 100% rename from languages/kotlin/sdk/src/main/AndroidManifest.xml rename to crates/bitwarden-uniffi/kotlin/sdk/src/main/AndroidManifest.xml diff --git a/languages/kotlin/sdk/src/main/jniLibs/.gitignore b/crates/bitwarden-uniffi/kotlin/sdk/src/main/jniLibs/.gitignore similarity index 100% rename from languages/kotlin/sdk/src/main/jniLibs/.gitignore rename to crates/bitwarden-uniffi/kotlin/sdk/src/main/jniLibs/.gitignore diff --git a/languages/kotlin/sdk/src/main/resources/META-INF/LICENSE_GPL.txt b/crates/bitwarden-uniffi/kotlin/sdk/src/main/resources/META-INF/LICENSE_GPL.txt similarity index 100% rename from languages/kotlin/sdk/src/main/resources/META-INF/LICENSE_GPL.txt rename to crates/bitwarden-uniffi/kotlin/sdk/src/main/resources/META-INF/LICENSE_GPL.txt diff --git a/languages/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt b/crates/bitwarden-uniffi/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt similarity index 100% rename from languages/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt rename to crates/bitwarden-uniffi/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt diff --git a/languages/kotlin/settings.gradle b/crates/bitwarden-uniffi/kotlin/settings.gradle similarity index 100% rename from languages/kotlin/settings.gradle rename to crates/bitwarden-uniffi/kotlin/settings.gradle diff --git a/languages/swift/LICENSE_GPL.txt b/crates/bitwarden-uniffi/swift/LICENSE_GPL.txt similarity index 100% rename from languages/swift/LICENSE_GPL.txt rename to crates/bitwarden-uniffi/swift/LICENSE_GPL.txt diff --git a/languages/swift/Package.swift b/crates/bitwarden-uniffi/swift/Package.swift similarity index 100% rename from languages/swift/Package.swift rename to crates/bitwarden-uniffi/swift/Package.swift diff --git a/languages/swift/README.md b/crates/bitwarden-uniffi/swift/README.md similarity index 100% rename from languages/swift/README.md rename to crates/bitwarden-uniffi/swift/README.md diff --git a/languages/swift/Sources/BitwardenSdk/.gitignore b/crates/bitwarden-uniffi/swift/Sources/BitwardenSdk/.gitignore similarity index 100% rename from languages/swift/Sources/BitwardenSdk/.gitignore rename to crates/bitwarden-uniffi/swift/Sources/BitwardenSdk/.gitignore diff --git a/languages/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift b/crates/bitwarden-uniffi/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift similarity index 100% rename from languages/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift rename to crates/bitwarden-uniffi/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift diff --git a/languages/swift/build.sh b/crates/bitwarden-uniffi/swift/build.sh similarity index 80% rename from languages/swift/build.sh rename to crates/bitwarden-uniffi/swift/build.sh index 69bc9a88..10ff4a41 100755 --- a/languages/swift/build.sh +++ b/crates/bitwarden-uniffi/swift/build.sh @@ -15,13 +15,13 @@ cargo build --package bitwarden-uniffi --target aarch64-apple-ios --release cargo build --package bitwarden-uniffi --target x86_64-apple-ios --release # Create universal libraries -lipo -create ../../target/aarch64-apple-ios-sim/release/libbitwarden_uniffi.a \ - ../../target/x86_64-apple-ios/release/libbitwarden_uniffi.a \ +lipo -create ../../../target/aarch64-apple-ios-sim/release/libbitwarden_uniffi.a \ + ../../../target/x86_64-apple-ios/release/libbitwarden_uniffi.a \ -output ./tmp/target/universal-ios-sim/release/libbitwarden_uniffi.a # Generate swift bindings cargo run -p uniffi-bindgen generate \ - ../../target/aarch64-apple-ios-sim/release/libbitwarden_uniffi.dylib \ + ../../../target/aarch64-apple-ios-sim/release/libbitwarden_uniffi.dylib \ --library \ --language swift \ --no-format \ @@ -37,7 +37,7 @@ cat ./tmp/bindings/*.modulemap > ./tmp/Headers/module.modulemap # Build xcframework xcodebuild -create-xcframework \ - -library ../../target/aarch64-apple-ios/release/libbitwarden_uniffi.a \ + -library ../../../target/aarch64-apple-ios/release/libbitwarden_uniffi.a \ -headers ./tmp/Headers \ -library ./tmp/target/universal-ios-sim/release/libbitwarden_uniffi.a \ -headers ./tmp/Headers \ diff --git a/languages/swift/iOS/App.xcodeproj/project.pbxproj b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.pbxproj similarity index 100% rename from languages/swift/iOS/App.xcodeproj/project.pbxproj rename to crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.pbxproj diff --git a/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..9f103192 --- /dev/null +++ b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/languages/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from languages/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/languages/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json b/crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from languages/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json rename to crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/languages/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from languages/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json rename to crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/languages/swift/iOS/App/Assets.xcassets/Contents.json b/crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/Contents.json similarity index 100% rename from languages/swift/iOS/App/Assets.xcassets/Contents.json rename to crates/bitwarden-uniffi/swift/iOS/App/Assets.xcassets/Contents.json diff --git a/languages/swift/iOS/App/Biometrics.swift b/crates/bitwarden-uniffi/swift/iOS/App/Biometrics.swift similarity index 100% rename from languages/swift/iOS/App/Biometrics.swift rename to crates/bitwarden-uniffi/swift/iOS/App/Biometrics.swift diff --git a/languages/swift/iOS/App/ContentView.swift b/crates/bitwarden-uniffi/swift/iOS/App/ContentView.swift similarity index 100% rename from languages/swift/iOS/App/ContentView.swift rename to crates/bitwarden-uniffi/swift/iOS/App/ContentView.swift diff --git a/languages/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json b/crates/bitwarden-uniffi/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json similarity index 100% rename from languages/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json rename to crates/bitwarden-uniffi/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/languages/swift/iOS/App/testApp.swift b/crates/bitwarden-uniffi/swift/iOS/App/testApp.swift similarity index 100% rename from languages/swift/iOS/App/testApp.swift rename to crates/bitwarden-uniffi/swift/iOS/App/testApp.swift diff --git a/languages/swift/iOS/swift-format.json b/crates/bitwarden-uniffi/swift/iOS/swift-format.json similarity index 100% rename from languages/swift/iOS/swift-format.json rename to crates/bitwarden-uniffi/swift/iOS/swift-format.json diff --git a/languages/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/languages/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 6207d7c8..00000000 --- a/languages/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - From f58f2253759df178c58ca01308a6c69c72d1af1f Mon Sep 17 00:00:00 2001 From: Hinton Date: Fri, 8 Nov 2024 13:40:37 +0100 Subject: [PATCH 4/5] Fix builds --- crates/bitwarden-uniffi/kotlin/README.md | 9 +++++++++ crates/bitwarden-uniffi/kotlin/sdk/build.gradle | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/bitwarden-uniffi/kotlin/README.md b/crates/bitwarden-uniffi/kotlin/README.md index 42ba38b5..9ce988b2 100644 --- a/crates/bitwarden-uniffi/kotlin/README.md +++ b/crates/bitwarden-uniffi/kotlin/README.md @@ -9,6 +9,15 @@ Note that the latest published version is very old, so we need to use a newer Gi cargo install cross --locked --git https://github.com/cross-rs/cross.git --rev 185398b1b885820515a212de720a306b08e2c8c9 ``` +## Development + +When building the Android SDK using Android Studio on MacOS you will need access to the local +`$PATH`, where cargo is installed. This can be done by starting Android Studio from the terminal. + +```bash +open -a /Applications/Android\ Studio.app +``` + ## Building Depending on which CPU architecture you will need to specify different targets. Please refer to the diff --git a/crates/bitwarden-uniffi/kotlin/sdk/build.gradle b/crates/bitwarden-uniffi/kotlin/sdk/build.gradle index 6879beae..1d2e4de4 100644 --- a/crates/bitwarden-uniffi/kotlin/sdk/build.gradle +++ b/crates/bitwarden-uniffi/kotlin/sdk/build.gradle @@ -58,7 +58,7 @@ publishing { def branchName = 'git branch --show-current'.execute().text.trim() if (branchName == 'main') { - def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() + def content = ['grep', '-o', '^version = ".*"', rootDir.toString() + '/../../../Cargo.toml'].execute().text.trim() def match = ~/version = "(.*)"/ def matcher = match.matcher(content) matcher.find() @@ -94,7 +94,7 @@ publishing { File findRustlsPlatformVerifierClassesJar() { def dependencyText = providers.exec { it.workingDir = new File('../../') - commandLine('cargo', 'metadata', '--format-version', '1', '--manifest-path', 'crates/bitwarden-uniffi/Cargo.toml') + commandLine('cargo', 'metadata', '--format-version', '1') }.standardOutput.asText.get() def dependencyJson = new groovy.json.JsonSlurper().parseText(dependencyText) From 3a809cc0b65672614f4761dc2b040187fa6ecab4 Mon Sep 17 00:00:00 2001 From: Hinton Date: Tue, 12 Nov 2024 13:04:05 +0100 Subject: [PATCH 5/5] Fix path --- .../App.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 9f103192..4c37bbb1 100644 --- a/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/crates/bitwarden-uniffi/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location="self:">