Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EF86A200BAC for ; Wed, 26 Oct 2016 09:19:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EE1E5160AEE; Wed, 26 Oct 2016 07:19:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E576E160ACA for ; Wed, 26 Oct 2016 09:19:10 +0200 (CEST) Received: (qmail 66133 invoked by uid 500); 26 Oct 2016 07:19:09 -0000 Mailing-List: contact commits-help@gump.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@gump.apache.org Delivered-To: mailing list commits@gump.apache.org Received: (qmail 66124 invoked by uid 99); 26 Oct 2016 07:19:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 07:19:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 69501C0A3E for ; Wed, 26 Oct 2016 07:19:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id JDpGTDf1XTWF for ; Wed, 26 Oct 2016 07:19:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4C5EE5FAF9 for ; Wed, 26 Oct 2016 07:19:06 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 94C93E00E9 for ; Wed, 26 Oct 2016 07:18:34 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 5F4873A0230 for ; Wed, 26 Oct 2016 07:18:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1766633 - in /gump/live/python/gump: core/build/maven.py test/maven.py Date: Wed, 26 Oct 2016 07:18:33 -0000 To: commits@gump.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161026071834.5F4873A0230@svn01-us-west.apache.org> archived-at: Wed, 26 Oct 2016 07:19:12 -0000 Author: bodewig Date: Wed Oct 26 07:18:33 2016 New Revision: 1766633 URL: http://svn.apache.org/viewvc?rev=1766633&view=rev Log: refactor builder for maven 1.x Modified: gump/live/python/gump/core/build/maven.py gump/live/python/gump/test/maven.py Modified: gump/live/python/gump/core/build/maven.py URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/maven.py?rev=1766633&r1=1766632&r2=1766633&view=diff ============================================================================== --- gump/live/python/gump/core/build/maven.py (original) +++ gump/live/python/gump/core/build/maven.py Wed Oct 26 07:18:33 2016 @@ -16,63 +16,42 @@ # See the License for the specific language governing permissions and # limitations under the License. -__revision__ = "$Rev: 36667 $" -__date__ = "$Date: 2004-08-20 08:55:45 -0600 (Fri, 20 Aug 2004) $" -__copyright__ = "Copyright (c) 1999-2004 Apache Software Foundation" -__license__ = "http://www.apache.org/licenses/LICENSE-2.0" - +""" + Builder for Maven 1.x uses a properties file with paths to dependencies. +""" import os.path import time import gump from gump import log -from gump.core.config import setting -from gump.core.model.workspace import CommandWorkItem, \ - REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, REASON_PREBUILD_FAILED, \ - STATE_FAILED, STATE_SUCCESS, WORK_TYPE_BUILD -from gump.core.run.gumprun import RunSpecific +from gump.core.build.basebuilder import BaseBuilder, get_command_skeleton, \ + is_debug_enabled, is_verbose_enabled +from gump.core.model.workspace import REASON_PREBUILD_FAILED, STATE_FAILED from gump.util.file import FILE_TYPE_CONFIG -from gump.util.process.command import Cmd, CMD_STATE_SUCCESS, \ - CMD_STATE_TIMED_OUT -from gump.util.process.launcher import execute from gump.util.tools import catFileToFileHolder # # Build an Maven command for this project # -def getMavenCommand(project): +def get_maven_command(project): + """ + Sets up the maven command line based on the 0: + cmd.addEnvironment('MAVEN_OPTS', jvmargs.formatCommandLine()) + return cmd - workspace = self.run.getWorkspace() - - log.debug('Run Maven on Project: #[' + `project.getPosition()` + \ - '] ' + project.getName()) - - self.performPreBuild(project, languageHelper, stats) - - if project.okToPerformWork(): - - # - # Get the appropriate build command... - # - cmd = getMavenCommand(project) - - if cmd: - # Get/set JVM properties - jvmargs = languageHelper.getJVMArgs(project) - if jvmargs and len(jvmargs.items()) > 0: - cmd.addEnvironment('MAVEN_OPTS', - jvmargs.formatCommandLine()) - - # Execute the command .... - cmdResult = execute(cmd, workspace.tmpdir) - - # Update Context - work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult) - project.performedWork(work) - project.setBuilt(True) - - # Update Context w/ Results - if cmdResult.state != CMD_STATE_SUCCESS: - reason = REASON_BUILD_FAILED - if cmdResult.state == CMD_STATE_TIMED_OUT: - reason = REASON_BUILD_TIMEDOUT - project.changeState(STATE_FAILED, reason) - else: - # For now, things are going good... - project.changeState(STATE_SUCCESS) - - if project.wasBuilt(): - pomFile = locateMavenProjectFile(project) - if os.path.exists(pomFile): - project.addDebug('Maven POM in: ' + pomFile) - catFileToFileHolder(project, pomFile, FILE_TYPE_CONFIG) - - projpFile = locateMavenProjectPropertiesFile(project) - if os.path.exists(projpFile): - project.addDebug('Maven project properties in: ' + projpFile) - catFileToFileHolder(project, projpFile, FILE_TYPE_CONFIG) - - # Do this even if not ok - def performPreBuild(self, project, languageHelper, _stats): - - # Maven requires a build.properties to be generated... + def pre_build(self, project, language, _stats): + """ + Generate build.properties + """ if project.okToPerformWork(): try: - propertiesFile = generateMavenProperties(project, - languageHelper) + props_file = generate_maven_properties(project, language) project.addDebug('(Apache Gump generated) Apache Maven Properties in: ' + \ - propertiesFile) + props_file) try: - catFileToFileHolder(project, propertiesFile, + catFileToFileHolder(project, props_file, FILE_TYPE_CONFIG, - os.path.basename(propertiesFile)) + os.path.basename(props_file)) except: - log.error('Display Properties [ ' + propertiesFile + \ + log.error('Display Properties [ ' + props_file + \ '] Failed', exc_info=1) except Exception, details: @@ -266,7 +203,17 @@ class Maven1Builder(RunSpecific): project.addError(message) project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED) - def preview(self, project, _languageHelper, _stats): - cmd = getMavenCommand(project) - cmd.dump() + def post_build(self, project, _language, _stats): + """ + Attach POM and build.properties to output. + """ + pom = locate_maven_pom(project) + if os.path.exists(pom): + project.addDebug('Maven POM in: ' + pom) + catFileToFileHolder(project, pom, FILE_TYPE_CONFIG) + + props = locate_maven_project_props(project) + if os.path.exists(props): + project.addDebug('Maven project properties in: ' + props) + catFileToFileHolder(project, props, FILE_TYPE_CONFIG) Modified: gump/live/python/gump/test/maven.py URL: http://svn.apache.org/viewvc/gump/live/python/gump/test/maven.py?rev=1766633&r1=1766632&r2=1766633&view=diff ============================================================================== --- gump/live/python/gump/test/maven.py (original) +++ gump/live/python/gump/test/maven.py Wed Oct 26 07:18:33 2016 @@ -62,12 +62,12 @@ class MavenTestSuite(UnitTestSuite): def testMavenProperties(self): self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven()) - generateMavenProperties(self.maven1, self.javaHelper, 'test/unit-testing-maven.properties') + generate_maven_properties(self.maven1, self.javaHelper, 'test/unit-testing-maven.properties') def testMavenCommand(self): self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven()) - cmd = getMavenCommand(self.maven1) + cmd = get_maven_command(self.maven1) # cmd.dump()