diff --git a/build.gradle.kts b/build.gradle.kts index 3b9ae43..35c7fb5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ + import com.github.breadmoirai.githubreleaseplugin.GithubReleaseExtension -import com.gradle.publish.PluginBundleExtension import com.gradle.publish.PublishPlugin import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -14,6 +14,7 @@ val projectDescription: String by project val projectChangelog: String by project val kotlinVersion: String by project val androidBuildToolsVersion: String by project +val dokkaVersion: String by project val ideaExtVersion: String by project val devBuildNumber: String? by project @@ -25,6 +26,7 @@ fun NamedDomainObjectContainer.createMultiGradlePlugin(type: displayName = "MultiGradle ${type.capitalize()} [${applicableTo.capitalize()}]" description = projectDescription.replace("%type%", type) implementationClass = "net.pearx.multigradle.plugin.$type.MultiGradle${type.capitalize()}${applicableTo.capitalize()}" + tags.set(listOf("kotlin", "multiplatform", "modular", "kotlin-multiplatform")) } } @@ -60,10 +62,11 @@ subprojects { } } - configure { - website = "https://github.com/pearxteam/multigradle" - vcsUrl = "https://github.com/pearxteam/multigradle" - tags = listOf("kotlin", "multiplatform", "modular", "kotlin-multiplatform") + + + configure { + website.set("https://github.com/pearxteam/multigradle") + vcsUrl.set("https://github.com/pearxteam/multigradle") } tasks { @@ -92,7 +95,7 @@ project(":multigradle") { dependencies { "implementation"("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion") "api"("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - "api"("org.jetbrains.dokka:dokka-gradle-plugin:$kotlinVersion") + "api"("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion") "api"("com.android.tools.build:gradle:$androidBuildToolsVersion") "api"("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:$ideaExtVersion") } diff --git a/gradle.properties b/gradle.properties index 657adb9..15bca0c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,11 @@ -projectVersion=1.11.0 +projectVersion=1.12.0 projectChangelog=Update dependencies, disable generation of Javadocs for JVM platofrm projectDescription=A Gradle plugin that simplifies the creation of %type% multiplatform Kotlin projects. -kotlinVersion=1.4.32 -pluginPublishVersion=1.0.0-rc-2 -githubReleaseVersion=2.3.7 -androidBuildToolsVersion=7.2.1 -ideaExtVersion=1.1.4 +kotlinVersion=1.8.20 +dokkaVersion=1.8.10 +pluginPublishVersion=1.1.0 +githubReleaseVersion=2.4.1 +androidBuildToolsVersion=7.4.2 +ideaExtVersion=1.1.5 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..ccebba7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fc..5083229 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..79a61d4 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..6689b85 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/AndroidPlatform.kt b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/AndroidPlatform.kt index 9676fcb..e0a44e5 100644 --- a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/AndroidPlatform.kt +++ b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/AndroidPlatform.kt @@ -9,28 +9,37 @@ package net.pearx.multigradle.util.platform import com.android.build.gradle.LibraryExtension import com.android.build.gradle.LibraryPlugin -import com.android.build.gradle.tasks.GenerateBuildConfig import net.pearx.multigradle.util.alias import net.pearx.multigradle.util.kotlinMpp import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.plugins.ExtensionAware import org.gradle.kotlin.dsl.* -import org.gradle.plugins.ide.idea.model.IdeaModel -import org.jetbrains.gradle.ext.ProjectSettings -import org.jetbrains.gradle.ext.TaskTriggersConfig class AndroidPlatformConfig(project: Project) : PlatformConfig(project) { var compileSdkVersion: String by project.the().alias({ compileSdkVersion!! }, { compileSdkVersion = it }) var buildToolsVersion: String by project.the().alias({ buildToolsVersion }, { buildToolsVersion = it }) lateinit var junitVersion: String + private lateinit var _javaVersion: String + var javaVersion: String + get() = _javaVersion + set(value) { + _javaVersion = value + project.the().compileOptions.targetCompatibility("1.$value") + project.the().compileOptions.sourceCompatibility("1.$value") + project.kotlinMpp.android { + compilations.configureEach { kotlinOptions.jvmTarget = "1.$value" } + } + } } +val Project.androidPackageName + get() = mutableListOf().also { + it += project.group.toString() + it += project.name.split('-').drop(1) + }.joinToString(".") // todo a bit hacky :( + val AndroidPlatform = platform("android", listOf("testReleaseUnitTest", "testDebugUnitTest"), { AndroidPlatformConfig(it) }) { ext -> apply() - val manifestPath = file("$buildDir/AndroidManifest.xml") - repositories { google() } @@ -43,7 +52,7 @@ val AndroidPlatform = platform("android", listOf("testReleaseUnitTest", "testDeb implementation(kotlin("stdlib")) } } - named("androidTest") { + named("androidUnitTest") { dependencies { implementation(kotlin("test-annotations-common")) implementation(kotlin("test-junit")) @@ -58,47 +67,6 @@ val AndroidPlatform = platform("android", listOf("testReleaseUnitTest", "testDeb } configure { - defaultConfig { - - } - buildTypes.configureEach { - sourceSets.configureEach { - manifest.srcFile(manifestPath) - } - } - } - - - tasks { - val generateAndroidManifest by registering(Task::class) { - with(inputs) { - property("group", project.group) - property("name", project.name) - } - outputs.file(manifestPath) - doLast { - val pkg = mutableListOf().also { - it += project.group.toString() - it += project.name.split('-').drop(1) - }.joinToString(".") // todo a bit hacky :( - manifestPath.writeText(""" - - - """.trimIndent()) - } - } - - configure { - (project as ExtensionAware).configure { - (this as ExtensionAware).configure { - beforeSync(generateAndroidManifest) - } - } - } - - withType { - dependsOn(generateAndroidManifest) - } + namespace = project.androidPackageName } } \ No newline at end of file diff --git a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/JsPlatform.kt b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/JsPlatform.kt index f65e2cf..34e2b15 100644 --- a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/JsPlatform.kt +++ b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/JsPlatform.kt @@ -16,7 +16,7 @@ class JsPlatformConfig(project: Project) : PlatformConfig(project) val JsPlatform = platform("js", listOf("jsTest"), { JsPlatformConfig(it) }) { kotlinMpp { - js { + js(IR) { nodejs { testTask { useMocha() diff --git a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/NativePlatforms.kt b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/NativePlatforms.kt index eef01a5..f103497 100644 --- a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/NativePlatforms.kt +++ b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/NativePlatforms.kt @@ -25,23 +25,16 @@ private val nativeSourceSetRelations = mapOf( val LinuxX64Platform = nativePlatform("linuxX64", "linux", test = true) val LinuxArm64Platform = nativePlatform("linuxArm64", "linux") -val LinuxArm32HfpPlatform = nativePlatform("linuxArm32Hfp", "linux") -val LinuxMips32Platform = nativePlatform("linuxMips32", "linux") -val LinuxMipsel32Platform = nativePlatform("linuxMipsel32", "linux") val AndroidNativeArm32Platform = nativePlatform("androidNativeArm32", "androidNative") val AndroidNativeArm64Platform = nativePlatform("androidNativeArm64", "androidNative") val TvOsArm32Platform = nativePlatform("tvosArm64", "tvos") val TvOsX64Platform = nativePlatform("tvosX64", "tvos", test = true) -val IOsArm32Platform = nativePlatform("iosArm32", "ios") val IOsArm64Platform = nativePlatform("iosArm64", "ios") val IOsX64Platform = nativePlatform("iosX64", "ios", test = true) val WatchOsArm32Platform = nativePlatform("watchosArm32", "watchos") val WatchOsArm64Platform = nativePlatform("watchosArm64", "watchos") -val WatchOsX86Platform = nativePlatform("watchosX86", "watchos", test = true) val MacOsX64Platform = nativePlatform("macosX64", "macos", test = true) val MingwX64Platform = nativePlatform("mingwX64", "mingw", test = true) -val MingwX86Platform = nativePlatform("mingwX86", "mingw") -val Wasm32Platform = nativePlatform("wasm32", "wasm") private fun KotlinMultiplatformExtension.createConfiguration(name: String): KotlinSourceSet { return if (ideaActive) { // hack. idea doesn't go well with common native source sets as good as gradle does. diff --git a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/Platforms.kt b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/Platforms.kt index 297c256..62805ac 100644 --- a/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/Platforms.kt +++ b/multigradle/src/main/kotlin/net/pearx/multigradle/util/platform/Platforms.kt @@ -52,21 +52,14 @@ val PLATFORMS = setOf( AndroidPlatform, LinuxX64Platform, LinuxArm64Platform, - LinuxArm32HfpPlatform, - LinuxMips32Platform, - LinuxMipsel32Platform, AndroidNativeArm32Platform, AndroidNativeArm64Platform, TvOsArm32Platform, TvOsX64Platform, - IOsArm32Platform, IOsArm64Platform, IOsX64Platform, WatchOsArm32Platform, WatchOsArm64Platform, - WatchOsX86Platform, MacOsX64Platform, - MingwX86Platform, MingwX64Platform, - Wasm32Platform ).associateBy { p -> p.name } \ No newline at end of file