forked from JetBrains/Exposed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Kotlin Script for Gradle instead of Groovy (JetBrains#513)
* Use build.gradle.kts, rework modules and few more fixes to gradle * Fix dialect tests, add buildSrc and rework directories structure * Update to kosogor 1.0.2. Update wrapper to 5.2.1. Fix userOrg and vcsUrl in publishing * Gradle: Remove unneeded default_dialect
- Loading branch information
Showing
88 changed files
with
254 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.iml | ||
.idea | ||
.gradle | ||
out | ||
build | ||
classes | ||
out/test/resources |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
kotlin("jvm") version "1.3.21" apply true | ||
id("tanvd.kosogor") version "1.0.2" apply true | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "tanvd.kosogor") | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3.1' | ||
|
||
services: | ||
oracle: | ||
container_name: oracleDB | ||
image: sath89/oracle-12c:latest | ||
ports: | ||
- "1521" | ||
environment: | ||
WEB_CONSOLE: "true" | ||
DBCA_TOTAL_MEMORY: 1024 | ||
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/u01/app/oracle/product/12.1.0/xe/bin | ||
USE_UTF8_IF_CHARSET_EMPTY: "true" | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8080/apex"] | ||
interval: 1m | ||
timeout: 10s | ||
retries: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3.1' | ||
|
||
services: | ||
sqlserver: | ||
container_name: SQLServer | ||
image: microsoft/mssql-server-linux:latest | ||
ports: | ||
- "1433" | ||
environment: | ||
ACCEPT_EULA: Y | ||
SA_PASSWORD: "yourStrong(!)Password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
gradleApi() | ||
compile("com.avast.gradle", "gradle-docker-compose-plugin", "0.9.1") | ||
} | ||
|
||
plugins { | ||
`kotlin-dsl` apply true | ||
id("tanvd.kosogor") version "1.0.1" apply true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
org.gradle.caching=true | ||
org.gradle.parallel=true | ||
org.gradle.jvmargs=-Dfile.encoding=UTF-8 |
20 changes: 20 additions & 0 deletions
20
buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Accessors.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@file:Suppress("FunctionName") | ||
|
||
package org.jetbrains.exposed.gradle | ||
|
||
import com.avast.gradle.dockercompose.ComposeExtension | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.apply | ||
import org.gradle.kotlin.dsl.getByName | ||
|
||
private inline fun <reified T : Any> Project.extByName(name: String): T = extensions.getByName<T>(name) | ||
|
||
fun Project._dockerCompose(configure: ComposeExtension.() -> Unit) = extByName<ComposeExtension>("dockerCompose").apply(configure) | ||
val Project._dockerCompose | ||
get() = extByName<ComposeExtension>("dockerCompose") | ||
|
||
fun Project.applyPluginSafely(id: String) { | ||
if (!plugins.hasPlugin(id)) { | ||
apply(plugin = id) | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jetbrains.exposed.gradle | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.kotlin.dsl.create | ||
import java.io.File | ||
import java.time.Duration | ||
|
||
fun Project.setupDialectTest(dialect: String) { | ||
applyPluginSafely("com.avast.gradle.docker-compose") | ||
val dialectTest = tasks.create("exposedDialectTestWithDocker", Test::class) { | ||
group = "verification" | ||
systemProperties["exposed.test.dialects"] = dialect | ||
|
||
doFirst { | ||
_dockerCompose { | ||
val containerInfo = servicesInfos[dialect]!! | ||
systemProperty("exposed.test.$dialect.host", containerInfo.host) | ||
systemProperty("exposed.test.oracle.port", containerInfo.ports[1521] ?: -1) | ||
systemProperty("exposed.test.sqlserver.port", containerInfo.ports[1433] ?: -1) | ||
systemProperty("exposed.test.mariadb.port", containerInfo.ports[3306] ?: -1) | ||
} | ||
} | ||
} | ||
|
||
_dockerCompose.isRequiredBy(dialectTest) | ||
|
||
_dockerCompose { | ||
useComposeFiles = listOf(File(project.rootProject.projectDir, "buildScripts/docker/docker-compose-$dialect.yml").absolutePath) | ||
captureContainersOutput = true | ||
removeVolumes = true | ||
environment["COMPOSE_CONVERT_WINDOWS_PATHS"] = true | ||
waitForHealthyStateTimeout = Duration.ofMinutes(60) | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
import org.jetbrains.exposed.gradle.setupDialectTest | ||
import tanvd.kosogor.proxy.publishJar | ||
|
||
plugins { | ||
kotlin("jvm") apply true | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
api(kotlin("stdlib")) | ||
api(kotlin("reflect")) | ||
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.0.1") | ||
api("joda-time", "joda-time", "2.9.9") | ||
api("org.slf4j", "slf4j-api", "1.7.25") | ||
implementation("com.h2database", "h2", "1.4.197") | ||
|
||
testImplementation(kotlin("test-junit")) | ||
testImplementation("org.slf4j", "slf4j-log4j12", "1.7.25") | ||
testImplementation("log4j", "log4j", "1.2.17") | ||
testImplementation("junit", "junit", "4.12") | ||
testImplementation("org.hamcrest", "hamcrest-library", "1.3") | ||
testImplementation("com.h2database", "h2", "1.4.197") | ||
|
||
testImplementation("mysql", "mysql-connector-java", "5.1.46") | ||
testImplementation("mysql", "mysql-connector-mxj", "5.0.12") | ||
testImplementation("org.mariadb.jdbc", "mariadb-java-client", "2.3.0") | ||
testImplementation("org.postgresql", "postgresql", "42.2.2.jre6") | ||
testImplementation("com.opentable.components", "otj-pg-embedded", "0.12.0") | ||
testImplementation("org.xerial", "sqlite-jdbc", "3.23.1") | ||
testImplementation("com.oracle", "ojdbc6", "12.1.0.1-atlassian-hosted") | ||
testImplementation("com.microsoft.sqlserver", "mssql-jdbc", "6.4.0.jre7") | ||
} | ||
|
||
publishJar { | ||
publication { | ||
artifactId = "exposed" | ||
} | ||
|
||
bintray { | ||
repository = "exposed" | ||
info { | ||
githubRepo = "https://github.com/JetBrains/Exposed.git" | ||
vcsUrl = "https://github.com/JetBrains/Exposed.git" | ||
userOrg = "kotlin" | ||
license = "Apache-2.0" | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(Test::class.java) { | ||
jvmArgs = listOf("-XX:MaxPermSize=256m") | ||
testLogging { | ||
events.addAll(listOf(TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED)) | ||
showStandardStreams = true | ||
exceptionFormat = TestExceptionFormat.FULL | ||
} | ||
} | ||
|
||
val dialect: String by project | ||
setupDialectTest(dialect) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/test/kotlin/demo/SamplesDao.kt → .../exposed/sql/tests/demo/dao/SamplesDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.