Skip to content

Commit

Permalink
Update toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
mrapplexz committed Apr 24, 2023
1 parent 4eb54f6 commit 548e60e
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 89 deletions.
15 changes: 9 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -25,6 +26,7 @@ fun NamedDomainObjectContainer<PluginDeclaration>.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"))
}
}

Expand Down Expand Up @@ -60,10 +62,11 @@ subprojects {
}
}

configure<PluginBundleExtension> {
website = "https://github.com/pearxteam/multigradle"
vcsUrl = "https://github.com/pearxteam/multigradle"
tags = listOf("kotlin", "multiplatform", "modular", "kotlin-multiplatform")


configure<GradlePluginDevelopmentExtension> {
website.set("https://github.com/pearxteam/multigradle")
vcsUrl.set("https://github.com/pearxteam/multigradle")
}

tasks {
Expand Down Expand Up @@ -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")
}
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<LibraryExtension>().alias({ compileSdkVersion!! }, { compileSdkVersion = it })
var buildToolsVersion: String by project.the<LibraryExtension>().alias({ buildToolsVersion }, { buildToolsVersion = it })
lateinit var junitVersion: String
private lateinit var _javaVersion: String
var javaVersion: String
get() = _javaVersion
set(value) {
_javaVersion = value
project.the<LibraryExtension>().compileOptions.targetCompatibility("1.$value")
project.the<LibraryExtension>().compileOptions.sourceCompatibility("1.$value")
project.kotlinMpp.android {
compilations.configureEach { kotlinOptions.jvmTarget = "1.$value" }
}
}
}

val Project.androidPackageName
get() = mutableListOf<String>().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<LibraryPlugin>()

val manifestPath = file("$buildDir/AndroidManifest.xml")

repositories {
google()
}
Expand All @@ -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"))
Expand All @@ -58,47 +67,6 @@ val AndroidPlatform = platform("android", listOf("testReleaseUnitTest", "testDeb
}

configure<LibraryExtension> {
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<String>().also {
it += project.group.toString()
it += project.name.split('-').drop(1)
}.joinToString(".") // todo a bit hacky :(
manifestPath.writeText("""
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="$pkg"/>
""".trimIndent())
}
}

configure<IdeaModel> {
(project as ExtensionAware).configure<ProjectSettings> {
(this as ExtensionAware).configure<TaskTriggersConfig> {
beforeSync(generateAndroidManifest)
}
}
}

withType<GenerateBuildConfig> {
dependsOn(generateAndroidManifest)
}
namespace = project.androidPackageName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 548e60e

Please sign in to comment.