~longsleep/snapcraft/snapcraft-debs-plugin

« back to all changes in this revision

Viewing changes to snapcraft/plugins/ant.py

  • Committer: Snappy Tarmac
  • Author(s): Sergio Schvezov
  • Date: 2015-10-26 15:25:06 UTC
  • mfrom: (250.2.4 work)
  • Revision ID: snappy_tarmac-20151026152506-7hqsn1kftvqcuncl
Plugins raise exception instead of true/false by sergiusens approved by elopio

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import glob
18
18
import logging
19
19
import os
20
 
import sys
21
20
 
22
21
import snapcraft
23
22
import snapcraft.common
35
34
 
36
35
    def build(self):
37
36
        super().build()
38
 
        if not self.run(['ant']):
39
 
            return False
 
37
        self.run(['ant'])
40
38
        files = glob.glob(os.path.join(self.builddir, 'target', '*.jar'))
41
39
        if not files:
42
 
            logger.error('Could not find any built jar files for part %s',
43
 
                         self.name)
44
 
            sys.exit(1)
 
40
            raise RuntimeError('could not find any built jar files for part')
45
41
        jardir = os.path.join(self.installdir, 'jar')
46
 
        return self.run(['mkdir', '-p', jardir]) and \
47
 
            self.run(['cp', '-a'] + files + [jardir])
 
42
        self.run(['mkdir', '-p', jardir])
 
43
        self.run(['cp', '-a'] + files + [jardir])
48
44
 
49
45
    def env(self, root):
50
46
        env = super().env(root)