File: SConstruct

package info (click to toggle)
java-imaging-utilities 0.14.3-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,500 kB
  • ctags: 3,737
  • sloc: java: 31,233; python: 71; xml: 30; makefile: 27; sh: 5
file content (66 lines) | stat: -rw-r--r-- 2,304 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
# SCons build rules for JIU

import os

env = Environment()

# Note that setting the source version does not provide backwards compatibility,
# that would require -target, -bootclasspath and -extdir parameters.
java_source_version = '1.3'
env['JAVAVERSION'] = java_source_version
env['JAVACFLAGS'] = '-source ' + java_source_version

# Auto-detect java based on JAVA_HOME, if set
if os.environ.has_key('JAVA_HOME'):
    java_home = os.environ['JAVA_HOME']
    env['ENV']['PATH'] = os.path.join(java_home, 'bin')

# Surprisingly, the Eclipse compiler seems to produce significantly faster
# code than a standard jdk6 javac, so try to use it if possible.
if os.environ.has_key('ECLIPSE_HOME'):
    # try to use eclipse java compiler
    java_env = env.Clone(tools=['eclipse_javac'])
    java_env['JAVACFLAGS'] = '-1.3 -warn:-serial -warn:-unusedPrivate'
else:
    java_env = env

# Build classes
java_env.Java('classes', '.')

# Install resources
env.Install('classes', ['resources'])

# Build jar
# Note: the Jar builder autodetects the manifest as such, as long as it's
# explicitly listed as a source.
jiu_jar = env.Jar('jiu.jar', ['classes', 'META-INF/MANIFEST.MF'], JARCHDIR='classes')
#env.Default(jiu_jar)

# Javadoc
apidoc = env.Command('doc/api', 'net', 'javadoc @packages @docs-html-options')
# AlwaysBuild tells scons to ignore dependencies, not really to always build it
AlwaysBuild(apidoc)
env.Alias('javadoc', apidoc)

# Bundling
def versioned_mercurial_files():
    '''Generates a list of versioned files (in mercurial).'''
    import subprocess
    cmd = 'hg status -cman'.split()
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    return [line.strip() for line in p.stdout]

versioned_files = versioned_mercurial_files()

if versioned_files:
    VERSION = '0.14.3'
    BUNDLENAME = 'java-imaging-utilities-' + VERSION
    SUFFIXES = ['.zip', '.tar.gz', '.tar.bz2']
    
    pkg_env = Environment(tools=['default', 'bundle_tool'])
    pkg_env['BUNDLE_PREFIX'] = 'jiu-' + VERSION + '/'
    
    pkg_env.Bundle([BUNDLENAME + '-core' + suffix for suffix in SUFFIXES], versioned_files)
    pkg_env.Bundle([BUNDLENAME + suffix for suffix in SUFFIXES], versioned_files + ['jiu.jar', Dir('doc/api')])
else:
    print 'Failed to get a list of versioned (Mercurial) files, bundling skipped.'