-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lucas Frossard
committed
Oct 31, 2023
1 parent
4c55bac
commit 4b2db74
Showing
3 changed files
with
150 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GROUP=com.whatsapp.otp | ||
LIBRARY_VERSION_NAME=0.1.0 | ||
|
||
POM_ARTIFACT_ID=whatsapp-otp-android-sdk | ||
POM_NAME=OtpSdk | ||
POM_PACKAGING=aar | ||
POM_DESCRIPTION=WhatsApp Otp SDK for Android Apps | ||
POM_URL=https://github.com/WhatsApp/WhatsApp-Android-OTP-SDK | ||
POM_SCM_URL=https://github.com/WhatsApp/WhatsApp-Android-OTP-SDK.git | ||
POM_SCM_CONNECTION=scm:git:https://github.com/WhatsApp/WhatsApp-Android-OTP-SDK.git | ||
POM_SCM_DEV_CONNECTION=scm:git:[email protected]:WhatsApp/WhatsApp-Android-OTP-SDK.git | ||
POM_LICENSE_NAME=MIT license | ||
POM_LICENSE_URL=https://github.com/WhatsApp/WhatsApp-Android-OTP-SDK/blob/main/LICENSE | ||
POM_LICENSE_DIST=repo | ||
POM_DEVELOPER_ID=whatsapp | ||
POM_DEVELOPER_NAME=WhatsApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
version = LIBRARY_VERSION_NAME | ||
group = GROUP | ||
|
||
def isReleaseBuild() { | ||
return LIBRARY_VERSION_NAME.contains("SNAPSHOT") == false | ||
} | ||
|
||
def getMavenRepositoryUrl() { | ||
return hasProperty('repositoryUrl') ? property('repositoryUrl') : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
} | ||
|
||
def getMavenRepositoryUsername() { | ||
return hasProperty('repositoryUsername') ? property('repositoryUsername') : "" | ||
} | ||
|
||
def getMavenRepositoryPassword() { | ||
return hasProperty('repositoryPassword') ? property('repositoryPassword') : "" | ||
} | ||
|
||
afterEvaluate { project -> | ||
task androidJavadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.source | ||
classpath += files(android.getBootClasspath().join(File.pathSeparator)) | ||
if (JavaVersion.current().isJava8Compatible()) { | ||
options.addStringOption('Xdoclint:none', '-quiet') | ||
} | ||
if (JavaVersion.current().isJava9Compatible()) { | ||
options.addBooleanOption('html5', true) | ||
} | ||
} | ||
|
||
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { | ||
archiveClassifier = 'javadoc' | ||
from androidJavadoc.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier = 'sources' | ||
from android.sourceSets.main.java.source | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives androidJavadocJar | ||
} | ||
|
||
android.libraryVariants.all { variant -> | ||
tasks.androidJavadoc.doFirst { | ||
classpath += files(variant.javaCompileProvider.get().classpath.files.join(File.pathSeparator)) | ||
} | ||
def name = variant.name.capitalize() | ||
task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider) { | ||
from variant.javaCompileProvider.get().destinationDir | ||
} | ||
} | ||
|
||
def releaseVariant | ||
android.libraryVariants.all { variant -> | ||
if (variant.buildType.name == 'release') { | ||
releaseVariant = variant.name | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenRelease(MavenPublication) { | ||
groupId GROUP | ||
artifactId POM_ARTIFACT_ID | ||
version LIBRARY_VERSION_NAME | ||
|
||
from components[releaseVariant] | ||
|
||
artifact androidJavadocJar | ||
artifact androidSourcesJar | ||
|
||
pom { | ||
name = POM_NAME | ||
description = POM_DESCRIPTION | ||
url = POM_URL | ||
|
||
scm { | ||
url = POM_SCM_URL | ||
connection = POM_SCM_CONNECTION | ||
developerConnection = POM_SCM_DEV_CONNECTION | ||
} | ||
|
||
licenses { | ||
license { | ||
name = POM_LICENSE_NAME | ||
url = POM_LICENSE_URL | ||
distribution = POM_LICENSE_DIST | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = POM_DEVELOPER_ID | ||
name = POM_DEVELOPER_NAME | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { | ||
url getMavenRepositoryUrl() | ||
credentials(PasswordCredentials) { | ||
username = getMavenRepositoryUsername() | ||
password = getMavenRepositoryPassword() | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
required { isReleaseBuild() } | ||
publishing.publications.all { publication -> | ||
sign publication | ||
} | ||
} | ||
} |