-
Notifications
You must be signed in to change notification settings - Fork 74
Build cleanup #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build cleanup #19
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
buildscript { | ||
// repositories { | ||
// mavenCentral() | ||
// maven { url 'https://plugins.gradle.org/m2' } | ||
// maven { url 'https://repo.spring.io/plugins-release' } | ||
// mavenLocal() | ||
// } | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
|
@@ -17,7 +11,7 @@ plugins { | |
id 'project-report' | ||
id 'idea' | ||
id 'org.sonarqube' version '2.8' | ||
// id 'org.ajoberstar.grgit' version '4.0.1' apply false | ||
id 'org.ajoberstar.grgit' version '4.0.1' apply false | ||
id 'io.spring.nohttp' version '0.0.5.RELEASE' | ||
id 'io.spring.dependency-management' version '1.0.10.RELEASE' apply false | ||
id 'com.jfrog.artifactory' version '4.18.2' apply false | ||
|
@@ -28,36 +22,46 @@ plugins { | |
|
||
apply plugin: 'io.spring.nohttp' | ||
|
||
//def gitPresent = new File('.git').exists() | ||
def gitPresent = new File('.git').exists() | ||
|
||
//if(gitPresent) { | ||
// apply plugin: 'org.ajoberstar.grgit' | ||
//} | ||
if (gitPresent) { | ||
apply plugin: 'org.ajoberstar.grgit' | ||
} | ||
|
||
description = 'Spring for Apache Pulsar' | ||
|
||
ext { | ||
// if (gitPresent) { | ||
// modifiedFiles = | ||
// files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } | ||
// } | ||
linkHomepage = 'https://github.com/spring-projects-experimental/spring-pulsar' | ||
linkIssue = 'https://github.com/spring-projects-experimental/spring-pulsar/issues' | ||
linkScmUrl = 'https://github.com/spring-projects-experimental/spring-pulsar' | ||
linkScmConnection = 'https://github.com/spring-projects-experimental/spring-pulsar.git' | ||
linkScmDevConnection = '[email protected]:spring-projects-experimental/spring-pulsar.git' | ||
docResourcesVersion = '0.2.5' | ||
|
||
javadocLinks = [ | ||
'https://docs.oracle.com/en/java/javase/17/docs/api/', | ||
'https://docs.spring.io/spring-framework/docs/current/javadoc-api/' | ||
] as String[] | ||
|
||
if (gitPresent) { | ||
modifiedFiles = | ||
files(grgit.status().unstaged.modified).filter{ f -> f.name.endsWith('.java') } | ||
} | ||
|
||
assertjVersion = '3.21.0' | ||
awaitilityVersion = '4.1.1' | ||
assertjVersion = '3.22.0' | ||
awaitilityVersion = '4.2.0' | ||
googleJsr305Version = '3.0.2' | ||
hamcrestVersion = '2.2' | ||
hibernateValidationVersion = '6.2.3.Final' | ||
jacksonBomVersion = '2.13.2.20220328' | ||
hibernateValidationVersion = '7.0.4.Final' | ||
jacksonBomVersion = '2.13.3' | ||
jaywayJsonPathVersion = '2.6.0' | ||
junit4Version = '4.13.2' | ||
junitJupiterVersion = '5.8.2' | ||
pulsarVersion = '2.10.0' | ||
log4jVersion = '2.17.2' | ||
// micrometerVersion = '2.0.0-SNAPSHOT' | ||
mockitoVersion = '4.0.0' | ||
mockitoVersion = '4.5.1' | ||
reactorVersion = '2020.0.17' | ||
springBootVersion = '3.0.0-SNAPSHOT' // docs module | ||
springRetryVersion = '1.3.2' | ||
springRetryVersion = '1.3.3' | ||
springVersion = '6.0.0-SNAPSHOT' | ||
|
||
idPrefix = 'pulsar' | ||
|
@@ -105,11 +109,11 @@ allprojects { | |
subprojects { subproject -> | ||
apply plugin: 'java-library' | ||
apply plugin: 'java' | ||
// apply from: "${rootProject.projectDir}/publish-maven.gradle" | ||
apply from: "${rootProject.projectDir}/publish-maven.gradle" | ||
apply plugin: 'eclipse' | ||
apply plugin: 'idea' | ||
apply plugin: 'jacoco' | ||
// apply plugin: 'checkstyle' | ||
apply plugin: 'checkstyle' | ||
|
||
java { | ||
withJavadocJar() | ||
|
@@ -162,12 +166,9 @@ subprojects { subproject -> | |
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the actual dependencies, should we specify the versions in dependencyManagement section and then just specify group/artifiact in the actual dependencies? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may not have to - i followed what SK does. |
||
optionalApi "org.assertj:assertj-core:$assertjVersion" | ||
|
||
|
||
|
||
testImplementation("org.testcontainers:pulsar:1.17.2") { | ||
exclude module: 'log4j-to-slf4j' | ||
} | ||
|
||
} | ||
|
||
// enable all compiler warnings; individual projects may customize further | ||
|
@@ -208,15 +209,68 @@ subprojects { subproject -> | |
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
suppressAllPomMetadataWarnings() | ||
from components.java | ||
pom.withXml { | ||
def pomDeps = asNode().dependencies.first() | ||
subproject.configurations.providedImplementation.allDependencies.each { dep -> | ||
pomDeps.remove(pomDeps.'*'.find { it.artifactId.text() == dep.name }) | ||
pomDeps.appendNode('dependency').with { | ||
it.appendNode('groupId', dep.group) | ||
it.appendNode('artifactId', dep.name) | ||
it.appendNode('version', dep.version) | ||
it.appendNode('scope', 'provided') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task updateCopyrights { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition! |
||
onlyIf { gitPresent && !System.getenv('GITHUB_ACTION') } | ||
if (gitPresent) { | ||
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) }) | ||
} | ||
outputs.dir('build') | ||
|
||
doLast { | ||
def now = Calendar.instance.get(Calendar.YEAR) as String | ||
inputs.files.each { file -> | ||
def line | ||
file.withReader { reader -> | ||
while (line = reader.readLine()) { | ||
def matcher = line =~ /Copyright (20\d\d)-?(20\d\d)?/ | ||
if (matcher.count) { | ||
def beginningYear = matcher[0][1] | ||
if (now != beginningYear && now != matcher[0][2]) { | ||
def years = "$beginningYear-$now" | ||
def sourceCode = file.text | ||
sourceCode = sourceCode.replaceFirst(/20\d\d(-20\d\d)?/, years) | ||
file.write(sourceCode) | ||
println "Copyright updated for file: $file" | ||
} | ||
break | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
jar { | ||
manifest { | ||
attributes( | ||
'Implementation-Version': archiveVersion, | ||
// 'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})", | ||
'Created-By': "JDK ${System.properties['java.version']} (${System.properties['java.specification.vendor']})", | ||
'Implementation-Title': subproject.name, | ||
'Implementation-Vendor-Id': subproject.group, | ||
'Implementation-Vendor': 'Pivotal Software, Inc.', | ||
// 'Implementation-URL': linkHomepage, | ||
'Implementation-URL': linkHomepage, | ||
'Automatic-Module-Name': subproject.name.replace('-', '.') // for Jigsaw | ||
) | ||
} | ||
|
@@ -227,6 +281,10 @@ subprojects { subproject -> | |
into 'META-INF' | ||
expand(copyright: new Date().format('yyyy'), version: project.version) | ||
} | ||
from("${rootProject.projectDir}") { | ||
include 'LICENSE.txt' | ||
into 'META-INF' | ||
} | ||
} | ||
|
||
tasks.withType(Javadoc) { | ||
|
@@ -262,13 +320,10 @@ project ('spring-pulsar') { | |
optionalApi "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion" | ||
|
||
optionalApi 'io.projectreactor:reactor-core' | ||
// optionalApi "io.micrometer:micrometer-core:$micrometerVersion" | ||
|
||
testImplementation 'io.projectreactor:reactor-test' | ||
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion" | ||
testImplementation "org.hibernate.validator:hibernate-validator:$hibernateValidationVersion" | ||
|
||
testImplementation project (':spring-pulsar-boot-autoconfigure') | ||
} | ||
} | ||
|
||
|
@@ -296,3 +351,14 @@ project ('spring-pulsar-sample-apps') { | |
} | ||
} | ||
|
||
sonarqube { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition! I saw this and the copyrights in spring-integration and was wanting to add it here as well. You beat me to it. :) |
||
properties { | ||
property 'sonar.links.homepage', linkHomepage | ||
property 'sonar.links.ci', linkCi | ||
property 'sonar.links.issue', linkIssue | ||
property 'sonar.links.scm', linkScmUrl | ||
property 'sonar.links.scm_dev', linkScmDevConnection | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.artifactory' | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
pom { | ||
afterEvaluate { | ||
name = project.description | ||
description = project.description | ||
} | ||
url = linkScmUrl | ||
// organization { | ||
// name = 'Spring IO' | ||
// url = 'https://spring.io/projects/spring-pulsar' | ||
// } | ||
licenses { | ||
license { | ||
name = 'Apache License, Version 2.0' | ||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
scm { | ||
url = linkScmUrl | ||
connection = linkScmConnection | ||
developerConnection = linkScmDevConnection | ||
} | ||
// developers { | ||
// | ||
// } | ||
issueManagement { | ||
system = 'GitHub' | ||
url = linkIssue | ||
} | ||
} | ||
versionMapping { | ||
usage('java-api') { | ||
fromResolutionResult() | ||
} | ||
usage('java-runtime') { | ||
fromResolutionResult() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
artifactoryPublish { | ||
dependsOn build | ||
publications(publishing.publications.mavenJava) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,17 @@ | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.pulsar.core.DefaultPulsarConsumerFactory; | ||
import org.springframework.pulsar.core.DefaultPulsarProducerFactory; | ||
import org.springframework.pulsar.config.PulsarClientConfiguration; | ||
import org.springframework.pulsar.config.PulsarClientFactoryBean; | ||
import org.springframework.pulsar.core.DefaultPulsarConsumerFactory; | ||
import org.springframework.pulsar.core.DefaultPulsarProducerFactory; | ||
import org.springframework.pulsar.core.PulsarConsumerFactory; | ||
import org.springframework.pulsar.core.PulsarProducerFactory; | ||
import org.springframework.pulsar.core.PulsarTemplate; | ||
|
||
/** | ||
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration Auto-configuration} for Apache Pulsar. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Nit/Question] I wonder if it is sufficient to just link to org.springframework.boot.autoconfigure.Autoconfiguration now that its a 1st class thing in SB3? Also, does this have to be fully specified like it is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, we can do it that way. Feel free to do that as part of the cleanup that you will do in the boot module. |
||
* | ||
* @author Soby Chacko | ||
*/ | ||
@AutoConfiguration | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can instead pull in the junit bom under dependency mgmt which would get rid of some of these version specified I believe. Same as what spring-framework does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i just followed what Spring-Kafka does. We can do that. Feel free to make that change once this PR is merged.