build.gradle 5.0 KB

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