Skip to content

Commit

Permalink
Standardize Build
Browse files Browse the repository at this point in the history
The build now uses spring build conventions to simplify the build

Fixes gh-4284
  • Loading branch information
rwinch committed Apr 21, 2017
1 parent 5a65da4 commit dd6fc48
Show file tree
Hide file tree
Showing 119 changed files with 1,111 additions and 2,228 deletions.
19 changes: 0 additions & 19 deletions acl/acl.gradle

This file was deleted.

19 changes: 19 additions & 0 deletions acl/spring-security-acl.gradle
@@ -0,0 +1,19 @@
apply plugin: 'io.spring.convention.spring-module'

dependencies {
compile project(':spring-security-core')
compile 'aopalliance:aopalliance'
compile 'org.springframework:spring-aop'
compile 'org.springframework:spring-context'
compile 'org.springframework:spring-core'
compile 'org.springframework:spring-jdbc'
compile 'org.springframework:spring-tx'

optional 'net.sf.ehcache:ehcache'

testCompile 'org.springframework:spring-beans'
testCompile 'org.springframework:spring-context-support'
testCompile 'org.springframework:spring-test'

testRuntime 'org.hsqldb:hsqldb'
}
10 changes: 0 additions & 10 deletions aspects/aspects.gradle

This file was deleted.

12 changes: 12 additions & 0 deletions aspects/spring-security-aspects.gradle
@@ -0,0 +1,12 @@
apply plugin: 'io.spring.convention.spring-module'
apply plugin: 'aspectj'

dependencies {
compile project(':spring-security-core')
compile 'org.springframework:spring-beans'
compile 'org.springframework:spring-context'
compile 'org.springframework:spring-core'

testCompile 'aopalliance:aopalliance'
testCompile 'org.springframework:spring-aop'
}
9 changes: 0 additions & 9 deletions bom/build.gradle

This file was deleted.

9 changes: 9 additions & 0 deletions bom/spring-security-bom.gradle
@@ -0,0 +1,9 @@
apply plugin: 'maven-bom'

sonarqube.skipProject = true

project.rootProject.allprojects.each { p ->
p.plugins.withType(io.spring.gradle.convention.SpringMavenPlugin) {
project.mavenBom.projects.add(p)
}
}
194 changes: 10 additions & 184 deletions build.gradle
@@ -1,192 +1,18 @@
buildscript {
repositories {
maven { url "https://repo.spring.io/plugins-release" }
maven { url "https://repo.spring.io/plugins-snapshot" }
}
dependencies {
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
classpath("io.spring.gradle:spring-io-plugin:0.0.6.RELEASE")
classpath("com.bmuschko:gradle-tomcat-plugin:2.2.4")
classpath('me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1')
classpath('org.asciidoctor:asciidoctor-gradle-plugin:1.5.1')
classpath("io.spring.gradle:docbook-reference-plugin:0.3.1")
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.0.BUILD-SNAPSHOT")
classpath 'io.spring.gradle:spring-gradle-build-conventions:1.0-SNAPSHOT'
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
}
}

plugins {
id "org.sonarqube" version "2.1-rc1"
}

apply plugin: 'base'

description = 'Spring Security'

allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'

ext.releaseBuild = version.endsWith('RELEASE')
ext.snapshotBuild = version.endsWith('SNAPSHOT')
ext.springVersion = '4.3.5.RELEASE'
ext.springLdapVersion = '2.2.0.RELEASE'

group = 'org.springframework.security'

repositories {
mavenCentral()
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "https://repo.spring.io/plugins-release" }
maven { url "http://repo.terracotta.org/maven2/" }
}

}

sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.projectName", "Spring Security"
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", 'https://www.springsource.org/spring-security'
property "sonar.links.ci", 'https://build.springsource.org/browse/SEC-B32X'
property "sonar.links.issue", 'https://jira.springsource.org/browse/SEC'
property "sonar.links.scm", 'https://github.com/SpringSource/spring-security'
property "sonar.links.scm_dev", 'https://github.com/SpringSource/spring-security.git'
property "sonar.java.coveragePlugin", "jacoco"
}
}

// Set up different subproject lists for individual configuration
ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'manual' && project.name != 'guides' && project.name != 'spring-security-bom' }
ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
ext.itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') }
ext.coreModuleProjects = javaProjects - sampleProjects - itestProjects
ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-xml-aspectj'), project(':spring-security-samples-javaconfig-aspectj')]

configure(allprojects - javaProjects) {
task afterEclipseImport {
ext.srcFile = file('.classpath')
inputs.file srcFile
outputs.dir srcFile

onlyIf { !srcFile.exists() }

doLast {
srcFile << """<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
"""
}
}
}

configure(subprojects - coreModuleProjects - project(':spring-security-samples-javaconfig-messages') - project(':spring-security-bom')) {
tasks.findByPath("artifactoryPublish")?.enabled = false
sonarqube {
skipProject = true
}
}

configure(javaProjects) {
ext.TOMCAT_GRADLE = "$rootDir/gradle/tomcat.gradle"
ext.WAR_SAMPLE_GRADLE = "$rootDir/gradle/war-sample.gradle"
ext.BOOT_SAMPLE_GRADLE = "$rootDir/gradle/boot-sample.gradle"
apply from: "$rootDir/gradle/javaprojects.gradle"
if(!project.name.contains('gae')) {
apply from: "$rootDir/gradle/checkstyle.gradle"
}
apply from: "$rootDir/gradle/ide.gradle"
apply from: "$rootDir/gradle/release-checks.gradle"
apply from: "$rootDir/gradle/maven-deployment.gradle"
}

configure(coreModuleProjects) {
apply plugin: 'emma'
apply plugin: 'spring-io'

ext.springIoVersion = project.hasProperty('platformVersion') ? platformVersion : 'Brussels-SR1'

configurations {
jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
}

dependencyManagement {
springIoTestRuntime {
imports {
mavenBom("io.spring.platform:platform-bom:${springIoVersion}") {
bomProperties([
'mockito.version': '1.10.19'
])
}
}
}
}
dependencies {
jacoco "org.jacoco:org.jacoco.agent:0.7.5.201505241946:runtime"
}
test {
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
}
integrationTest {
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=${project.group}.*"
maven { url 'https://repo.spring.io/libs-snapshot' }
maven { url 'https://repo.spring.io/plugins-release' }
}
}
apply plugin: 'io.spring.convention.root'

configure (aspectjProjects) {
apply plugin: 'java'
apply plugin: 'aspectj'
}

task coreBuild {
dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'build' }
}

task coreInstall {
dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'install' }
}

// Task for creating the distro zip

task dist(type: Zip) {
dependsOn { subprojects*.tasks*.matching { task -> task.name.endsWith('generatePom') } }
classifier = 'dist'

evaluationDependsOn(':docs')
evaluationDependsOn(':docs:manual')

def zipRootDir = "${project.name}-$version"
into(zipRootDir) {
from(rootDir) {
include '*.adoc'
include '*.txt'
}
into('docs') {
with(project(':docs').apiSpec)
with(project(':docs:manual').spec)
with(project(':docs:guides').spec)
}
project.coreModuleProjects*.tasks*.withType(AbstractArchiveTask).flatten().each{ archiveTask ->
if(archiveTask!=dist){
into("$zipRootDir/dist") {
from archiveTask.outputs.files
}
}
}
sampleProjects.each { project->
into("$zipRootDir/samples/$project.name") {
from(project.projectDir) {
include "src/main/**"
include "pom.xml"
}
}
}
}
}
group = 'org.springframework.security'
description = 'Spring Security'

artifacts {
archives dist
archives project(':docs').docsZip
archives project(':docs').schemaZip
}
ext.snapshotBuild = version.contains("SNAPSHOT")
ext.releaseBuild = version.contains("SNAPSHOT")
ext.milestoneBuild = !(snapshotBuild || releaseBuild)
4 changes: 2 additions & 2 deletions buildSrc/src/main/groovy/MavenBomTask.groovy
Expand Up @@ -6,7 +6,7 @@ import org.gradle.api.tasks.*

public class MavenBomTask extends DefaultTask {

Set<Project> projects
Set<Project> projects = []

File bomFile

Expand Down Expand Up @@ -52,4 +52,4 @@ public class MavenBomTask extends DefaultTask {
}
}
}
}
}
8 changes: 2 additions & 6 deletions buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy
Expand Up @@ -26,15 +26,11 @@ class AspectJPlugin implements Plugin<Project> {
void apply(Project project) {
project.plugins.apply(JavaPlugin)

if (!project.hasProperty('aspectjVersion')) {
throw new GradleException("You must set the property 'aspectjVersion' before applying the aspectj plugin")
}

if (project.configurations.findByName('ajtools') == null) {
project.configurations.create('ajtools')
project.dependencies {
ajtools "org.aspectj:aspectjtools:${project.aspectjVersion}"
optional "org.aspectj:aspectjrt:${project.aspectjVersion}"
ajtools "org.aspectj:aspectjtools"
optional "org.aspectj:aspectjrt"
}
}

Expand Down
17 changes: 0 additions & 17 deletions cas/cas.gradle

This file was deleted.

18 changes: 18 additions & 0 deletions cas/spring-security-cas.gradle
@@ -0,0 +1,18 @@
apply plugin: 'io.spring.convention.spring-module'

dependencies {
compile project(':spring-security-core')
compile project(':spring-security-web')
compile 'org.jasig.cas.client:cas-client-core'
compile 'org.springframework:spring-beans'
compile 'org.springframework:spring-context'
compile 'org.springframework:spring-core'
compile 'org.springframework:spring-web'

optional 'com.fasterxml.jackson.core:jackson-databind'
optional 'net.sf.ehcache:ehcache'

provided 'javax.servlet:javax.servlet-api'

testCompile 'org.skyscreamer:jsonassert'
}

0 comments on commit dd6fc48

Please sign in to comment.