Skip to content

Commit

Permalink
change build script language from groovy to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
CattenLinger committed Nov 7, 2022
1 parent 3eeffa4 commit f7c896f
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 113 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# toy-brick-fx
Our utilities for javafx.
# toy-brick

It is a framework-like utility. All codes are from my personal javafx project.
> The original `toy-brick-fx` repository was renamed into `toy-brick` now
Our utilities for java GUI applications.

It is a framework-like utility. All codes are from my personal java GUI projects.
It was planed to being migrating more utilities, features or concepts from my personal projects.

76 changes: 0 additions & 76 deletions build.gradle

This file was deleted.

76 changes: 76 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("java")
kotlin("jvm") version "1.7.10" apply false
}

allprojects {
group = "com.shinonometn"
version = "1.1-SNAPSHOT"

repositories {
mavenCentral()
maven {
url = uri("https://nexus.shinonometn.com/repository/shinonometn-repo/")
}
}
}

subprojects {
apply(plugin = "java")
apply(plugin = "kotlin")

if(!project.name.endsWith("-demo")) {
apply(plugin = "maven-publish")
}

dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
}

//import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
//
//plugins {
// kotlin("jvm") version "1.7.0"
// id("org.openjfx.javafxplugin") version "0.0.8" apply false
//}
//
//
//subprojects {
//
// publishing {
// repositories {
// maven {
// name = "shinonometn"
//
// def releasesRepoUrl = "https://nexus.shinonometn.com/repository/maven-releases/"
// def snapshotsRepoUrl = "https://nexus.shinonometn.com/repository/maven-snapshots/"
// url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
//
// credentials {
// // Stored in ~/.gradle/gradle.properties
// username "$mavenUsername"
// password "$mavenPassword"
// }
// }
// }
//
// publications {
// maven(MavenPublication) {
// from(components.java)
// }
// }
// }
//}
2 changes: 2 additions & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
26 changes: 26 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
mavenCentral()
}
}

plugins {
kotlin("jvm") version "1.7.0"
}

repositories {
mavenCentral()
}

dependencies {
implementation(localGroovy())

}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.shinonometn.toybrick.build

import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication

fun Project.publishToShinonomeTN(publishing: PublishingExtension) = with(publishing) {
repositories { repos ->
repos.maven { maven ->
maven.name = "shinonometn"
val releasesUrl = uri("https://nexus.shinonometn.com/repository/maven-releases/")
val snapshotsUrl = uri("https://nexus.shinonometn.com/repository/maven-snapshots/")
maven.url = if (project.version.toString().endsWith("SNAPSHOT")) snapshotsUrl else releasesUrl

maven.credentials { credentials ->
credentials.username = System.getenv("MAVEN_USERNAME")
credentials.password = System.getenv("MAVEN_PASSWORD")
}
}
}

publications { container ->
container.create("maven", MavenPublication::class.java) { mvnPub ->
mvnPub.from(components.getByName("java"))
}
}
}
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#Tue Sep 01 02:34:07 CST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
#
# Upgrade gradle to 7.3.3, see: https://stackoverflow.com/questions/73342537/cannot-use-kotlin-1-7-10
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
7 changes: 0 additions & 7 deletions settings.gradle

This file was deleted.

8 changes: 8 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* This file was generated by the Gradle 'init' task.
*/
rootProject.name = "toy-brick"

include(
":toy-brick-fx", ":toy-brick-fx-demo"
)
14 changes: 0 additions & 14 deletions toy-brick-fx-demo/build.gradle

This file was deleted.

16 changes: 16 additions & 0 deletions toy-brick-fx-demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id("application")
}

application {

}

//mainClassName="com.shinonometn.fx.demo.MainKt"

dependencies {
implementation(project(":toy-brick-fx"))
}
12 changes: 0 additions & 12 deletions toy-brick-fx/build.gradle

This file was deleted.

26 changes: 26 additions & 0 deletions toy-brick-fx/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import com.shinonometn.toybrick.build.publishToShinonomeTN

/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
id("org.openjfx.javafxplugin") version "0.0.13"
}

javafx {
version = "11.0.2"
modules = listOf(
"javafx.controls",
"javafx.graphics",
"javafx.fxml",
"javafx.web",
"javafx.media"
)
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-javafx:1.6.4")
}

publishToShinonomeTN(publishing)

0 comments on commit f7c896f

Please sign in to comment.