Skip to content

Commit 7e178a1

Browse files
authored
Merge pull request #364 from domaframework/change-structure
Split a project in two
2 parents 4fcf4b3 + f37ddd1 commit 7e178a1

File tree

1,947 files changed

+5787
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,947 files changed

+5787
-304
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Doma [![Build Status](https://travis-ci.org/domaframework/doma.svg?branch=master
33

44
[![Join the chat at https://gitter.im/domaframework/doma](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/domaframework/doma?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
55

6-
Doma is a database access framework for Java.
6+
Doma is a database access framework for Java.
77
Doma uses [Pluggable Annotation Processing API][apt] to generate source code and validate sql mappings **at compile time**.
88

99
Example
@@ -57,7 +57,7 @@ Build with Gradle
5757

5858
```groovy
5959
dependencies {
60-
implementation "org.seasar.doma:doma:2.30.0-SNAPSHOT"
60+
implementation "org.seasar.doma:doma-core:2.30.0-SNAPSHOT"
6161
annotationProcessor "org.seasar.doma:doma-processor:2.30.0-SNAPSHOT"
6262
}
6363
```

build.gradle.kts

Lines changed: 199 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,206 @@
1-
import org.gradle.api.publish.maven.MavenPom
2-
31
plugins {
4-
`java-library`
5-
`maven-publish`
6-
signing
7-
id("com.diffplug.eclipse.apt") version "3.22.0"
8-
id("com.diffplug.gradle.spotless") version "3.27.2"
9-
id("de.marcphilipp.nexus-publish") version "0.4.0"
10-
id("net.researchgate.release") version "2.8.1"
2+
base
3+
id("com.diffplug.eclipse.apt") version "3.22.0" apply false
4+
id("com.diffplug.gradle.spotless") version "3.27.2"
5+
id("de.marcphilipp.nexus-publish") version "0.4.0" apply false
6+
id("net.researchgate.release") version "2.8.1"
117
}
128

13-
apply("release.gradle")
14-
159
val encoding: String by project
1610
val isSnapshot = project.version.toString().endsWith("SNAPSHOT")
1711

18-
val compileJava by tasks.existing(JavaCompile::class) {
19-
dependsOn(tasks.named("replaceVersion"))
20-
options.encoding = encoding
21-
}
22-
23-
val compileTestJava by tasks.existing(JavaCompile::class) {
24-
options.encoding = encoding
25-
options.compilerArgs = listOf("-proc:none")
26-
}
27-
28-
val test by tasks.existing(Test::class) {
29-
maxHeapSize = "1g"
30-
useJUnitPlatform()
31-
}
32-
33-
val javadoc by tasks.existing(Javadoc::class) {
34-
options.encoding = encoding
35-
(options as StandardJavadocDocletOptions).apply {
36-
charSet = encoding
37-
docEncoding = encoding
38-
links("https://docs.oracle.com/javase/jp/8/docs/api/")
39-
use()
40-
exclude("**/internal/**")
41-
}
42-
}
43-
44-
val jar by tasks.existing(Jar::class) {
45-
manifest {
46-
attributes(mapOf("Implementation-Title" to "Doma", "Implementation-Version" to archiveVersion))
47-
}
48-
exclude("**/apt/**", "META-INF/**")
49-
}
50-
51-
val processorJar by tasks.registering(Jar::class) {
52-
manifest {
53-
attributes(mapOf("Implementation-Title" to "Doma Processor", "Implementation-Version" to archiveVersion))
54-
}
55-
archiveAppendix.set("processor")
56-
from(compileJava.get().destinationDirectory)
57-
from(tasks.processResources.get().destinationDir)
58-
}
59-
60-
val processorSourcesJar by tasks.registering(Jar::class) {
61-
archiveAppendix.set("processor")
62-
archiveClassifier.set("sources")
63-
from(sourceSets.main.get().allSource)
64-
}
65-
66-
val processorJavadocJar by tasks.registering(Jar::class) {
67-
dependsOn(javadoc)
68-
archiveAppendix.set("processor")
69-
archiveClassifier.set("javadoc")
70-
from(javadoc.get().destinationDir)
71-
}
72-
73-
val build by tasks.existing {
74-
val publishToMavenLocal by tasks.existing
75-
dependsOn(publishToMavenLocal)
76-
}
77-
78-
java {
79-
sourceCompatibility = JavaVersion.VERSION_1_8
80-
targetCompatibility = JavaVersion.VERSION_1_8
81-
withJavadocJar()
82-
withSourcesJar()
83-
}
84-
85-
repositories {
86-
mavenCentral()
87-
}
88-
89-
dependencies {
90-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.0")
91-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.0")
92-
}
93-
94-
nexusPublishing {
95-
repositories {
96-
sonatype()
97-
}
98-
}
99-
100-
publishing {
101-
publications {
102-
fun pomDefinition(publicationName: String): MavenPom.() -> Unit {
103-
return {
104-
val projectUrl: String by project
105-
name.set(publicationName)
106-
description.set("DAO Oriented Database Mapping Framework for Java 8+")
107-
url.set(projectUrl)
108-
licenses {
109-
license {
110-
name.set("The Apache Software License, Version 2.0")
111-
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
112-
}
113-
}
114-
developers {
115-
developer {
116-
id.set("nakamura-to")
117-
name.set("Toshihiro Nakamura")
118-
email.set("[email protected]")
119-
}
120-
}
121-
scm {
122-
val githubUrl: String by project
123-
connection.set("scm:git:${githubUrl}")
124-
developerConnection.set("scm:git:${githubUrl}")
125-
url.set(projectUrl)
126-
}
127-
}
128-
}
129-
create<MavenPublication>("main") {
130-
from(components["java"])
131-
pom(pomDefinition(name))
132-
}
133-
create<MavenPublication>("processor") {
134-
pom(pomDefinition(name))
135-
val jar = processorJar.get()
136-
artifactId = "${jar.archiveBaseName.get()}-${jar.archiveAppendix.get()}"
137-
artifact(jar)
138-
artifact(processorSourcesJar.get())
139-
artifact(processorJavadocJar.get())
140-
}
141-
}
142-
}
143-
144-
signing {
145-
sign(publishing.publications)
146-
isRequired = !isSnapshot
147-
}
148-
149-
spotless {
150-
java {
151-
googleJavaFormat("1.7")
152-
}
153-
}
154-
155-
eclipse {
156-
classpath {
157-
file {
158-
whenMerged {
159-
val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
160-
classpath.entries.removeAll {
161-
when (it) {
162-
is org.gradle.plugins.ide.eclipse.model.Output -> it.path == ".apt_generated"
163-
else -> false
164-
}
165-
}
166-
}
167-
withXml {
168-
val node = asNode()
169-
node.appendNode("classpathentry", mapOf("kind" to "src", "output" to "bin/main", "path" to ".apt_generated"))
170-
}
171-
}
172-
}
173-
jdt {
174-
javaRuntimeName = "JavaSE-1.8"
175-
}
12+
allprojects {
13+
val replaceVersionJava by tasks.registering {
14+
doLast {
15+
ant.withGroovyBuilder {
16+
"replaceregexp"("match" to """(private static final String VERSION = ")[^"]*(")""",
17+
"replace" to "\\1${version}\\2",
18+
"encoding" to encoding,
19+
"flags" to "g") {
20+
"fileset"("dir" to ".") {
21+
"include"("name" to "**/Artifact.java")
22+
}
23+
}
24+
}
25+
}
26+
}
27+
28+
repositories {
29+
mavenCentral()
30+
}
31+
}
32+
33+
subprojects {
34+
apply(plugin = "java-library")
35+
apply(plugin = "maven-publish")
36+
apply(plugin = "signing")
37+
apply(plugin = "com.diffplug.eclipse.apt")
38+
apply(plugin = "com.diffplug.gradle.spotless")
39+
apply(plugin = "de.marcphilipp.nexus-publish")
40+
41+
val compileJava by tasks.existing(JavaCompile::class) {
42+
dependsOn(tasks.named("replaceVersionJava"))
43+
options.encoding = encoding
44+
}
45+
46+
val compileTestJava by tasks.existing(JavaCompile::class) {
47+
options.encoding = encoding
48+
options.compilerArgs = listOf("-proc:none")
49+
}
50+
51+
val javadoc by tasks.existing(Javadoc::class) {
52+
options.encoding = encoding
53+
(options as StandardJavadocDocletOptions).apply {
54+
charSet = encoding
55+
docEncoding = encoding
56+
links("https://docs.oracle.com/javase/jp/8/docs/api/")
57+
use()
58+
exclude("**/internal/**")
59+
}
60+
}
61+
62+
val jar by tasks.existing(Jar::class) {
63+
manifest {
64+
attributes(mapOf("Implementation-Title" to project.name, "Implementation-Version" to archiveVersion))
65+
}
66+
}
67+
68+
val test by tasks.existing(Test::class) {
69+
maxHeapSize = "1g"
70+
useJUnitPlatform()
71+
}
72+
73+
val build by tasks.existing {
74+
val publishToMavenLocal by tasks.existing
75+
dependsOn(publishToMavenLocal)
76+
}
77+
78+
dependencies {
79+
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.4.0")
80+
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.4.0")
81+
}
82+
83+
configure<JavaPluginExtension> {
84+
sourceCompatibility = JavaVersion.VERSION_1_8
85+
targetCompatibility = JavaVersion.VERSION_1_8
86+
withJavadocJar()
87+
withSourcesJar()
88+
}
89+
90+
configure<de.marcphilipp.gradle.nexus.NexusPublishExtension> {
91+
repositories {
92+
sonatype()
93+
}
94+
}
95+
96+
configure<PublishingExtension> {
97+
publications {
98+
create<MavenPublication>("maven") {
99+
from(components["java"])
100+
pom {
101+
val projectUrl: String by project
102+
description.set("DAO Oriented Database Mapping Framework for Java 8+")
103+
url.set(projectUrl)
104+
licenses {
105+
license {
106+
name.set("The Apache Software License, Version 2.0")
107+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
108+
}
109+
}
110+
developers {
111+
developer {
112+
id.set("nakamura-to")
113+
name.set("Toshihiro Nakamura")
114+
email.set("[email protected]")
115+
}
116+
}
117+
scm {
118+
val githubUrl: String by project
119+
connection.set("scm:git:${githubUrl}")
120+
developerConnection.set("scm:git:${githubUrl}")
121+
url.set(projectUrl)
122+
}
123+
}
124+
}
125+
}
126+
}
127+
128+
configure<SigningExtension> {
129+
val publishing = convention.findByType(PublishingExtension::class)!!
130+
sign(publishing.publications)
131+
isRequired = !isSnapshot
132+
}
133+
134+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
135+
java {
136+
googleJavaFormat("1.7")
137+
}
138+
}
139+
140+
configure<org.gradle.plugins.ide.eclipse.model.EclipseModel> {
141+
classpath {
142+
file {
143+
whenMerged {
144+
val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
145+
classpath.entries.removeAll {
146+
when (it) {
147+
is org.gradle.plugins.ide.eclipse.model.Output -> it.path == ".apt_generated"
148+
else -> false
149+
}
150+
}
151+
}
152+
withXml {
153+
val node = asNode()
154+
node.appendNode("classpathentry", mapOf("kind" to "src", "output" to "bin/main", "path" to ".apt_generated"))
155+
}
156+
}
157+
}
158+
jdt {
159+
javaRuntimeName = "JavaSE-1.8"
160+
}
161+
}
162+
}
163+
164+
rootProject.apply {
165+
apply(from = "release.gradle")
166+
167+
val replaceVersionDoc by tasks.registering {
168+
mustRunAfter(tasks.named("updateVersion"))
169+
doLast {
170+
ant.withGroovyBuilder {
171+
"replaceregexp"("match" to """("org.seasar.doma:doma(-core|-processor)?:)[^"]*(")""",
172+
"replace" to "\\1${version}\\3",
173+
"encoding" to encoding,
174+
"flags" to "g") {
175+
"fileset"("dir" to ".") {
176+
"include"("name" to "README.md")
177+
"include"("name" to "docs/**/*.rst")
178+
}
179+
}
180+
}
181+
}
182+
}
183+
184+
val replaceVersion by tasks.registering {
185+
dependsOn(replaceVersionDoc, tasks.named("replaceVersionJava"))
186+
}
187+
188+
val commitNewVersion by tasks.existing {
189+
dependsOn(replaceVersion)
190+
}
191+
192+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
193+
format("misc") {
194+
target("**/*.gradle", "**/*.gradle.kts", "**/*.gitignore")
195+
targetExclude("**/bin/**", "**/build/**")
196+
indentWithTabs()
197+
trimTrailingWhitespace()
198+
endWithNewline()
199+
}
200+
format("documentation") {
201+
target("docs/**/*.rst", "**/*.md")
202+
trimTrailingWhitespace()
203+
endWithNewline()
204+
}
205+
}
176206
}

0 commit comments

Comments
 (0)