"Fossies" - the Fresh Open Source Software Archive

Member "build.gradle" (8 Apr 2021, 20271 Bytes) of package /linux/www/apache-tapestry-5.7.2-sources.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Java source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "build.gradle": 5.7.1_vs_5.7.2.

    1 description = "Apache Tapestry 5 Project"
    2 
    3 import org.apache.tools.ant.filters.ReplaceTokens
    4 
    5 apply plugin: "base"
    6 
    7 apply from: "ssh.gradle"
    8 apply from: "md5.gradle"
    9 apply from: "sha256.gradle"
   10 
   11 project.ext.versions = [
   12     jetty: "8.1.19.v20160209",
   13     tomcat: "7.0.70",
   14     testng: "6.8.21",
   15     easymock: "3.3.1",
   16     servletapi: "3.0.1",
   17     spock: "1.3-groovy-2.5",
   18     hibernate: "5.1.1.Final",
   19     slf4j: "1.7.25",
   20     geb: "2.0",
   21     selenium: "3.141.59"
   22 ]
   23 
   24 ext.continuousIntegrationBuild = Boolean.getBoolean("ci")
   25 
   26 // Provided so that the CI server can override the normal version number for nightly builds.
   27 project.version = tapestryVersion()
   28 
   29 // Remember that when generating a release, this should be incremented. Also don"t forget to
   30 // tag the release in Git.
   31 // Version number is always "5.x(.y)?-SNAPSHOT" and only gets fixed, e.g. to 5.4-alpha-1
   32 // during a release
   33 
   34 def tapestryVersion() {
   35 
   36     def major = "5.7.2"
   37     def minor = ""
   38 
   39     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
   40     // When building normally, or for a release, no suffix is desired.
   41     continuousIntegrationBuild ? major + "-SNAPSHOT" : major + minor
   42 }
   43 
   44 // Let analysis.apache.org get in touch with our builds
   45 
   46 project.ext {
   47 
   48     stagingUrl = "https://repository.apache.org/service/local/staging/deploy/maven2/"
   49     snapshotUrl = "https://repository.apache.org/content/repositories/snapshots"
   50 
   51     doSign = !project.hasProperty("noSign") && project.hasProperty("signing.keyId")
   52 
   53     // apacheDeployUserName and apacheDeployPassword should be specified in ~/.gradle/gradle.properties
   54 
   55     deployUsernameProperty = isSnapshot() ? "snapshotDeployUserName" : "apacheDeployUserName"
   56     deployPasswordProperty = isSnapshot() ? "snapshotDeployPassword" : "apacheDeployPassword"
   57 
   58     canDeploy = [deployUsernameProperty, deployPasswordProperty, "apacheArchivesFolder"].every { project.hasProperty(it) }
   59 
   60     // These are all deferred inside closures, to allow people without the necessary values in their
   61     // gradle.properties to build locally, just not deploy. getProperty() throws an exception if the property
   62     // is not present.
   63     deployUsername = { getProperty(deployUsernameProperty) }
   64     deployPassword = { getProperty(deployPasswordProperty) }
   65 
   66     archiveDeployFolder = { getProperty("apacheArchivesFolder") }
   67 }
   68 
   69 println "JDK: " + System.getProperty("java.version")
   70 
   71 //println "Can deploy? $canDeploy"
   72 //println "Is snapshot? isSnapshot"
   73 //println "deployUsernameProperty $deployUsernameProperty"
   74 //println "deployPasswordProperty $deployPasswordProperty"
   75 //println "continuousIntegrationBuild? $continuousIntegrationBuild"
   76 
   77 allprojects {
   78 
   79     apply plugin: "eclipse"
   80     apply plugin: "idea"
   81     apply plugin: "signing"
   82 
   83 
   84     repositories {
   85         mavenCentral()
   86 
   87         // All things JBoss/Hibernate
   88         maven {
   89             name "JBoss"
   90             url "https://repository.jboss.org/nexus/content/repositories/releases/"
   91         }
   92     }
   93 
   94     configurations {
   95         // Non-code artifacts, such as sources JARs and zipped JavaDocs
   96         meta
   97     }
   98 
   99 }
  100 
  101 idea {
  102     project {
  103         languageLevel = "1.8"
  104     }
  105 }
  106 
  107 // Specific to top-level build, not set for subprojects:
  108 
  109 configurations {
  110     javadoc
  111     published.extendsFrom archives, meta
  112     if (doSign) {
  113         published.extendsFrom signatures
  114     }
  115     binaries // additional dependencies included in the binary archive
  116 }
  117 
  118 dependencies {
  119     javadoc project(":tapestry-javadoc")
  120 
  121     // From tapestry-ioc:
  122     binaries "javax.inject:javax.inject:1"
  123     binaries "org.slf4j:slf4j-api:${versions.slf4j}"
  124     binaries "commons-codec:commons-codec:1.5"
  125     binaries "org.antlr:antlr-runtime:3.3", { transitive = false }
  126 }
  127 
  128 String jdkVersion = System.properties['java.version']
  129 def jdkMajorVersion = jdkVersion.substring(0, jdkVersion.indexOf(".")) // 1, 9, 10...
  130 
  131 subprojects {
  132 
  133     def specifyMaxPermSize = jdkVersion ==~ /1\.[67].+/
  134     
  135     version = parent.version
  136 
  137     group = "org.apache.tapestry"
  138 
  139     configurations {
  140         provided
  141     }
  142 
  143     apply plugin: "java"
  144     apply plugin: "groovy" // mostly for testing
  145     apply plugin: "maven"  // for deployment
  146     // TODO: replace the "maven" plugin above with the newer "maven-publish"
  147 
  148     apply plugin: "project-report"
  149     apply plugin: "jacoco"
  150     
  151     jacoco {
  152         toolVersion = "0.8.6"
  153     }
  154     
  155     sourceCompatibility = "1.8"
  156     targetCompatibility = "1.8"
  157 
  158     // See http://jira.codehaus.org/browse/GRADLE-784
  159 
  160     sourceSets {
  161         main {
  162             compileClasspath += configurations.provided
  163         }
  164         test {
  165             compileClasspath += configurations.provided
  166             runtimeClasspath += configurations.provided
  167         }
  168     }
  169 
  170     idea.module {
  171         scopes.PROVIDED.plus += [configurations.provided]
  172     }
  173 
  174     eclipse.classpath.plusConfigurations += [configurations.provided]
  175 
  176     dependencies {
  177         
  178         testCompile "org.spockframework:spock-core:${versions.spock}"
  179          
  180         testRuntime "org.slf4j:slf4j-log4j12:${versions.slf4j}"
  181     }
  182 
  183     compileTestGroovy {
  184         configure(groovyOptions.forkOptions) {
  185             memoryMaximumSize = '1g'
  186             jvmArgs = ['-Xms512m', '-Xmx1g']
  187             if (specifyMaxPermSize){
  188               jvmArgs << '-XX:MaxPermSize=512m'
  189             }
  190         }
  191     }
  192 
  193     tasks.withType(Test) {
  194         useTestNG()
  195 
  196         options.suites("src/test/conf/testng.xml")
  197         if (specifyMaxPermSize){
  198           maxHeapSize "400M"
  199           jvmArgs("-XX:MaxPermSize=200m")
  200         }else{
  201           maxHeapSize "600M"
  202         }
  203 
  204         // Turn off live service reloading
  205 
  206         systemProperties["tapestry.service-reloading-enabled"] = "false"
  207         systemProperties["java.io.tmpdir"] = temporaryDir.absolutePath
  208 
  209         jvmArgs("-Dfile.encoding=UTF-8")
  210 
  211         environment.LANG = 'en_US.UTF-8'
  212         
  213         if (continuousIntegrationBuild){
  214           // Travis runs our builds with TERM=dumb and kills it if we don't produce any
  215           // output for 10 minutes, so we log some task execution progress 
  216 
  217           testLogging {
  218             exceptionFormat "full"
  219           }
  220 
  221           def numberOfTestsExecuted = 0
  222           afterTest { descriptor, result->
  223             numberOfTestsExecuted++
  224             if (numberOfTestsExecuted % 25 == 0){
  225               logger.lifecycle "$numberOfTestsExecuted tests executed"
  226             }
  227           }
  228         }
  229     }
  230 
  231     jar {
  232         // println "JAR projectDir: " + projectDir.getName().replaceAll("5", "").replaceAll("tapestry-", "").replaceAll("-", "");
  233         from(projectDir) {
  234             include "*.txt"
  235             into "META-INF"
  236         }
  237         manifest {
  238             attributes("Automatic-Module-Name": "org.apache.tapestry." + projectDir.getName()
  239                 .replaceAll("tapestry5", "tapestry")
  240                 .replaceAll("tapestry-", "")
  241                 .replaceAll("-", ""))               
  242             if (projectDir.getName().equals("tapestry-version-migrator")) {
  243                 attributes("Main-Class": "org.apache.tapestry5.versionmigrator.Main")
  244             }
  245         }
  246     }
  247 
  248     task sourcesJar(type: Jar) {
  249         dependsOn classes
  250         classifier "sources"
  251         from sourceSets.main.allSource
  252         from(projectDir) {
  253             include "*.txt"
  254             into "META-INF"
  255         }
  256     }
  257 
  258     artifacts {
  259         archives sourcesJar
  260         meta sourcesJar
  261     }
  262 
  263 
  264     configurations {
  265         // published -- what gets uploaded to the Nexus repository
  266         published.extendsFrom archives, meta
  267 
  268         if (rootProject.doSign) {
  269             published.extendsFrom signatures
  270         }
  271     }
  272 
  273     if (rootProject.doSign) {
  274         // sign (create PGP signature for) archives (standard JARs)
  275         // and meta (sources JARs)
  276         signing { sign configurations.archives, configurations.meta }
  277     }
  278 
  279     uploadPublished {
  280 
  281         doFirst {
  282             if (!canDeploy) {
  283                 throw new InvalidUserDataException("Missing upload credentials. Set '$deployUsernameProperty' and '$deployPasswordProperty' root project properties.")
  284             }
  285         }
  286 
  287         if (canDeploy) {
  288             repositories {
  289 
  290                 project.ext.deployer = repositories.mavenDeployer {
  291 
  292                     if (doSign) {
  293                         beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
  294                     }
  295 
  296                     repository(url: stagingUrl) {
  297                         authentication(userName: deployUsername(), password: deployPassword())
  298                     }
  299 
  300                     snapshotRepository(url: snapshotUrl) {
  301                         authentication(userName: deployUsername(), password: deployPassword())
  302                     }
  303                 }
  304             }
  305         }
  306     }
  307 }
  308 
  309 subprojects.each { project.evaluationDependsOn(it.name) }
  310 
  311 subprojects {
  312 
  313     configurations.all {
  314 
  315         resolutionStrategy.force "antlr:antlr:2.7.7",
  316             "cglib:cglib-nodep:2.2",
  317             "commons-codec:commons-codec:1.10",
  318             "commons-io:commons-io:2.4",
  319             "commons-logging:commons-logging:1.1.3",
  320             "hsqldb:hsqldb:2.2.8",
  321             "org.antlr:antlr-runtime:3.5.2",
  322             "org.apache.tomcat:dbcp:6.0.32",
  323             "org.hamcrest:hamcrest-core:1.3",
  324             "org.json:json:20140107",
  325             "org.yaml:snakeyaml:1.8",
  326             "xml-apis:xml-apis:1.4.01"
  327 
  328     }
  329 }
  330 
  331 // Cribbed from https://github.com/hibernate/hibernate-core/blob/master/release/release.gradle#L19
  332 
  333 task aggregateJavadoc(type: Javadoc) {
  334     dependsOn configurations.javadoc
  335     group "Documentation"
  336 
  337     description "Build the aggregated JavaDocs for all modules"
  338     maxMemory "512m"
  339     destinationDir file("$buildDir/documentation/javadocs")
  340 
  341     def tapestryStylesheet = file("src/javadoc/stylesheet7.css")
  342     int thisYear = java.time.Year.now().getValue()
  343 
  344     def allMainSourceSets = subprojects*.sourceSets*.main.flatten()
  345     def allMainJavaFiles = allMainSourceSets*.java
  346     def allMainJavaSrcDirs = allMainJavaFiles*.srcDirs
  347 
  348     options {
  349         splitIndex true
  350         linkSource true
  351         stylesheetFile tapestryStylesheet
  352         windowTitle "Tapestry API - ${project.version}"
  353         header "Tapestry API - ${project.version}"
  354         docTitle "Tapestry API - ($project.version)"
  355         bottom "${project.version} - Copyright &copy; 2003-${thisYear} <a href=\"http://tapestry.apache.org/\">The Apache Software Foundation</a>."
  356         use = true // 'use' seems to be a reserved word for the DSL
  357         links "https://docs.oracle.com/javase/8/docs/api/"
  358         links "https://docs.oracle.com/javaee/7/api/"
  359         tagletPath List.copyOf((Set) configurations.javadoc.files)
  360         //  Uncomment jFlags to debug `./gradlew aggregateJavadoc`
  361 //        jFlags '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'
  362         addStringOption '-source-path', files(allMainJavaSrcDirs.flatten()).asPath
  363         addStringOption 'source', '8'
  364         taglets "org.apache.tapestry5.javadoc.TapestryDocTaglet"
  365         exclude "org/apache/tapestry5/internal/plastic/asm/**"
  366         exclude "org/apache/tapestry5/internal/webresources/**"
  367         exclude "org/apache/tapestry5/webresources/modules/**"
  368     }
  369 
  370     source allMainJavaFiles
  371 
  372     classpath += files(allMainSourceSets*.compileClasspath)
  373 
  374     inputs.files allMainJavaSrcDirs
  375 
  376     // As part of generating the documentation, ALSO copy any related files:
  377     // Any extra images (Tapestry logo)
  378     // Any images stored under src/main/java ... everything but .java, .xdoc and package.html
  379 
  380     doLast {
  381         copy {
  382             from allMainJavaSrcDirs
  383             into aggregateJavadoc.destinationDir
  384             exclude "**/*.java"
  385             exclude "**/*.xdoc"
  386             exclude "**/package.html"
  387         }
  388 
  389         copy {
  390             from file("src/javadoc/images")
  391             into aggregateJavadoc.destinationDir
  392         }
  393     }
  394 }
  395 
  396 task coffeeScriptDocs(type: Exec) {
  397     group "Documentation"
  398     description "Build docco documentation for all CoffeeScript sources"
  399     dependsOn project(":tapestry-core").tasks.preprocessCoffeeScript
  400 
  401     def outputDir = file("$buildDir/documentation/coffeescript")
  402 
  403     def sources = files()
  404 
  405     subprojects.each { sub ->
  406         sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" })
  407     }
  408 
  409     sources += project(":tapestry-core").tasks.preprocessCoffeeScript.outputs.files.asFileTree
  410 
  411     // Needs to be installed via "npm install -g docco@0.6.3"
  412     executable isWindows() ? "docco.cmd" : "docco"
  413     args "--output", outputDir
  414     args sources.files.sort({ a, b -> a.name.compareTo b.name })
  415 }
  416 
  417 
  418 
  419 dependencies {
  420     meta aggregateJavadoc.outputs.files
  421 }
  422 
  423 task combinedJacocoReport(type:JacocoReport){
  424   def subprojectsToConsider = subprojects.findAll {it.name != 'quickstart' && it.name != 'beanmodel' && it.name != 'commons' && it.name != 'genericsresolver-guava' && it.name != 'tapestry5-annotations' && it.name != 'tapestry-internal-test' && it.name != 'tapestry-runner' && it.name != 'tapestry-test-constants' && it.name != 'tapestry-test-data' && it.name != 'tapestry-ioc-jcache'}
  425   dependsOn = subprojectsToConsider.test
  426   additionalSourceDirs = files(subprojectsToConsider.sourceSets.main.allSource.srcDirs)
  427   sourceDirectories = files(subprojectsToConsider.sourceSets.main.allSource.srcDirs)
  428   classDirectories = files(subprojectsToConsider.sourceSets.main.output)
  429   executionData = files(subprojectsToConsider.jacocoTestReport.executionData)
  430   jacocoClasspath = files(subprojectsToConsider.jacocoTestReport.jacocoClasspath)
  431   reports {
  432       html {
  433         enabled = true
  434         destination = file("$buildDir/reports/jacoco")
  435       }
  436       xml {
  437         enabled = false
  438       }
  439       csv {
  440         enabled = false
  441       }
  442   }
  443   onlyIf = {
  444       true
  445   }
  446   doFirst {
  447       executionData = files(executionData.findAll {
  448           it.exists()
  449       })
  450   }
  451 }
  452 
  453 task continuousIntegration {
  454     dependsOn subprojects.build, 'tapestry-core:testWithPrototype', aggregateJavadoc, combinedJacocoReport
  455     description "Task executed on Jenkins CI server after Git commits"
  456 }
  457 
  458 task zippedSources(type: Zip) {
  459     description "Creates a combined Zip file of all sub-project's sources"
  460     group "Release artifact"
  461 
  462     destinationDir buildDir
  463     baseName "apache-tapestry"
  464     version project.version
  465     classifier "sources"
  466 
  467     from project.projectDir
  468     exclude "out/**"
  469     exclude "**/*.iml"
  470     exclude "**/*.ipr"
  471     exclude "**/*.iws"
  472     exclude "**/.*/**"
  473     exclude "**/bin/**"
  474     exclude "**/target/**"
  475     exclude "**/build/**"
  476     exclude "**/test-output/**"  // Left around by TestNG sometimes
  477 }
  478 
  479 task zippedApidoc(type: Zip) {
  480     dependsOn aggregateJavadoc
  481     description "Zip archive of the project's aggregate JavaDoc and CoffeeScript documentation"
  482     group "Release artifact"
  483 
  484     destinationDir buildDir
  485     baseName "apache-tapestry"
  486     version project.version
  487     classifier "apidocs"
  488 
  489     from file("src/docroot-template"), {
  490         filter ReplaceTokens, tokens: [version: project.version]
  491         include "*.html"
  492     }
  493 
  494     from file("src/docroot-template"), {
  495         exclude "*.html"
  496     }
  497 
  498     into "apidocs", { from aggregateJavadoc.outputs.files }
  499 
  500 
  501     into "coffeescript", { from coffeeScriptDocs.outputs.files }
  502 
  503 }
  504 
  505 task zippedBinaries(type: Zip) {
  506     description "Zip archive of binaries of each sub-project"
  507     // TODO: Plus dependencies?
  508     group "Release artifact"
  509     // This may create a few unwanted dependencies, but does
  510     // seem to ensure that the subprojects are created
  511     inputs.files subprojects*.configurations*.archives.artifacts.files
  512 
  513     destinationDir buildDir
  514     baseName "apache-tapestry"
  515     version project.version
  516     classifier "bin"
  517 
  518     // This is via some experimentation
  519     from subprojects*.configurations*.archives.artifacts*.file*.findAll {
  520         !(it.name.endsWith(".asc") || it.name.startsWith("quickstart"))
  521     }
  522 
  523     from configurations.binaries
  524 
  525     // Pick up various licenses and notices
  526 
  527     from(projectDir) {
  528         include "*.txt"
  529     }
  530 
  531     subprojects.each { sub ->
  532         from(sub.projectDir) {
  533             include "*.txt"
  534             into sub.name
  535         }
  536     }
  537 }
  538 
  539 if (canDeploy) {
  540 
  541     configurations {
  542         archives
  543         uploads.extendsFrom archives, signatures
  544     }
  545 
  546 
  547     artifacts {
  548         archives zippedApidoc, zippedSources, zippedBinaries
  549     }
  550 
  551     configurations {
  552         upload.extendsFrom archives, signatures
  553     }
  554 
  555     task generateMD5Checksums(type: GenMD5) {
  556         group "Release artifact"
  557         description "Creates MD5 checksums for archives of source and JavaDoc"
  558         source tasks.withType(Zip)
  559         outputDir "$buildDir/md5"
  560     }
  561 
  562     task generateSHA256Checksums(type: GenSHA256) {
  563         group "Release artifact"
  564         description "Creates SHA-256 checksums for archives of source and JavaDoc"
  565         source tasks.withType(Zip)
  566         outputDir "$buildDir/sha256"
  567     }
  568 
  569     if (doSign) {
  570         signing {
  571             sign configurations.archives
  572         }
  573     }
  574 
  575     // This requires that you have the apacheArchivesFolder property configured in your
  576     // ~/.gradle/gradle.properties. The folder should be a Subversion workspace for
  577     // https://dist.apache.org/repos/dist/dev/tapestry
  578     // after the build, you must manually add the new files to the workspace (using "svn add")
  579     // then commit ("svn commit").
  580 
  581     // The files will be visible in https://dist.apache.org/repos/dist/dev/tapestry/, allowing
  582     // committers to download and verify them.
  583 
  584     // After a successful release vote, the files can be moved to a second Subversion workspace
  585     // for https://dist.apache.org/repos/dist/release/tapestry. Adding the files and committing
  586     // there will publish them to http://www.apache.org/dist/tapestry ... and from there
  587     // to all Apache mirrors (after about a 24 hour delay).
  588 
  589     task copyArchives(type: Copy) {
  590         group "Release artifact"
  591         description "Copies build archives (source, bin, docs) to a configured deployment folder, along with MD5 and SHA-256 checksums and PGP signatures (if signing is enabled)"
  592 
  593         destinationDir file(archiveDeployFolder())
  594 
  595         from generateMD5Checksums
  596         from generateSHA256Checksums
  597         from configurations.uploads.allArtifacts.files
  598     }
  599 
  600     task generateRelease {
  601         dependsOn subprojects.uploadPublished, copyArchives
  602         group "Release artifact"
  603         description "Generates and uploads a final release to Apache Nexus and copies archives for deployment"
  604     }
  605 }
  606 
  607 boolean isSnapshot() {
  608     project.version.contains("SNAPSHOT")
  609 }
  610 
  611 boolean isWindows() {
  612     System.properties['os.name'].toLowerCase().contains('windows')
  613 }
  614 
  615 task updateBootstrap {
  616   doLast {
  617       def bootstrapVersion = '3.3.7'
  618       def target = new File(temporaryDir, 'bootstrap.zip')
  619       ant.get(src: "https://github.com/twbs/bootstrap/archive/v${bootstrapVersion}.zip", dest: target)
  620     
  621       def adjustDirectory = {
  622           def relativePath = it.relativePath
  623           if (relativePath.pathString.contains('/dist/')){
  624               relativePath = new RelativePath(!it.file.isDirectory(), relativePath.segments[2..-1] as String[])
  625           } else {
  626               relativePath = new RelativePath(!it.file.isDirectory(), relativePath.segments[1..-1] as String[])
  627           }
  628           println "copying $it.relativePath to $relativePath"
  629           it.relativePath = relativePath
  630     
  631       }
  632     
  633       copy {
  634         from(zipTree(target)){
  635             include('*/js/*.js')
  636             include('*/dist/fonts/*')
  637             eachFile adjustDirectory
  638         }
  639         from(zipTree(target)){
  640             include('*/dist/css/bootstrap.css')
  641             include('*/dist/css/bootstrap-theme.css')
  642             eachFile adjustDirectory
  643             // TAP5-2351: remove source map reference from css files
  644             filter({ (it ==~ /\/\*\s*# sourceMappingURL=[\S]+\s*\*\//) ? "" : it })
  645         }
  646         into('tapestry-core/src/main/resources/META-INF/assets/tapestry5/bootstrap/')
  647       }
  648     
  649       copy {
  650         from(zipTree(target)){
  651             include('*/js/*.js')
  652             include('*/dist/fonts/*')
  653             include('*/less/**/*.less')
  654     
  655             eachFile adjustDirectory
  656         }
  657         into('tapestry-webresources/src/test/webapp/bootstrap/')
  658       }
  659   }
  660 }