Skip to content

Commit

Permalink
Merge pull request #50 from adzerk/version-bump
Browse files Browse the repository at this point in the history
Update gradle and build plugins
  • Loading branch information
jcazevedo authored Oct 3, 2024
2 parents 2dce2f0 + cd93336 commit 2845890
Show file tree
Hide file tree
Showing 21 changed files with 585 additions and 437 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 11
java-version: 17
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlinVersion = '1.4.31'
ext.kotlinVersion = '1.9.25'

repositories {
maven {
Expand All @@ -13,11 +13,11 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:8.7.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'net.researchgate:gradle-release:2.8.0'
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.0.0"
classpath 'net.researchgate:gradle-release:3.0.2'
classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.1"

// NOTE: Do not place application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -47,7 +47,7 @@ subprojects {

// Optionally configure plugin
ktlint {
version = "0.40.0"
version = "1.3.1"
enableExperimentalRules = true
debug = true
android = true
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Mar 15 17:34:55 WET 2021
#Wed Oct 02 15:31:01 WEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
13 changes: 11 additions & 2 deletions velocidi-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
compileSdkVersion 33
namespace "com.velocidi.sampleapp"
defaultConfig {
applicationId "com.velocidi.sampleapp"
minSdkVersion 19
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand All @@ -20,6 +21,14 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions velocidi-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.velocidi.sampleapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -16,6 +15,7 @@
<activity android:name=".JavaActivity"></activity>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
Expand All @@ -26,4 +26,4 @@
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public class JavaActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Channel trackEndpoint = new Channel(Uri.parse("http://tr.cdp.velocidi.com/events"), true);
Channel matchEndpoint = new Channel(Uri.parse("http://match.cdp.velocidi.com/match"), true);
// Example: https://tr.cdp.example.audience.kevel.com/events
Channel trackEndpoint = new Channel(Uri.parse("http://localhost"), true);
// Example: https://match.cdp.example.audience.kevel.com/events
Channel matchEndpoint = new Channel(Uri.parse("http://localhost"), true);
Config config = new Config(trackEndpoint, matchEndpoint);

Velocidi.init(config, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.velocidi.Velocidi
import org.json.JSONObject

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Expand All @@ -33,34 +32,48 @@ class MainActivity : AppCompatActivity() {
""".trimIndent()

Velocidi.getInstance().track(
UserId("user_email_hash", "email_sha256"),
eventJsonString
// [email protected]
UserId(
"388c735eec8225c4ad7a507944dd0a975296baea383198aa87177f29af2c6f69",
"email_sha256",
),
eventJsonString,
)

val eventJsonObj = mapOf(
"clientId" to "velocidi",
"siteId" to "velocidi.com",
"type" to "appView",
"title" to "Welcome Screen",
"customFields" to mapOf(
"debug" to true,
"role" to "superuser"
val eventJsonObj =
mapOf(
"clientId" to "velocidi",
"siteId" to "velocidi.com",
"type" to "appView",
"title" to "Welcome Screen",
"customFields" to
mapOf(
"debug" to true,
"role" to "superuser",
),
)
)

Velocidi.getInstance().track(
UserId("user_email_hash", "email_sha256"),
JSONObject(eventJsonObj)
// [email protected]
UserId(
"388c735eec8225c4ad7a507944dd0a975296baea383198aa87177f29af2c6f69",
"email_sha256",
),
JSONObject(eventJsonObj),
)
}

matchButton.setOnClickListener {
Velocidi.getInstance().match(
"someProvider",
"web",
listOf(
UserId("user_email_hash", "email_sha256"),
UserId("user_advertising_id", "gaid")
)
// [email protected]
UserId(
"388c735eec8225c4ad7a507944dd0a975296baea383198aa87177f29af2c6f69",
"email_sha256",
),
UserId("user_advertising_id", "gaid"),
),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()

val trackEndpoint = Channel(Uri.parse("http://tr.cdp.velocidi.com/events"), true)
val matchEndpoint = Channel(Uri.parse("http://match.cdp.velocidi.com/match"), true)
// Example: https://tr.cdp.example.audience.kevel.com/events
val trackEndpoint = Channel(Uri.parse("http://localhost"), true)
// Example: https://match.cdp.example.audience.kevel.com/events
val matchEndpoint = Channel(Uri.parse("http://localhost"), true)
val config = Config(trackEndpoint, matchEndpoint)

// OR
Expand Down
22 changes: 16 additions & 6 deletions velocidi-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30

compileSdkVersion 33
namespace "com.velocidi"
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildFeatures {
buildConfig true
}
buildTypes {

debug {
Expand All @@ -33,6 +35,14 @@ android {

useLibrary 'org.apache.http.legacy'

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}

testOptions {
unitTests {
includeAndroidResources = true
Expand All @@ -48,8 +58,8 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.13'
testImplementation 'androidx.test:core:1.3.0'
testImplementation 'org.assertj:assertj-core:3.12.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.13'
Expand Down
6 changes: 3 additions & 3 deletions velocidi-sdk/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ release {
newVersionCommitMessage = "Set version to"

git {
signTag = true
requireBranch = 'master'
pushToRemote = ''
signTag.set(true)
requireBranch.set('master')
pushToRemote.set('')
}
}

Expand Down
4 changes: 2 additions & 2 deletions velocidi-sdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.velocidi"/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
23 changes: 16 additions & 7 deletions velocidi-sdk/src/main/kotlin/com/velocidi/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ import android.net.Uri
* @property track Channel configuration for the track functionality
* @property match Channel configuration for the match functionality
*/
class Config(val track: Channel, val match: Channel) {

class Config(
val track: Channel,
val match: Channel,
) {
constructor(url: Uri) : this(
Channel(parseUrl(url, "tr", "events"), true),
Channel(parseUrl(url, "match", "match"), true)
Channel(parseUrl(url, "match", "match"), true),
)

internal companion object {

private fun parseUrl(url: Uri, prefix: String, endpoint: String): Uri =
Uri.Builder()
private fun parseUrl(
url: Uri,
prefix: String,
endpoint: String,
): Uri =
Uri
.Builder()
.scheme(url.scheme)
.encodedAuthority("$prefix.${url.host}")
.appendEncodedPath(endpoint)
Expand All @@ -32,4 +38,7 @@ class Config(val track: Channel, val match: Channel) {
* @property host endpoint URL
* @property enabled
*/
data class Channel(val host: Uri, val enabled: Boolean)
data class Channel(
val host: Uri,
val enabled: Boolean,
)
Loading

0 comments on commit 2845890

Please sign in to comment.