Skip to content

Commit

Permalink
Changes to use dart 3.0.0:
Browse files Browse the repository at this point in the history
- Reintroduce klutterGetKradleTask.
- Use klutter-dart to build native executable.
- Make al files executable when unzipping to prevent script problems.
- Use klutter-dart 3.0.0 for iOS init and delete init tasks from kore module.
- Bump Jetbrains dependency, use newer platform api.
- Project cleanup.
  • Loading branch information
buijs-dev committed May 13, 2024
1 parent ea8c568 commit 657b7c7
Show file tree
Hide file tree
Showing 23 changed files with 251 additions and 147 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/kradle.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
Klutter is a framework which interconnects Flutter and Kotlin Multiplatform.
It can be used to create Flutter plugins.


### Getting started
- Start a new project with the
- [Intellij](https://buijs.dev/klutter-3/) plugin
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
org.gradle.jvmargs=-Xms3096M -Xmx8192M -Dkotlin.daemon.jvm.options\="-Xmx8192M"
kotlin.mpp.stability.nowarn=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.native.cacheKind.iosArm64=none
kotlin.native.cacheKind.iosArm64=none
kotlin.stdlib.default.dependency = false
1 change: 0 additions & 1 deletion lib-build/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ buildscript {

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
//classpath("com.android.tools.build:gradle:8.1.4")
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sourceSets {

dependencies {
//Kotlin
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.22")
implementation("org.jetbrains.kotlin:kotlin-compiler:1.7.10")

//Jackson for XML
Expand Down
6 changes: 0 additions & 6 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ kover {

// a test-only module
":lib-test",

// a test-only module
":test-integration",

// for KSP testing only
":test-ksp",
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ private fun TaskContainer.registerTasks() {

GetProtoc ->
registerTask<GetProtocGradleTask>(gradleTaskName)

GetKradle ->
registerTask<GetKradleGradleTask>(gradleTaskName)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ enum class KlutterGradleTaskName(private val identifier: String) {

GetProtoc("GetProtoc"),

GetKradle("GetKradle"),

CompileProtoSchemas("CompileProtoSchemas");

val taskName: String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Copyright (c) 2021 - 2024 Buijs Software
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package dev.buijs.klutter.gradle.tasks

import dev.buijs.klutter.kore.KlutterTask
import dev.buijs.klutter.kore.tasks.GetKradleTask

internal open class GetKradleGradleTask: AbstractTask() {

override val gradleTaskName = KlutterGradleTaskName.GetKradle

override fun klutterTask(): KlutterTask {
val project = super.project()
return GetKradleTask(project.root.resolve("kradle").absolutePath)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Copyright (c) 2021 - 2022 Buijs Software
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package dev.buijs.klutter.gradle.tasks

import spock.lang.Ignore
import spock.lang.Specification

import static dev.buijs.klutter.gradle.tasks.TaskTestUtil.getTask

class GetKradleGradleTaskSpec extends Specification {

// does not work in ci yet ...
@Ignore
def "Verify getKradleTask works"() {
def task = getTask(GetKradleGradleTask)

when:
task.execute()

then: "No exception is thrown"
1 == 1
}

}
8 changes: 8 additions & 0 deletions lib/jetbrains/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
## [2024.1.1]

### Changed
- Uses klutter 2024.1.1.beta.
- Uses klutter (dart) [3.0.0](https://pub.dev/packages/klutter).
- Uses klutter_ui (dart) [1.1.0](https://pub.dev/packages/klutter_ui).
- Add protobuf support.

## [2023.3.1]

### Changed
Expand Down
28 changes: 4 additions & 24 deletions lib/jetbrains/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.changelog.date

plugins {
id("org.jetbrains.intellij") version "1.13.3"
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.changelog") version "2.0.0"
id("java")
id("maven-publish")
Expand All @@ -22,19 +22,8 @@ val robotVersion = "0.11.16"
group = "dev.buijs.klutter"
version = dev.buijs.klutter.ProjectVersions.jetbrains

//java {
// sourceCompatibility = JavaVersion.VERSION_17
// targetCompatibility = JavaVersion.VERSION_17
//}

//kotlin {
// jvmToolchain {
// languageVersion.set(JavaLanguageVersion.of(13))
// }
//}

intellij {
version.set("2022.3.2")
version.set("2023.2")
type.set("IC") // Intellij Community Edition
plugins.set(listOf("java", "com.intellij.gradle","android"))
}
Expand Down Expand Up @@ -62,22 +51,13 @@ changelog {

tasks {

// withType<JavaCompile> {
// sourceCompatibility = "13"
// targetCompatibility = "13"
// }
//
// withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
// kotlinOptions.jvmTarget = "13"
// }

withType<Test> {
useJUnitPlatform()
}

patchPluginXml {
sinceBuild.set("223")
untilBuild.set("232.*")
sinceBuild.set("232")
//untilBuild.set("232.*")
}

signPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ object KlutterBundle {
*/
@ExcludeFromJacocoGeneratedReport
object KlutterIcons {
val logo16x16: Icon = IconLoader.getIcon("/pluginIcon16x16.png", KlutterIcons::class.java)
val logo20x20: Icon = IconLoader.getIcon("/pluginIcon20x20.png", KlutterIcons::class.java)
val logo16x16: Icon = IconLoader.getIcon("/pluginIcon16x16.svg", KlutterIcons::class.java)
val logo20x20: Icon = IconLoader.getIcon("/pluginIcon20x20.svg", KlutterIcons::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.Project
import dev.buijs.klutter.kore.project.*
import dev.buijs.klutter.kore.tasks.execute
import dev.buijs.klutter.kore.tasks.executor
import dev.buijs.klutter.kore.tasks.project.*
import mu.KotlinLogging
Expand Down Expand Up @@ -67,6 +68,7 @@ private fun createKlutterPluginTask(
executor = JetbrainsExecutor()
task.run()
rootFolder.moveUpFolder(options.pluginName.validPluginNameOrThrow())
"./gradlew klutterGetKradle -p platform" execute rootFolder
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private fun newProjectPanel(data: NewProjectConfig, disposable: Disposable) = pa
indent {
row {
// KLUTTER BANNER
cell(KlutterBanner).verticalAlign(VerticalAlign.CENTER)
cell(KlutterBanner).align(AlignY.CENTER)
}

val project = "Project"
Expand All @@ -139,7 +139,7 @@ private fun newProjectPanel(data: NewProjectConfig, disposable: Disposable) = pa
textField()
.bindText(data.appNameObservable)
.widthGroup(project)
.horizontalAlign(HorizontalAlign.LEFT)
.align(AlignX.LEFT)
.bindValidator(disposable) { input ->
if(toPluginName(input) is EitherNok) "The Plugin Name is not valid." else null
}
Expand All @@ -150,7 +150,7 @@ private fun newProjectPanel(data: NewProjectConfig, disposable: Disposable) = pa
textField()
.bindText(data.groupNameObservable)
.widthGroup(project)
.horizontalAlign(HorizontalAlign.LEFT)
.align(AlignX.LEFT)
.bindValidator(disposable) { input ->
if(toGroupName(input) is EitherNok) "The Group Name is not valid." else null
}
Expand All @@ -164,7 +164,7 @@ private fun newProjectPanel(data: NewProjectConfig, disposable: Disposable) = pa
.also { it.component.isEditable = true }
.widthGroup(dependencies)
.bindItem(data.gradleVersionObservable)
.horizontalAlign(HorizontalAlign.LEFT)
.align(AlignX.LEFT)
.bindValidator(disposable, isBlocking = false) { input ->
if(knownKlutterBOMVersions.none { it == input }) "The BOM Version is unknown." else null
}
Expand All @@ -173,13 +173,13 @@ private fun newProjectPanel(data: NewProjectConfig, disposable: Disposable) = pa
comboBox(items = flutterVersionsDescending(currentOperatingSystem).map { "${it.prettyPrintedString}" })
.widthGroup(dependencies)
.bindItem(data.flutterVersionObservable)
.horizontalAlign(HorizontalAlign.LEFT)
.align(AlignX.LEFT)
}
row {
checkBox("Get flutter dependencies from git.")
.widthGroup(dependencies)
.bindSelected(data.useGitForPubDependenciesObservable)
.horizontalAlign(HorizontalAlign.LEFT)
.align(AlignX.LEFT)
}

row {}.comment("If enabled then all flutter dependencies are pulled from git and not pub.")
Expand Down Expand Up @@ -271,8 +271,4 @@ private fun <T> observable(
// nothing
}

override fun afterChange(listener: (T) -> Unit, parentDisposable: Disposable) {
// nothing
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ val Version.prettyPrint: String
val isWindows: Boolean
get() = currentOperatingSystem == OperatingSystem.WINDOWS

val isMacos: Boolean
get() = currentOperatingSystem == OperatingSystem.MACOS

/**
* Get current [OperatingSystem] from System Properties.
*
Expand All @@ -45,7 +48,17 @@ val currentOperatingSystem: OperatingSystem
}

val currentArchitecture: Architecture
get() = """uname -m""".execute(Path.of("").toFile().absoluteFile).let { str ->
if(str.uppercase().contains("ARM")) Architecture.ARM64 else Architecture.X64
get() {
val sysctl = "sysctl -n sysctl.proc_translated" execute currentWorkingDirectory
val usesRosetta = sysctl == "1"
val architecture = """uname -m""" execute currentWorkingDirectory
val archContainsARM = architecture.uppercase().contains("ARM")
return when {
usesRosetta -> Architecture.ARM64
archContainsARM -> Architecture.ARM64
else -> Architecture.X64
}
}

val currentWorkingDirectory: File
get() = Path.of("").toFile().absoluteFile
Loading

0 comments on commit 657b7c7

Please sign in to comment.