File: build.gradle

package info (click to toggle)
svnkit 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,256 kB
  • ctags: 26,264
  • sloc: java: 221,083; ansic: 389; xml: 273; sh: 264; makefile: 47; python: 17; perl: 8
file content (126 lines) | stat: -rw-r--r-- 4,289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
task buildAll << {
    File dstDir = new File(buildDir, "all")
    dstDir.mkdirs()
    
    copy {
        into new File(dstDir, "svnkit-${version}")
        into('lib') {
            from configurations.binaries.files
            exclude '**/*.asc'
            eachFile fullJarNameExpander
            
        }
        into ('bin') {
            from configurations.scripts.files
            exclude '**/logging.properties'
        } 
        into('src') {
            from configurations.sources.files
        }
        into('licenses') {
            from file('src/main/licenses')
        }
        into ('conf') {
            from configurations.scripts.files
            include '**/logging.properties'
            rename { String filename -> return filename + '.disabled' }            
        }
        
        from rootProject.files('LICENSE.txt', 'README.txt', 'CHANGES.txt')
    }
    
    File destfile = new File(distsDir, "svnkit-${version}-all.zip")
    ant.zip(destfile: destfile.absolutePath) {
        zipfileset(dir: dstDir.absolutePath, excludes: '**/bin/**')
        zipfileset(dir: dstDir.absolutePath, includes: '**/bin/**', excludes: '**/bin/*.bat', filemode: '755')
        zipfileset(dir: dstDir.absolutePath, includes: '**/bin/*.bat')
    }
    File destfileNoJNA = new File(distsDir, "svnkit-nojna-${version}-all.zip")
    ant.zip(destfile: destfileNoJNA.absolutePath) {
        zipfileset(dir: dstDir.absolutePath, excludes: '**/bin/**,**/jna*,**/platform*,**/jsch*,**/LICENSE-JNA.txt,**/LICENSE-JSCH.txt')
        zipfileset(dir: dstDir.absolutePath, includes: '**/bin/**', excludes: '**/bin/*.bat', filemode: '755')
        zipfileset(dir: dstDir.absolutePath, includes: '**/bin/*.bat')
    }
}

task buildSources(type: Zip) {
    baseName = 'svnkit'
    classifier = 'src'

    into("svnkit-${version}")

    from rootProject.rootDir

    exclude '.*'
    exclude '**/.*'
    exclude '**/.*/**'

    exclude '**/build/**'
    exclude '**/bin/**'
    exclude '**/target/**'
}

task buildUpdateSite << {
    def tokens = new HashMap()
    File siteDir = new File(buildDir, 'site')
    File pluginsDir = new File(siteDir, 'plugins')
    File featuresDir = new File(siteDir, 'features')
    pluginsDir.mkdirs()
    
    configurations.osgi.resolvedConfiguration.each { conf ->
        conf.resolvedArtifacts.each { artifact ->
            if (artifact.file.name.endsWith('.zip') || artifact.file.name.endsWith('.jar')) {
                org.tmatesoft.build.BuildVersion fileVersion = org.tmatesoft.build.BuildVersion.fromJarFile(artifact.file)
                String name = artifact.getModuleVersion().getId().getName()
                name = name.replace('-', '_')
                tokens[name + '_version'] = fileVersion.bundleVersion
                tokens[name + '_name'] = fileVersion.bundleSymbolicName
                tokens[name + '_fullName'] = fullJarName(artifact.file) 
                copy {
                   from artifact.file
                   into pluginsDir
                   eachFile fullJarNameExpander
                }
            }
        }
    }
    copy {
        into siteDir
        from 'src/main/update-site'
        include 'site.xml'
        expand(tokens)
    }
    file('src/main/update-site/features').listFiles().each {
        if (it.isDirectory()) {
            String fullName = tokens[it.name.replace('-', '_') + '_fullName']
            if (fullName != null) {
                makeFeatureJar(it, new File(featuresDir, fullName), tokens)
            }
        }
    }

    distsDir.mkdirs()
    File destfile = new File(distsDir, "svnkit-update-site-${version}.zip")
    ant.zip(destfile: destfile.absolutePath, basedir: siteDir.absolutePath)
}

def makeFeatureJar(File dir, File dstFile, Map tokens) {
    def tmpDir = new File(buildDir, 'tmp/' + dstFile.getName())
    tmpDir.mkdirs()
    copy {
        into tmpDir
        from dir
        expand(tokens)
    }
    ant.jar(destfile: dstFile.absolutePath, basedir: tmpDir.absolutePath)
    
}

buildAll.dependsOn tasks.clean
buildAll.dependsOn configurations.binaries
buildAll.dependsOn configurations.scripts
buildAll.dependsOn configurations.sources

buildUpdateSite.dependsOn configurations.osgi

task build(dependsOn: [buildAll, buildUpdateSite, buildSources])