From 83a122e68dd19ed7664b60922948edc4a1b02325 Mon Sep 17 00:00:00 2001 From: Darshan Pania Date: Thu, 3 Dec 2020 23:01:51 +0530 Subject: [PATCH 1/9] task(SDK-560): Update CT Android SDK to v4.0.1 and prep for release --- CHANGELOG.md | 4 + build.gradle | 4 +- .../clevertap/CleverTapIntegration.java | 181 ++++++++++-------- 3 files changed, 103 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5940467..0ca2f86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGE LOG +Version 1.2.1 (4 December, 2020) +=================================== +*(Supports analytics-android 4.9.0 and CleverTap 4.0.1)* + Version 1.2.0 (1 October, 2020) =================================== *(Supports analytics-android 4.5.0 and CleverTap 4.0.0)* diff --git a/build.gradle b/build.gradle index 70c9be9..2f9e344 100644 --- a/build.gradle +++ b/build.gradle @@ -149,10 +149,10 @@ dependencies { } implementation fileTree(dir: 'libs', include: ['*.jar']) - compileOnly 'com.segment.analytics.android:analytics:4.5.0' + compileOnly 'com.segment.analytics.android:analytics:4.9.0' compileOnly 'androidx.annotation:annotation:1.1.0' - implementation 'com.clevertap.android:clevertap-android-sdk:4.0.0' + implementation 'com.clevertap.android:clevertap-android-sdk:4.0.1' testImplementation 'junit:junit:4.12' testImplementation('org.robolectric:robolectric:3.0') { diff --git a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java index bffdef5..7e7dd05 100644 --- a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java +++ b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java @@ -1,10 +1,11 @@ package com.segment.analytics.android.integrations.clevertap; +import static com.segment.analytics.internal.Utils.isNullOrEmpty; + import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; - import com.clevertap.android.sdk.CleverTapAPI; import com.segment.analytics.Analytics; import com.segment.analytics.Properties; @@ -18,9 +19,6 @@ import com.segment.analytics.integrations.ScreenPayload; import com.segment.analytics.integrations.TrackPayload; import com.segment.analytics.internal.Utils; - -import org.json.JSONObject; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -31,32 +29,27 @@ import java.util.List; import java.util.Map; import java.util.Set; - -import static com.segment.analytics.internal.Utils.isNullOrEmpty; +import org.jetbrains.annotations.NotNull; +import org.json.JSONObject; public class CleverTapIntegration extends Integration { - private final CleverTapAPI cl; + private static final String CLEVERTAP_KEY = "CleverTap"; + private static final String ACCOUNT_ID_KEY = "clevertap_account_id"; + private static final String ACCOUNT_TOKEN_KEY = "clevertap_account_token"; + private static final String ACCOUNT_REGION_KEY = "region"; private static final Set MALE_TOKENS = new HashSet<>(Arrays.asList("M", "MALE")); + private static final Set FEMALE_TOKENS = new HashSet<>(Arrays.asList("F", "FEMALE")); private static final Map MAP_KNOWN_PROFILE_FIELDS; - static { - Map knownFieldsMap = new LinkedHashMap<>(); - knownFieldsMap.put("phone", "Phone"); - knownFieldsMap.put("name", "Name"); - knownFieldsMap.put("email", "Email"); - knownFieldsMap.put("birthday", "DOB"); - MAP_KNOWN_PROFILE_FIELDS = Collections.unmodifiableMap(knownFieldsMap); - } - public static final Factory FACTORY = new Factory() { @Override public Integration create(ValueMap settings, Analytics analytics) { @@ -70,7 +63,8 @@ public Integration create(ValueMap settings, Analytics analytics) { } if (Utils.isNullOrEmpty(accountID) || Utils.isNullOrEmpty(accountToken)) { - logger.info("CleverTap+Segment integration attempt to initialize without account id or account token."); + logger.info( + "CleverTap+Segment integration attempt to initialize without account id or account token."); return null; } @@ -81,6 +75,7 @@ public Integration create(ValueMap settings, Analytics analytics) { return new CleverTapIntegration(cl, logger); } + @NotNull @Override public String key() { return CLEVERTAP_KEY; @@ -88,20 +83,25 @@ public String key() { }; + private final CleverTapAPI cl; + private final Logger mLogger; public CleverTapIntegration(CleverTapAPI instance, Logger logger) { this.cl = instance; this.mLogger = logger; - if (this.cl != null) + if (this.cl != null) { this.cl.setLibrary("Segment-Android"); + } } @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { super.onActivityCreated(activity, savedInstanceState); - if (cl == null) return; + if (cl == null) { + return; + } CleverTapAPI.setAppForeground(true); try { @@ -120,37 +120,38 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) { } @Override - public void onActivityResumed(Activity activity) { - super.onActivityResumed(activity); + public void alias(AliasPayload alias) { + super.alias(alias); - if (cl == null) return; + if (cl == null) { + mLogger.debug("CleverTap Instance is null."); + return; + } + + if (alias == null || Utils.isNullOrEmpty(alias.userId())) { + return; + } try { - CleverTapAPI.onActivityResumed(activity); + HashMap profile = new HashMap<>(); + profile.put("Identity", alias.userId()); + cl.pushProfile(profile); } catch (Throwable t) { - // Ignore + mLogger.error(t, "CleverTap: Error pushing profile"); + cl.pushError(t.getMessage(), 512); } } @Override - public void onActivityPaused(Activity activity) { - super.onActivityPaused(activity); - - if (cl == null) return; - - try { - CleverTapAPI.onActivityPaused(); - } catch (Throwable t) { - // Ignore - } + public CleverTapAPI getUnderlyingInstance() { + return cl; } @Override public void identify(IdentifyPayload identify) { super.identify(identify); - if(cl == null) - { + if (cl == null) { mLogger.debug("CleverTap Instance is null."); return; } @@ -187,12 +188,57 @@ public void identify(IdentifyPayload identify) { } } + @Override + public void onActivityPaused(Activity activity) { + super.onActivityPaused(activity); + + if (cl == null) { + return; + } + + try { + CleverTapAPI.onActivityPaused(); + } catch (Throwable t) { + // Ignore + } + } + + @Override + public void onActivityResumed(Activity activity) { + super.onActivityResumed(activity); + + if (cl == null) { + return; + } + + try { + CleverTapAPI.onActivityResumed(activity); + } catch (Throwable t) { + // Ignore + } + } + + @Override + public void screen(ScreenPayload screen) { + super.screen(screen); + + if (cl == null) { + mLogger.debug("CleverTap Instance is null."); + return; + } + + if (screen == null || screen.name() == null) { + return; + } + + cl.recordScreen(screen.name()); + } + @Override public void track(TrackPayload track) { super.track(track); - if(cl == null) - { + if (cl == null) { mLogger.debug("CleverTap Instance is null."); return; } @@ -221,45 +267,17 @@ public void track(TrackPayload track) { } } - @Override - public void alias(AliasPayload alias) { - super.alias(alias); + private void handleOrderCompleted(TrackPayload track) { - if(cl == null) - { + if (cl == null) { mLogger.debug("CleverTap Instance is null."); return; } - if (alias == null || Utils.isNullOrEmpty(alias.userId())) { + if (!track.event().equals("Order Completed")) { return; } - try { - HashMap profile = new HashMap<>(); - profile.put("Identity", alias.userId()); - cl.pushProfile(profile); - } catch (Throwable t) { - mLogger.error(t, "CleverTap: Error pushing profile"); - cl.pushError(t.getMessage(), 512); - } - } - - @Override - public CleverTapAPI getUnderlyingInstance() { - return cl; - } - - private void handleOrderCompleted(TrackPayload track) { - - if(cl == null) - { - mLogger.debug("CleverTap Instance is null."); - return; - } - - if (!track.event().equals("Order Completed")) return; - Properties properties = track.properties(); HashMap details = new HashMap<>(); @@ -277,7 +295,9 @@ private void handleOrderCompleted(TrackPayload track) { while (keys.hasNext()) { try { String key = (String) keys.next(); - if (key.equals("products")) continue; + if (key.equals("products")) { + continue; + } details.put(key, propertiesJson.get(key)); } catch (Throwable t) { @@ -319,20 +339,13 @@ private void handleOrderCompleted(TrackPayload track) { } } - @Override - public void screen(ScreenPayload screen) { - super.screen(screen); - - if(cl == null) - { - mLogger.debug("CleverTap Instance is null."); - return; - } - - if (screen == null || screen.name() == null) - return; - - cl.recordScreen(screen.name()); + static { + Map knownFieldsMap = new LinkedHashMap<>(); + knownFieldsMap.put("phone", "Phone"); + knownFieldsMap.put("name", "Name"); + knownFieldsMap.put("email", "Email"); + knownFieldsMap.put("birthday", "DOB"); + MAP_KNOWN_PROFILE_FIELDS = Collections.unmodifiableMap(knownFieldsMap); } } From b2bf32ec35ec891e3f5e6eb0eb242623deca3973 Mon Sep 17 00:00:00 2001 From: Darshan Pania Date: Mon, 28 Dec 2020 23:03:43 +0530 Subject: [PATCH 2/9] task(SDK-560): Upgrades CT Android SDK to v4.0.2 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2f9e344..065260e 100644 --- a/build.gradle +++ b/build.gradle @@ -152,7 +152,7 @@ dependencies { compileOnly 'com.segment.analytics.android:analytics:4.9.0' compileOnly 'androidx.annotation:annotation:1.1.0' - implementation 'com.clevertap.android:clevertap-android-sdk:4.0.1' + implementation 'com.clevertap.android:clevertap-android-sdk:4.0.2' testImplementation 'junit:junit:4.12' testImplementation('org.robolectric:robolectric:3.0') { From 6e1576870831dc2381556f1accfe3e85bd32629e Mon Sep 17 00:00:00 2001 From: william Date: Thu, 6 May 2021 12:23:44 +0530 Subject: [PATCH 3/9] *updated segment and ct core deps. *added try/catch for record screen npe --- build.gradle | 4 ++-- .../clevertap/CleverTapIntegration.java | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 065260e..64093c0 100644 --- a/build.gradle +++ b/build.gradle @@ -149,10 +149,10 @@ dependencies { } implementation fileTree(dir: 'libs', include: ['*.jar']) - compileOnly 'com.segment.analytics.android:analytics:4.9.0' + compileOnly 'com.segment.analytics.android:analytics:4.9.4' compileOnly 'androidx.annotation:annotation:1.1.0' - implementation 'com.clevertap.android:clevertap-android-sdk:4.0.2' + implementation 'com.clevertap.android:clevertap-android-sdk:4.1.1' testImplementation 'junit:junit:4.12' testImplementation('org.robolectric:robolectric:3.0') { diff --git a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java index 7e7dd05..dc3a5df 100644 --- a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java +++ b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java @@ -1,11 +1,10 @@ package com.segment.analytics.android.integrations.clevertap; -import static com.segment.analytics.internal.Utils.isNullOrEmpty; - import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; + import com.clevertap.android.sdk.CleverTapAPI; import com.segment.analytics.Analytics; import com.segment.analytics.Properties; @@ -19,6 +18,10 @@ import com.segment.analytics.integrations.ScreenPayload; import com.segment.analytics.integrations.TrackPayload; import com.segment.analytics.internal.Utils; + +import org.jetbrains.annotations.NotNull; +import org.json.JSONObject; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -29,8 +32,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.jetbrains.annotations.NotNull; -import org.json.JSONObject; + +import static com.segment.analytics.internal.Utils.isNullOrEmpty; public class CleverTapIntegration extends Integration { @@ -231,7 +234,11 @@ public void screen(ScreenPayload screen) { return; } - cl.recordScreen(screen.name()); + try { + cl.recordScreen(screen.name()); + } catch (NullPointerException npe) { + mLogger.debug("ScreenPayLoad obj is returning null."+npe); + }//Added this as screen.getTitle() was returning null in sdk v4.1.1 } @Override From a7f9eeba4cb24cfb86b9095164628c273d4bafac Mon Sep 17 00:00:00 2001 From: william Date: Thu, 6 May 2021 12:42:07 +0530 Subject: [PATCH 4/9] *updated segment and ct core deps.#SDK-804 *added try/catch for record screen npe.#SDK-804 --- .../android/integrations/clevertap/CleverTapIntegration.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java index dc3a5df..40577c4 100644 --- a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java +++ b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java @@ -239,6 +239,7 @@ public void screen(ScreenPayload screen) { } catch (NullPointerException npe) { mLogger.debug("ScreenPayLoad obj is returning null."+npe); }//Added this as screen.getTitle() was returning null in sdk v4.1.1 + } @Override From b80feb0455b78d2e08d237ffee1e798270d6f4ed Mon Sep 17 00:00:00 2001 From: william Date: Thu, 6 May 2021 16:10:18 +0530 Subject: [PATCH 5/9] *updated segment and ct core deps.#SDK-804 *added try/catch for record screen npe.#SDK-804 --- .../android/integrations/clevertap/CleverTapIntegration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java index 40577c4..d5d8ee1 100644 --- a/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java +++ b/src/main/java/com/segment/analytics/android/integrations/clevertap/CleverTapIntegration.java @@ -237,8 +237,8 @@ public void screen(ScreenPayload screen) { try { cl.recordScreen(screen.name()); } catch (NullPointerException npe) { - mLogger.debug("ScreenPayLoad obj is returning null."+npe); - }//Added this as screen.getTitle() was returning null in sdk v4.1.1 + mLogger.debug("ScreenPayLoad obj is null."+npe); + } } From d75aa61cd267f0ff7f1f2ecdfc0c8ba68dfaa8be Mon Sep 17 00:00:00 2001 From: william Date: Fri, 7 May 2021 10:09:48 +0530 Subject: [PATCH 6/9] *removed jCenter() deps.#SDK-806 --- build.gradle | 60 ++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/build.gradle b/build.gradle index 64093c0..8d2082c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,6 @@ buildscript { url "https://maven.google.com" } mavenCentral() - jcenter() flatDir { dirs 'libs' } @@ -13,7 +12,6 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.google.gms:google-services:4.3.3' } } @@ -48,7 +46,6 @@ group = publishedGroupId apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' android { @@ -71,34 +68,34 @@ android { } // Bintray -Properties properties = new Properties() -if (project.rootProject.file('local.properties').exists()) { - properties.load(project.rootProject.file('local.properties').newDataInputStream()) -} - -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = bintrayRepo - name = bintrayName - userOrg = org - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses - publish = true - publicDownloadNumbers = true - version { - desc = libraryDescription - gpg { - sign = false - } - } - } -} +//Properties properties = new Properties() +//if (project.rootProject.file('local.properties').exists()) { +// properties.load(project.rootProject.file('local.properties').newDataInputStream()) +//} + +//bintray { +// user = properties.getProperty("bintray.user") +// key = properties.getProperty("bintray.apikey") +// +// configurations = ['archives'] +// pkg { +// repo = bintrayRepo +// name = bintrayName +// userOrg = org +// desc = libraryDescription +// websiteUrl = siteUrl +// vcsUrl = gitUrl +// licenses = allLicenses +// publish = true +// publicDownloadNumbers = true +// version { +// desc = libraryDescription +// gpg { +// sign = false +// } +// } +// } +//} install { repositories.mavenInstaller { @@ -142,7 +139,6 @@ install { dependencies { repositories { mavenCentral() - jcenter() maven { url "https://maven.google.com" } From 73901576deaf2d176dd22419f324122983fbc546 Mon Sep 17 00:00:00 2001 From: william Date: Mon, 10 May 2021 16:43:20 +0530 Subject: [PATCH 7/9] *removed jCenter() and updated with new exts.#SDK-806 --- build.gradle | 195 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 73 deletions(-) diff --git a/build.gradle b/build.gradle index 8d2082c..455c4af 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,8 @@ +apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'maven-publish' +apply plugin: 'signing' + buildscript { repositories { maven { @@ -17,14 +22,11 @@ buildscript { } ext { - bintrayRepo = 'Maven' - bintrayName = 'clevertap-segment-integration' - org = 'clevertap' + Repo = 'Maven' publishedGroupId = 'com.clevertap.android' libraryName = 'clevertap-segment-integration' artifact = 'clevertap-segment-android' - libraryDescription = 'CleverTap Integration for Segment Android Analytics' siteUrl = 'https://github.com/CleverTap/clevertap-segment-android' @@ -32,21 +34,25 @@ ext { libraryVersion = '1.2.0' - developerId = 'clevertap' - developerName = 'CleverTap' - developerEmail = 'support@clevertap.com' licenseName = 'The MIT License (MIT)' licenseUrl = 'http://opensource.org/licenses/MIT' allLicenses = ["MIT"] } +ext["signing.keyId"] = '' +ext["signing.password"] = '' +ext["signing.secretKeyRingFile"] = '' +ext["ossrhUsername"] = '' +ext["ossrhPassword"] = '' +ext["sonatypeStagingProfileId"] = '' +ext["developerId"] = '' +ext["developerName"] = '' +ext["developerEmail"] = '' + version = libraryVersion group = publishedGroupId -apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' - android { compileSdkVersion 29 @@ -65,77 +71,129 @@ android { testOptions { unitTests.returnDefaultValues = true } + + libraryVariants.all { variant -> + variant.outputs.all { + if (variant.getName().toLowerCase().contains('release')) { + outputFileName = "${artifact}-${libraryVersion}.aar" + } else if (variant.getName().toLowerCase().contains('debug')) { + outputFileName = "${artifact}-${variant.name}-${libraryVersion}.aar" + } + } + } +} + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar } -// Bintray -//Properties properties = new Properties() -//if (project.rootProject.file('local.properties').exists()) { -// properties.load(project.rootProject.file('local.properties').newDataInputStream()) -//} - -//bintray { -// user = properties.getProperty("bintray.user") -// key = properties.getProperty("bintray.apikey") -// -// configurations = ['archives'] -// pkg { -// repo = bintrayRepo -// name = bintrayName -// userOrg = org -// desc = libraryDescription -// websiteUrl = siteUrl -// vcsUrl = gitUrl -// licenses = allLicenses -// publish = true -// publicDownloadNumbers = true -// version { -// desc = libraryDescription -// gpg { -// sign = false -// } -// } -// } -//} - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - groupId publishedGroupId - artifactId artifact - - // Add your description here - name libraryName - description libraryDescription - url siteUrl - - // Set your license +Properties properties = new Properties() +if (project.rootProject.file('local.properties').exists()) { + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + properties.each { name, value -> + ext[name] = value + } +}else{ + ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') + ext["signing.password"] = System.getenv('SIGNING_PASSWORD') + ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') + ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') + ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') +} + +publishing { + publications { + release(MavenPublication) { + // The coordinates of the library, being set from variables that + // we'll set up later + groupId publishedGroupId + artifactId artifact + version version + + // Two artifacts, the `aar` (or `jar`) and the sources + if (project.plugins.findPlugin("com.android.library")) { + artifact("$buildDir/outputs/aar/${artifact}-${libraryVersion}.aar") + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + artifact sourcesJar + + // Mostly self-explanatory metadata + pom { + name = artifact + description = libraryDescription + url = siteUrl licenses { license { - name licenseName - url licenseUrl + name = licenseName + url = licenseUrl } } developers { developer { - id developerId - name developerName - email developerEmail + id = developerId + name = developerName + email = developerEmail } + // Add all other devs here... } + // Version control info - if you're using GitHub, follow the format as seen here scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - + connection = 'scm:git:github.com/CleverTap/clevertap-android-sdk.git' + developerConnection = 'scm:git:ssh:github.com/CleverTap/clevertap-android-sdk.git' + url = 'https://github.com/CleverTap/clevertap-android-sdk/tree/master' } + // A slightly hacky fix so that your POM will include any transitive dependencies + // that your library builds upon + withXml { + def dependenciesNode = asNode().appendNode('dependencies') + + project.configurations.implementation.allDependencies.each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + } + } + } + } + } + // The repository to publish to, Sonatype/MavenCentral + repositories { + maven { + // This is an arbitrary name, you may also use "mavencentral" or + // any other name that's descriptive for you + name = Repo + url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username ossrhUsername + password ossrhPassword } } } } +signing { + sign publishing.publications +} + dependencies { repositories { mavenCentral() @@ -174,12 +232,3 @@ dependencies { androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' } - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -artifacts { - archives sourcesJar -} From 91e57d38928210e6bed3eb4563ce53fc4c9f033c Mon Sep 17 00:00:00 2001 From: Darshan Pania Date: Mon, 10 May 2021 21:58:31 +0530 Subject: [PATCH 8/9] task(SDK-511): Updates publishing process, CHANGELOG and adds support for Android 11 --- CHANGELOG.md | 4 +- RELEASING.md | 11 ----- build.gradle | 117 +++++++++++++++++++++++---------------------------- 3 files changed, 54 insertions(+), 78 deletions(-) delete mode 100644 RELEASING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ca2f86..7990451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # CHANGE LOG -Version 1.2.1 (4 December, 2020) +Version 1.2.1 (11 May, 2021) =================================== -*(Supports analytics-android 4.9.0 and CleverTap 4.0.1)* +*(Supports analytics-android 4.9.0 and CleverTap 4.1.1)* Version 1.2.0 (1 October, 2020) =================================== diff --git a/RELEASING.md b/RELEASING.md deleted file mode 100644 index 0243977..0000000 --- a/RELEASING.md +++ /dev/null @@ -1,11 +0,0 @@ -Releasing -======== - - 1. Change the version in `build.gradle` to a non-SNAPSHOT version. - 2. Update the `CHANGELOG.md` for the impending release. - 3. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version) - 4. `git tag -a X.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version) - 5. `./gradlew bintrayUpload` - 6. Update the `build.gradle` to the next SNAPSHOT version. - 7. `git commit -am "Prepare next development version."` - 8. `git push && git push --tags` diff --git a/build.gradle b/build.gradle index 455c4af..49ced21 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ ext { siteUrl = 'https://github.com/CleverTap/clevertap-segment-android' gitUrl = 'https://github.com/CleverTap/clevertap-segment-android.git' - libraryVersion = '1.2.0' + libraryVersion = '1.2.1' licenseName = 'The MIT License (MIT)' @@ -55,12 +55,12 @@ group = publishedGroupId android { - compileSdkVersion 29 - buildToolsVersion '29.0.3' + compileSdkVersion 30 + buildToolsVersion '30.0.3' defaultConfig { minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 30 } compileOptions { @@ -118,73 +118,60 @@ if (project.rootProject.file('local.properties').exists()) { ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') } -publishing { - publications { - release(MavenPublication) { - // The coordinates of the library, being set from variables that - // we'll set up later - groupId publishedGroupId - artifactId artifact - version version - - // Two artifacts, the `aar` (or `jar`) and the sources - if (project.plugins.findPlugin("com.android.library")) { - artifact("$buildDir/outputs/aar/${artifact}-${libraryVersion}.aar") - } else { - artifact("$buildDir/libs/${project.getName()}-${version}.jar") - } - artifact sourcesJar - - // Mostly self-explanatory metadata - pom { - name = artifact - description = libraryDescription - url = siteUrl - licenses { - license { - name = licenseName - url = licenseUrl +afterEvaluate { + publishing { + publications { + // Creates a Maven publication called "release". + release(MavenPublication) { + // Applies the component for the release build variant. + from components.release + + // You can then customize attributes of the publication as shown below. + groupId publishedGroupId + artifactId artifact + version version + + artifact sourcesJar + + pom { + name = artifact + description = libraryDescription + url = siteUrl + packaging = "aar" + licenses { + license { + name = licenseName + url = licenseUrl + } } - } - developers { - developer { - id = developerId - name = developerName - email = developerEmail + developers { + developer { + id = developerId + name = developerName + email = developerEmail + } + // Add all other devs here... } - // Add all other devs here... - } - // Version control info - if you're using GitHub, follow the format as seen here - scm { - connection = 'scm:git:github.com/CleverTap/clevertap-android-sdk.git' - developerConnection = 'scm:git:ssh:github.com/CleverTap/clevertap-android-sdk.git' - url = 'https://github.com/CleverTap/clevertap-android-sdk/tree/master' - } - // A slightly hacky fix so that your POM will include any transitive dependencies - // that your library builds upon - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - project.configurations.implementation.allDependencies.each { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) + // Version control info - if you're using GitHub, follow the format as seen here + scm { + connection = 'scm:git:github.com/CleverTap/clevertap-android-sdk.git' + developerConnection = 'scm:git:ssh:github.com/CleverTap/clevertap-android-sdk.git' + url = 'https://github.com/CleverTap/clevertap-android-sdk/tree/master' } } } } - } - // The repository to publish to, Sonatype/MavenCentral - repositories { - maven { - // This is an arbitrary name, you may also use "mavencentral" or - // any other name that's descriptive for you - name = Repo - url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username ossrhUsername - password ossrhPassword + // The repository to publish to, Sonatype/MavenCentral + repositories { + maven { + // This is an arbitrary name, you may also use "mavencentral" or + // any other name that's descriptive for you + name = Repo + url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username ossrhUsername + password ossrhPassword + } } } } From 4e052471b9df86e9ea883bd8918105c6d251b6ee Mon Sep 17 00:00:00 2001 From: Darshan Pania Date: Mon, 10 May 2021 22:25:27 +0530 Subject: [PATCH 9/9] task(SDK-511): Updates CHANGELOG for release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7990451..ad7764e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ Version 1.2.1 (11 May, 2021) =================================== -*(Supports analytics-android 4.9.0 and CleverTap 4.1.1)* +*(Supports analytics-android 4.9.4 and CleverTap 4.1.1)* Version 1.2.0 (1 October, 2020) ===================================