diff --git a/languages/kotlin/publish-local.sh b/languages/kotlin/publish-local.sh new file mode 100755 index 000000000..68e67455f --- /dev/null +++ b/languages/kotlin/publish-local.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +cd "$(dirname "$0")" + +mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86} + +# Build arm64 for emulator +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 + +# Generate latest bindings +./build-schemas.sh + +# Publish to local maven +./gradlew sdk:publishToMavenLocal -Pversion=LOCAL diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index d3ea098e3..2006e4673 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -47,23 +47,25 @@ publishing { groupId = 'com.bitwarden' artifactId = 'sdk-android' - // Determine the version from the git history. - // - // PRs: use the branch name. - // Main: Grab it from `crates/bitwarden/Cargo.toml` - - def branchName = 'git branch --show-current'.execute().text.trim() - - if (branchName == 'main') { - def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() - def match = ~/version = "(.*)"/ - def matcher = match.matcher(content) - matcher.find() - - version = "${matcher.group(1)}-SNAPSHOT" - } else { - // branchName-SNAPSHOT - version = "${branchName.replaceAll('/', '-')}-SNAPSHOT" + if (findProperty('version') == 'unspecified') { + // Determine the version from the git history. + // + // PRs: use the branch name. + // Main: Grab it from `crates/bitwarden/Cargo.toml` + + def branchName = 'git branch --show-current'.execute().text.trim() + + if (branchName == 'main') { + def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() + def match = ~/version = "(.*)"/ + def matcher = match.matcher(content) + matcher.find() + + version = "${matcher.group(1)}-SNAPSHOT" + } else { + // branchName-SNAPSHOT + version = "${branchName.replaceAll('/', '-')}-SNAPSHOT" + } } afterEvaluate {