587
|
1 |
/*
|
628
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: To update the build status to Diamonds with signals in case of build exceptions.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
587
|
18 |
package com.nokia.helium.diamonds;
|
|
19 |
|
628
|
20 |
import org.apache.log4j.Logger;
|
|
21 |
import org.apache.tools.ant.types.DataType;
|
587
|
22 |
import org.apache.tools.ant.Project;
|
628
|
23 |
import com.nokia.helium.core.ant.PostBuildAction;
|
587
|
24 |
|
|
25 |
/**
|
628
|
26 |
* Class to store the builds status and send the generated XML file to diamonds client class to
|
|
27 |
* update the build status into diamonds
|
587
|
28 |
*/
|
628
|
29 |
public class DiamondsPostBuildStatusUpdate extends DataType implements PostBuildAction {
|
587
|
30 |
private Logger log;
|
|
31 |
|
|
32 |
/* Initiate build status to failed as this method will be invoked in case of exceptions only */
|
|
33 |
private String buildStatus = "succeeded";
|
|
34 |
|
628
|
35 |
private String outputFile, templateFile;
|
587
|
36 |
|
|
37 |
|
|
38 |
public DiamondsPostBuildStatusUpdate() {
|
628
|
39 |
log = Logger.getLogger(DiamondsPostBuildStatusUpdate.class);
|
587
|
40 |
}
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Override execute method to update build status to diamonds.
|
628
|
44 |
*
|
587
|
45 |
* @param prj
|
|
46 |
* @param module
|
|
47 |
* @param targetNames
|
|
48 |
*/
|
|
49 |
@SuppressWarnings("unchecked")
|
628
|
50 |
public void executeOnPostBuild(Project project, String[] targetNames) {
|
|
51 |
try {
|
|
52 |
if (DiamondsListenerImpl.isInitialized()) {
|
|
53 |
Project prj = DiamondsListenerImpl.getProject();
|
|
54 |
prj.setProperty("build.status", buildStatus);
|
|
55 |
DiamondsListenerImpl.sendMessage("diamonds-status");
|
587
|
56 |
}
|
628
|
57 |
} catch (DiamondsException de) {
|
|
58 |
log.error("Not able to merge into full results XML file " + de.getMessage(), de);
|
587
|
59 |
}
|
|
60 |
}
|
|
61 |
|
|
62 |
} |