Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

./mvnw sortpom:sort spotless:apply -DspotlessFiles=src/main/java/.*.java
./gradlew spotlessApply
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 0 additions & 18 deletions .mvn/wrapper/maven-wrapper.properties

This file was deleted.

10 changes: 5 additions & 5 deletions .teamcity/builds/Build.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ class Build(
parallel {
listOf("17", "21").forEach { java ->
dependentBuildType(
Maven(
Gradle(
"${name}-build-${java}",
"build - java ${java}",
"sortpom:verify license:check spotless:check compile",
"-DspotlessFiles=src/main/java/.*.java",
java))
"spotlessCheck build",
// "-DspotlessFiles=src/main/java/.*.java",
javaVersion = java))
}
}
dependentBuildType(
Maven(
Gradle(
"${name}-test",
"test",
"verify",
Expand Down
33 changes: 29 additions & 4 deletions .teamcity/builds/Common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.buildFeatures.PullRequests
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.buildFeatures.pullRequests
import jetbrains.buildServer.configs.kotlin.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.MavenBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.buildSteps.maven
import jetbrains.buildServer.configs.kotlin.buildSteps.script

const val GITHUB_OWNER = "neo4j"
const val GITHUB_REPOSITORY = "import-spec"
const val MAVEN_DEFAULT_ARGS = "--no-transfer-progress --batch-mode --show-version"
const val GRADLE_DEFAULT_ARGS = "--quiet"

const val DEFAULT_JAVA_VERSION = "17"
const val LTS_JAVA_VERSION = "21"
Expand Down Expand Up @@ -78,14 +81,36 @@ fun BuildSteps.runMaven(
return maven
}

fun BuildSteps.setVersion(name: String, version: String): MavenBuildStep {
return this.runMaven {
fun BuildSteps.runGradle(
javaVersion: String = DEFAULT_JAVA_VERSION,
init: GradleBuildStep.() -> Unit
): GradleBuildStep {
val maven =
this.gradle {
dockerImagePlatform = GradleBuildStep.ImagePlatform.Linux
dockerImage = "eclipse-temurin:${javaVersion}-jdk"
dockerRunParameters = "--volume /var/run/docker.sock:/var/run/docker.sock"
}

init(maven)
return maven
}

fun BuildSteps.setVersion(name: String, version: String): GradleBuildStep {
return this.runGradle {
this.name = name
goals = "versions:set"
runnerArgs = "$MAVEN_DEFAULT_ARGS -DnewVersion=$version -DgenerateBackupPoms=false"
gradleParams = "$GRADLE_DEFAULT_ARGS -Pversion=$version"
}
}

// fun BuildSteps.setVersion(name: String, version: String): MavenBuildStep {
// return this.runMaven {
// this.name = name
// goals = "versions:set"
// runnerArgs = "$MAVEN_DEFAULT_ARGS -DnewVersion=$version -DgenerateBackupPoms=false"
// }
// }

fun BuildSteps.commitAndPush(
name: String,
commitMessage: String,
Expand Down
29 changes: 29 additions & 0 deletions .teamcity/builds/Gradle.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package builds

import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.buildFeatures.dockerSupport
import jetbrains.buildServer.configs.kotlin.toId

class Gradle(
id: String,
name: String,
goals: String,
args: String? = null,
javaVersion: String = DEFAULT_JAVA_VERSION,
size: LinuxSize = LinuxSize.SMALL
) :
BuildType({
this.id(id.toId())
this.name = name

steps {
runGradle(javaVersion) {
this.tasks = goals
this.gradleParams = "$GRADLE_DEFAULT_ARGS ${args ?: ""}"
}
}

features { dockerSupport {} }

requirements { runOnLinux(size) }
})
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ class GettingStarted {

## Prerequisites

- Maven
- Gradle
- JDK 21 (21 is used for tests, 11 and 17 for production sources)
11 changes: 11 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.2.1")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
plugins {
`java-library`
`maven-publish`
id("com.diffplug.spotless")
}

repositories {
mavenLocal()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}

group = "org.neo4j.importer"
version = "1.0.0-SNAPSHOT"

java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set(project.name)
description.set("Uniform Import Specification Library for Neo4j")
url.set("https://github.com/neo4j/import-spec")
inceptionYear.set("2024")
organization {
name.set("Neo4j, Neo4j Sweden AB")
url.set("https://neo4j.com")
}
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("manual")
}
}
developers {
developer {
id.set("team-connectors")
name.set("Connectors Team")
organization.set("Neo4j")
organizationUrl.set("https://neo4j.com")
}
}
scm {
connection.set("scm:git:git://github.com/neo4j/import-spec.git")
developerConnection.set("scm:git:[email protected]:neo4j/import-spec.git")
url.set("https://github.com/neo4j/import-spec")
}
}
}

repositories {
maven {
name = project.findProperty("repositoryId") as? String ?: "default"
url = uri(project.findProperty("repositoryUrl") ?: "${layout.buildDirectory}/repo")
}
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}

tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}

configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
target("src/main/java/**/*.java", "src/test/java/**/*.java")
palantirJavaFormat("2.74.0")
}
kotlin {
ktfmt().kotlinlangStyle()
licenseHeaderFile(rootProject.file("license-header.txt"))
}
kotlinGradle {
target("*.gradle.kts")
ktfmt().kotlinlangStyle()
}
}
34 changes: 34 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins { id("buildlogic.java-conventions") }

dependencies {
api(libs.com.fasterxml.jackson.dataformat.jackson.dataformat.yaml)
api(libs.com.networknt.json.schema.validator)
testImplementation(libs.org.apache.beam.beam.sdks.java.myextensions.sql)
testImplementation(libs.org.apache.beam.beam.sdks.java.io.jdbc)
testImplementation(libs.org.assertj.assertj.core)
testImplementation(libs.org.junit.jupiter.junit.jupiter)
testImplementation(libs.org.junit.jupiter.junit.jupiter.params)
testImplementation(libs.org.junit.vintage.junit.vintage.engine)
testImplementation(libs.org.neo4j.driver.neo4j.java.driver)
testImplementation(libs.org.postgresql.postgresql)
testImplementation(libs.org.slf4j.slf4j.nop)
testImplementation(libs.org.testcontainers.junit.jupiter)
testImplementation(libs.org.testcontainers.neo4j)
testImplementation(libs.org.testcontainers.postgresql)
testImplementation(libs.org.testcontainers.testcontainers)
}

description = "import-spec"

java {
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks {
compileTestJava {
sourceCompatibility = "21"
targetCompatibility = "21"
}
}
Loading