From e218458d57b5333aec87a6b43ff9b932fc547944 Mon Sep 17 00:00:00 2001 From: shabinder Date: Fri, 27 Aug 2021 00:48:12 +0530 Subject: [PATCH] AGP 7.0.1, Ffmpeg submodule and fixes --- .gitmodules | 9 ++--- android/build.gradle.kts | 13 ++++--- build.gradle.kts | 7 +++- buildSrc/buildSrc/src/main/kotlin/Versions.kt | 35 ++++++++++++++++--- .../src/main/kotlin/android-setup.gradle.kts | 6 ++-- .../kotlin/multiplatform-setup.gradle.kts | 16 ++++++--- .../media_converter/AndroidMediaConverter.kt | 1 - ffmpeg-android-maker | 1 + ffmpeg-kit | 1 - gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 +-- settings.gradle.kts | 1 - web-app/build.gradle.kts | 15 +++++--- 13 files changed, 75 insertions(+), 36 deletions(-) create mode 160000 ffmpeg-android-maker delete mode 160000 ffmpeg-kit diff --git a/.gitmodules b/.gitmodules index 1e6d2ea1..1b3e249b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "spotiflyer-ios"] path = spotiflyer-ios url = https://github.com/Shabinder/spotiflyer-ios -[submodule "mosaic"] - path = mosaic - url = https://github.com/JakeWharton/mosaic -[submodule "ffmpeg-kit"] - path = ffmpeg-kit - url = https://github.com/tanersener/ffmpeg-kit +[submodule "ffmpeg-android-maker"] + path = ffmpeg-android-maker + url = https://github.com/Shabinder/ffmpeg-android-maker diff --git a/android/build.gradle.kts b/android/build.gradle.kts index a2fbb11c..d91a8178 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -31,9 +31,6 @@ version = Versions.versionName repositories { google() mavenCentral() - // Remove jcenter as soon as following issue closes - // https://github.com/matomo-org/matomo-sdk-android/issues/301 - jcenter() } android { @@ -50,13 +47,13 @@ android { } } - compileSdkVersion(Versions.compileSdkVersion) + compileSdk = Versions.compileSdkVersion buildToolsVersion = "30.0.3" defaultConfig { applicationId = "com.shabinder.spotiflyer" - minSdkVersion(Versions.minSdkVersion) - targetSdkVersion(Versions.targetSdkVersion) + minSdk = Versions.minSdkVersion + targetSdk = Versions.targetSdkVersion versionCode = Versions.versionCode versionName = Versions.versionName } @@ -90,7 +87,9 @@ android { } } packagingOptions { - exclude("META-INF/*") + resources.excludes.apply { + add("META-INF/*") + } } } dependencies { diff --git a/build.gradle.kts b/build.gradle.kts index 1e039b6d..5bbf0d10 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,9 +27,14 @@ allprojects { // mavenLocal() maven(url = "https://jitpack.io") maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") - maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers") maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") } + /*Fixes: Could not resolve org.nodejs:node*/ + plugins.withType { + configure { + download = false + } + } tasks.withType().configureEach { dependsOn(":common:data-models:generateI18n4kFiles") kotlinOptions { jvmTarget = "1.8" } diff --git a/buildSrc/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/buildSrc/src/main/kotlin/Versions.kt index 059e313b..ae985a32 100644 --- a/buildSrc/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/buildSrc/src/main/kotlin/Versions.kt @@ -16,11 +16,17 @@ @file:Suppress("MayBeConstant", "SpellCheckingInspection") +import org.gradle.api.Action +import org.gradle.api.artifacts.ExternalModuleDependency +import org.gradle.api.artifacts.dsl.DependencyHandler +import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo + object Versions { // App's Version (To be bumped at each update) const val versionName = "3.2.11" const val versionCode = 23 + // Kotlin const val kotlinVersion = "1.5.21" @@ -64,15 +70,23 @@ object Versions { object HostOS { // Host OS Properties private val hostOs = System.getProperty("os.name") - val isMingwX64 = hostOs.startsWith("Windows",true) - val isMac = hostOs.startsWith("Mac",true) - val isLinux = hostOs.startsWith("Linux",true) + val isMingwX64 = hostOs.startsWith("Windows", true) + val isMac = hostOs.startsWith("Mac", true) + val isLinux = hostOs.startsWith("Linux", true) } object MultiPlatformSettings { const val dep = "com.russhwolf:multiplatform-settings-no-arg:0.7.7" } +object KotlinJSWrappers { + private const val bomVersion = "0.0.1-pre.235-kotlin-1.5.21" + val bom = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${bomVersion}" + const val kotlinReact = "org.jetbrains.kotlin-wrappers:kotlin-react" + const val kotlinReactDom = "org.jetbrains.kotlin-wrappers:kotlin-react-dom" + const val kotlinStyled = "org.jetbrains.kotlin-wrappers:kotlin-styled" +} + object Koin { val core = "io.insert-koin:koin-core:${Versions.koin}" val test = "io.insert-koin:koin-test:${Versions.koin}" @@ -89,7 +103,7 @@ object Androidx { const val junit = "androidx.test.ext:junit:1.1.2" const val expresso = "androidx.test.espresso:espresso-core:3.3.0" - const val gradlePlugin = "com.android.tools.build:gradle:4.1.1" + const val gradlePlugin = "com.android.tools.build:gradle:7.0.1" } object KTLint { @@ -103,7 +117,8 @@ object JetBrains { const val serialization = "org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlinVersion}" const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:${Versions.kotlinVersion}" const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.kotlinVersion}" - const val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:${Versions.kotlinVersion}" + const val testAnnotationsCommon = + "org.jetbrains.kotlin:kotlin-test-annotations-common:${Versions.kotlinVersion}" } object Compose { @@ -112,6 +127,7 @@ object JetBrains { const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } + object Mosaic { const val gradlePlugin = "com.jakewharton.mosaic:mosaic-gradle-plugin:${Versions.mosaic}" } @@ -165,11 +181,13 @@ object Extras { const val mp3agic = "com.mpatric:mp3agic:0.9.0" const val jaudioTagger = "com.github.Shabinder:JAudioTagger-Android:1.0" const val kermit = "co.touchlab:kermit:${Versions.kermit}" + object Android { // Self Hosted Analytics & Crashlytics (FOSS) val countly = "ly.count.android:sdk:20.11.8" val appUpdator = "com.github.amitbd1508:AppUpdater:4.1.0" } + object Desktop { val countly = "ly.count.sdk:java:20.11.0" } @@ -190,3 +208,10 @@ object SqlDelight { val nativeDriverMacos = "com.squareup.sqldelight:native-driver-macosx64:${Versions.sqlDelight}" val jdbcDriver = "org.xerial:sqlite-jdbc:${Versions.sqliteJdbcDriver}" } + +fun DependencyHandler.`implementation`( + dependencyNotation: String, + dependencyConfiguration: ExternalModuleDependency.() -> Unit +): ExternalModuleDependency = addDependencyTo( + this, "implementation", dependencyNotation +) { dependencyConfiguration() } diff --git a/buildSrc/src/main/kotlin/android-setup.gradle.kts b/buildSrc/src/main/kotlin/android-setup.gradle.kts index 3db175be..ff2ba9e1 100644 --- a/buildSrc/src/main/kotlin/android-setup.gradle.kts +++ b/buildSrc/src/main/kotlin/android-setup.gradle.kts @@ -22,11 +22,11 @@ plugins { } android { - compileSdkVersion(Versions.compileSdkVersion) + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdkVersion(Versions.minSdkVersion) - targetSdkVersion(Versions.targetSdkVersion) + minSdk = Versions.minSdkVersion + targetSdk = Versions.targetSdkVersion } compileOptions { diff --git a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts index 3e77b378..f0c9619c 100644 --- a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts +++ b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts @@ -38,7 +38,11 @@ kotlin { android() js(BOTH) { - browser() + browser { + commonWebpackConfig { + cssSupport.enabled = true + } + } // nodejs() } @@ -102,9 +106,13 @@ kotlin { named("jsMain") { dependencies { implementation(Ktor.clientJs) - implementation("org.jetbrains.kotlin-wrappers:kotlin-react:17.0.2-pre.213-kotlin-1.5.10") - implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:17.0.2-pre.213-kotlin-1.5.10") - implementation("org.jetbrains.kotlin-wrappers:kotlin-styled:5.3.0-pre.213-kotlin-1.5.10") + + /*with(KotlinJSWrappers) { + implementation(enforcedPlatform(bom)) + implementation(kotlinReact) + implementation(kotlinReactDom) + implementation(kotlinStyled) + }*/ } } if(HostOS.isMac){ diff --git a/common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AndroidMediaConverter.kt b/common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AndroidMediaConverter.kt index 8e485f52..ae2c9734 100644 --- a/common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AndroidMediaConverter.kt +++ b/common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AndroidMediaConverter.kt @@ -43,7 +43,6 @@ class AndroidMediaConverter : MediaConverter() { else -> throw SpotiFlyerException.MP3ConversionFailed("FFmpeg Conversion Failed for $inputFilePath") } } - } internal actual fun mediaConverterModule() = module { diff --git a/ffmpeg-android-maker b/ffmpeg-android-maker new file mode 160000 index 00000000..be40713a --- /dev/null +++ b/ffmpeg-android-maker @@ -0,0 +1 @@ +Subproject commit be40713aab45168d90f0ac117e454c17d38563b1 diff --git a/ffmpeg-kit b/ffmpeg-kit deleted file mode 160000 index 33c8cbe2..00000000 --- a/ffmpeg-kit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 33c8cbe27b8c99cedf795b54d7b76a28a2809df8 diff --git a/gradle.properties b/gradle.properties index 2af2d0a0..b2589535 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx3072m +org.gradle.jvmargs=-Xmx2048m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 51d930a3..66b43b88 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +#distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 77d4cc80..a19d65bc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,7 +27,6 @@ include( ":common:providers", ":common:core-components", ":common:dependency-injection", - ":ffmpeg-kit:android:ffmpeg-kit-android-lib", ":android", ":desktop", ":web-app", diff --git a/web-app/build.gradle.kts b/web-app/build.gradle.kts index c18bd2ea..e13b2509 100644 --- a/web-app/build.gradle.kts +++ b/web-app/build.gradle.kts @@ -23,7 +23,7 @@ version = "0.1" repositories { mavenCentral() - maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers") + //maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers") } dependencies { @@ -46,17 +46,24 @@ dependencies { implementation("co.touchlab:stately-common:1.1.7") implementation("dev.icerock.moko:parcelize:${Versions.mokoParcelize}") // implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2") { // https://youtrack.jetbrains.com/issue/KTOR-2670 + @Suppress("DEPRECATION") isForce = true } + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1-native-mt") { @Suppress("DEPRECATION") isForce = true } - implementation("org.jetbrains.kotlin-wrappers:kotlin-react:17.0.2-pre.213-kotlin-1.5.10") - implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:17.0.2-pre.213-kotlin-1.5.10") - implementation("org.jetbrains.kotlin-wrappers:kotlin-styled:5.3.0-pre.213-kotlin-1.5.10") + + with(KotlinJSWrappers) { + implementation(enforcedPlatform(bom)) + implementation(kotlinReact) + implementation(kotlinReactDom) + implementation(kotlinStyled) + } } kotlin {