Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 3fdd304

Browse files
优化模板,升级 Java 8 -> Java 11
1 parent 2127db0 commit 3fdd304

15 files changed

Lines changed: 86 additions & 30 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020, Open EDGN. All rights reserved.
1+
Copyright (c) 2020, OpenEDGN. All rights reserved.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Gradle 快速开始模板
1+
# Gradle Quick Starter

build.gradle.kts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
group = "com.github.openEdgn"
2-
version = "last"
1+
group = "com.github.openEDGN"
2+
version = Versions.Project.core
33

44
buildscript {
5-
val kotlinVersion :String by extra("1.3.72")
6-
7-
8-
repositories {
9-
maven { url = uri("https://maven.aliyun.com/repository/public/") }
10-
jcenter()
11-
maven { url = uri("https://jitpack.io") }
12-
13-
}
5+
repositories.loadMirrors(rootProject)
146
dependencies {
15-
classpath("${kotlin("gradle-plugin")}:$kotlinVersion")
7+
classpath("${kotlin("gradle-plugin")}:${Versions.Kotlin.gradlePlugin}")
168
}
179
}
1810

1911
allprojects {
20-
repositories {
21-
maven { url = uri("https://maven.aliyun.com/repository/public/") }
22-
jcenter()
23-
maven { url = uri( "https://jitpack.io") }
24-
}
12+
repositories.loadMirrors(rootProject)
2513
}
2614

27-
28-
29-
tasks.register("clean",Delete::class){
15+
tasks.register("clean", Delete::class) {
3016
delete(rootProject.buildDir)
3117
for (childProject in childProjects.values) {
3218
delete(childProject.buildDir)

buildSrc/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
*.iml

buildSrc/build.gradle.kts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenLocal()
7+
jcenter()
8+
mavenCentral()
9+
}
10+
11+
kotlin {
12+
sourceSets.all {
13+
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
14+
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
15+
}
16+
}
17+
18+
kotlinDslPluginOptions {
19+
experimentalWarning.set(false)
20+
}
21+
22+
dependencies {
23+
compileOnly(gradleApi())
24+
}
25+
26+
27+
28+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import org.gradle.api.Project
2+
import org.gradle.api.artifacts.dsl.RepositoryHandler
3+
4+
5+
6+
fun RepositoryHandler.loadMirrors(project:Project) {
7+
mavenLocal()
8+
maven { url = project.uri("https://maven.aliyun.com/repository/public/") }
9+
jcenter()
10+
mavenCentral()
11+
maven { url = project.uri("https://jitpack.io") }
12+
}
13+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
object Versions {
2+
object Project {
3+
const val core = "1.0"
4+
}
5+
6+
object Kotlin {
7+
//1.3.72
8+
const val gradlePlugin = "1.3.72"
9+
}
10+
11+
object Junit {
12+
//5.6.2
13+
const val junitJupiter = "5.6.2"
14+
}
15+
}
16+
17+
/**
18+
* INCLUDE OpenEDGN Project
19+
*/
20+
fun openEDGN(name: String, version: String? = null): String = "com.github.OpenEdgn:$name${if (version == null) "" else ":$version"}"

core/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ plugins {
44
kotlin("jvm")
55
`maven-publish`
66
}
7-
java.sourceCompatibility = JavaVersion.VERSION_1_8
7+
java.sourceCompatibility = JavaVersion.VERSION_11
88

99
dependencies {
1010
implementation(kotlin("reflect"))
1111
implementation(kotlin("stdlib"))
12-
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
12+
testImplementation("org.junit.jupiter:junit-jupiter:${Versions.Junit.junitJupiter}")
1313
}
1414

1515
tasks.test {
@@ -20,8 +20,9 @@ tasks.test {
2020
}
2121

2222
tasks.withType<KotlinCompile>().configureEach {
23-
kotlinOptions.jvmTarget = "1.8"
23+
kotlinOptions.jvmTarget = "11"
2424
}
2525

2626

2727

28+

core/src/main/kotlin/com/github/open_edgn/template/Main.kt renamed to core/src/main/kotlin/com/github/template/Main.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.open_edgn.template
1+
package com.github.template
22

33

44
class Main
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module TemplateRepository.core.main {
2+
requires java.base;
3+
requires kotlin.stdlib;
4+
requires kotlin.reflect;
5+
requires kotlin.stdlib.common;
6+
exports com.github.template;
7+
}

0 commit comments

Comments
 (0)