From 5e3259cc6b226ede83149b19934f047a436727f8 Mon Sep 17 00:00:00 2001 From: Alistair Bush Date: Sat, 5 Jul 2008 14:02:45 +0000 Subject: Adding preliminarily, ruff, sucky and generally unfinished first draft of eclipse-build.py and supporting library. svn path=/projects/javatoolkit/trunk/; revision=6401 --- src/py/eclipse-build.py | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 src/py/eclipse-build.py (limited to 'src/py/eclipse-build.py') diff --git a/src/py/eclipse-build.py b/src/py/eclipse-build.py new file mode 100755 index 0000000..b660f95 --- /dev/null +++ b/src/py/eclipse-build.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +# Copyright 2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public Licence v2 + +# Authors +# Alistair Bush + +from __future__ import with_statement +import os +import sys +from optparse import OptionParser, make_option +from xml.dom.minidom import parse +from javatoolkit.java.properties import PropertiesParser + + +__version__ = "$Revision: 1 $"[11:-2] + +if __name__ == '__main__': + usage = "Eclipse Ant Build File writer " + __version__ + "\n" + usage += "Copyright 2008 Gentoo Foundation\n" + usage += "Distributed under the terms of the GNU General Public Licence\n" + usage += "Please contact the Gentoo Java Team with problems.\n" + usage += "\nJust wait till I finish this." + + + option_list = [ + make_option ( '-p', '--project', action='store', dest='project', help='Project Name' ), + make_option ( '-i', '--include', action='append', dest='includes', help='Files to include in jar' ), + make_option ( '-s', '--src', action='append', dest='source', help='Directories containing src to build' ), + make_option ( '-m', '--manifest', action='store', dest='manifest', help='Manifest File' ), + make_option ( '-f', '--file', action='store', dest='file', help='Eclipse build.properties file to parse.' ), + make_option ( '-o', '--output', action='store', dest='output', help='Output build.xml to this file' ) + ] + + parser = OptionParser( usage, option_list ) + (options, args) = parser.parse_args() + #check parser options here. + + if options.file: + properties = PropertiesParser( options.file ) + #dom = parse( options.file ) + #classpathentries = dom.getElementsByTagName('classpathentry') + + #for entry in classpathentries: + # if entry.attributes['kind'] and entry.attributes['kind'].nodeValue == 'src': + # print entry.attributes['path'].nodeValue + # if entry.attributes['path']: + # src_dirs.append( entry.attributes['path'].nodeValue ) + + with open( options.output, 'w' ) as output: + output.write('\n') + output.write('\n') + output.write('\n') + output.write('\n') + output.write('\n\n') + output.write('\n') + output.write('\n') + output.write('\n') + try: + if properties.config['source..']: + for dir in properties.config['source..']: + output.write('\n') + if properties.config['bin.includes']: + for item in properties.config['bin.includes']: + if item != '.': + if item.endswith('/'): + item = item.rstrip('/') + output.write('\n') + else: + output.write('\n') + finally: + output.write('\n') + if options.includes: + for file in options.includes: + output.write('') + output.write('\n') + output.write('\n\n\t\n\n\n') + output.write('\n') + output.write('\n') + try: + if properties.config['source..']: + for dir in properties.config['source..']: + output.write('\t\n') + finally: + output.write('\n') + output.write('\n\n') + output.write('\n') + output.write('\n') + else: + output.write('>\n') + output.write('\n') + output.write('\n') + output.write('\n') + #output.write('') + #output.write('') + #output.write('') + #output.write('') + #output.write('') + #output.write('') + #output.write('') + +# vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap : -- cgit v1.2.3-65-gdbad