build.gradle 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. apply plugin: 'base'
  2. allprojects {
  3. version = '3.1.0.CI-SNAPSHOT'
  4. releaseBuild = version.endsWith('RELEASE')
  5. snapshotBuild = version.endsWith('SNAPSHOT')
  6. group = 'org.springframework.security'
  7. repositories {
  8. mavenLocal()
  9. mavenCentral()
  10. }
  11. }
  12. // Set up different subproject lists for individual configuration
  13. javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' }
  14. sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
  15. itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') }
  16. coreModuleProjects = javaProjects - sampleProjects - itestProjects
  17. aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj')]
  18. configure(javaProjects) {
  19. apply from: "$rootDir/gradle/javaprojects.gradle"
  20. }
  21. configure(coreModuleProjects) {
  22. // Gives better names in structure101 jar diagram
  23. sourceSets.main.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1))
  24. apply plugin: 'bundlor'
  25. bundlor.expansions = bundlorProperties
  26. apply from: "$rootDir/gradle/maven-deployment.gradle"
  27. apply plugin: 'emma'
  28. }
  29. task coreBuild {
  30. dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'build' }
  31. }
  32. configure (aspectjProjects) {
  33. apply plugin: 'aspectj'
  34. }
  35. apply from: "$rootDir/gradle/dist.gradle"
  36. apply plugin: 'idea'
  37. configure(javaProjects) {
  38. apply plugin: 'idea'
  39. apply plugin: 'eclipse'
  40. ideaModule {
  41. downloadJavadoc=false
  42. excludeDirs.add(buildDir)
  43. gradleCacheVariable = 'GRADLE_CACHE'
  44. outputDir = "$rootProject.projectDir/intellij/out" as File
  45. testOutputDir = "$rootProject.projectDir/intellij/testOut" as File
  46. whenConfigured { module ->
  47. def allClasses = module.dependencies.findAll() { dep ->
  48. if (dep instanceof org.gradle.plugins.idea.model.ModuleLibrary
  49. && dep.classes.find { path ->
  50. path.url.matches('.*jcl-over-slf4j.*') ||
  51. path.url.matches('.*servlet-api.*') ||
  52. path.url.matches('.*jsp-api.*')
  53. }) {
  54. dep.scope = 'COMPILE'
  55. dep.exported = false
  56. }
  57. }
  58. }
  59. }
  60. // GRADLE-1116
  61. eclipseClasspath.whenConfigured { classpath ->
  62. classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') }
  63. }
  64. eclipseClasspath.doFirst {
  65. eclipseClasspath.whenConfigured { classpath ->
  66. def includeDeps = project.configurations.getByName('runtime')?.collect { f-> f.absolutePath } as Set
  67. classpath.entries.each { cp ->
  68. if(cp instanceof org.gradle.plugins.eclipse.model.Library) {
  69. def include = includeDeps.contains(cp.path)
  70. def attr = 'org.eclipse.jst.component.dependency'
  71. if(include && project.hasProperty('war')) {
  72. // GRADLE-1426 (part a)
  73. cp.entryAttributes.put(attr,'/WEB-INF/lib')
  74. } else if(!include) {
  75. // GRADLE-1422
  76. cp.entryAttributes.remove(attr)
  77. }
  78. }
  79. }
  80. }
  81. }
  82. // GRADLE-1426 (part b)
  83. project.plugins.withType(org.gradle.api.plugins.WarPlugin.class).all {
  84. eclipseWtpComponent.whenConfigured { wtpComp ->
  85. wtpComp.wbModuleEntries.findAll { it instanceof org.gradle.plugins.eclipse.model.WbDependentModule }.each { e ->
  86. if(!e.handle.startsWith('module:/resource/')) {
  87. wtpComp.wbModuleEntries.remove(e)
  88. }
  89. }
  90. }
  91. }
  92. tasks.withType(org.gradle.plugins.eclipse.EclipseWtpComponent) {
  93. whenConfigured { wtpComponent ->
  94. wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','')
  95. }
  96. }
  97. }
  98. ideaModule {
  99. excludeDirs += file('.gradle')
  100. excludeDirs += file('buildSrc/build')
  101. excludeDirs += file('buildSrc/.gradle')
  102. }
  103. ideaProject {
  104. javaVersion = '1.6'
  105. subprojects = [rootProject] + javaProjects
  106. withXml { node ->
  107. // Use git
  108. def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
  109. vcsConfig.mapping[0].'@vcs' = 'Git'
  110. }
  111. }
  112. task wrapper(type: Wrapper) {
  113. gradleVersion = '1.0-milestone-1'
  114. }