File: build.gradle

package info (click to toggle)
sqljet 1.1.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,364 kB
  • sloc: java: 36,711; ansic: 695; xml: 232; makefile: 31; sh: 19; sql: 14; php: 4
file content (153 lines) | stat: -rw-r--r-- 4,384 bytes parent folder | download | duplicates (2)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
def baseDirectoryName = "sqljet-$version"
def baseArchiveName = 'sqljet'

project.ext {
    host = 'sqljet.com'
   url = 'http://' + host
   thisYear = new java.text.SimpleDateFormat('yyyy').format(new Date())

   browserMainClass = 'org.tmatesoft.sqljet.browser.DBBrowser'

   jnlpTemplate = 'src/main/jnlp/browser.jnlp'
   keystoreFile = 'src/main/jnlp/keystore'
   keystoreAlias = 'tmate'
}

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

    into(baseDirectoryName)

    from rootProject.rootDir

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

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

build.dependsOn buildSources

build {
    baseName = baseArchiveName
    classifier = 'all'

    into(baseDirectoryName)
    from configurations.binaries

    from rootProject.files('LICENSE.txt', 'README.txt', 'CHANGES.txt', 'LICENSE-ANTLR.txt')

    into("src") {
        from configurations.sources.collect { zipTree(it) }
        exclude 'META-INF/**'
    }
    into("javadoc") { from configurations.javadocs }

    configurations.examples.dependencies.each { exampleProject ->
        into("examples/${exampleProject.name}/src") {
            from configurations.examples.files(exampleProject).collect { zipTree(it) }
            exclude 'META-INF/**'
        }
    }
} << {
    copy {
        into 'build/distributions'
        from configurations.osgi.files
    }
}

buildSite << {
    copy {
        def osgi_jar_file = configurations.osgi.files.asList()[0]

        into 'build/site'
        from('src/main/site') {
            include '**/*.html'
            expand(project : project,
                    distribution_all_zip : build.archivePath.name,
                    distribution_src_zip : buildSources.archivePath.name,
                    distribution_osgi_jar : osgi_jar_file.name
                    )
        }
        from('src/main/site') { 
            exclude '**/*.html' 
        }
        from rootProject.file('LICENSE.txt')
        
        into('files') {  
            from build.destinationDir 
        }

        def browserClasspath = []
        into('browser') {
            from configurations.binaries.files
            eachFile fullJarNameExpander
            eachFile { 
                browserClasspath.add it.name 
            }
        }
        
        into('browser') {    
            from file(jnlpTemplate)
            filter { 
                expandClasspath(it, browserClasspath) 
            }
            expand(project.properties)
        }
    }
    ant.signjar(alias: keystoreAlias,
        keystore: keystoreFile,
        storepass: keystorePassword,
        keypass: keystorePassword) {
            fileset(dir: 'build/site/browser') { include(name: '**/*.jar') }
        }
}

task siteTar(type: Tar, dependsOn: buildSite) {
    baseName = 'sqljet-site'

    from 'build/site'
    into 'sqljet-site-' + buildVersion.baseVersion
}

configurations {
    sshAntTask
}

dependencies {
    sshAntTask 'org.apache.ant:ant-jsch:1.8.2'
}

task uploadSite(dependsOn: siteTar) << {
    ant.taskdef(name: 'scp', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
                classpath: configurations.sshAntTask.asPath)
    ant.taskdef(name: 'sshexec', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec',
                classpath: configurations.sshAntTask.asPath)

    def sshFullHost = "$sshUser.$sshHost"
    def sshUrl = "$sshUser@$sshFullHost:/home/$sshUser/$host/"
 
    ant.sshexec(host: sshFullHost, 
            username: sshUser, 
            trust: 'true', 
            verbose: 'true', 
            password: sshPassword,
            failonerror: 'false',
            command: "rm /home/$sshUser/$host/${siteTar.archiveName} ; " + 
                     "rm -rf /home/$sshUser/$host/sqljet-site-${buildVersion.baseVersion}")

    ant.scp(file: siteTar.archivePath, 
            todir: sshUrl,
            verbose: 'true', 
            trust: 'true',
            password: sshPassword)

    ant.sshexec(host: sshFullHost, username: sshUser, trust: 'true', verbose: 'true', password: sshPassword,
            command: "tar -xf /home/$sshUser/$host/${siteTar.archiveName} -C /home/$sshUser/$host && " +
                     "rm /home/$sshUser/$host/${siteTar.archiveName}")
}
uploadSite.onlyIf { project.release == true }