Skip to content

Commit

Permalink
migrate to kotlin dsl and remove open if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Feb 14, 2024
1 parent 86dbb10 commit e2b4356
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 139 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ allprojects {
}
}
dependencies {
implementation 'com.github.pedroSG94:RTSP-Server:1.2.0'
implementation 'com.github.pedroSG94.RootEncoder:library:2.3.3'
implementation 'com.github.pedroSG94:RTSP-Server:1.2.1'
implementation 'com.github.pedroSG94.RootEncoder:library:2.3.5'
}
```
37 changes: 0 additions & 37 deletions app/build.gradle

This file was deleted.

42 changes: 42 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
val vCode: Int by rootProject.extra
val vName: String by rootProject.extra
val rootEncoderVersion: String by rootProject.extra

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

android {
namespace = "com.pedro.sample"
compileSdk = 34

defaultConfig {
applicationId = "com.pedro.sample"
minSdk = 16
targetSdk = 34
versionCode = vCode
versionName = vName
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
implementation(project(":rtspserver"))
implementation("com.github.pedroSG94.RootEncoder:library:$rootEncoderVersion")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
33 changes: 0 additions & 33 deletions build.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
val libraryGroup by rootProject.extra { "com.github.pedroSG94" }
val vCode by rootProject.extra { 121 }
val vName by rootProject.extra { "1.2.1" }
val coroutinesVersion by rootProject.extra { "1.7.3" }
val rootEncoderVersion by rootProject.extra { "2.3.5" }

plugins {
id("com.android.application") version "8.2.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
id("org.jetbrains.dokka") version "1.9.10" apply true
}

tasks.register("clean") {
delete(rootProject.buildDir)
}

tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(File("docs"))
}
56 changes: 0 additions & 56 deletions rtspserver/build.gradle

This file was deleted.

61 changes: 61 additions & 0 deletions rtspserver/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
val libraryGroup: String by rootProject.extra
val vName: String by rootProject.extra
val coroutinesVersion: String by rootProject.extra
val rootEncoderVersion: String by rootProject.extra

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("maven-publish")
id("org.jetbrains.dokka")
}

android {
namespace = "com.pedro.rtspserver"
compileSdk = 34

defaultConfig {
minSdk = 16
lint.targetSdk = 34
}

buildTypes {
release {
isMinifyEnabled = false
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

publishing {
singleVariant("release")
}
}

afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
create<MavenPublication>("release") {
// Applies the component for the release build variant.
from(components["release"])

// You can then customize attributes of the publication as shown below.
groupId = libraryGroup
artifactId = "rtspserver"
version = vName
}
}
}
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
implementation("com.github.pedroSG94.RootEncoder:library:$rootEncoderVersion")
}
2 changes: 1 addition & 1 deletion rtspserver/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit
* TODO Use different session per client.
*/

open class RtspServer(
class RtspServer(
private val connectChecker: ConnectChecker,
val port: Int
): ServerListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.nio.ByteBuffer
/**
* Created by pedro on 13/02/19.
*/
open class RtspServerCamera1: Camera1Base {
class RtspServerCamera1: Camera1Base {

private val rtspServer: RtspServer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.pedro.rtspserver.util.RtspServerStreamClient
import java.nio.ByteBuffer

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
open class RtspServerCamera2: Camera2Base {
class RtspServerCamera2: Camera2Base {

private val rtspServer: RtspServer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.pedro.rtspserver.util.RtspServerStreamClient
import java.nio.ByteBuffer

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
open class RtspServerDisplay(
class RtspServerDisplay(
context: Context, useOpengl: Boolean,
connectChecker: ConnectChecker, port: Int
): DisplayBase(context, useOpengl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.pedro.rtspserver.util.RtspServerStreamClient
import java.nio.ByteBuffer

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
open class RtspServerFromFile: FromFileBase {
class RtspServerFromFile: FromFileBase {

private val rtspServer: RtspServer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.nio.ByteBuffer
/**
* Created by pedro on 17/04/21.
*/
open class RtspServerOnlyAudio(
class RtspServerOnlyAudio(
connectChecker: ConnectChecker, port: Int
): OnlyAudioBase() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.net.Socket
import java.net.SocketException
import java.nio.ByteBuffer

open class ServerClient(
class ServerClient(
private val socket: Socket, serverIp: String, serverPort: Int,
private val connectChecker: ConnectChecker,
val clientAddress: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.util.regex.Pattern
* Created by pedro on 23/10/19.
*
*/
open class ServerCommandManager: CommandsManager() {
class ServerCommandManager: CommandsManager() {

private var serverIp: String = ""
private var serverPort: Int = 0
Expand Down
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}

rootProject.name = "RTSP-Server"
include(":app", ":rtspserver")

0 comments on commit e2b4356

Please sign in to comment.