Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinogradov Andrey committed Dec 24, 2022
1 parent fa4b3f2 commit 69cf0ed
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 143 deletions.
57 changes: 18 additions & 39 deletions auth/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
plugins {
id("com.android.library")
kotlin("android")
kotlin("android.extensions")
id("kotlin-android")
id("kotlin-android-extensions")
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.android.extensions)
alias(libs.plugins.dokka)
alias(libs.plugins.publish)
}

android {
compileSdkVersion(Config.Android.compileSdk)
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
minSdkVersion(Config.Android.minSdk)
targetSdkVersion(Config.Android.compileSdk)
buildToolsVersion(Config.Android.buildToolsVersion)
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.compileSdk.get().toInt()
buildToolsVersion = libs.versions.buildToolsVersion.get()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

// applicationId = "${project.property("GROUP").toString()}.auth"
versionCode = 1
versionName = "0.0.1"
}
buildTypes {
getByName("release") {
Expand All @@ -25,37 +21,20 @@ android {
consumerProguardFile("consumer-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
sourceSets {
val main by getting {}
val test by getting {}
val androidTest by getting {}
main.java.srcDirs("src/main/kotlin")
test.java.srcDirs("src/test/kotlin")
androidTest.java.srcDirs("src/androidTest/kotlin")
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(kotlin("stdlib-jdk8", Config.Versions.Kotlin.kotlin))

implementation("androidx.appcompat:appcompat:${Config.Versions.Android.appCompat}")
implementation("androidx.core:core-ktx:${Config.Versions.Android.coreKtx}")
implementation("androidx.constraintlayout:constraintlayout:${Config.Versions.Android.constraintLayout}")

testImplementation("junit:junit:${Config.Versions.Test.junit}")

androidTestImplementation("androidx.test:runner:${Config.Versions.AndroidTest.runner}")
androidTestImplementation("androidx.test.ext:junit:${Config.Versions.AndroidTest.extJunit}")
androidTestImplementation("androidx.test.espresso:espresso-core:${Config.Versions.AndroidTest.espressoCore}")
androidTestImplementation("org.mockito:mockito-android:${Config.Versions.Test.mockito}")
implementation(libs.androidx.appcompat)
implementation(libs.androidx.ktx)

testImplementation(libs.junit)

androidTestImplementation(libs.runner)
androidTestImplementation(libs.extJunit)
androidTestImplementation(libs.espressoCore)
androidTestImplementation(libs.mockito)
}

apply(from = "$rootDir/gradle/mavenpublish.gradle")
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import androidx.annotation.CheckResult
import androidx.core.os.bundleOf
Expand All @@ -14,6 +15,7 @@ import com.petersamokhin.vksdk.android.auth.error.VkAppMissingException
import com.petersamokhin.vksdk.android.auth.hidden.ActivityResultListener
import com.petersamokhin.vksdk.android.auth.hidden.HiddenFragment
import com.petersamokhin.vksdk.android.auth.model.VkAuthResult
import kotlinx.android.parcel.Parcelize

/**
* VK authorization handler.
Expand Down Expand Up @@ -724,6 +726,7 @@ object VkAuth {
* See: https://vk.com/dev/implicit_flow_user
* See: https://vk.com/dev/authcode_flow_user
*/
@Parcelize
data class AuthParams(
val clientId: Int,
val responseType: ResponseType,
Expand All @@ -733,7 +736,7 @@ object VkAuth {
val state: String = "",
val revoke: Boolean = true,
val apiVersion: Double = 5.103
) {
): Parcelable {
constructor(
clientId: Int,
responseType: ResponseType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class VkAuthWebView @JvmOverloads constructor(
lastUrl?.also(::loadUrl)
}

override fun loadUrl(url: String?) {
override fun loadUrl(url: String) {
lastUrl = url
super.loadUrl(url)
}
Expand Down
25 changes: 7 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,21 @@ buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
}

dependencies {
classpath(kotlin("gradle-plugin", Config.Versions.Kotlin.kotlin))
classpath("com.android.tools.build:gradle:${Config.Versions.Plugin.androidGradle}")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${Config.Versions.Plugin.dokka}")
classpath("com.vanniktech:gradle-maven-publish-plugin:${Config.Versions.Plugin.publish}")
}
plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.android.extensions) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.publish) apply false
}

allprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all {
JavaVersion.VERSION_1_8.toString().also {
kotlinOptions.jvmTarget = it
if (plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
sourceCompatibility = it
targetCompatibility = it
}
}
}

repositories {
mavenCentral()
google()
jcenter()
}

group = project.property("GROUP").toString()
Expand Down
7 changes: 0 additions & 7 deletions buildSrc/build.gradle.kts

This file was deleted.

33 changes: 0 additions & 33 deletions buildSrc/src/main/kotlin/Config.kt

This file was deleted.

2 changes: 0 additions & 2 deletions gradle/dokka.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply plugin: 'org.jetbrains.dokka'

/**
* Should be changed after each major and minor release.
* Also, previous docs subdirectory should be added to .gitignore file.
Expand Down
44 changes: 44 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[versions]

buildToolsVersion = "33.0.1"
minSdk = "21"
compileSdk = "33"

kotlin = "1.7.22"
appCompat = "1.5.1"
coreKtx = "1.9.0"

junit = "4.13.2"
extJunit = "1.1.4"
runner = "1.5.1"
espressoCore = "3.5.0"
mockito = "4.9.0"

androidGradle = "7.3.1"
publish = "0.22.0"
dokka = "0.9.18"

[libraries]
# AndroidX
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appCompat" }
androidx-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }

junit = { module = "junit:junit", version.ref = "junit" }
runner = { module = "androidx.test:runner", version.ref = "runner" }
extJunit = { module = "androidx.test.ext:junit", version.ref = "extJunit" }
espressoCore = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
mockito = { module = "org.mockito:mockito-android", version.ref = "mockito" }

[plugins]
# Android
android-library = { id = "com.android.library", version.ref = "androidGradle" }
android-gradle = { id = "com.android.tools.build:gradle", version.ref = "androidGradle" }

# Kotlin
kotlin-gradle = { id = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }

# Other
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
47 changes: 8 additions & 39 deletions gradle/mavenpublish.gradle
Original file line number Diff line number Diff line change
@@ -1,47 +1,16 @@
apply plugin: "com.vanniktech.maven.publish"

mavenPublish {
def isRelease = isReleaseBuild()
def signKeyValid = !getGpgKey().isEmpty()

// useLegacyMode = !project.plugins.hasPlugin('org.jetbrains.kotlin.multiplatform')
releaseSigningEnabled = isRelease

project.logger.warn("publish: maven: release=$isRelease, keyValid=$signKeyValid")

if (isRelease && !signKeyValid) {
project.logger.error("Release signing enabled, but key is empty")
}

targets {
installArchives {
def url = file("${rootProject.buildDir}/localMaven").toURI().toString()
project.logger.warn("publish: test: repo: $url")
releaseRepositoryUrl = url
snapshotRepositoryUrl = url
publishing {
repositories {
maven {
url = file("${rootProject.buildDir}/localMaven").toURI().toString()
}
}
}

signing {
def key = getGpgKey()
def pwd = getGpgPassword()
if (!key.isEmpty()) {
useInMemoryPgpKeys(key, pwd)
mavenPublishing {
pom {
name.set("VK SDK Android")
url.set("https://github.com/vksdk/vk-sdk-android")
}
}

@SuppressWarnings("GrMethodMayBeStatic")
Boolean isReleaseBuild() {
return !VERSION_NAME.contains("SNAPSHOT")
}

def getGpgKey() {
return hasProperty('signingKey') ? signingKey : ""
}

def getGpgPassword() {
return hasProperty('signingPassword') ? signingPassword : ""
}

apply from: "$rootDir/gradle/dokka.gradle"
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Wed Apr 15 01:08:04 MSK 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
#Sun Dec 11 21:52:44 MSK 2022
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
16 changes: 15 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,18 @@ include(
// Do NOT include ":examples:*" here;
// they are individual projects.
// To test, use `./gradlew publish` and test repository `./build/localMaven`
)
)

pluginManagement {
repositories {
google()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android") {
useModule("com.android.tools.build:gradle:${requested.version}")
}
}
}
}

0 comments on commit 69cf0ed

Please sign in to comment.