Skip to content
Open
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
27 changes: 27 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
buildscript {
ext.kotlin_version = '2.1.0'
ext.isSigningEnabled = {
def signingKey = System.getenv("MVN_SIGNING_KEY")
def signingPassphrase = System.getenv("MVN_SIGNING_PASSPHRASE")
return signingKey != null && !signingKey.isEmpty() && signingPassphrase != null && !signingPassphrase.isEmpty()
}
repositories {
google()
mavenCentral()
Expand All @@ -10,6 +15,28 @@ buildscript {
}
}

plugins {
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

group = 'com.trustwallet'

nexusPublishing {
packageGroup = 'com.trustwallet'
repositories {
sonatype {
nexusUrl = uri('https://ossrh-staging-api.central.sonatype.com/service/local/')
snapshotRepositoryUrl = uri('https://central.sonatype.com/repository/maven-snapshots/')
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
def profileId = System.getenv('SONATYPE_STAGING_PROFILE_ID')
if (profileId) {
stagingProfileId = profileId
}
}
}
}

allprojects {
repositories {
google()
Expand Down
1 change: 1 addition & 0 deletions android/wallet-core-proto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ java {
targetCompatibility = JavaVersion.VERSION_17

withSourcesJar()
withJavadocJar()

sourceSets {
main.java.srcDirs += '../../jni/proto'
Expand Down
36 changes: 36 additions & 0 deletions android/wallet-core-proto/maven-push.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {
release(MavenPublication) {
from components.java

groupId = 'com.trustwallet.walletcore'
artifactId = 'proto'
version = project.findProperty('version') ?: '0.0.0'

pom {
name = 'WalletCoreProto'
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
}
}

Expand All @@ -19,3 +48,10 @@ publishing {
mavenLocal()
}
}

if (rootProject.ext.isSigningEnabled()) {
signing {
useInMemoryPgpKeys(System.getenv("MVN_SIGNING_KEY"), System.getenv("MVN_SIGNING_PASSPHRASE"))
sign publishing.publications.release
}
}
1 change: 1 addition & 0 deletions android/wallet-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ android {
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
lint {
Expand Down
36 changes: 36 additions & 0 deletions android/wallet-core/maven-push.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

publishing {
publications {
release(MavenPublication) {
afterEvaluate {
from components.release
}

groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = project.findProperty('version') ?: VERSION_NAME

pom {
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
}
}

Expand All @@ -21,3 +50,10 @@ publishing {
mavenLocal()
}
}

if (rootProject.ext.isSigningEnabled()) {
signing {
useInMemoryPgpKeys(System.getenv("MVN_SIGNING_KEY"), System.getenv("MVN_SIGNING_PASSPHRASE"))
sign publishing.publications.release
}
}
71 changes: 53 additions & 18 deletions tools/android-release
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,80 @@
#
# This script uploads android build to repositories defined in maven-push.gradle
# It also builds and uploads Kotlin docs
#
# Usage:
# tools/android-release [version] [--target local|sonatype|gpr|all]
#

set -e

source $(dirname $0)/library
version=$(wc_read_version $1)

# Parse arguments
version=""
target="all"
while [[ $# -gt 0 ]]; do
case "$1" in
--target)
target="$2"
shift 2
;;
*)
version="$1"
shift
;;
esac
done

version=$(wc_read_version "$version")

if [[ $(uname -s) == "Darwin" ]]; then
export BOOST_ROOT=$(brew --prefix boost)
fi

echo "Building $version"
echo "Building $version (target: $target)"

export ANDROID_HOME="$HOME/Library/Android/sdk"
pushd android
./gradlew clean build assembleRelease -Pversion="$version"

echo "Publishing to Maven Local..."
./gradlew publishAllPublicationsToMavenLocalRepository -Pversion="$version"
if [[ "$target" == "local" || "$target" == "all" ]]; then
echo "Publishing to Maven Local..."
./gradlew publishAllPublicationsToMavenLocalRepository -Pversion="$version"

echo ""
echo "Published artifacts in Maven Local (~/.m2/repository/com/trustwallet):"
find ~/.m2/repository/com/trustwallet -type f -name "*.pom" -o -name "*.jar" -o -name "*.aar" -o -name "*.klib" 2>/dev/null | grep "$version" | sort || echo "No artifacts found"
echo ""
echo "Published artifacts in Maven Local (~/.m2/repository/com/trustwallet):"
find ~/.m2/repository/com/trustwallet -type f -name "*.pom" -o -name "*.jar" -o -name "*.aar" -o -name "*.klib" 2>/dev/null | grep "$version" | sort || echo "No artifacts found"
fi

echo "Publishing to GitHub Packages..."
./gradlew publishAllPublicationsToGitHubPackagesRepository -Pversion="$version" || echo "Warning: GitHub Packages publishing failed"
if [[ "$target" == "sonatype" || "$target" == "all" ]]; then
echo "Publishing to Maven Central (Sonatype)..."
if [ -n "${SONATYPE_USERNAME:-}" ] && [ -n "${SONATYPE_PASSWORD:-}" ] && [ -n "${MVN_SIGNING_KEY:-}" ]; then
./gradlew publishAllPublicationsToSonatypeRepository -Pversion="$version"
echo "Artifacts staged on Sonatype. Visit https://central.sonatype.com to verify and release."
else
echo "Skipping Sonatype: SONATYPE_USERNAME, SONATYPE_PASSWORD, and MVN_SIGNING_KEY must be set"
fi
fi

if [[ "$target" == "gpr" || "$target" == "all" ]]; then
echo "Publishing to GitHub Packages..."
./gradlew publishAllPublicationsToGitHubPackagesRepository -Pversion="$version" || echo "Warning: GitHub Packages publishing failed"
fi

echo "Android build uploaded"
popd # android

echo "Building docs..."
tools/kotlin-doc
if [[ "$target" == "all" ]]; then
echo "Building docs..."
tools/kotlin-doc

pushd build/dokka
pushd build/dokka

filename=kdoc.zip
echo "Upload asset $filename"
download_url=$(wc_upload_asset ${version} ${filename})
echo "download_url is $download_url"

popd # build/dokka
filename=kdoc.zip
echo "Upload asset $filename"
download_url=$(wc_upload_asset ${version} ${filename})
echo "download_url is $download_url"

popd # build/dokka
fi