This repository has been archived by the owner on Apr 3, 2018. It is now read-only.
/
BuildTarget.java
76 lines (58 loc) · 2.25 KB
/
BuildTarget.java
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
/*******************************************************************************
* Copyright (c) 2015, 2015 IBM 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:
* Bruno Medeiros - initial API and implementation
*******************************************************************************/
package melnorme.lang.ide.core.operations;
import static melnorme.utilbox.core.CoreUtil.areEqual;
import java.nio.file.Path;
import org.eclipse.core.resources.IProject;
import melnorme.lang.ide.core.LangCore;
import melnorme.lang.ide.core.project_model.BuildManager;
import melnorme.utilbox.core.CommonException;
import melnorme.utilbox.misc.HashcodeUtil;
public class BuildTarget {
protected final boolean enabled;
protected final String targetName;
public BuildTarget(boolean enabled, String targetName) {
this.enabled = enabled;
this.targetName = targetName;
}
public boolean isEnabled() {
return enabled;
}
public String getTargetName() {
return targetName;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(!(obj instanceof BuildTarget)) return false;
BuildTarget other = (BuildTarget) obj;
return
areEqual(enabled, other.enabled) &&
areEqual(targetName, other.targetName);
}
@Override
public int hashCode() {
return HashcodeUtil.combinedHashCode(enabled, targetName);
}
/* ----------------- ----------------- */
protected Path getSDKToolPath() throws CommonException {
return getToolManager().getSDKToolPath();
}
public AbstractToolManager getToolManager() {
return LangCore.getToolManager();
}
public CommonBuildTargetOperation newBuildTargetOperation(OperationInfo parentOpInfo, IProject project,
boolean fullBuild) throws CommonException {
Path buildToolPath = getToolManager().getSDKToolPath();
BuildManager buildMgr = LangCore.getBuildManager();
return buildMgr.createBuildTargetOperation(parentOpInfo, project, buildToolPath, this, fullBuild);
}
}