diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68c760d7..e2956acb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 - name: Run unit tests - run: ./gradlew testReleaseUnitTest + run: ./gradlew test env: YOSPACE_USERNAME: ${{ secrets.YOSPACE_USERNAME }} YOSPACE_PASSWORD: ${{ secrets.YOSPACE_PASSWORD }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c353be07..fb86f123 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 - name: Build API documentation with Dokka - run: ./gradlew :dokkaHtmlMultiModule --no-configuration-cache + run: ./gradlew :dokkaGenerateHtml env: YOSPACE_USERNAME: ${{ secrets.YOSPACE_USERNAME }} YOSPACE_PASSWORD: ${{ secrets.YOSPACE_PASSWORD }} diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 6a005c85..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,80 +0,0 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.application - alias libs.plugins.kotlin.android - alias libs.plugins.compose.compiler -} - -android { - namespace 'com.theoplayer.android.connector' - compileSdk 36 - - defaultConfig { - applicationId "com.theoplayer.android.connector" - minSdk 23 - targetSdk 36 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } - - buildFeatures { - compose = true - } -} - -dependencies { - implementation libs.androidx.core.ktx - implementation libs.androidx.appcompat - implementation libs.kotlinx.coroutines.android - - def composeBom = platform(libs.androidx.compose.bom) - implementation(composeBom) - androidTestImplementation(composeBom) - implementation libs.androidx.activity.compose - implementation libs.androidx.lifecycle.compose - implementation libs.androidx.compose.material3 - implementation libs.androidx.compose.ui.ui - implementation libs.androidx.compose.ui.tooling.preview - debugImplementation libs.androidx.compose.ui.tooling - - implementation "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$sdkVersion" - implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:$sdkVersion" - implementation libs.theoplayer.android.ui - - implementation project(":connectors:analytics:conviva") - implementation libs.conviva - - implementation project(":connectors:analytics:nielsen") - implementation libs.nielsen - - implementation project(':connectors:analytics:comscore') - implementation libs.comscore - - // FIXME Re-enable Yospace connector - // implementation project(':connectors:yospace') - // implementation libs.yospace - - implementation project(':connectors:uplynk') -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..64c4ba6b --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,79 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.compose.compiler) +} + +android { + namespace = "com.theoplayer.android.connector" + compileSdk = 36 + + defaultConfig { + applicationId = "com.theoplayer.android.connector" + minSdk = 23 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + buildFeatures { + compose = true + } +} + +kotlin { + compilerOptions { + apiVersion = KotlinVersion.KOTLIN_2_0 + jvmTarget = JvmTarget.JVM_1_8 + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.kotlinx.coroutines.android) + + val composeBom = platform(libs.androidx.compose.bom) + implementation(composeBom) + androidTestImplementation(composeBom) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.lifecycle.compose) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.ui.ui) + implementation(libs.androidx.compose.ui.tooling.preview) + debugImplementation(libs.androidx.compose.ui.tooling) + + implementation(libs.theoplayer) + implementation(libs.theoplayer.integration.ima) + implementation(libs.theoplayer.integration.dai) + implementation(libs.theoplayer.android.ui) + + implementation(project(":connectors:analytics:conviva")) + implementation(libs.conviva) + + implementation(project(":connectors:analytics:nielsen")) + implementation(libs.nielsen) + + implementation(project(":connectors:analytics:comscore")) + implementation(libs.comscore) + + // FIXME Re-enable Yospace connector + // implementation(project(":connectors:yospace")) + // implementation(libs.yospace) + + implementation(project(":connectors:uplynk")) +} diff --git a/build-logic/convention/.gitignore b/build-logic/convention/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/build-logic/convention/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts new file mode 100644 index 00000000..5c9f2c28 --- /dev/null +++ b/build-logic/convention/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + `kotlin-dsl` +} + +dependencies { + compileOnly(libs.android.gradlePlugin) + compileOnly(libs.android.tools.common) + compileOnly(libs.kotlin.gradlePlugin) + compileOnly(libs.dokka.gradlePlugin) +} + +gradlePlugin { + plugins { + register("androidConnectorLibrary") { + id = libs.plugins.android.connector.library.get().pluginId + implementationClass = "AndroidConnectorLibraryConventionPlugin" + } + } +} + +tasks { + validatePlugins { + enableStricterValidation = true + failOnWarning = true + } +} diff --git a/build-logic/convention/src/main/kotlin/AndroidConnectorLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidConnectorLibraryConventionPlugin.kt new file mode 100644 index 00000000..8fb0548a --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidConnectorLibraryConventionPlugin.kt @@ -0,0 +1,129 @@ +import com.android.build.api.dsl.LibraryExtension +import extension.libs +import extension.versions +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.register +import org.jetbrains.dokka.gradle.DokkaExtension +import org.jetbrains.dokka.gradle.tasks.DokkaGenerateTask +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + +class AndroidConnectorLibraryConventionPlugin : Plugin { + override fun apply(target: Project) = with(target) { + apply(plugin = "com.android.library") + apply(plugin = "org.jetbrains.dokka") + apply(plugin = "org.jetbrains.dokka-javadoc") + apply(plugin = "maven-publish") + + extensions.configure { + compileSdk = 36 + + defaultConfig { + minSdk = 23 + consumerProguardFiles(file("consumer-rules.pro")) + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + file("proguard-rules.pro") + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + buildFeatures { + buildConfig = true + } + + publishing { + singleVariant("release") { + withSourcesJar() + // We use Dokka for JavaDoc generation, see dokkaJavadocJar below + // withJavadocJar() + } + } + } + + extensions.configure { + compilerOptions { + apiVersion.set(KotlinVersion.KOTLIN_2_0) + jvmTarget.set(JvmTarget.JVM_1_8) + } + } + + extensions.configure { + val connectorVersion = libs.versions.androidConnector + version = connectorVersion + + dokkaSourceSets.configureEach { + externalDocumentationLinks.register("com.theoplayer.android.api") { + url("https://optiview.dolby.com/docs/theoplayer/v10/api-reference/android/") + packageListUrl("https://optiview.dolby.com/docs/theoplayer/v10/api-reference/android/package-list") + } + + perPackageOption { + matchingRegex.set("com[.]theoplayer[.]android[.]connector[.].*[.]internal.*") + suppress.set(true) + } + } + } + + // https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar + val dokkaGeneratePublicationJavadoc = tasks.named("dokkaGeneratePublicationJavadoc") + val dokkaJavadocJar = tasks.register("dokkaJavadocJar") { + group = "dokka" + dependsOn(dokkaGeneratePublicationJavadoc) + from(dokkaGeneratePublicationJavadoc) + archiveClassifier.set("javadoc") + } + + extensions.configure { + repositories { + maven { + name = "reposilite" + url = uri("https://maven.theoplayer.com/releases") + credentials { + username = System.getenv("REPOSILITE_USERNAME") + password = System.getenv("REPOSILITE_PASSWORD") + } + } + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/THEOplayer/android-connector") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + + afterEvaluate { + publications { + register("release") { + groupId = "com.theoplayer.android-connector" + artifactId = project.name + version = libs.versions.androidConnector + artifact(dokkaJavadocJar) + from(components.getByName("release")) + } + } + } + } + } +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/extension/VersionCatalogExtensions.kt b/build-logic/convention/src/main/kotlin/extension/VersionCatalogExtensions.kt new file mode 100644 index 00000000..7fcf3786 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/extension/VersionCatalogExtensions.kt @@ -0,0 +1,28 @@ +package extension + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + +internal val Project.libs: VersionCatalog + get() = getVersionCatalog() + +private fun Project.getVersionCatalog(name: String = "libs"): VersionCatalog { + return extensions + .getByType() + .named(name) +} + +internal val VersionCatalog.versions: Versions + get() = Versions(this) + +internal class Versions(catalog: VersionCatalog) { + val androidConnector: String = catalog.findVersionOrThrow("androidConnector") +} + +private fun VersionCatalog.findVersionOrThrow(name: String): String { + return findVersion(name) + .orElseThrow { NoSuchElementException("Version $name not found in version catalog") } + .requiredVersion +} \ No newline at end of file diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 00000000..8338ba5b --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,21 @@ +dependencyResolutionManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + gradlePluginPortal() + mavenCentral() + } + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "build-logic" +include(":convention") \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e1661825..00000000 --- a/build.gradle +++ /dev/null @@ -1,88 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.dokka.gradle.DokkaMultiModuleTask - -import java.time.Year - -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.20" - } -} - -plugins { - alias libs.plugins.android.application apply false - alias libs.plugins.android.library apply false - alias libs.plugins.kotlin.android apply false - alias libs.plugins.compose.compiler apply false - alias libs.plugins.dokka - alias libs.plugins.kotlinx.serialization apply false -} - -tasks.register('updateVersion') { - def sdkVersion = project.ext.sdkVersion - ant.replaceregexp(file: 'gradle.properties', match: 'sdkVersion=.*', replace: "sdkVersion=$sdkVersion", flags: 'g', byline: true) - ant.replaceregexp(file: 'gradle.properties', match: 'connectorVersion=.*', replace: "connectorVersion=$sdkVersion", flags: 'g', byline: true) -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} - -tasks.withType(DokkaMultiModuleTask.class).configureEach { - moduleName = "THEOplayer Connectors for Android" - - String dokkaBaseConfiguration = """ - { - "customAssets": ["${file("assets/logo-icon.svg").path.replace('\\', "\\\\")}"], - "footerMessage": "© ${Year.now().value} THEO Technologies" - } - """ - pluginsMapConfiguration.set( - // fully qualified plugin name to json configuration - ["org.jetbrains.dokka.base.DokkaBase": dokkaBaseConfiguration] - ) -} - -tasks.dokkaHtmlMultiModule.configure { - outputDirectory = rootProject.file("site/api") -} - -subprojects { - version = connectorVersion - - tasks.withType(AbstractDokkaLeafTask.class).configureEach { - suppressObviousFunctions.set(true) - suppressInheritedMembers.set(true) - - dokkaSourceSets { - configureEach { - includeNonPublic.set(false) // Use to include or exclude non public members - skipDeprecated.set(false) // Do not output deprecated members. Applies globally, can be overridden by packageOptions - // Emit warnings about not documented members. Applies globally, also can be overridden by packageOptions - reportUndocumented.set(true) - skipEmptyPackages.set(false) // Do not create index pages for empty packages - jdkVersion.set(11) // Used for linking to JDK documentation - noStdlibLink.set(false) // Use to enable or disable linking to online kotlin-stdlib documentation - noJdkLink.set(false) // Use to enable or disable linking to online JDK documentation - // Use to enable or disable linking to online Android documentation (only applicable for Android projects) - noAndroidSdkLink.set(false) - - externalDocumentationLink { - url.set(new URL("https://www.theoplayer.com/docs/theoplayer/v7/api-reference/android/")) - // TODO: Fix link to https://www.theoplayer.com/docs/theoplayer/v7/api-reference/android/package-list - packageListUrl.set(new URL("https://raw.githubusercontent.com/THEOplayer/documentation/main/theoplayer/static/theoplayer/v7/api-reference/android/package-list")) - } - - perPackageOption { - matchingRegex.set("com[.]theoplayer[.]android[.]connector[.].*[.]internal.*") - suppress.set(true) - } - } - } - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..f5b1c581 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,71 @@ +import java.time.Year +import kotlin.text.Typography.copyright + +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20") + } +} + +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.compose.compiler) apply false + alias(libs.plugins.dokka) + alias(libs.plugins.kotlinx.serialization) apply false +} + +tasks.register("updateVersion") { + val versionCatalog = rootProject.file("gradle/libs.versions.toml") + inputs.file(versionCatalog) + + val sdkVersion: String? by project.ext + require(!sdkVersion.isNullOrBlank()) { "Missing sdkVersion" } + + ant.withGroovyBuilder { + "replaceregexp"( + "file" to versionCatalog, + "match" to """^theoplayer = ".+"$""", + "replace" to """theoplayer = "$sdkVersion"""", + "byline" to true + ) + "replaceregexp"( + "file" to versionCatalog, + "match" to """^androidConnector = ".+"$""", + "replace" to """androidConnector = "$sdkVersion"""", + "byline" to true + ) + } +} + +dependencies { + dokka(project(":connectors:analytics:comscore")) + dokka(project(":connectors:analytics:conviva")) + dokka(project(":connectors:analytics:nielsen")) + dokka(project(":connectors:mediasession")) + // FIXME Re-enable Yospace connector + // dokka(project(":connectors:yospace")) + dokka(project(":connectors:uplynk")) +} + +dokka { + val connectorVersion: String = libs.versions.androidConnector.get() + + moduleName = "THEOplayer Connectors for Android" + version = connectorVersion + + pluginsConfiguration.html { + customAssets.from("assets/logo-icon.svg") + footerMessage = + "$copyright ${Year.now().value} Dolby Laboratories, Inc. All rights reserved." + } + + dokkaPublications.html { + outputDirectory = rootDir.resolve("site/api") + } +} diff --git a/connectors/analytics/comscore/build.gradle b/connectors/analytics/comscore/build.gradle deleted file mode 100644 index 93e0409e..00000000 --- a/connectors/analytics/comscore/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.analytics.comscore' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } - - buildFeatures { - buildConfig true - } -} - -dependencies { - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$sdkVersion" - - compileOnly libs.comscore -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Comscore Connector" -} diff --git a/connectors/analytics/comscore/build.gradle.kts b/connectors/analytics/comscore/build.gradle.kts new file mode 100644 index 00000000..995dfb21 --- /dev/null +++ b/connectors/analytics/comscore/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + alias(libs.plugins.android.connector.library) +} + +android { + namespace = "com.theoplayer.android.connector.analytics.comscore" + + buildFeatures { + buildConfig = true + } +} + +dependencies { + compileOnly(libs.theoplayer) + compileOnly(libs.theoplayer.integration.ima) + + compileOnly(libs.comscore) +} + +dokka { + moduleName = "Comscore Connector" +} diff --git a/connectors/analytics/conviva/build.gradle b/connectors/analytics/conviva/build.gradle deleted file mode 100644 index 48cb0173..00000000 --- a/connectors/analytics/conviva/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.analytics.conviva' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } - - buildFeatures { - buildConfig true - } -} - -dependencies { - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$sdkVersion" - compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:$sdkVersion" - compileOnly libs.conviva - - implementation libs.androidx.lifecycle.process -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Conviva Connector" -} diff --git a/connectors/analytics/conviva/build.gradle.kts b/connectors/analytics/conviva/build.gradle.kts new file mode 100644 index 00000000..64dac1f7 --- /dev/null +++ b/connectors/analytics/conviva/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + alias(libs.plugins.android.connector.library) +} + +android { + namespace = "com.theoplayer.android.connector.analytics.conviva" + + buildFeatures { + buildConfig = true + } +} + +dependencies { + compileOnly(libs.theoplayer) + compileOnly(libs.theoplayer.integration.ima) + compileOnly(libs.theoplayer.integration.theoads) + compileOnly(libs.conviva) + + implementation(libs.androidx.lifecycle.process) +} + +dokka { + moduleName = "Conviva Connector" +} diff --git a/connectors/analytics/nielsen/build.gradle b/connectors/analytics/nielsen/build.gradle deleted file mode 100644 index 4c867188..00000000 --- a/connectors/analytics/nielsen/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.analytics.nielsen' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } -} - -dependencies { - implementation libs.androidx.lifecycle.process - - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$sdkVersion" - compileOnly libs.nielsen -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Nielsen Connector" -} - diff --git a/connectors/analytics/nielsen/build.gradle.kts b/connectors/analytics/nielsen/build.gradle.kts new file mode 100644 index 00000000..b3737769 --- /dev/null +++ b/connectors/analytics/nielsen/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + alias(libs.plugins.android.connector.library) +} + +android { + namespace = "com.theoplayer.android.connector.analytics.nielsen" +} + +dependencies { + implementation(libs.androidx.lifecycle.process) + + compileOnly(libs.theoplayer) + compileOnly(libs.theoplayer.integration.ima) + compileOnly(libs.nielsen) +} + +dokka { + moduleName = "Nielsen Connector" +} + diff --git a/connectors/mediasession/build.gradle b/connectors/mediasession/build.gradle deleted file mode 100644 index f48ebe93..00000000 --- a/connectors/mediasession/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.mediasession' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } - - buildFeatures { - buildConfig true - } -} - -dependencies { - implementation libs.androidx.media - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Media Session Connector" -} diff --git a/connectors/mediasession/build.gradle.kts b/connectors/mediasession/build.gradle.kts new file mode 100644 index 00000000..25adddbe --- /dev/null +++ b/connectors/mediasession/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + alias(libs.plugins.android.connector.library) +} + +android { + namespace = "com.theoplayer.android.connector.mediasession" +} + +dependencies { + implementation(libs.androidx.media) + compileOnly(libs.theoplayer) +} + +dokka { + moduleName = "Media Session Connector" +} diff --git a/connectors/publish.gradle b/connectors/publish.gradle deleted file mode 100644 index 789e864d..00000000 --- a/connectors/publish.gradle +++ /dev/null @@ -1,51 +0,0 @@ -apply plugin: 'maven-publish' - -android { - publishing { - singleVariant("release") { - withSourcesJar() - // We use Dokka for JavaDoc generation, see dokkaJavadocJar below - // withJavadocJar() - } - } -} - -tasks.register("dokkaJavadocJar", Jar) { - group = "documentation" - dependsOn(tasks.dokkaJavadoc) - from(tasks.dokkaJavadoc) - archiveClassifier.set("javadoc") -} - -afterEvaluate { - publishing { - repositories { - maven { - name = "reposilite" - url = uri("https://maven.theoplayer.com/releases") - credentials { - username = System.getenv("REPOSILITE_USERNAME") - password = System.getenv("REPOSILITE_PASSWORD") - } - } - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/THEOplayer/android-connector") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } - - publications { - release(MavenPublication) { - groupId project.ext.groupId - artifactId project.name - version project.ext.connectorVersion - artifact(tasks.dokkaJavadocJar) - from components.release - } - } - } -} diff --git a/connectors/uplynk/build.gradle b/connectors/uplynk/build.gradle deleted file mode 100644 index f3a5e554..00000000 --- a/connectors/uplynk/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.kotlinx.serialization - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.uplynk' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } -} - -dependencies { - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - implementation libs.kotlinx.serialization.json - implementation libs.kotlinx.coroutines.android - - testImplementation libs.junit - testImplementation "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - testImplementation libs.mockito.inline - testImplementation libs.mockito.kotlin - testImplementation libs.kotlin.test.junit - androidTestImplementation libs.androidx.test.ext.junit - androidTestImplementation libs.androidx.test.espresso.core -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Uplynk Connector" -} \ No newline at end of file diff --git a/connectors/uplynk/build.gradle.kts b/connectors/uplynk/build.gradle.kts new file mode 100644 index 00000000..219a3dbc --- /dev/null +++ b/connectors/uplynk/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + alias(libs.plugins.android.connector.library) + alias(libs.plugins.kotlinx.serialization) +} + +android { + namespace = "com.theoplayer.android.connector.uplynk" +} + +dependencies { + compileOnly(libs.theoplayer) + implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.coroutines.android) + + testImplementation(libs.junit) + testImplementation(libs.theoplayer) + testImplementation(libs.mockito.inline) + testImplementation(libs.mockito.kotlin) + testImplementation(libs.kotlin.test.junit) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.androidx.test.espresso.core) +} + +dokka { + moduleName = "Uplynk Connector" +} \ No newline at end of file diff --git a/connectors/yospace/build.gradle b/connectors/yospace/build.gradle deleted file mode 100644 index eff57cb7..00000000 --- a/connectors/yospace/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - -plugins { - alias libs.plugins.android.library - alias libs.plugins.kotlin.android - alias libs.plugins.kotlinx.serialization - alias libs.plugins.dokka -} -apply from: "$rootDir/connectors/publish.gradle" - -android { - namespace 'com.theoplayer.android.connector.yospace' - compileSdk 36 - - defaultConfig { - minSdk 23 - consumerProguardFiles "consumer-rules.pro" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - buildConfigField("String", "LIBRARY_VERSION", "\"${connectorVersion}\"") - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlin { - compilerOptions { - apiVersion = KotlinVersion.KOTLIN_2_0 - jvmTarget = JvmTarget.JVM_1_8 - } - } - - buildFeatures { - buildConfig true - } -} - -dependencies { - implementation libs.androidx.core.ktx - compileOnly "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - compileOnly(libs.yospace) { - version { - strictly("[3.6, 4.0)") - prefer(libs.yospace.get().version) - } - } - implementation libs.kotlinx.serialization.json - - // Tests - testImplementation libs.androidx.test.core - testImplementation libs.androidx.test.ext.junit - testImplementation "com.theoplayer.theoplayer-sdk-android:core:$sdkVersion" - testImplementation libs.yospace -} - -tasks.withType(AbstractDokkaLeafTask.class).configureEach { - moduleName = "Yospace Connector" - - dokkaSourceSets.named("main") { - samples.from(project.fileTree("src/test/java/")) - } -} diff --git a/connectors/yospace/build.gradle.kts b/connectors/yospace/build.gradle.kts new file mode 100644 index 00000000..32541aeb --- /dev/null +++ b/connectors/yospace/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + alias(libs.plugins.android.connector.library) + alias(libs.plugins.kotlinx.serialization) +} + +android { + namespace = "com.theoplayer.android.connector.yospace" + + defaultConfig { + val connectorVersion = libs.versions.androidConnector.get() + buildConfigField("String", "LIBRARY_VERSION", "\"${connectorVersion}\"") + } + + buildFeatures { + buildConfig = true + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + compileOnly(libs.theoplayer) + compileOnly(libs.yospace) + implementation(libs.kotlinx.serialization.json) + + // Tests + testImplementation(libs.androidx.test.core) + testImplementation(libs.androidx.test.ext.junit) + testImplementation(libs.theoplayer) + testImplementation(libs.yospace) +} + +dokka { + moduleName = "Yospace Connector" + +// dokkaSourceSets.named("main") { +// samples.from(project.fileTree("src/test/java/")) +// } +} diff --git a/gradle.properties b/gradle.properties index 97da00f9..591ee07d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,5 +23,4 @@ kotlin.code.style=official android.nonTransitiveRClass=true android.nonFinalResIds=true groupId=com.theoplayer.android-connector -sdkVersion=10.12.1 -connectorVersion=10.12.1 +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled \ No newline at end of file diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 00000000..2ff97572 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,13 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/56a19bc915b9ba2eb62ba7554c61b919/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/10fc3bf1ee0001078a473afe6e43cfdb/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/658299a896470fbb3103ba3a430ee227/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/56a19bc915b9ba2eb62ba7554c61b919/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e55dccbfe27cb97945148c61a39c89c5/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/056dc25d3b9d168ede8b94d3d2f99942/redirect +toolchainVendor=JETBRAINS +toolchainVersion=21 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3a9ea036..b653b85f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,11 @@ [versions] -androidGradlePlugin = "8.13.0" +androidConnector = "10.12.1" +androidGradlePlugin = "9.1.0" +androidTools = "32.1.0" kotlin = "2.2.10" kotlinxSerialization = "2.2.10" kotlinxSerializationJson = "1.9.0" -dokka = "1.9.20" +dokka = "2.2.0" androidxAppCompat = "1.7.1" androidxActivity = "1.10.1" androidxCore = "1.17.0" @@ -12,6 +14,7 @@ androidxComposeBom = "2025.08.01" androidxLifecycle = "2.5.1" androidxMedia = "1.7.1" kotlinxCoroutines = "1.10.2" +theoplayer = "10.12.1" theoplayerAndroidUi = "1.13.0" junit = "4.13.2" kotlinTestJunit = "2.2.10" @@ -23,7 +26,7 @@ androidxTestExt = "1.3.0" conviva = "4.0.43" nielsen = "9.2.0.0" comscore = "6.10.0" -yospace = "3.6.7" +yospace = { strictly = "[3.6, 4.0)", prefer = "3.6.7" } [libraries] androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppCompat" } @@ -47,16 +50,28 @@ kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" junit = { group = "junit", name = "junit", version.ref = "junit" } mockito-inline = { group = "org.mockito", name = "mockito-inline", version.ref = "mockito" } mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version.ref = "mockitoKotlin" } +theoplayer = { group = "com.theoplayer.theoplayer-sdk-android", name = "core", version.ref = "theoplayer" } +theoplayer-integration-dai = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-dai", version.ref = "theoplayer" } +theoplayer-integration-ima = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-ima", version.ref = "theoplayer" } +theoplayer-integration-theoads = { group = "com.theoplayer.theoplayer-sdk-android", name = "integration-ads-theoads", version.ref = "theoplayer" } theoplayer-android-ui = { group = "com.theoplayer.android-ui", name = "android-ui", version.ref = "theoplayerAndroidUi" } conviva = { group = "com.conviva.sdk", name = "conviva-core-sdk", version.ref = "conviva" } nielsen = { group = "com.nielsenappsdk.global", name = "ad", version.ref = "nielsen" } comscore = { group = "com.comscore", name = "android-analytics", version.ref = "comscore" } yospace = { group = "com.yospace", name = "admanagement-sdk", version.ref = "yospace" } +# build-logic +android-gradlePlugin = { group = "com.android.tools.build", name = "gradle-api", version.ref = "androidGradlePlugin" } +android-tools-common = { group = "com.android.tools", name = "common", version.ref = "androidTools" } +kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +dokka-gradlePlugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" } + [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } -kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlinxSerialization" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + +# build-logic +android-connector-library = { id = "com.theoplayer.android.connector.library" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 047da3f0..559ff8d6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Sep 06 12:39:24 CEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 7c39f840..00000000 --- a/settings.gradle +++ /dev/null @@ -1,34 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - mavenCentral() - } -} - -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - maven { url 'https://maven.theoplayer.com/releases/' } - maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/' } - maven { - url 'https://yospacerepo.jfrog.io/yospacerepo/android-sdk' - credentials { - username System.getenv("YOSPACE_USERNAME") - password System.getenv("YOSPACE_PASSWORD") - } - } - } -} - -rootProject.name = "THEOplayer Connector" -include ':app' -include ':connectors:analytics:comscore' -include ':connectors:analytics:conviva' -include ':connectors:analytics:nielsen' -include ':connectors:mediasession' -// FIXME Re-enable Yospace connector after updating JFrog credentials -// include ':connectors:yospace' -include ':connectors:uplynk' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..c1fb495b --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,39 @@ +pluginManagement { + includeBuild("build-logic") + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url = uri("https://maven.theoplayer.com/releases/") } + maven { url = uri("https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/") } + maven { + url = uri("https://yospacerepo.jfrog.io/yospacerepo/android-sdk") + credentials { + username = System.getenv("YOSPACE_USERNAME") + password = System.getenv("YOSPACE_PASSWORD") + } + } + } +} + +rootProject.name = "THEOplayer Connector" +include(":app") +include(":connectors:analytics:comscore") +include(":connectors:analytics:conviva") +include(":connectors:analytics:nielsen") +include(":connectors:mediasession") +// FIXME Re-enable Yospace connector after updating JFrog credentials +// include(":connectors:yospace") +include(":connectors:uplynk")