summaryrefslogtreecommitdiffstats
blob: 9f539b6a2fb0db08311144f94d5754a906b1202f (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*******************************************************************************
 * Copyright (c) 2007 Intel Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Intel Corporation - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.dataprovider;

import org.eclipse.cdt.core.envvar.IEnvironmentContributor;
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

public class BuildBuildData extends CBuildData {
	private Builder fBuilder;
	private Configuration fCfg;
//	private BuildEnvironmentContributor fEnvContibutor;
	public BuildBuildData(IBuilder builder){
		fBuilder = (Builder)builder;
		fCfg = (Configuration)fBuilder.getParent().getParent();
	}

	@Override
	public IPath getBuilderCWD() {
		return new Path(fBuilder.getBuildPath());//ManagedBuildManager.getBuildLocation(fCfg, fBuilder);
	}
	
//	private IPath createAbsolutePathFromWorkspacePath(IPath path){
//		IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
//		String locationString = mngr.generateVariableExpression("workspace_loc", path.toString()); //$NON-NLS-1$
//		return new Path(locationString);
//	}

	@Override
	public String[] getErrorParserIDs() {
		return fCfg.getErrorParserList();
	}

	@Override
	public ICOutputEntry[] getOutputDirectories() {
		return fBuilder.getOutputEntries();
	}

	@Override
	public void setBuilderCWD(IPath path) {
		fBuilder.setBuildPath(path.toString());
	}

	@Override
	public void setErrorParserIDs(String[] ids) {
		fCfg.setErrorParserList(ids);
	}

	@Override
	public void setOutputDirectories(ICOutputEntry[] entries) {
		fBuilder.setOutputEntries(entries);
	}

	@Override
	public String getId() {
		return fBuilder.getId();
	}

	@Override
	public String getName() {
		return fBuilder.getName();
	}

	@Override
	public boolean isValid() {
		return fBuilder != null;
	}

	public void setName(String name) {
		//TODO
	}

	@Override
	public IEnvironmentContributor getBuildEnvironmentContributor() {
//		if(fEnvContibutor == null)
//			fEnvContibutor = new BuildEnvironmentContributor(this);
//		return fEnvContibutor;
		return new BuildEnvironmentContributor(this);
	}
	
	public IBuilder getBuilder(){
		return fBuilder;
	}

}