Convert project to be multi-module (#372)

This commit is contained in:
Ali Ustek
2019-10-29 07:15:18 +00:00
committed by Robert Winkler
parent ed026f3587
commit 1566b22489
354 changed files with 270 additions and 161 deletions

View File

@@ -1,69 +1,133 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'org.asciidoctor', name: 'asciidoctor-gradle-plugin', version: '1.5.6'
classpath group: 'org.asciidoctor', name: 'asciidoctorj-pdf', version: '1.5.0-alpha.16'
classpath group: 'org.kt3k.gradle.plugin', name: 'coveralls-gradle-plugin', version: '2.0.1'
classpath group: 'com.jfrog.bintray.gradle', name: 'gradle-bintray-plugin', version: '1.6'
classpath group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.0.0'
classpath group: 'org.ajoberstar', name: 'gradle-git', version: '1.7.2'
}
}
plugins {
id 'java'
id 'eclipse'
id "org.sonarqube" version "2.7"
id "com.jfrog.bintray" version "1.8.4"
id "me.champeau.gradle.jmh" version "0.4.8"
id 'org.asciidoctor.convert' version '1.6.0'
id "com.jfrog.artifactory" version "4.9.5"
id "org.ajoberstar.github-pages" version "1.7.2"
}
apply from: 'gradle/publishing.gradle'
apply from: 'gradle/coverage.gradle'
apply from: 'gradle/documentation.gradle'
apply plugin: 'idea'
group 'io.github.swagger2markup'
description = 'swagger2markup Build'
version = '1.3.4-SNAPSHOT'
tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.deprecation = true
options.encoding = 'UTF-8'
options.compilerArgs += ['-Xlint:unchecked']
ext {
releaseVersion = '1.3.3'
}
repositories {
maven {
url "https://oss.jfrog.org/artifactory/oss-snapshot-local"
allprojects {
apply plugin: 'jacoco'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'com.jfrog.artifactory'
version = '1.3.4-SNAPSHOT'
group 'io.github.swagger2markup'
description = 'swagger2markup Build'
repositories {
maven {
name "OSS Snapshots"
url "https://oss.jfrog.org/artifactory/oss-snapshot-local"
}
jcenter()
mavenCentral()
}
}
artifactoryPublish.skip = true // apply to all projects except the root
ext {
coreProjects = subprojects.findAll {
p -> !p.name.contains("documentation") && !p.name.endsWith("-bom")
}
jcenter()
//mavenLocal()
}
dependencies {
implementation group: 'io.github.swagger2markup', name: 'markup-document-builder', version: '1.1.3-SNAPSHOT'
implementation group: 'io.swagger', name: 'swagger-compat-spec-parser', version: '1.0.35'
implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.1'
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.2'
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
implementation group: 'io.vavr', name: 'vavr', version: '0.9.1'
implementation group: 'ch.netzwerg', name: 'paleo-core', version: '0.11.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.asciidoctor', name: 'asciidoctorj', version: '1.5.6'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
testImplementation group: 'io.github.robwin', name: 'assertj-diff', version: '0.1.1'
configure(project.coreProjects) {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply from: "${rootDir}/publishing.gradle"
apply plugin: 'jacoco'
tasks.withType(JavaCompile) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.deprecation = true
options.encoding = 'UTF-8'
options.compilerArgs += ["-Xlint:unchecked", "-parameters"]
}
jmh {
duplicateClassesStrategy = 'warn'
}
}
sonarqube {
properties {
property "sonar.projectName", "swagger2markup"
property "sonar.projectKey", "swagger2markup_swagger2markup"
property "sonar.links.homepage", "https://github.com/Swagger2Markup/swagger2markup"
property "sonar.links.ci", "https://travis-ci.org/Swagger2Markup/swagger2markup"
property "sonar.links.scm", "https://github.com/Swagger2Markup/swagger2markup"
property "sonar.links.issue", "https://github.com/Swagger2Markup/swagger2markup/issues"
property "sonar.language", "java"
}
}
def allTestCoverageFile = "$buildDir/jacoco/allTestCoverage.exec"
task jacocoMergeTest(type: JacocoMerge) {
destinationFile = file(allTestCoverageFile)
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
}
task jacocoMerge(dependsOn: ['jacocoMergeTest']) {
// used to run the other merge tasks
}
subprojects {
sonarqube {
properties {
property "sonar.jacoco.reportPaths", allTestCoverageFile
}
}
afterEvaluate {
// exclude subprojects that don't produce a jar file or by design.
if (!project.name.equals('swagger2markup-bom') && !project.name.equals('swagger2markup-documentation')) {
jar {
inputs.property('moduleName', moduleName)
manifest.attributes(
'Automatic-Module-Name': moduleName
)
}
}
}
}
tasks.check.dependsOn tasks.jacocoTestReport
test {
if (System.properties['http.proxyHost']) {
systemProperty 'http.proxyHost', System.properties['http.proxyHost']
systemProperty 'http.proxyPort', System.properties['http.proxyPort']
systemProperty 'http.nonProxyHosts', System.properties['http.nonProxyHosts']
}
systemProperty 'file.encoding', 'UTF-8'
dependsOn(subprojects.test) // required by cobertura to aggregate report
}
javadoc {
options.encoding = 'UTF-8'
artifactory {
contextUrl = 'https://oss.jfrog.org'
resolve {
repository {
repoKey = 'libs-release'
maven = true
}
}
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
//when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
//~/.gradle/gradle.properties, otherwise to be set in the build server
username = project.hasProperty('bintrayUsername') ? project.bintrayUsername : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayApiKey') ? project.bintrayApiKey : System.getenv('BINTRAY_KEY')
}
defaults {
publications('mavenJava')
}
}
if (System.properties['https.proxyHost']) {
clientConfig.proxy.host = System.properties['https.proxyHost']
clientConfig.proxy.port = System.properties['https.proxyPort'].toInteger()
}
}

View File

@@ -1,13 +0,0 @@
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
tasks.coveralls {
dependsOn 'check'
}

View File

@@ -1,17 +1,32 @@
import java.text.SimpleDateFormat
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: "com.jfrog.artifactory"
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
projectUrl = 'https://github.com/Swagger2Markup/swagger2markup'
licenseUrl = 'https://github.com/Swagger2Markup/swagger2markup/blob/master/LICENSE.txt'
scmUrl = 'https://github.com/Swagger2Markup/swagger2markup.git'
issuesUrl = 'https://github.com/Swagger2Markup/swagger2markup/issues'
}
def projectArtifactId = 'swagger2markup'
def projectUrl = 'https://github.com/Swagger2Markup/swagger2markup'
def licenseUrl = 'https://github.com/Swagger2Markup/swagger2markup/blob/master/LICENSE.txt'
def scmUrl = 'https://github.com/Swagger2Markup/swagger2markup.git'
def issuesUrl = 'https://github.com/Swagger2Markup/swagger2markup/issues'
jar {
manifest {
attributes(
'Built-By': 'Robert Winkler',
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Build-Date': project.buildDate,
'Build-Time': project.buildTime,
'Specification-Title': projectArtifactId,
'Specification-Version': project.version,
'Implementation-Title': projectArtifactId,
'Implementation-Version': project.version
)
}
}
task sourcesJar(type: Jar) {
@@ -29,32 +44,45 @@ artifacts {
archives javadocJar
}
jar {
manifest {
attributes(
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Built-With': "gradle-${project.getGradle().getGradleVersion()}, groovy-${GroovySystem.getVersion()}",
'Build-Time': "${new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")}",
'Specification-Title': "${project.name}",
'Specification-Version': project.version.toString(),
'Implementation-Title': "${project.name}",
'Implementation-Version': project.version.toString()
)
bintray {
user = project.hasProperty('bintrayUsername') ? project.property('bintrayUsername') : ''
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : ''
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
publications = ['mavenJava']
pkg {
repo = 'Maven'
name = "${projectArtifactId}"
userOrg = "${projectArtifactId}"
websiteUrl = "${projectUrl}"
issueTrackerUrl = issuesUrl
vcsUrl = scmUrl
desc = project.description
licenses = ['Apache-2.0']
version {
name = project.version
vcsTag = "v${project.version}"
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
//Optional. The passphrase for GPG signing'
passphrase = project.hasProperty('gpgPassphrase') ? project.property('gpgPassphrase') : ''
}
mavenCentralSync {
sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
user = project.hasProperty('ossUser') ? project.property('ossUser') : '' //OSS user token
password = project.hasProperty('ossPassword') ? project.property('ossPassword') : '' //OSS user password
}
}
}
}
if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = ''
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = ''
if (!project.hasProperty('gpgPassphrase')) ext.gpgPassphrase = ''
if (!project.hasProperty('ossUser')) ext.ossUser = ''
if (!project.hasProperty('ossPassword')) ext.ossPassword = ''
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
def devs = ['RobWin': 'Robert Winkler']
def devs = ['RobWin': 'Robert Winkler',
'austek': 'Ali Ustek']
def root = asNode()
root.dependencies.'*'.findAll() {
@@ -65,7 +93,7 @@ publishing {
it.scope*.value = 'compile'
}
root.appendNode('name', project.name)
root.appendNode('name', projectArtifactId)
root.appendNode('packaging', 'jar')
root.appendNode('url', projectUrl)
root.appendNode('description', project.description)
@@ -89,63 +117,3 @@ publishing {
}
}
}
bintray {
user = project.bintrayUsername
key = project.bintrayApiKey
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
publications = ['mavenJava']
pkg {
repo = 'Maven'
name = 'swagger2markup'
userOrg = 'swagger2markup'
websiteUrl = projectUrl
issueTrackerUrl = issuesUrl
vcsUrl = scmUrl
desc = rootProject.description
licenses = ['Apache-2.0']
version {
vcsTag = rootProject.version
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = project.gpgPassphrase //Optional. The passphrase for GPG signing'
}
mavenCentralSync {
sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
user = ossUser //OSS user token
password = ossPassword //OSS user password
}
}
}
}
artifactory {
contextUrl = 'https://oss.jfrog.org'
resolve {
repository {
repoKey = 'libs-release'
}
}
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
//when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
//~/.gradle/gradle.properties, otherwise to be set in the build server
username = project.hasProperty('bintrayUsername') ? project.bintrayUsername : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayApiKey') ? project.bintrayApiKey : System.getenv('BINTRAY_KEY')
}
defaults {
publications('mavenJava')
}
}
if (System.properties['https.proxyHost']) {
clientConfig.proxy.host = System.properties['https.proxyHost']
clientConfig.proxy.port = System.properties['https.proxyPort'].toInteger()
}
}
tasks.artifactoryPublish {
dependsOn 'check'
}

View File

@@ -1 +1,5 @@
rootProject.name = 'swagger2markup'
rootProject.name = 'swagger2markup'
include 'swagger2markup-bom'
include 'swagger2markup-core'
include 'swagger2markup-documentation'

View File

@@ -0,0 +1,40 @@
= swagger2markup-bom
generates BOM (Bill Of Materials) to control used version of swagger2markup projects in a single place.
.Maven's example:
[source,xml]
----
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Swagger2Markup -->
<groupId>io.github.swagger2markup</groupId>
<artifactId>swagger2markup-bom</artifactId>
<version>0.14.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
----
.Gradle example:
[source,groovy]
----
dependencies {
implementation 'io.github.swagger2markup:swagger2markup-bom:0.14.0'
implementation 'io.github.swagger2markup:swagger2markup-core'
}
----
== License
Copyright {docyear} Alexey Shirmanov
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

View File

@@ -0,0 +1,29 @@
description = "swagger2markup bom"
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
asNode().appendNode('packaging', 'pom')
def license = asNode().appendNode('licenses').appendNode('license')
license.appendNode('name', 'Apache-2.0')
license.appendNode('url', 'https://github.com/Swagger2Markup/swagger2markup/blob/master/LICENSE.txt')
license.appendNode('distribution', 'repo')
asNode().appendNode('scm').appendNode('url', 'https://github.com/Swagger2Markup/swagger2markup.git')
Node deps = asNode().appendNode('dependencyManagement').appendNode('dependencies')
coreProjects.each {
Node dep = deps.appendNode('dependency')
dep.appendNode('groupId').value = it.group
dep.appendNode('artifactId').value = it.name
dep.appendNode('version').value = it.version
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
ext.moduleName='io.github.swagger2markup.core'
dependencies {
implementation group: 'io.github.swagger2markup', name: 'markup-document-builder', version: '1.1.3-SNAPSHOT'
implementation group: 'io.swagger', name: 'swagger-compat-spec-parser', version: '1.0.35'
implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.1'
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.2'
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
implementation group: 'io.vavr', name: 'vavr', version: '0.9.1'
implementation group: 'ch.netzwerg', name: 'paleo-core', version: '0.11.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.asciidoctor', name: 'asciidoctorj', version: '1.5.6'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.8.0'
testImplementation group: 'io.github.robwin', name: 'assertj-diff', version: '0.1.1'
}

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Some files were not shown because too many files have changed in this diff Show More