Skip to content

Commit 0eebeae

Browse files
author
jan
committed
add isProjectTypeSupported to IBuildTools and fix pathTools
1 parent 5afd638 commit 0eebeae

File tree

12 files changed

+318
-357
lines changed

12 files changed

+318
-357
lines changed

io.sloeber.autoBuild/META-INF/MANIFEST.MF

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ Export-Package: io.sloeber.autoBuild.api;
6666
org.eclipse.cdt.core.envvar,
6767
io.sloeber.buildTool.api,
6868
org.eclipse.cdt.core.language.settings.providers",
69-
io.sloeber.autoBuild.internal;x-internal:=true,
69+
io.sloeber.autoBuild.internal;x-friends:="io.sloeber.autoBuild.test",
7070
io.sloeber.buildTool.api;uses:="org.eclipse.core.runtime",
71-
io.sloeber.buildTool.internal;x-internal:=true,
71+
io.sloeber.buildTool.internal;x-friends:="io.sloeber.autoBuild.test",
7272
io.sloeber.schema.api;
7373
uses:="io.sloeber.autoBuild.extensionPoint,
7474
io.sloeber.autoBuild.extensionPoint.providers,
@@ -77,11 +77,10 @@ Export-Package: io.sloeber.autoBuild.api;
7777
org.eclipse.core.resources,
7878
io.sloeber.autoBuild.api,
7979
org.eclipse.cdt.core.settings.model.extension",
80-
io.sloeber.schema.internal;x-internal:=true,
81-
io.sloeber.schema.internal.enablement;x-internal:=true
80+
io.sloeber.schema.internal;x-friends:="io.sloeber.autoBuild.test",
81+
io.sloeber.schema.internal.enablement;x-friends:="io.sloeber.autoBuild.test"
8282
Import-Package: org.apache.commons.io,
8383
org.eclipse.cdt.build.core.scannerconfig,
8484
org.eclipse.cdt.build.internal.core.scannerconfig2,
85-
org.eclipse.cdt.managedbuilder.core,
8685
org.eclipse.cdt.newmake.core,
8786
org.eclipse.core.expressions

io.sloeber.autoBuild/OSGI-INF/l10n/bundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ minGW32ToolProviderName=MinGW 32 tool provider
88
minGW64ToolProviderName=MinGW 64 tool provider
99
user.defined.tool.provider=user defined tool provider
1010
user.defined.tool.provider.description=Toolchain defined in preferences
11+
path.build.tool.provider=Build tools on the path
1112

1213

1314
Option.Posix.Linker.GroupLibs=Group libraries (-Wl,--start-group ... -Wl,--end-group)

io.sloeber.autoBuild/plugin.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,12 @@
20012001
name="%user.defined.tool.provider"
20022002
toolProvider="io.sloeber.buildTool.internal.UserDefinedBuildToolProvider">
20032003
</ToolProvider>
2004+
<ToolProvider
2005+
Description="The build Tools on the path"
2006+
id="io.sloeber.autoBuild.Path.BuildToolProvider"
2007+
name="%path.build.tool.provider"
2008+
toolProvider="io.sloeber.buildTool.internal.PathToolProvider">
2009+
</ToolProvider>
20042010
<builder
20052011
autoBuildTarget="all"
20062012
buildRunner="io.sloeber.autoBuild.extensionPoint.providers.BuildRunnerForMake"

io.sloeber.autoBuild/src/io/sloeber/autoBuild/api/AutoBuildConstants.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,14 @@ public class AutoBuildConstants {
252252
public static final String DISCOVERY_PARAMETERS =" -E -P -v -dD "+INPUTS_VARIABLE;
253253
public static final String MAKE_FILE_EXTENSION = "makefile.extension";
254254

255+
public static final String EXTENSION_CPP="cpp";
256+
public static final String EXTENSION_C="c";
257+
public static final String SPEC_BASE="spec";
258+
public static final String TOOL_PREFIX ="TOOL_PREFIX";
259+
public static final String TOOL_SUFFIX ="TOOL_SUFFIX";
255260

261+
public static final String PROJECT_TYPE_ID_DYNAMIC_LIB ="io.sloeber.autoBuild.projectType.dynamic.lib";
262+
public static final String PROJECT_TYPE_ID_STATIC_LIB="io.sloeber.autoBuild.projectType.static.lib";
263+
public static final String PROJECT_TYPE_ID_COMPOUND_EXE="io.sloeber.autoBuild.projectType.compound.exe";
264+
public static final String PROJECT_TYPE_ID_EXE="io.sloeber.autoBuild.projectType.exe";
256265
}

io.sloeber.autoBuild/src/io/sloeber/buildTool/api/IBuildToolManager.java

Lines changed: 118 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -8,140 +8,146 @@
88

99
public interface IBuildToolManager {
1010

11-
public enum ToolType {
12-
A_TO_O, CPP_TO_O, C_TO_O, O_TO_C_DYNAMIC_LIB, O_TO_CPP_DYNAMIC_LIB, O_TO_ARCHIVE, O_TO_C_EXE, O_TO_CPP_EXE;
13-
14-
@SuppressWarnings("nls")
15-
public static ToolType getToolType(String toolTypeName) {
16-
try {
17-
if (valueOf(toolTypeName) != null) {
18-
return valueOf(toolTypeName);
19-
}
20-
} catch (@SuppressWarnings("unused") Exception e) {
21-
//nothing to log here
22-
}
23-
switch (toolTypeName) {
24-
case "a->a.o":
25-
return A_TO_O;
26-
case "cpp->cpp.o":
27-
return CPP_TO_O;
28-
case "c->c.o":
29-
return C_TO_O;
30-
case "c.o->so/dll":
31-
return O_TO_C_DYNAMIC_LIB;
32-
case "cpp.o->so/dll":
33-
return O_TO_CPP_DYNAMIC_LIB;
34-
case "o->ar":
35-
return O_TO_ARCHIVE;
36-
case "c.o->exe":
37-
return O_TO_C_EXE;
38-
case "cpp.o->exe":
39-
return O_TO_CPP_EXE;
11+
public enum ToolType {
12+
A_TO_O, CPP_TO_O, C_TO_O, O_TO_C_DYNAMIC_LIB, O_TO_CPP_DYNAMIC_LIB, O_TO_ARCHIVE, O_TO_C_EXE, O_TO_CPP_EXE;
13+
14+
@SuppressWarnings("nls")
15+
public static ToolType getToolType(String toolTypeName) {
16+
try {
17+
if (valueOf(toolTypeName) != null) {
18+
return valueOf(toolTypeName);
19+
}
20+
} catch (@SuppressWarnings("unused") Exception e) {
21+
// nothing to log here
22+
}
23+
switch (toolTypeName) {
24+
case "a->a.o":
25+
return A_TO_O;
26+
case "cpp->cpp.o":
27+
return CPP_TO_O;
28+
case "c->c.o":
29+
return C_TO_O;
30+
case "c.o->so/dll":
31+
return O_TO_C_DYNAMIC_LIB;
32+
case "cpp.o->so/dll":
33+
return O_TO_CPP_DYNAMIC_LIB;
34+
case "o->ar":
35+
return O_TO_ARCHIVE;
36+
case "c.o->exe":
37+
return O_TO_C_EXE;
38+
case "cpp.o->exe":
39+
return O_TO_CPP_EXE;
4040
default:
4141
break;
42-
}
43-
return null;
44-
}
42+
}
43+
return null;
44+
}
4545

4646
public boolean isForLanguage(String languageId) {
47-
if(LANGUAGEID_ASSEMBLY.equals(languageId)) {
48-
switch(this) {
47+
if (LANGUAGEID_ASSEMBLY.equals(languageId)) {
48+
switch (this) {
4949
case A_TO_O:
5050
return true;
51-
default:
52-
return false;
51+
default:
52+
return false;
5353
}
5454
}
55-
if(LANGUAGEID_C.equals(languageId)) {
56-
switch(this) {
57-
case C_TO_O:case O_TO_C_DYNAMIC_LIB:case O_TO_C_EXE:
55+
if (LANGUAGEID_C.equals(languageId)) {
56+
switch (this) {
57+
case C_TO_O:
58+
case O_TO_C_DYNAMIC_LIB:
59+
case O_TO_C_EXE:
5860
return true;
59-
default:
60-
return false;
61+
default:
62+
return false;
6163
}
6264
}
63-
if(LANGUAGEID_CPP.equals(languageId)) {
64-
switch(this) {
65-
case CPP_TO_O:case O_TO_CPP_DYNAMIC_LIB:case O_TO_CPP_EXE:case O_TO_ARCHIVE:
65+
if (LANGUAGEID_CPP.equals(languageId)) {
66+
switch (this) {
67+
case CPP_TO_O:
68+
case O_TO_CPP_DYNAMIC_LIB:
69+
case O_TO_CPP_EXE:
70+
case O_TO_ARCHIVE:
6671
return true;
67-
default:
68-
return false;
72+
default:
73+
return false;
6974
}
7075
}
7176
return false;
7277
}
73-
}
74-
75-
public enum ToolFlavour {
76-
GNU, CYGWIN, MINGW, MVC, MAC_OS, GCC, LLVM;
77-
78-
}
79-
80-
/**
81-
* There should only be one BuildToolManger.
82-
* Use this static method to get the BuildToolManager
83-
*
84-
* @return
85-
*/
86-
public static IBuildToolManager getDefault() {
87-
return io.sloeber.buildTool.internal.BuildToolManager.getDefault();
88-
}
89-
90-
public String getDefaultCommand(ToolFlavour toolFlavour, ToolType toolType);
91-
92-
/**
93-
* Get the tool provider associated with the provided tool provider ID
94-
* @param toolProviderID
95-
* @return The tool Provider associated with the tool provider ID or null if no such provider is found
96-
*/
97-
public IBuildToolProvider getToolProvider(String toolProviderID);
98-
/**
99-
* Given the tool provider and the build tool ID return the build tools
100-
* @param toolProviderID
101-
* @param buildToolsID
102-
* @return the buildTools or null if not found
103-
*/
104-
public IBuildTools getBuildTools(String toolProviderID,String buildToolsID);
105-
106-
/**
107-
* get all installed targetTools
108-
* Doesn't matter which tool provider
109-
*
110-
*
111-
* @return a tool
112-
*/
113-
public Set<IBuildTools> getAllInstalledTargetTools();
114-
115-
/**
116-
* get a build tools that is compatible with the given
117-
* projectType
118-
* Doesn't matter which tool provider
119-
*
120-
*
121-
* @return a build tools
122-
*/
123-
public IBuildTools getAnyInstalledBuildTools(IProjectType projectType);
124-
125-
/**
126-
* Get all the build tool providers known to the
127-
* Build tool Manager
128-
*
129-
* @param onlyHoldsTools if true only return the providers that have actually
130-
* installed tools
131-
* if false return all known tool providers
132-
*
133-
* @return a set of IBuildToolProvider
134-
*/
78+
}
79+
80+
public enum ToolFlavour {
81+
GNU, CYGWIN, MINGW, MVC, MAC_OS, GCC, LLVM;
82+
83+
}
84+
85+
/**
86+
* There should only be one BuildToolManger. Use this static method to get the
87+
* BuildToolManager
88+
*
89+
* @return
90+
*/
91+
public static IBuildToolManager getDefault() {
92+
return io.sloeber.buildTool.internal.BuildToolManager.getDefault();
93+
}
94+
95+
public String getDefaultCommand(ToolFlavour toolFlavour, ToolType toolType);
96+
97+
/**
98+
* Get the tool provider associated with the provided tool provider ID
99+
*
100+
* @param toolProviderID
101+
* @return The tool Provider associated with the tool provider ID or null if no
102+
* such provider is found
103+
*/
104+
public IBuildToolProvider getToolProvider(String toolProviderID);
105+
106+
/**
107+
* Given the tool provider and the build tool ID return the build tools
108+
*
109+
* @param toolProviderID
110+
* @param buildToolsID
111+
* @return the buildTools or null if not found
112+
*/
113+
public IBuildTools getBuildTools(String toolProviderID, String buildToolsID);
114+
115+
/**
116+
* get all installed targetTools Doesn't matter which tool provider
117+
*
118+
*
119+
* @return a tool
120+
*/
121+
public Set<IBuildTools> getAllInstalledTargetTools();
122+
123+
/**
124+
* get a build tools that is compatible with the given projectType Doesn't
125+
* matter which tool provider
126+
*
127+
*
128+
* @return a build tools
129+
*/
130+
public IBuildTools getAnyInstalledBuildTools(IProjectType projectType);
131+
132+
/**
133+
* Get all the build tool providers known to the Build tool Manager
134+
*
135+
* @param onlyHoldsTools if true only return the providers that have actually
136+
* installed tools if false return all known tool
137+
* providers
138+
*
139+
* @return a set of IBuildToolProvider
140+
*/
135141
public Set<IBuildToolProvider> GetToolProviders(boolean onlyHoldsTools);
136142

137143
/**
138-
* refresh the toolchains known.
139-
* The manager caches the toolchains.
140-
* When this method is called the cache needs to be refreshed.
144+
* refresh the toolchains known. The manager caches the toolchains. When this
145+
* method is called the cache needs to be refreshed.
146+
* Also recalculates the make availability.
141147
*
142148
*/
143149
public void refreshToolchains();
144150

145-
146151
public IBuildToolProvider GetToolProviderByName(String toolProviderName);
152+
147153
}

io.sloeber.autoBuild/src/io/sloeber/buildTool/api/IBuildTools.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import io.sloeber.buildTool.api.IBuildToolManager.ToolFlavour;
88
import io.sloeber.buildTool.api.IBuildToolManager.ToolType;
9+
import io.sloeber.schema.api.IProjectType;
910

1011
/**
1112
* This is a set of tools on the local disk to build a target
@@ -17,19 +18,19 @@ public interface IBuildTools {
1718
* This tool provider find tools on the local disk
1819
* This method does not tell you how many locations of tools were found
1920
* It only tells you there is at least one location on disk that contains all
20-
* the tools
21-
* expected for the toolflavour.
22-
* For instance MVC needs a resource compiler tooltype where a ll other tools do
21+
* the tools expected for the toolflavour.
22+
* For instance MVC needs a resource compiler tooltype where a all other tools do
2323
* not need this
24-
* So if the tool type is GNU and not resource compiler is found but the others
25-
* are this method
26-
* should return true where MVC toolFlavour should return false
27-
*
24+
* For example:
25+
* 1) If the tool type is GNU the existence of the resource compiler does not
26+
* affect the outcome of this method
27+
* 2) If the tool type is MVC the existence of the resource compiler
28+
* affects the outcome of this method
2829
*
2930
* @return true if tools were found
3031
* false if no tools were found
3132
*/
32-
boolean holdsAllTools();
33+
boolean holdsAllTools( );
3334

3435
/**
3536
* A buildTool provider may provide different versions of tools.
@@ -119,4 +120,6 @@ public interface IBuildTools {
119120

120121
String getPathExtension();
121122

123+
boolean isProjectTypeSupported(IProjectType projectType);
124+
122125
}

io.sloeber.autoBuild/src/io/sloeber/buildTool/internal/CDTBuildTool.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.eclipse.core.runtime.IPath;
1212

1313
import io.sloeber.buildTool.api.IBuildTools;
14+
import io.sloeber.schema.api.IProjectType;
1415
import io.sloeber.buildTool.api.IBuildToolManager;
1516
import io.sloeber.buildTool.api.IBuildToolManager.ToolFlavour;
1617
import io.sloeber.buildTool.api.IBuildToolManager.ToolType;
@@ -98,5 +99,9 @@ public String getDiscoveryCommand(ToolType toolType) {
9899
return getToolLocation().append( getCommand(toolType)).toString() + DISCOVERY_PARAMETERS;
99100
}
100101

102+
@Override
103+
public boolean isProjectTypeSupported(IProjectType projectType) {
104+
return true;
105+
}
101106

102107
}

io.sloeber.autoBuild/src/io/sloeber/buildTool/internal/MinGW32ToolProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private void findTools() {
3737
if (myMinGWHome != null) {
3838

3939
myMinGWBinPath = new Path(myMinGWHome).append(BIN_FOLDER);
40-
IBuildTools targetTool= new MinGWTargetTool(myMinGWBinPath, getID(),MINGW_ID);
40+
IBuildTools targetTool= new MinGWTargetTool(myMinGWBinPath, this,MINGW_ID);
4141
myTargetTools.put(targetTool.getSelectionID(), targetTool);
4242
myHoldsAllTools = targetTool.holdsAllTools();
4343
}

0 commit comments

Comments
 (0)