From b28616e6af55a9e032a03b81d60f4bbb8ed3a8bc Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 3 Jun 2015 17:57:23 -0400 Subject: [PATCH] Update build plugins and scripts --- .gitignore | 1 + build.gradle | 6 ++--- .../build/gradle/MergePlugin.groovy | 22 ++++++++--------- ide.gradle | 24 +++++++++++++------ publish-maven.gradle | 23 +++++++++--------- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 54fd4ae7..fea596a1 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ target *.iml *.ipr *.iws +.idea out gradle-app.setting diff --git a/build.gradle b/build.gradle index d54e0d73..65da9185 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,9 @@ buildscript { maven { url "http://repo.spring.io/plugins-release" } } dependencies { - classpath("org.springframework.build.gradle:propdeps-plugin:0.0.5") + classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7") classpath("org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE") - classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.8") + classpath("io.spring.gradle:docbook-reference-plugin:0.3.1") classpath("me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1") } } @@ -21,7 +21,6 @@ configure(allprojects) { } configure(subprojects.findAll {it.name != "spring-build-src"}) { subproject -> - apply plugin: "merge" apply from: "${rootProject.projectDir}/publish-maven.gradle" @@ -217,6 +216,7 @@ project("spring-js-tiles3") { optional("org.apache.tiles:tiles-extras:3.0.1") { exclude group: "org.slf4j", module: "jcl-over-slf4j" exclude group: "org.springframework", module: "spring-web" + exclude group: "ognl", module: "ognl" } testCompile("javax.servlet:jstl:1.2") testCompile("org.slf4j:jcl-over-slf4j:$slf4jVersion") diff --git a/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy index ab4a0d3c..44d270ad 100644 --- a/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,10 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ProjectDependency; import org.gradle.api.artifacts.maven.Conf2ScopeMapping import org.gradle.api.plugins.MavenPlugin -import org.gradle.api.tasks.* import org.gradle.plugins.ide.eclipse.EclipsePlugin -import org.gradle.plugins.ide.eclipse.model.EclipseClasspath; import org.gradle.plugins.ide.idea.IdeaPlugin import org.gradle.api.invocation.* - /** * Gradle plugin that allows projects to merged together. Primarily developed to * allow Spring to support multiple incompatible versions of third-party @@ -71,18 +68,18 @@ class MergePlugin implements Plugin { Configuration runtimeMerge = project.configurations.create("runtimeMerge") // Ensure the IDE can reference merged projects - project.eclipse.classpath.plusConfigurations += [runtimeMerge] - project.idea.module.scopes.PROVIDED.plus += runtimeMerge + project.eclipse.classpath.plusConfigurations += [ runtimeMerge ] + project.idea.module.scopes.PROVIDED.plus += [ runtimeMerge ] // Hook to perform the actual merge logic project.afterEvaluate{ - if(it.merge.into != null) { + if (it.merge.into != null) { setup(it) } } // Hook to build runtimeMerge dependencies - if(!attachedProjectsEvaluated) { + if (!attachedProjectsEvaluated) { project.gradle.projectsEvaluated{ postProcessProjects(it) } @@ -102,7 +99,7 @@ class MergePlugin implements Plugin { // invoking a task will invoke the task with the same name on 'into' project ["sourcesJar", "jar", "javadocJar", "javadoc", "install", "artifactoryPublish"].each { def task = project.tasks.findByPath(it) - if(task) { + if (task) { task.enabled = false task.dependsOn(project.merge.into.tasks.findByPath(it)) } @@ -120,7 +117,7 @@ class MergePlugin implements Plugin { private void setupMaven(Project project) { project.configurations.each { configuration -> Conf2ScopeMapping mapping = project.conf2ScopeMappings.getMapping([configuration]) - if(mapping.scope) { + if (mapping.scope) { Configuration intoConfiguration = project.merge.into.configurations.create( project.name + "-" + configuration.name) configuration.excludeRules.each { @@ -131,12 +128,13 @@ class MergePlugin implements Plugin { configuration.dependencies.each { def intoCompile = project.merge.into.configurations.getByName("compile") // Protect against changing a compile scope dependency (SPR-10218) - if(!intoCompile.dependencies.contains(it)) { + if (!intoCompile.dependencies.contains(it)) { intoConfiguration.dependencies.add(it) } } + def index = project.parent.childProjects.findIndexOf {p -> p.getValue() == project} project.merge.into.install.repositories.mavenInstaller.pom.scopeMappings.addMapping( - mapping.priority + 100, intoConfiguration, mapping.scope) + mapping.priority + 100 + index, intoConfiguration, mapping.scope) } } } diff --git a/ide.gradle b/ide.gradle index 6ec13d44..b488901d 100644 --- a/ide.gradle +++ b/ide.gradle @@ -6,17 +6,18 @@ apply plugin: "propdeps-eclipse" apply plugin: "propdeps-idea" eclipse.jdt { - sourceCompatibility = 1.6 - targetCompatibility = 1.6 + sourceCompatibility = 1.7 + targetCompatibility = 1.7 } // Replace classpath entries with project dependencies (GRADLE-1116) +// http://issues.gradle.org/browse/GRADLE-1116 eclipse.classpath.file.whenMerged { classpath -> def regexp = /.*?\/([^\/]+)\/build\/[^\/]+\/(?:main|test)/ // only match those that end in main or test (avoids removing necessary entries like build/classes/jaxb) def projectOutputDependencies = classpath.entries.findAll { entry -> entry.path =~ regexp } projectOutputDependencies.each { entry -> def matcher = (entry.path =~ regexp) - if(matcher) { + if (matcher) { def projectName = matcher[0][1] def path = "/${projectName}" if(!classpath.entries.find { e -> e instanceof ProjectDependency && e.path == path }) { @@ -46,9 +47,19 @@ eclipse.classpath.file.whenMerged { classpath -> } } -// Allow projects to be used as WPT modules -eclipse.project.natures "org.eclipse.wst.common.project.facet.core.nature" +// Ensure project dependencies come after 3rd-party libs (SPR-11836) +// https://jira.spring.io/browse/SPR-11836 +eclipse.classpath.file.whenMerged { classpath -> + classpath.entries.findAll { it instanceof ProjectDependency }.each { + // delete from original position + classpath.entries.remove(it) + // append to end of classpath + classpath.entries.add(it) + } +} +// Allow projects to be used as WTP modules +eclipse.project.natures "org.eclipse.wst.common.project.facet.core.nature" // Include project specific settings task eclipseSettings(type: Copy) { @@ -74,8 +85,8 @@ task eclipseJdtPrepare(type: Copy) { } task cleanEclipseJdtUi(type: Delete) { + delete project.file(".settings/org.eclipse.jdt.core.prefs") delete project.file(".settings/org.eclipse.jdt.ui.prefs") - delete project.file("org.eclipse.jdt.core.prefs") delete project.file(".settings/org.eclipse.wst.common.component") delete project.file(".settings/org.eclipse.wst.common.project.facet.core.xml") } @@ -86,7 +97,6 @@ tasks["eclipse"].dependsOn(eclipseSettings, eclipseWstComponent) // Filter 'build' folder - eclipse.project.file.withXml { def node = it.asNode() diff --git a/publish-maven.gradle b/publish-maven.gradle index a02e5a30..6090186d 100644 --- a/publish-maven.gradle +++ b/publish-maven.gradle @@ -22,10 +22,10 @@ def customizePom(pom, gradleProject) { generatedPom.project { name = gradleProject.description description = gradleProject.description - url = "https://github.com/SpringSource/spring-webflow" + url = "https://github.com/spring-projects/spring-webflow" organization { - name = "SpringSource" - url = "http://springsource.org/spring-webflow" + name = "Spring IO" + url = "http://projects.spring.io/spring-webflow" } licenses { license { @@ -35,22 +35,21 @@ def customizePom(pom, gradleProject) { } } scm { - url = "https://github.com/SpringSource/spring-webflow" - connection = "scm:git:git://github.com/SpringSource/spring-webflow" - developerConnection = "scm:git:git://github.com/SpringSource/spring-webflow" + url = "https://github.com/spring-projects/spring-webflow" + connection = "scm:git:git://github.com/spring-projects/spring-webflow" + developerConnection = "scm:git:git://github.com/spring-projects/spring-webflow" } developers { developer { id = "rstoyanchev" name = "Rossen Stoyanchev" - email = "rstoyanchev@vmware.com" - } - developer { - id = "pwebb" - name = "Phil Webb" - email = "pwebb@vmware.com" + email = "rstoyanchev@pivotal.io" } } + issueManagement { + system = "Jira" + url = "https://jira.spring.io/browse/SWF" + } } } }