Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build/org.eclipse.cdt.make.core/src/org/eclipse/cdt')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeBuilderInfo.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeCommonBuildInfo.java7
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTarget.java35
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTargetManager.java28
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java72
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java9
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java76
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java29
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java16
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeTargetEvent.java12
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IArchiveTarget.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IAutomaticVariable.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBadDirective.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBuiltinFunction.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDefaultRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IIgnoreRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java26
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileReaderProvider.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileValidator.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPosixRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPreciousRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISccsGetRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISilentRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISpecialRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISuffixesRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IDeleteOnErrorRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IExportAllVariablesRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IIntermediateRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ILowResolutionTimeRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/INotParallelRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IPhonyRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ISecondaryRule.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ITerminal.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IUnExport.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IVariableDefinition.java17
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java20
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfoProvider.java26
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java165
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IExternalScannerInfoProvider.java34
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo.java13
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2.java55
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2Set.java13
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector.java14
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector2.java18
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java44
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/InfoContext.java78
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java167
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java95
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java50
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigScope.java62
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java33
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java51
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ListenerList.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.java12
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java14
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java33
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java49
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/PreferenceInitializer.java54
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java14
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeCDataFactory.java19
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeConfigurationDataProvider.java13
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeDiscoveredInfoProcessor.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeLanguageData.java19
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java15
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java23
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileReader.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Util.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/BuiltinFunction.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java7
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportVariable.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java116
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java5
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java55
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java50
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java24
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java5
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideVariable.java1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/StaticTargetRule.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/TargetVariable.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java15
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java606
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoProcessor.java88
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java97
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java25
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java36
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java417
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java414
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java46
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigUtil.java62
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java155
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java364
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java330
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java177
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java465
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java180
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java296
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java20
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/ScannerInfoConsoleParserUtility.java78
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/BuildOutputReaderJob.java57
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java304
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java528
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java29
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/KVStringPair.java13
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/LogWriter.java44
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/PathInfoToLangSettingsConverter.java31
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java113
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java34
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java41
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java64
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java169
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java119
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/MakeConfigurationDataProviderMessages.java3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java1443
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java465
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java225
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java34
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCProfileInstance.java82
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java960
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfile.java149
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java152
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/templateengine/AddMakeTarget.java23
150 files changed, 5486 insertions, 5470 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeBuilderInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeBuilderInfo.java
index f8776c5e3e3..03be1d1e14a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeBuilderInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeBuilderInfo.java
@@ -31,8 +31,9 @@ public interface IMakeBuilderInfo extends IMakeCommonBuildInfo {
/** @deprecated as of CDT 4.0 */
@Deprecated
public final static String BUILD_TARGET_FULL = ARGS_PREFIX + ".build.target.full"; //$NON-NLS-1$
-
+
boolean isAutoBuildEnable();
+
void setAutoBuildEnable(boolean enabled) throws CoreException;
String getAutoBuildTarget();
@@ -44,6 +45,7 @@ public interface IMakeBuilderInfo extends IMakeCommonBuildInfo {
void setAutoBuildTarget(String target) throws CoreException;
boolean isIncrementalBuildEnabled();
+
void setIncrementalBuildEnable(boolean enabled) throws CoreException;
String getIncrementalBuildTarget();
@@ -55,6 +57,7 @@ public interface IMakeBuilderInfo extends IMakeCommonBuildInfo {
void setIncrementalBuildTarget(String target) throws CoreException;
boolean isFullBuildEnabled();
+
void setFullBuildEnable(boolean enabled) throws CoreException;
String getFullBuildTarget();
@@ -74,6 +77,7 @@ public interface IMakeBuilderInfo extends IMakeCommonBuildInfo {
void setCleanBuildTarget(String target) throws CoreException;
boolean isCleanBuildEnabled();
+
void setCleanBuildEnable(boolean enabled) throws CoreException;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeCommonBuildInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeCommonBuildInfo.java
index 23d19b57031..33527522579 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeCommonBuildInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeCommonBuildInfo.java
@@ -18,7 +18,6 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-
/**
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
@@ -31,6 +30,7 @@ public interface IMakeCommonBuildInfo {
public final static String BUILD_ARGUMENTS = ARGS_PREFIX + ".build.arguments"; //$NON-NLS-1$
void setBuildAttribute(String name, String value) throws CoreException;
+
String getBuildAttribute(String name, String defaultValue);
IPath getBuildLocation();
@@ -42,9 +42,11 @@ public interface IMakeCommonBuildInfo {
void setBuildLocation(IPath location) throws CoreException;
boolean isStopOnError();
+
void setStopOnError(boolean on) throws CoreException;
boolean isDefaultBuildCmd();
+
void setUseDefaultBuildCmd(boolean on) throws CoreException;
IPath getBuildCommand();
@@ -64,13 +66,16 @@ public interface IMakeCommonBuildInfo {
void setBuildArguments(String args) throws CoreException;
String[] getErrorParsers();
+
void setErrorParsers(String[] parsers) throws CoreException;
Map<String, String> getExpandedEnvironment() throws CoreException;
Map<String, String> getEnvironment();
+
void setEnvironment(Map<String, String> env) throws CoreException;
boolean appendEnvironment();
+
void setAppendEnvironment(boolean append) throws CoreException;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTarget.java
index 031b85deb98..94e03592524 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTarget.java
@@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* {@code IMakeTarget} represents a make target item in Make Targets View.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -35,52 +35,51 @@ public interface IMakeTarget extends IAdaptable, IMakeCommonBuildInfo {
* @noreference This method is not intended to be referenced by clients.
* Do not use this method to change target name, rather use {@link MakeTargetManager#renameTarget(IMakeTarget, String)}.
* This method is for internal use only.
- *
+ *
* @since 7.0
*/
public void setName(String name);
-
+
public String getTargetBuilderID();
-
+
public IProject getProject();
-
+
/**
* Set build target
- *
+ *
* @deprecated as of CDT 3.0
*/
@Deprecated
public void setBuildTarget(String target) throws CoreException;
-
/**
* @deprecated as of CDT 3.0
- *
+ *
* @return build target
*/
@Deprecated
public String getBuildTarget();
-
+
public void setRunAllBuilders(boolean runAllBuilders) throws CoreException;
public boolean runAllBuilders();
-
+
/**
* Get the target build container.
- *
- * @return IContainer of where target build will be invoked.
+ *
+ * @return IContainer of where target build will be invoked.
*/
public IContainer getContainer();
-
+
/**
- * Make this target temporary on the container, this target will not be persisted,
- * and may not be added to the IMakeTargetManager.
+ * Make this target temporary on the container, this target will not be persisted,
+ * and may not be added to the IMakeTargetManager.
*/
public void setContainer(IContainer container);
-
+
public void setAppendProjectEnvironment(boolean append);
-
+
public boolean appendProjectEnvironment();
-
+
public void build(IProgressMonitor monitor) throws CoreException;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTargetManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTargetManager.java
index 822fb7297c3..c33e5d92bdb 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTargetManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/IMakeTargetManager.java
@@ -21,25 +21,28 @@ import org.eclipse.core.runtime.CoreException;
/**
* Interface for {@link MakeTargetManager} handling make target items in Make Targets View.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMakeTargetManager {
IMakeTarget createTarget(IProject project, String targetName, String targetBuilderID) throws CoreException;
+
/**
* Adds target to manager.
*/
void addTarget(IMakeTarget target) throws CoreException;
-
+
/**
* Adds target to manager on a specific projects folder. It is assumed
* that the target and container belong to the same project.
*/
void addTarget(IContainer container, IMakeTarget target) throws CoreException;
+
void removeTarget(IMakeTarget target) throws CoreException;
+
void renameTarget(IMakeTarget target, String name) throws CoreException;
-
+
/**
* Set targets on a specific projects folder. It is assumed
* all targets and container belong to the same project which
@@ -48,26 +51,29 @@ public interface IMakeTargetManager {
* All previous targets for the container are replaced upon success and if
* failure occurs, an exception is thrown and the previous set of targets
* for the container are unchanged.
- *
+ *
* @param container to set targets for or null if project should be used
* @param targets array
- *
+ *
* @since 7.0
*/
public void setTargets(IContainer container, IMakeTarget[] targets) throws CoreException;
-
+
boolean targetExists(IMakeTarget target);
-
+
IMakeTarget[] getTargets(IContainer container) throws CoreException;
+
IMakeTarget findTarget(IContainer container, String name) throws CoreException;
- IProject[] getTargetBuilderProjects() throws CoreException;
-
+ IProject[] getTargetBuilderProjects() throws CoreException;
+
String getBuilderID(String targetBuilderID);
-
+
boolean hasTargetBuilder(IProject project);
+
String[] getTargetBuilders(IProject project);
-
+
void addListener(IMakeTargetListener listener);
+
void removeListener(IMakeTargetListener listener);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
index eb85f305657..d991fe80078 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
@@ -85,7 +85,8 @@ public class MakeBuilder extends ACBuilder {
* @see IncrementalProjectBuilder#build
*/
@Override
- protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args0, IProgressMonitor monitor) throws CoreException {
+ protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args0, IProgressMonitor monitor)
+ throws CoreException {
@SuppressWarnings("unchecked")
Map<String, String> args = args0;
if (DEBUG_EVENTS)
@@ -117,7 +118,6 @@ public class MakeBuilder extends ACBuilder {
return getProject().getReferencedProjects();
}
-
@Override
protected void clean(IProgressMonitor monitor) throws CoreException {
if (DEBUG_EVENTS)
@@ -125,9 +125,9 @@ public class MakeBuilder extends ACBuilder {
final IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(getProject(), BUILDER_ID);
if (shouldBuild(CLEAN_BUILD, info)) {
- IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
+ IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
final ISchedulingRule rule = ruleFactory.modifyRule(getProject());
- Job backgroundJob = new Job("Standard Make Builder"){ //$NON-NLS-1$
+ Job backgroundJob = new Job("Standard Make Builder") { //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -148,7 +148,6 @@ public class MakeBuilder extends ACBuilder {
return returnStatus;
}
-
};
backgroundJob.setRule(rule);
@@ -208,18 +207,22 @@ public class MakeBuilder extends ACBuilder {
collectLanguageSettingsConsoleParsers(cfgDescription, epm, parsers);
}
if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(project)) {
- IScannerInfoConsoleParser parserSD = ScannerInfoConsoleParserFactory.getScannerInfoConsoleParser(project, workingDirectoryURI, this);
+ IScannerInfoConsoleParser parserSD = ScannerInfoConsoleParserFactory
+ .getScannerInfoConsoleParser(project, workingDirectoryURI, this);
parsers.add(parserSD);
}
}
buildRunnerHelper.setLaunchParameters(launcher, buildCommand, args, workingDirectoryURI, envp);
- buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor, TICKS_STREAM_PROGRESS_MONITOR, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
+ buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor,
+ TICKS_STREAM_PROGRESS_MONITOR, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
- buildRunnerHelper.removeOldMarkers(project, new SubProgressMonitor(monitor, TICKS_DELETE_MARKERS, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
+ buildRunnerHelper.removeOldMarkers(project, new SubProgressMonitor(monitor, TICKS_DELETE_MARKERS,
+ SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
buildRunnerHelper.greeting(kind);
- int state = buildRunnerHelper.build(new SubProgressMonitor(monitor, TICKS_EXECUTE_COMMAND, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
+ int state = buildRunnerHelper.build(new SubProgressMonitor(monitor, TICKS_EXECUTE_COMMAND,
+ SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
buildRunnerHelper.close();
buildRunnerHelper.goodbye();
@@ -227,7 +230,8 @@ public class MakeBuilder extends ACBuilder {
refreshProject(project);
}
} else {
- String msg = MakeMessages.getFormattedString("MakeBuilder.message.undefined.build.command", project.getName()); //$NON-NLS-1$
+ String msg = MakeMessages.getFormattedString("MakeBuilder.message.undefined.build.command", //$NON-NLS-1$
+ project.getName());
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, msg, new Exception()));
}
} catch (Exception e) {
@@ -247,8 +251,8 @@ public class MakeBuilder extends ACBuilder {
throws CoreException {
HashMap<String, String> envMap = new HashMap<String, String>();
if (info.appendEnvironment()) {
- @SuppressWarnings({"unchecked", "rawtypes"})
- Map<String, String> env = (Map)launcher.getEnvironment();
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ Map<String, String> env = (Map) launcher.getEnvironment();
if (env != null) {
envMap.putAll(env);
}
@@ -289,7 +293,6 @@ public class MakeBuilder extends ACBuilder {
}
}
-
/**
* Check whether the build has been canceled.
*/
@@ -300,13 +303,13 @@ public class MakeBuilder extends ACBuilder {
protected boolean shouldBuild(int kind, IMakeBuilderInfo info) {
switch (kind) {
- case IncrementalProjectBuilder.AUTO_BUILD :
- return info.isAutoBuildEnable();
- case IncrementalProjectBuilder.INCREMENTAL_BUILD : // now treated as the same!
- case IncrementalProjectBuilder.FULL_BUILD :
- return info.isFullBuildEnabled() | info.isIncrementalBuildEnabled() ;
- case IncrementalProjectBuilder.CLEAN_BUILD :
- return info.isCleanBuildEnabled();
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ return info.isAutoBuildEnable();
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD: // now treated as the same!
+ case IncrementalProjectBuilder.FULL_BUILD:
+ return info.isFullBuildEnabled() | info.isIncrementalBuildEnabled();
+ case IncrementalProjectBuilder.CLEAN_BUILD:
+ return info.isCleanBuildEnabled();
}
return true;
}
@@ -314,16 +317,16 @@ public class MakeBuilder extends ACBuilder {
protected String[] getTargets(int kind, IMakeBuilderInfo info) {
String targets = ""; //$NON-NLS-1$
switch (kind) {
- case IncrementalProjectBuilder.AUTO_BUILD :
- targets = info.getAutoBuildTarget();
- break;
- case IncrementalProjectBuilder.INCREMENTAL_BUILD : // now treated as the same!
- case IncrementalProjectBuilder.FULL_BUILD :
- targets = info.getIncrementalBuildTarget();
- break;
- case IncrementalProjectBuilder.CLEAN_BUILD :
- targets = info.getCleanBuildTarget();
- break;
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ targets = info.getAutoBuildTarget();
+ break;
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD: // now treated as the same!
+ case IncrementalProjectBuilder.FULL_BUILD:
+ targets = info.getIncrementalBuildTarget();
+ break;
+ case IncrementalProjectBuilder.CLEAN_BUILD:
+ targets = info.getCleanBuildTarget();
+ break;
}
return makeArray(targets);
}
@@ -332,10 +335,12 @@ public class MakeBuilder extends ACBuilder {
private String[] makeArray(String string) {
return CommandLineUtil.argumentsToArray(string);
}
-
- private static void collectLanguageSettingsConsoleParsers(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker, List<IConsoleParser> parsers) {
+
+ private static void collectLanguageSettingsConsoleParsers(ICConfigurationDescription cfgDescription,
+ IWorkingDirectoryTracker cwdTracker, List<IConsoleParser> parsers) {
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
- List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
+ List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription)
+ .getLanguageSettingProviders();
for (ILanguageSettingsProvider lsProvider : lsProviders) {
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(lsProvider);
if (rawProvider instanceof ICBuildOutputParser) {
@@ -353,5 +358,4 @@ public class MakeBuilder extends ACBuilder {
}
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
index fef1afe4a30..72af911e10e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
@@ -70,9 +70,9 @@ public class MakeBuilderUtil {
}
return project.getLocationURI();
}
-
+
/**
- * @param builderID
+ * @param builderID
* @return URI of the build directory, or the Project's URI if one couldn't be found
* @since 7.1
*/
@@ -83,7 +83,7 @@ public class MakeBuilderUtil {
} catch (CoreException e) {
return project.getLocationURI();
}
-
+
IPath buildDirectory = info.getBuildLocation();
if (!buildDirectory.isEmpty()) {
IResource res = project.getParent().findMember(buildDirectory);
@@ -93,6 +93,5 @@ public class MakeBuilderUtil {
}
return project.getLocationURI();
}
-
-
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
index 69d30581775..80d4ede4d3c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java
@@ -99,16 +99,19 @@ public class MakeCorePlugin extends Plugin {
public static final String OLD_BUILDER_ID = "org.eclipse.cdt.core.cbuilder"; //$NON-NLS-1$
public static final String EXTERNAL_SI_PROVIDER_SIMPLE_ID = "ExternalScannerInfoProvider"; //$NON-NLS-1$
- public static final String SI_CONSOLE_PARSER_SIMPLE_ID = "ScannerInfoConsoleParser"; //$NON-NLS-1$
- public static final String DEFAULT_EXTERNAL_SI_PROVIDER_ID = MakeCorePlugin.getUniqueIdentifier() + ".DefaultExternalScannerInfoProvider"; //$NON-NLS-1$
+ public static final String SI_CONSOLE_PARSER_SIMPLE_ID = "ScannerInfoConsoleParser"; //$NON-NLS-1$
+ public static final String DEFAULT_EXTERNAL_SI_PROVIDER_ID = MakeCorePlugin.getUniqueIdentifier()
+ + ".DefaultExternalScannerInfoProvider"; //$NON-NLS-1$
- public static final String GCC_SPECS_CONSOLE_PARSER_ID = MakeCorePlugin.getUniqueIdentifier() + ".GCCSpecsConsoleParser"; //$NON-NLS-1$
- public static final String GCC_SCANNER_INFO_CONSOLE_PARSER_ID = MakeCorePlugin.getUniqueIdentifier() + ".GCCScannerInfoConsoleParser"; //$NON-NLS-1$
+ public static final String GCC_SPECS_CONSOLE_PARSER_ID = MakeCorePlugin.getUniqueIdentifier()
+ + ".GCCSpecsConsoleParser"; //$NON-NLS-1$
+ public static final String GCC_SCANNER_INFO_CONSOLE_PARSER_ID = MakeCorePlugin.getUniqueIdentifier()
+ + ".GCCScannerInfoConsoleParser"; //$NON-NLS-1$
public static final String MAKEFILE_STYLE = PLUGIN_ID + ".editor_makefile_style"; //$NON-NLS-1$
public static final String MAKEFILE_DIRS = PLUGIN_ID + ".editor_makefile_dirs"; //$NON-NLS-1$
- public static final String CFG_DATA_PROVIDER_ID = PLUGIN_ID + ".configurationDataProvider"; //$NON-NLS-1$
+ public static final String CFG_DATA_PROVIDER_ID = PLUGIN_ID + ".configurationDataProvider"; //$NON-NLS-1$
private MakeTargetManager fTargetManager;
private DiscoveredPathManager fDiscoveryPathManager;
//The shared instance.
@@ -165,7 +168,7 @@ public class MakeCorePlugin extends Plugin {
}
public IMakeTargetManager getTargetManager() {
- if ( fTargetManager == null) {
+ if (fTargetManager == null) {
fTargetManager = new MakeTargetManager();
fTargetManager.startup();
}
@@ -217,11 +220,13 @@ public class MakeCorePlugin extends Plugin {
return makefile;
}
- public static IMakefile createMakefile(IFileStore file, boolean isGnuStyle, String[] makefileDirs) throws CoreException {
+ public static IMakefile createMakefile(IFileStore file, boolean isGnuStyle, String[] makefileDirs)
+ throws CoreException {
return createMakefile(file.toURI(), isGnuStyle, makefileDirs, (String) null);
}
- static IMakefile createMakefile(IFileStore file, boolean isGnuStyle, String[] makefileDirs, String encoding) throws CoreException {
+ static IMakefile createMakefile(IFileStore file, boolean isGnuStyle, String[] makefileDirs, String encoding)
+ throws CoreException {
return createMakefile(file.toURI(), isGnuStyle, makefileDirs, encoding);
}
@@ -229,7 +234,6 @@ public class MakeCorePlugin extends Plugin {
return createMakefile(fileURI, isGnuStyle, makefileDirs, new FileStoreReaderProvider(encoding));
}
-
/**
* Create an IMakefile using the given IMakefileReaderProvider to fetch
* contents by name.
@@ -237,8 +241,8 @@ public class MakeCorePlugin extends Plugin {
* @param fileURI URI of main file
* @param makefileReaderProvider may be <code>null</code> for EFS IFileStore reading
*/
- public static IMakefile createMakefile(URI fileURI,
- boolean isGnuStyle, String[] makefileDirs, IMakefileReaderProvider makefileReaderProvider) {
+ public static IMakefile createMakefile(URI fileURI, boolean isGnuStyle, String[] makefileDirs,
+ IMakefileReaderProvider makefileReaderProvider) {
IMakefile makefile;
if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile();
@@ -274,13 +278,14 @@ public class MakeCorePlugin extends Plugin {
}
public IMakefile createMakefile(IFile file) throws CoreException {
- return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs(), file.getCharset());
+ return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs(),
+ file.getCharset());
}
@Override
public void stop(BundleContext context) throws Exception {
try {
- if ( fTargetManager != null) {
+ if (fTargetManager != null) {
fTargetManager.shutdown();
fTargetManager = null;
}
@@ -298,18 +303,17 @@ public class MakeCorePlugin extends Plugin {
* Following methods create IScannerConfigBuilderInfo
* Delegating requests to ScannerConfigInfoFactory
*/
- public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(
- Preferences prefs, String builderID, boolean useDefaults) {
+ public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(Preferences prefs, String builderID,
+ boolean useDefaults) {
return ScannerConfigInfoFactory.create(prefs, builderID, useDefaults);
}
- public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(
- IProject project, String builderID) throws CoreException {
+ public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(IProject project, String builderID)
+ throws CoreException {
return ScannerConfigInfoFactory.create(project, builderID);
}
- public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(
- Map<String, String> args, String builderID) {
+ public static IScannerConfigBuilderInfo createScannerConfigBuildInfo(Map<String, String> args, String builderID) {
return ScannerConfigInfoFactory.create(args, builderID);
}
@@ -318,7 +322,7 @@ public class MakeCorePlugin extends Plugin {
}
public IDiscoveredPathManager getDiscoveryManager() {
- if ( fDiscoveryPathManager == null) {
+ if (fDiscoveryPathManager == null) {
fDiscoveryPathManager = new DiscoveredPathManager();
fDiscoveryPathManager.startup();
}
@@ -331,7 +335,8 @@ public class MakeCorePlugin extends Plugin {
*/
public IExternalScannerInfoProvider getExternalScannerInfoProvider(String id) {
try {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, EXTERNAL_SI_PROVIDER_SIMPLE_ID);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID,
+ EXTERNAL_SI_PROVIDER_SIMPLE_ID);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++) {
@@ -341,15 +346,15 @@ public class MakeCorePlugin extends Plugin {
for (int j = 0; j < configElements.length; j++) {
IConfigurationElement[] runElement = configElements[j].getChildren("run"); //$NON-NLS-1$
if (runElement.length > 0) {
- IExternalScannerInfoProvider builder = (IExternalScannerInfoProvider) runElement[0].createExecutableExtension("class"); //$NON-NLS-1$
+ IExternalScannerInfoProvider builder = (IExternalScannerInfoProvider) runElement[0]
+ .createExecutableExtension("class"); //$NON-NLS-1$
return builder;
}
}
}
}
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
log(e);
}
return null;
@@ -361,9 +366,10 @@ public class MakeCorePlugin extends Plugin {
public String[] getScannerInfoConsoleParserIds(String commandId) {
String[] empty = new String[0];
if (commandId == null || commandId.length() == 0) {
- commandId = "all"; //$NON-NLS-1$
+ commandId = "all"; //$NON-NLS-1$
}
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, SI_CONSOLE_PARSER_SIMPLE_ID);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID,
+ SI_CONSOLE_PARSER_SIMPLE_ID);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
List<String> parserIds = new ArrayList<String>(extensions.length);
@@ -372,7 +378,7 @@ public class MakeCorePlugin extends Plugin {
if (parserId != null) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
String id = configElements[0].getAttribute("commandId");//$NON-NLS-1$
- if (id != null && (id.equals(commandId) || id.equals("all"))) { //$NON-NLS-1$
+ if (id != null && (id.equals(commandId) || id.equals("all"))) { //$NON-NLS-1$
parserIds.add(parserId);
}
}
@@ -387,20 +393,21 @@ public class MakeCorePlugin extends Plugin {
*/
public IScannerInfoConsoleParser getScannerInfoConsoleParser(String parserId) {
try {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, SI_CONSOLE_PARSER_SIMPLE_ID);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID,
+ SI_CONSOLE_PARSER_SIMPLE_ID);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++) {
String id = extensions[i].getUniqueIdentifier();
if (id != null && id.equals(parserId)) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- IScannerInfoConsoleParser parser = (IScannerInfoConsoleParser)configElements[0].createExecutableExtension("class");//$NON-NLS-1$
+ IScannerInfoConsoleParser parser = (IScannerInfoConsoleParser) configElements[0]
+ .createExecutableExtension("class");//$NON-NLS-1$
return parser;
}
}
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
log(e);
}
return null;
@@ -415,11 +422,12 @@ public class MakeCorePlugin extends Plugin {
//Set debug tracing options
configurePluginDebugOptions();
- // Scanner config discovery setup
- GCCScannerConfigUtil.createSpecs();
+ // Scanner config discovery setup
+ GCCScannerConfigUtil.createSpecs();
}
private static final String SCANNER_CONFIG = MakeCorePlugin.getUniqueIdentifier() + "/debug/scdiscovery"; //$NON-NLS-1$
+
/**
*
*/
@@ -427,7 +435,7 @@ public class MakeCorePlugin extends Plugin {
if (isDebugging()) {
String option = Platform.getDebugOption(SCANNER_CONFIG);
if (option != null) {
- TraceUtil.SCANNER_CONFIG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
+ TraceUtil.SCANNER_CONFIG = option.equalsIgnoreCase("true"); //$NON-NLS-1$
}
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java
index dd509100bd6..97e23c3ab46 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java
@@ -31,14 +31,14 @@ public class MakeProjectNature implements IProjectNature {
public static void addNature(IProject project, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = project.getDescription();
- String[] prevNatures= description.getNatureIds();
- for (int i= 0; i < prevNatures.length; i++) {
+ String[] prevNatures = description.getNatureIds();
+ for (int i = 0; i < prevNatures.length; i++) {
if (NATURE_ID.equals(prevNatures[i]))
return;
}
- String[] newNatures= new String[prevNatures.length + 1];
+ String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= NATURE_ID;
+ newNatures[prevNatures.length] = NATURE_ID;
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
}
@@ -111,7 +111,8 @@ public class MakeProjectNature implements IProjectNature {
/**
* Removes the given builder from the build spec for the given project.
*/
- public static void removeFromBuildSpec(IProject project, String builderID, IProgressMonitor mon) throws CoreException {
+ public static void removeFromBuildSpec(IProject project, String builderID, IProgressMonitor mon)
+ throws CoreException {
IProjectDescription description = project.getDescription();
ICommand[] commands = description.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
@@ -136,24 +137,30 @@ public class MakeProjectNature implements IProjectNature {
@Override
public void configure() throws CoreException {
addBuildSpec();
- IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false);
+ IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(),
+ MakeBuilder.BUILDER_ID, false);
IMakeBuilderInfo projectInfo = MakeCorePlugin.createBuildInfo(getProject(), MakeBuilder.BUILDER_ID);
- projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
- projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS,
+ info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND,
+ info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
projectInfo.setUseDefaultBuildCmd(info.isDefaultBuildCmd());
projectInfo.setStopOnError(info.isStopOnError());
projectInfo.setAutoBuildEnable(info.isAutoBuildEnable());
- projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO,
+ info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); //$NON-NLS-1$
projectInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled());
- projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL,
+ info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); //$NON-NLS-1$
projectInfo.setFullBuildEnable(info.isIncrementalBuildEnabled());
projectInfo.setCleanBuildEnable(info.isCleanBuildEnabled());
- projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, "")); //$NON-NLS-1$
+ projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN,
+ info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, "")); //$NON-NLS-1$
projectInfo.setErrorParsers(info.getErrorParsers());
projectInfo.setAppendEnvironment(info.appendEnvironment());
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java
index b46d51ac9e9..e863373c994 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java
@@ -70,6 +70,7 @@ public class MakeScannerInfo implements IScannerInfo {
getPathList().addAll(Arrays.asList(paths));
}
}
+
/*
* (non-Javadoc)
*
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java
index 1c9817bc31f..b398e6f089c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java
@@ -76,7 +76,7 @@ public class MakeScannerProvider extends ScannerProvider {
MakeScannerInfo scannerInfo = null;
// See if there's already one associated with the resource for this
// session
- scannerInfo = (MakeScannerInfo)project.getSessionProperty(scannerInfoProperty);
+ scannerInfo = (MakeScannerInfo) project.getSessionProperty(scannerInfoProperty);
// Try to load one for the project
if (scannerInfo == null) {
@@ -128,10 +128,10 @@ public class MakeScannerProvider extends ScannerProvider {
for (ICStorageElement child : storage.getChildren()) {
if (child.getName().equals(INCLUDE_PATH)) {
// Add the path to the property list
- includes.add( ((Element)child).getAttribute(PATH));
+ includes.add(((Element) child).getAttribute(PATH));
} else if (child.getName().equals(DEFINED_SYMBOL)) {
// Add the symbol to the symbol list
- symbols.add( ((Element)child).getAttribute(SYMBOL));
+ symbols.add(((Element) child).getAttribute(SYMBOL));
}
}
MakeScannerInfo info = new MakeScannerInfo(project);
@@ -148,14 +148,15 @@ public class MakeScannerProvider extends ScannerProvider {
List<IPathEntry> cPaths = new ArrayList<IPathEntry>(Arrays.asList(entries));
Iterator<IPathEntry> cpIter = cPaths.iterator();
- while(cpIter.hasNext()) {
+ while (cpIter.hasNext()) {
int kind = cpIter.next().getEntryKind();
- if(kind == IPathEntry.CDT_INCLUDE || kind == IPathEntry.CDT_MACRO) {
+ if (kind == IPathEntry.CDT_INCLUDE || kind == IPathEntry.CDT_MACRO) {
cpIter.remove();
}
}
for (int i = 0; i < includes.length; i++) {
- IIncludeEntry include = CoreModel.newIncludeEntry(info.getProject().getFullPath(), null, new Path(includes[i]), true);
+ IIncludeEntry include = CoreModel.newIncludeEntry(info.getProject().getFullPath(), null,
+ new Path(includes[i]), true);
if (!cPaths.contains(include)) {
cPaths.add(include);
}
@@ -163,7 +164,8 @@ public class MakeScannerProvider extends ScannerProvider {
Iterator<Entry<String, String>> syms = symbols.entrySet().iterator();
while (syms.hasNext()) {
Entry<String, String> entry = syms.next();
- IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), entry.getKey(), entry.getValue());
+ IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), entry.getKey(),
+ entry.getValue());
if (!cPaths.contains(sym)) {
cPaths.add(sym);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeTargetEvent.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeTargetEvent.java
index 48b4060a1cc..8dc61d3a680 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeTargetEvent.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeTargetEvent.java
@@ -21,7 +21,7 @@ import org.eclipse.core.resources.IProject;
/**
* This class represents an event sent when the set of Make Target items
* in Make Targets View has changed.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -45,14 +45,14 @@ public class MakeTargetEvent extends EventObject {
public MakeTargetEvent(Object source, int type, IMakeTarget target) {
super(source);
this.type = type;
- this.targets = new IMakeTarget[] {target};
+ this.targets = new IMakeTarget[] { target };
}
/**
* @param source - the object on which the Event initially occurred.
* @param type - event type (e.g. TARGET_ADD, TARGET_CHANGED)
* @param targets - array of MakeTargets
- *
+ *
* @since 7.0
*/
public MakeTargetEvent(Object source, int type, IMakeTarget[] targets) {
@@ -78,17 +78,17 @@ public class MakeTargetEvent extends EventObject {
/**
* @return the first target (for compatibility with old method).
- *
+ *
* @deprecated Use getTargets() instead.
*/
@Deprecated
public IMakeTarget getTarget() {
return targets[0];
}
-
+
/**
* @return MakeTargets passed in this event.
- *
+ *
* @since 7.0
*/
public IMakeTarget[] getTargets() {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
index c53a30be0cb..81c7bae29ee 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
@@ -33,14 +33,13 @@ public class MakefileBuildConfigurationProvider implements ICBuildConfigurationP
}
@Override
- public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
- throws CoreException {
+ public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
return new StandardBuildConfiguration(config, name);
}
@Override
- public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
- String launchMode, IProgressMonitor monitor) throws CoreException {
+ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain, String launchMode,
+ IProgressMonitor monitor) throws CoreException {
ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
@@ -68,8 +67,7 @@ public class MakefileBuildConfigurationProvider implements ICBuildConfigurationP
}
IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
- StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
- launchMode);
+ StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain, launchMode);
configManager.addBuildConfiguration(config, makeConfig);
return makeConfig;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
index 9bc3e729abc..383ee98824f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
@@ -33,7 +33,7 @@ import org.osgi.framework.Bundle;
/**
* Generator for Makefile projects.
- *
+ *
* @since 7.4
*/
public class MakefileProjectGenerator extends FMProjectGenerator {
@@ -49,8 +49,8 @@ public class MakefileProjectGenerator extends FMProjectGenerator {
@Override
protected void initProjectDescription(IProjectDescription description) throws CoreException {
- description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
- MakeProjectNature.NATURE_ID });
+ description.setNatureIds(
+ new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, MakeProjectNature.NATURE_ID });
ICommand command = description.newCommand();
CBuilder.setupBuilder(command);
description.setBuildSpec(new ICommand[] { command });
@@ -85,8 +85,8 @@ public class MakefileProjectGenerator extends FMProjectGenerator {
}
entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
- CoreModel.getDefault().create(project)
- .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
+ CoreModel.getDefault().create(project).setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
+ monitor);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IArchiveTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IArchiveTarget.java
index 3c9ae9169cc..c864717a4a9 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IArchiveTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IArchiveTarget.java
@@ -21,7 +21,7 @@ package org.eclipse.cdt.make.core.makefile;
* foolib(hack.o) : hack.o
* ar cr foolib hack.o
* ArchiveTarget(member) -- foolib(hack.o);
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IAutomaticVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IAutomaticVariable.java
index d72baacfdf3..d6805720fa3 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IAutomaticVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IAutomaticVariable.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.make.core.makefile.gnu.IVariableDefinition;
/**
* Interface fore built-in automatic variables.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 7.3
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBadDirective.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBadDirective.java
index 10fdefaa05d..8a9815bf003 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBadDirective.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBadDirective.java
@@ -16,7 +16,7 @@ package org.eclipse.cdt.make.core.makefile;
/**
* Represent an error in the makefile syntax
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBuiltinFunction.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBuiltinFunction.java
index fb0e33ab356..95e1cc54fe7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBuiltinFunction.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IBuiltinFunction.java
@@ -15,12 +15,12 @@ package org.eclipse.cdt.make.core.makefile;
/**
* Interface fore built-in internal functions.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 7.3
*/
-public interface IBuiltinFunction extends IDirective {
+public interface IBuiltinFunction extends IDirective {
/**
* @return the name of the function
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java
index 7484ff3947a..95eb787f46e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java
@@ -16,17 +16,16 @@ package org.eclipse.cdt.make.core.makefile;
import java.io.File;
import java.io.IOException;
-
/**
* ICommand
* Commands are associated with a rule and executed by
* the make program when building a target.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICommand extends IDirective {
-
+
final public static char HYPHEN = '-';
final public static String HYPHEN_STRING = "-"; //$NON-NLS-1$
@@ -65,7 +64,6 @@ public interface ICommand extends IDirective {
*/
boolean shouldExecute();
-
/**
* Executes the command in a separate process with the
* specified environment and working directory.
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java
index 4cc0ee1eff3..9ae58246de3 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java
@@ -15,11 +15,11 @@ package org.eclipse.cdt.make.core.makefile;
/**
* Comments start with '#' and until the end of the line.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface IComment extends IDirective {
+public interface IComment extends IDirective {
final public static char POUND = '#';
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDefaultRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDefaultRule.java
index 797621c4d67..0a2372979c9 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDefaultRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDefaultRule.java
@@ -18,7 +18,7 @@ package org.eclipse.cdt.make.core.makefile;
* If the makefile uses this special target, the application shall ensure that it is
* specified with commands, but without prerequisites.
* The commands shall be used by make if there are no other rules available to build a target.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java
index f6260b9a413..a09c119adf3 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java
@@ -15,7 +15,7 @@ package org.eclipse.cdt.make.core.makefile;
/**
* IEmptyLine
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IIgnoreRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IIgnoreRule.java
index a0ea4f64bc5..e78e7c92d9d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IIgnoreRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IIgnoreRule.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.make.core.makefile;
* .IGNORE
* Prerequisites of this special target are targets themselves; this shall cause errors
* from commands associated with them to be ignored in the same manner as specified by the -i option.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java
index 81ae343350f..6fb4a8a6dc4 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java
@@ -18,10 +18,10 @@ package org.eclipse.cdt.make.core.makefile;
* target:
* <tab>command
* [<tab>command]
- *
+ *
* The target is of the form .s2 or .s1.s2
* There are no prerequisites.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java
index 5b661ed8988..ab091331bcf 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java
@@ -16,11 +16,11 @@ package org.eclipse.cdt.make.core.makefile;
/**
* IMacroDefinitions are in the form:
* string1 = [string2]
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface IMacroDefinition extends IDirective {
+public interface IMacroDefinition extends IDirective {
/**
* @return the name of the macro
@@ -39,7 +39,7 @@ public interface IMacroDefinition extends IDirective {
/**
* @return the macro was found in a Makefile.
- *
+ *
*/
boolean isFromMakefile();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java
index 300f2dd0cff..6188893c4dd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java
@@ -17,7 +17,6 @@ import java.io.IOException;
import java.io.Reader;
import java.net.URI;
-
/**
* IMakefile:
*
@@ -26,16 +25,16 @@ import java.net.URI;
* rule : inference_rule | target_rule | special_rule
* inference_rule : target ':' [ ';' command ] <nl>
* [ ( command ) * ]
- * target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
+ * target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
* [ ( command ) * ]
- * macro_definition : string '=' ( string )*
+ * macro_definition : string '=' ( string )*
* comments : ('#' ( string ) <nl>) *
* empty : <nl>
* command : <tab> prefix_command string <nl>
* target : string
* prefix_command : '-' | '@' | '+'
- * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
- *
+ * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -53,7 +52,7 @@ public interface IMakefile extends IParent {
/**
* @return IInferenceRule
- *
+ *
*/
IInferenceRule[] getInferenceRules();
@@ -92,7 +91,7 @@ public interface IMakefile extends IParent {
* @since 7.3
*/
IBuiltinFunction[] getBuiltinFunctions();
-
+
/**
* @return all the built-in MacroDefintions
*/
@@ -103,7 +102,7 @@ public interface IMakefile extends IParent {
* @since 7.3
*/
IAutomaticVariable[] getAutomaticVariables();
-
+
/**
* @return the built-in macro definition for name.
*/
@@ -116,7 +115,7 @@ public interface IMakefile extends IParent {
/**
* @return line after expanding any macros.
- *
+ *
* @param line - line to expand
* @param recursive - if true recursively expand.
*/
@@ -126,25 +125,24 @@ public interface IMakefile extends IParent {
* @return the makefile Reader provider used to create this makefile or <code>null</code>
*/
IMakefileReaderProvider getMakefileReaderProvider();
-
+
/**
* Clear all statements and (re)parse the Makefile
*/
void parse(String filePath, Reader makefile) throws IOException;
-
+
/**
* Clear all statements and (re)parse the Makefile
*/
void parse(URI fileURI, Reader makefile) throws IOException;
-
+
/**
* Clear the all statements and (re)parse the Makefile
* using the given makefile Reader provider
- *
+ *
* @param makefileReaderProvider provider, or <code>null</code> to use a FileReader
*/
void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException;
-
/**
* @return the <code>URI</code> of this makefile
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileReaderProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileReaderProvider.java
index 449e1d736f8..235da2a9b1c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileReaderProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileReaderProvider.java
@@ -26,10 +26,10 @@ import java.net.URI;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMakefileReaderProvider {
- /**
+ /**
* Get a reader for the contents of the file at filename.
* @param fileURI the file to read. It's up to the implementation how to read
- * it, but usually EFS.getFileStore(fileURI).getInputStream(...) is the best bet.
+ * it, but usually EFS.getFileStore(fileURI).getInputStream(...) is the best bet.
* @return Reader a reader for the contents of the existing file
* @throws IOException if the file cannot be found according to the implementation
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileValidator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileValidator.java
index 5cf7e483421..a6789d3e540 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileValidator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefileValidator.java
@@ -23,11 +23,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMakefileValidator {
public abstract void setMarkerGenerator(IMarkerGenerator errorHandler);
+
public abstract void checkFile(IFile file, IProgressMonitor monitor);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPosixRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPosixRule.java
index b722fcca99d..b8bd0e9513d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPosixRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPosixRule.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.make.core.makefile;
* .POSIX
* The application shall ensure that this special target is specified without
* prerequisites or commands.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPreciousRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPreciousRule.java
index c716a6d347e..befe75b3421 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPreciousRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IPreciousRule.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.make.core.makefile;
* .PRECIOUS
* Prerequisites of this special target shall not be removed if make recieves an
* asynchronous events.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java
index 2f4d8665213..a9563f74670 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.make.core.makefile;
* There are several kinds of rules: Inference rules, target rules
* Some make provides special rules for example:
* .DEFAULT, .IGNORE etc ...
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -29,7 +29,7 @@ public interface IRule extends IParent {
/**
* @return The rule target name.
- *
+ *
*/
ITarget getTarget();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISccsGetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISccsGetRule.java
index bbb22351ef5..6b415e3cff0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISccsGetRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISccsGetRule.java
@@ -18,7 +18,7 @@ package org.eclipse.cdt.make.core.makefile;
* The application shall ensure that this special target is specified without prerequesites.
* The commands specified with this target shall replace the default
* commands associated with this special target.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISilentRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISilentRule.java
index 3554d71b3fa..84c2c0993d8 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISilentRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISilentRule.java
@@ -18,7 +18,7 @@ package org.eclipse.cdt.make.core.makefile;
* Prerequisites of this special target are targets themselves; this shall case
* commands associated with them not to be written to the standard output before
* they are executed.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISpecialRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISpecialRule.java
index 58fb830da44..097923aed71 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISpecialRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISpecialRule.java
@@ -15,7 +15,7 @@ package org.eclipse.cdt.make.core.makefile;
/**
* Target rule that have special meaning for Make.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISuffixesRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISuffixesRule.java
index 4512dbcccc9..0353a412519 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISuffixesRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ISuffixesRule.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.make.core.makefile;
* .SUFFIXES
* Prerequesites of .SUFFIXES shall be appended to the list of known suffixes and are
* used in conjunction with the inference rules.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IDeleteOnErrorRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IDeleteOnErrorRule.java
index 2a894bb3232..e5deae87f53 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IDeleteOnErrorRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IDeleteOnErrorRule.java
@@ -21,7 +21,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* makefile, then `make' will delete the target of a rule if it has
* changed and its commands exit with a nonzero exit status, just as
* it does when it receives a signal.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IExportAllVariablesRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IExportAllVariablesRule.java
index eac81c82797..03d5d1ea384 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IExportAllVariablesRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IExportAllVariablesRule.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* .EXPORT_ALL_VARIABLES
* Simply by being mentioned as a target, this tells `make' to export
* all variables to child processes by default.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IIntermediateRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IIntermediateRule.java
index 0a8580ed620..bde32b484e1 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IIntermediateRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IIntermediateRule.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* .INTERMEDIATE
* The targets which `.INTERMEDIATE' depends on are treated as intermediate files.
* `.INTERMEDIATE' with no prerequisites has no effect.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ILowResolutionTimeRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ILowResolutionTimeRule.java
index 79f488e0f79..7529ed653b2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ILowResolutionTimeRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ILowResolutionTimeRule.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* If you specify prerequisites for `.LOW_RESOLUTION_TIME', `make'
* assumes that these files are created by commands that generate low
* resolution time stamps.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/INotParallelRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/INotParallelRule.java
index 6785ba4da99..3d5fd16c84f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/INotParallelRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/INotParallelRule.java
@@ -22,7 +22,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* Any recursively invoked `make' command will still be run in
* parallel (unless its makefile contains this target). Any
* prerequisites on this target are ignored.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IPhonyRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IPhonyRule.java
index f7c7c64eb93..0ce18ed4109 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IPhonyRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IPhonyRule.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
* The prerequisites of the special target `.PHONY' are considered to be phony targets.
* When it is time to consider such a target, `make' will run its commands unconditionally, regardless of
* whether a file with that name exists or what its last-modification time is.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ISecondaryRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ISecondaryRule.java
index 1891003af46..d7b959815b0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ISecondaryRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ISecondaryRule.java
@@ -22,7 +22,7 @@ import org.eclipse.cdt.make.core.makefile.ISpecialRule;
*
* `.SECONDARY' with no prerequisites causes all targets to be treated
* as secondary (i.e., no target is removed because it is considered intermediate).
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ITerminal.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ITerminal.java
index bace7be3575..002656b329a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ITerminal.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/ITerminal.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.make.core.makefile.IDirective;
/**
* ITerminal finish a block.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IUnExport.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IUnExport.java
index 6fa6c0c491b..0de90d9ad31 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IUnExport.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IUnExport.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.make.core.makefile.IDirective;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IUnExport extends IDirective {
-
+
String getVariable();
}
-
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IVariableDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IVariableDefinition.java
index 9d6ea1b6953..e701e3272b7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IVariableDefinition.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/gnu/IVariableDefinition.java
@@ -22,21 +22,21 @@ import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IVariableDefinition extends IMacroDefinition {
-
+
boolean isRecursivelyExpanded();
-
+
boolean isSimplyExpanded();
-
+
boolean isConditional();
-
+
boolean isAppend();
-
+
boolean isTargetSpecific();
-
+
boolean isExport();
-
+
boolean isMultiLine();
-
+
/**
* Variable from an `override' directive.
*/
@@ -46,5 +46,6 @@ public interface IVariableDefinition extends IMacroDefinition {
* Automatic variable -- cannot be set.
*/
boolean isAutomatic();
+
String getTarget();
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java
index dac74953a86..c9e499a1f6d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/messages/Messages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java
index 03c3c929768..e28c031c2b2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java
@@ -45,7 +45,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
private ArrayList<String> activeSymbols;
private ArrayList<String> removedSymbols;
- private org.eclipse.cdt.make.core.MakeScannerInfo userInfo;
+ private org.eclipse.cdt.make.core.MakeScannerInfo userInfo;
public DiscoveredScannerInfo(IProject project) {
this.project = project;
@@ -64,6 +64,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
dSymbols.putAll(userInfo.getDefinedSymbols());
return dSymbols;
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.IScannerInfo#getIncludePaths()
*/
@@ -71,15 +72,16 @@ public class DiscoveredScannerInfo implements IScannerInfo {
public synchronized String[] getIncludePaths() {
String[] iPaths = new String[getUserIncludePaths().length + getActiveIncludePaths().length];
System.arraycopy(getUserIncludePaths(), 0, iPaths, 0, getUserIncludePaths().length);
- System.arraycopy(getActiveIncludePaths(), 0, iPaths, getUserIncludePaths().length, getActiveIncludePaths().length);
+ System.arraycopy(getActiveIncludePaths(), 0, iPaths, getUserIncludePaths().length,
+ getActiveIncludePaths().length);
return iPaths;
}
- public org.eclipse.cdt.make.core.MakeScannerInfo getUserScannerInfo() {
+ public org.eclipse.cdt.make.core.MakeScannerInfo getUserScannerInfo() {
return userInfo;
}
- public synchronized void setUserScannerInfo( org.eclipse.cdt.make.core.MakeScannerInfo info) {
+ public synchronized void setUserScannerInfo(org.eclipse.cdt.make.core.MakeScannerInfo info) {
userInfo = info;
}
@@ -89,6 +91,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
}
return new LinkedHashMap<String, Boolean>(discoveredPaths);
}
+
public synchronized void setDiscoveredIncludePaths(LinkedHashMap<String, Boolean> paths) {
discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
createPathLists();
@@ -108,8 +111,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
Boolean removed = discoveredPaths.get(path);
if (removed == null || removed.booleanValue() == false) {
aPaths.add(path);
- }
- else {
+ } else {
rPaths.add(path);
}
}
@@ -121,6 +123,7 @@ public class DiscoveredScannerInfo implements IScannerInfo {
}
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols);
}
+
public synchronized void setDiscoveredSymbolDefinitions(LinkedHashMap<String, SymbolEntry> symbols) {
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
createSymbolsLists();
@@ -145,9 +148,11 @@ public class DiscoveredScannerInfo implements IScannerInfo {
}
return userInfo.getIncludePaths();
}
+
public String[] getActiveIncludePaths() {
return getActivePathList().toArray(new String[getActivePathList().size()]);
}
+
public String[] getRemovedIncludePaths() {
return getRemovedPathList().toArray(new String[getRemovedPathList().size()]);
}
@@ -158,12 +163,15 @@ public class DiscoveredScannerInfo implements IScannerInfo {
}
return userInfo.getPreprocessorSymbols();
}
+
public String[] getActiveSymbolDefinitions() {
return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]);
}
+
public String[] getRemovedSymbolDefinitions() {
return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]);
}
+
public String[] getPreprocessorSymbols() {
// user specified + active
String[] userSymbols = getUserSymbolDefinitions();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfoProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfoProvider.java
index 69bae408a57..6b0a8d642ac 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfoProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfoProvider.java
@@ -35,10 +35,10 @@ import org.eclipse.core.runtime.QualifiedName;
/**
* Provider of both user specified and discovered scanner info
- *
+ *
* @deprecated as of CDT 4.0.
* @author vhirsl
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -46,7 +46,8 @@ import org.eclipse.core.runtime.QualifiedName;
public class DiscoveredScannerInfoProvider extends ScannerProvider {
// This is the id of the IScannerInfoProvider extension point entry
- public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier() + ".DiscoveredScannerInfoProvider"; //$NON-NLS-1$
+ public static final String INTERFACE_IDENTITY = MakeCorePlugin.getUniqueIdentifier()
+ + ".DiscoveredScannerInfoProvider"; //$NON-NLS-1$
// Name we will use to store build property with the project
private static final QualifiedName scannerInfoProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(),
@@ -54,6 +55,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
// Singleton
private static DiscoveredScannerInfoProvider instance;
+
public static DiscoveredScannerInfoProvider getDefault() {
if (instance == null) {
instance = new DiscoveredScannerInfoProvider();
@@ -63,7 +65,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
*/
@Override
@@ -77,7 +79,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#subscribe(org.eclipse.core.resources.IResource,
* org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
*/
@@ -88,7 +90,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#unsubscribe(org.eclipse.core.resources.IResource,
* org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
*/
@@ -101,15 +103,15 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
DiscoveredScannerInfo scannerInfo = null;
// See if there's already one associated with the resource for this
// session
- scannerInfo = (DiscoveredScannerInfo)project.getSessionProperty(scannerInfoProperty);
+ scannerInfo = (DiscoveredScannerInfo) project.getSessionProperty(scannerInfoProperty);
if (scannerInfo == null) {
scannerInfo = new DiscoveredScannerInfo(project);
// this will convert user info
- org.eclipse.cdt.make.core.MakeScannerInfo makeScannerInfo = org.eclipse.cdt.make.core.MakeScannerProvider.getDefault().getMakeScannerInfo(
- project, cacheInfo);
+ org.eclipse.cdt.make.core.MakeScannerInfo makeScannerInfo = org.eclipse.cdt.make.core.MakeScannerProvider
+ .getDefault().getMakeScannerInfo(project, cacheInfo);
scannerInfo.setUserScannerInfo(makeScannerInfo);
-
+
// migrate to new C Path Entries
IContainerEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
ICProject cProject = CoreModel.getDefault().create(project);
@@ -123,8 +125,8 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
}
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
descriptor.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); // remove scanner provider which will fallback to default
- // cpath provider.
- // place holder to that we don't convert again.
+ // cpath provider.
+ // place holder to that we don't convert again.
project.setSessionProperty(scannerInfoProperty, scannerInfo);
}
return scannerInfo;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
index 08bd0657430..b3f5dc2d4cd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
@@ -34,99 +34,114 @@ public interface IDiscoveredPathManager {
IProject getProject();
- /**
- * Get include paths for the whole project
- */
- IPath[] getIncludePaths();
- /**
- * Get defined symbols for the whole project
- */
- Map<String, String> getSymbols();
-
- IDiscoveredScannerInfoSerializable getSerializable();
+ /**
+ * Get include paths for the whole project
+ */
+ IPath[] getIncludePaths();
+
+ /**
+ * Get defined symbols for the whole project
+ */
+ Map<String, String> getSymbols();
+
+ IDiscoveredScannerInfoSerializable getSerializable();
}
-
- interface IPerProjectDiscoveredPathInfo extends IDiscoveredPathInfo {
- void setIncludeMap(LinkedHashMap<String, Boolean> map);
- void setSymbolMap(LinkedHashMap<String, SymbolEntry> map);
-
- LinkedHashMap<String, Boolean> getIncludeMap();
- LinkedHashMap<String, SymbolEntry> getSymbolMap();
- }
-
- interface IPerFileDiscoveredPathInfo extends IDiscoveredPathInfo {
- /**
- * Get include paths for the specific path (file)
- */
- IPath[] getIncludePaths(IPath path);
- /**
- * Get quote include paths (for #include "...") for the specific path (file)
- */
- IPath[] getQuoteIncludePaths(IPath path);
- /**
- * Get defined symbols for the specific path (file)
- */
- Map<String, String> getSymbols(IPath path);
-
- /**
- * Get include files (gcc option -include) for the specific path (file)
- */
- IPath[] getIncludeFiles(IPath path);
- /**
- * Get macro files (gcc option -imacros) for the specific path (file)
- */
- IPath[] getMacroFiles(IPath path);
+
+ interface IPerProjectDiscoveredPathInfo extends IDiscoveredPathInfo {
+ void setIncludeMap(LinkedHashMap<String, Boolean> map);
+
+ void setSymbolMap(LinkedHashMap<String, SymbolEntry> map);
+
+ LinkedHashMap<String, Boolean> getIncludeMap();
+
+ LinkedHashMap<String, SymbolEntry> getSymbolMap();
+ }
+
+ interface IPerFileDiscoveredPathInfo extends IDiscoveredPathInfo {
+ /**
+ * Get include paths for the specific path (file)
+ */
+ IPath[] getIncludePaths(IPath path);
+
+ /**
+ * Get quote include paths (for #include "...") for the specific path (file)
+ */
+ IPath[] getQuoteIncludePaths(IPath path);
+
+ /**
+ * Get defined symbols for the specific path (file)
+ */
+ Map<String, String> getSymbols(IPath path);
+
+ /**
+ * Get include files (gcc option -include) for the specific path (file)
+ */
+ IPath[] getIncludeFiles(IPath path);
+
+ /**
+ * Get macro files (gcc option -imacros) for the specific path (file)
+ */
+ IPath[] getMacroFiles(IPath path);
+
/**
* Returns if there is any discovered scanner info for the path
*/
boolean isEmpty(IPath path);
- }
-
- interface IPerFileDiscoveredPathInfo2 extends IPerFileDiscoveredPathInfo {
- /**
- * returns the map containing {@link IResource} - to - {@link PathInfo} pairs representing
- * complete set of discovered information for the whole project
- *
- * @return Map
- */
- Map<IResource, PathInfo> getPathInfoMap();
- }
-
-
- interface IDiscoveredScannerInfoSerializable {
- /**
- * Serialize discovered scanner info to an XML element
- */
- public void serialize(Element root);
-
- /**
- * Deserialize discovered scanner info from an XML element
- */
- public void deserialize(Element root);
-
- /**
- * @return an id of the collector
- */
- public String getCollectorId();
- }
-
- interface IDiscoveredInfoListener {
+ }
+
+ interface IPerFileDiscoveredPathInfo2 extends IPerFileDiscoveredPathInfo {
+ /**
+ * returns the map containing {@link IResource} - to - {@link PathInfo} pairs representing
+ * complete set of discovered information for the whole project
+ *
+ * @return Map
+ */
+ Map<IResource, PathInfo> getPathInfoMap();
+ }
+
+ interface IDiscoveredScannerInfoSerializable {
+ /**
+ * Serialize discovered scanner info to an XML element
+ */
+ public void serialize(Element root);
+
+ /**
+ * Deserialize discovered scanner info from an XML element
+ */
+ public void deserialize(Element root);
+
+ /**
+ * @return an id of the collector
+ */
+ public String getCollectorId();
+ }
+
+ interface IDiscoveredInfoListener {
void infoChanged(IDiscoveredPathInfo info);
+
void infoRemoved(IDiscoveredPathInfo info);
}
IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context) throws CoreException;
- IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException;
+ IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context, boolean defaultToProjectSettings)
+ throws CoreException;
IDiscoveredPathInfo getDiscoveredInfo(IProject project) throws CoreException;
+
void removeDiscoveredInfo(IProject project);
+
void removeDiscoveredInfo(IProject project, InfoContext context);
- void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources) throws CoreException;
+
+ void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer,
+ List<IResource> changedResources) throws CoreException;
+
void updateDiscoveredInfo(IDiscoveredPathInfo info, List<IResource> changedResources) throws CoreException;
- void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope, List<IResource> changedResources);
+
+ void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope, List<IResource> changedResources);
void addDiscoveredInfoListener(IDiscoveredInfoListener listener);
+
void removeDiscoveredInfoListener(IDiscoveredInfoListener listener);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IExternalScannerInfoProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IExternalScannerInfoProvider.java
index 29e6dd079a5..ff11511557f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IExternalScannerInfoProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IExternalScannerInfoProvider.java
@@ -19,29 +19,21 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * Interface for providers of C/C++ scanner info
- *
+ * Interface for providers of C/C++ scanner info
+ *
* @author vhirsl
*/
public interface IExternalScannerInfoProvider {
- /**
- * Invokes a provider to generate scanner info.
- */
- public boolean invokeProvider(IProgressMonitor monitor,
- IResource resource,
- String providerId,
- IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector);
+ /**
+ * Invokes a provider to generate scanner info.
+ */
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector);
+
+ /**
+ * Alternative interface to pass down the environment.
+ */
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, InfoContext context, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector, Properties env);
- /**
- * Alternative interface to pass down the environment.
- */
- public boolean invokeProvider(IProgressMonitor monitor,
- IResource resource,
- InfoContext context,
- String providerId,
- IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector,
- Properties env);
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo.java
index f059dae651d..0f6655557a7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo.java
@@ -19,37 +19,46 @@ import org.eclipse.core.runtime.IPath;
/**
* Settings for ScannerConfigBuilder
- *
+ *
* @author vhirsl
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IScannerConfigBuilderInfo {
boolean isAutoDiscoveryEnabled();
+
void setAutoDiscoveryEnabled(boolean enabled) throws CoreException;
String getMakeBuilderConsoleParserId();
+
void setMakeBuilderConsoleParserId(String parserId) throws CoreException;
boolean isESIProviderCommandEnabled();
+
void setESIProviderCommandEnabled(boolean enabled) throws CoreException;
boolean isDefaultESIProviderCmd();
+
void setUseDefaultESIProviderCmd(boolean on) throws CoreException;
IPath getESIProviderCommand();
+
void setESIProviderCommand(IPath command) throws CoreException;
String getESIProviderArguments();
+
void setESIProviderArguments(String args) throws CoreException;
String getESIProviderConsoleParserId();
+
void setESIProviderConsoleParserId(String parserId) throws CoreException;
boolean isMakeBuilderConsoleParserEnabled();
+
void setMakeBuilderConsoleParserEnabled(boolean enabled) throws CoreException;
boolean isSIProblemGenerationEnabled();
+
void setSIProblemGenerationEnabled(boolean enabled) throws CoreException;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2.java
index a4b64764492..b76da1b4a87 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2.java
@@ -20,59 +20,70 @@ import org.eclipse.core.runtime.CoreException;
/**
* New interface to replace IScannerConfigBuildInfo
* Persisted in .cdtproject file
- *
+ *
* @author vhirsl
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IScannerConfigBuilderInfo2 {
// general SCD options
boolean isAutoDiscoveryEnabled();
+
void setAutoDiscoveryEnabled(boolean enable);
boolean isProblemReportingEnabled();
+
void setProblemReportingEnabled(boolean enable);
-
+
String getSelectedProfileId();
+
void setSelectedProfileId(String profileId);
- List<String> getProfileIdList();
-
- // SCD profile - buildOutputProvider options
+ List<String> getProfileIdList();
+
+ // SCD profile - buildOutputProvider options
boolean isBuildOutputFileActionEnabled();
+
void setBuildOutputFileActionEnabled(boolean enable);
-
+
String getBuildOutputFilePath();
+
void setBuildOutputFilePath(String path);
-
+
boolean isBuildOutputParserEnabled();
+
void setBuildOutputParserEnabled(boolean enable);
-
+
// SCD profile - scanner info provider options
List<String> getProviderIdList();
-// void addSIProvider(String providerId);
-// void removeSIProvider(String providerId);
-
+ // void addSIProvider(String providerId);
+ // void removeSIProvider(String providerId);
+
boolean isProviderOutputParserEnabled(String providerId);
+
void setProviderOutputParserEnabled(String providerId, boolean enable);
-
+
boolean isUseDefaultProviderCommand(String providerId);
+
void setUseDefaultProviderCommand(String providerId, boolean enable);
-
+
String getProviderRunCommand(String providerId);
+
void setProviderRunCommand(String providerId, String command);
-
+
String getProviderRunArguments(String providerId);
+
void setProviderRunArguments(String providerId, String arguments);
-
+
String getProviderOpenFilePath(String providerId);
+
void setProviderOpenFilePath(String providerId, String filePath);
-
+
InfoContext getContext();
-
- /**
- * Persist the buildInfo.
- */
- void save() throws CoreException;
+
+ /**
+ * Persist the buildInfo.
+ */
+ void save() throws CoreException;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2Set.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2Set.java
index 31ee8da09ce..3423b3334de 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2Set.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerConfigBuilderInfo2Set.java
@@ -18,24 +18,23 @@ import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
-
/**
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IScannerConfigBuilderInfo2Set {
/**
- *
+ *
* @return InfoContext - to IScannerConfigBuilderInfo2 map
*/
Map<InfoContext, IScannerConfigBuilderInfo2> getInfoMap();
-
+
IScannerConfigBuilderInfo2 getInfo(InfoContext context);
-
+
IScannerConfigBuilderInfo2 removeInfo(InfoContext context) throws CoreException;
-
+
InfoContext[] getContexts();
-
+
IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base);
IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base, String profileId);
@@ -45,6 +44,6 @@ public interface IScannerConfigBuilderInfo2Set {
IScannerConfigBuilderInfo2 createInfo(InfoContext context, String profileId);
void save() throws CoreException;
-
+
IProject getProject();
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector.java
index df53b48d7be..a6ea6d85b80 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector.java
@@ -20,14 +20,14 @@ import java.util.Map;
* Interface for scanner info collector.
* Used by scanner info console parsers.
* Eclipse independent.
- *
+ *
* @author vhirsl
*/
@SuppressWarnings("rawtypes")
public interface IScannerInfoCollector {
/**
* Contribute to resource's scanner configuration
- *
+ *
* @param resource
* <li> {@link org.eclipse.core.resources.IResource} if used from within Eclipse.</li>
* <li> {@link java.io.File} if used outside of Eclipse.</li>
@@ -39,12 +39,12 @@ public interface IScannerInfoCollector {
*/
public void contributeToScannerConfig(Object resource, Map scannerInfo);
- /**
- * @return specific piece of discovered scanner info for a resource
- * discovered during the last collection cycle, can be:
+ /**
+ * @return specific piece of discovered scanner info for a resource
+ * discovered during the last collection cycle, can be:
* <li>{@code List<String>}</li>
* <li>{@code List<CCommandDSC>}</li>
- */
- public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type);
+ */
+ public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector2.java
index 25694cc6138..bc7e596d7fd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector2.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollector2.java
@@ -20,22 +20,22 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* New scanner info collector interface - Eclipse dependent
- *
+ *
* @author vhirsl
*/
public interface IScannerInfoCollector2 extends IScannerInfoCollector {
public void setProject(IProject project);
- /**
- * Relegate discovered scanner configuration to a scanner info provider
+ /**
+ * Relegate discovered scanner configuration to a scanner info provider
*/
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException;
- /**
- * Create and return new IDiscoveredPathInfo that can hopefully serialize
- * discovered scanner config to a file
- */
- public IDiscoveredPathInfo createPathInfoObject();
-
+ /**
+ * Create and return new IDiscoveredPathInfo that can hopefully serialize
+ * discovered scanner config to a file
+ */
+ public IDiscoveredPathInfo createPathInfoObject();
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
index ae359425632..6bcc3b70ddc 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
@@ -17,32 +17,32 @@ import org.eclipse.core.resources.IResource;
/**
* Utility functions some collectors may need
- *
+ *
* @author vhirsl
*/
public interface IScannerInfoCollectorCleaner {
- /**
- * Delete all discovered paths for the resource
- */
- public void deleteAllPaths(IResource resource);
+ /**
+ * Delete all discovered paths for the resource
+ */
+ public void deleteAllPaths(IResource resource);
+
+ /**
+ * Delete all discovered symbols for the resource
+ */
+ public void deleteAllSymbols(IResource resource);
- /**
- * Delete all discovered symbols for the resource
- */
- public void deleteAllSymbols(IResource resource);
+ /**
+ * Delete a specific include path
+ */
+ public void deletePath(IResource resource, String path);
- /**
- * Delete a specific include path
- */
- public void deletePath(IResource resource, String path);
+ /**
+ * Delete a specific symbol definition
+ */
+ public void deleteSymbol(IResource resource, String symbol);
- /**
- * Delete a specific symbol definition
- */
- public void deleteSymbol(IResource resource, String symbol);
-
- /**
- * Delete all discovered scanner info for the resource
- */
- public void deleteAll(IResource resource);
+ /**
+ * Delete all discovered scanner info for the resource
+ */
+ public void deleteAll(IResource resource);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java
index cb5e006e414..86e3adf2ca7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java
@@ -20,16 +20,16 @@ import org.eclipse.core.runtime.IPath;
/**
* Parses a line of command output looking for scanner info entries.
- *
+ *
* @author vhirsl
*/
public interface IScannerInfoConsoleParser extends IConsoleParser {
/**
* One time initialization of a console parser.
- *
+ *
* @param collector - scanner info collector
*/
- public void startup(IProject project, IPath workingDirectory,
- IScannerInfoCollector collector, IMarkerGenerator markerGenerator);
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/InfoContext.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/InfoContext.java
index bce752a313d..a0e6b865482 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/InfoContext.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/InfoContext.java
@@ -21,51 +21,51 @@ public final class InfoContext {
private String fInstanceId;
private ILanguage fLanguage;
- public InfoContext(IProject project){
+ public InfoContext(IProject project) {
this(project, null);
}
- public InfoContext(IProject project, String instanceId){
+ public InfoContext(IProject project, String instanceId) {
this.fProject = project;
- this.fInstanceId = instanceId != null ? instanceId : ""; //$NON-NLS-1$
+ this.fInstanceId = instanceId != null ? instanceId : ""; //$NON-NLS-1$
}
-
+
/**
* @since 7.1
*/
- public InfoContext(IProject project, String instanceId, ILanguage language){
+ public InfoContext(IProject project, String instanceId, ILanguage language) {
this.fProject = project;
- this.fInstanceId = instanceId != null ? instanceId : ""; //$NON-NLS-1$
+ this.fInstanceId = instanceId != null ? instanceId : ""; //$NON-NLS-1$
this.fLanguage = language;
}
-
- public String getInstanceId(){
+
+ public String getInstanceId() {
return fInstanceId;
}
-
+
/**
* @since 7.1
*/
- public ILanguage getLanguage(){
+ public ILanguage getLanguage() {
return fLanguage;
}
-
+
@Override
public boolean equals(Object obj) {
- if(obj == this)
+ if (obj == this)
return true;
-
- if(!(obj instanceof InfoContext))
+
+ if (!(obj instanceof InfoContext))
return false;
-
- InfoContext other = (InfoContext)obj;
- if(fProject == null){
- if(other.fProject != null)
+
+ InfoContext other = (InfoContext) obj;
+ if (fProject == null) {
+ if (other.fProject != null)
return false;
- } else if(!fProject.equals(other.fProject))
+ } else if (!fProject.equals(other.fProject))
return false;
-
- if(!fInstanceId.equals(other.fInstanceId))
+
+ if (!fInstanceId.equals(other.fInstanceId))
return false;
return true;
@@ -74,45 +74,45 @@ public final class InfoContext {
@Override
public int hashCode() {
int code = fProject != null ? fProject.hashCode() : 0;
-
+
code += fInstanceId.hashCode();
-
+
return code;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
-
- if(fProject != null)
+
+ if (fProject != null)
buf.append(fProject.toString());
else
- buf.append("no project"); //$NON-NLS-1$
- if(fInstanceId.length() != 0){
- buf.append(" , instance: "); //$NON-NLS-1$
+ buf.append("no project"); //$NON-NLS-1$
+ if (fInstanceId.length() != 0) {
+ buf.append(" , instance: "); //$NON-NLS-1$
buf.append(fInstanceId);
}
-
+
return buf.toString();
}
-
+
/**
* a convenience method that specifies whether this is a default context,
* i.e. the one defined for the project with no extension filters
- *
+ *
* @return boolean
*/
- public boolean isDefaultContext(){
-// if(fProject == null)
-// return false;
-
- if(fInstanceId.length() != 0)
+ public boolean isDefaultContext() {
+ // if(fProject == null)
+ // return false;
+
+ if (fInstanceId.length() != 0)
return false;
-
+
return true;
}
-
- public IProject getProject(){
+
+ public IProject getProject() {
return fProject;
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
index b87425b367e..920947af762 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
@@ -30,142 +30,145 @@ public final class PathInfo {
public final static PathInfo EMPTY_INFO = new PathInfo(null, null, null, null, null);
private static int EMPTY_CODE = 53;
-
+
private IPath[] fIncludePaths;
private IPath[] fQuoteIncludePaths;
private HashMap<String, String> fSymbols;
private IPath[] fIncludeFiles;
private IPath[] fMacroFiles;
private int fHash;
-
- public PathInfo(IPath[] includePaths,
- IPath[] quoteIncludePaths,
- Map<String, String> symbols,
- IPath[] includeFiles,
- IPath[] macroFiles){
- fIncludePaths = includePaths != null && includePaths.length != 0 ? (IPath[])includePaths.clone() : EMPTY_PATH_ARRAY;
- fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0 ? (IPath[])quoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
- fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols) : new HashMap<String, String>(0);
- fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[])includeFiles.clone() : EMPTY_PATH_ARRAY;
- fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[])macroFiles.clone() : EMPTY_PATH_ARRAY;
+
+ public PathInfo(IPath[] includePaths, IPath[] quoteIncludePaths, Map<String, String> symbols, IPath[] includeFiles,
+ IPath[] macroFiles) {
+ fIncludePaths = includePaths != null && includePaths.length != 0 ? (IPath[]) includePaths.clone()
+ : EMPTY_PATH_ARRAY;
+ fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0
+ ? (IPath[]) quoteIncludePaths.clone()
+ : EMPTY_PATH_ARRAY;
+ fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols)
+ : new HashMap<String, String>(0);
+ fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[]) includeFiles.clone()
+ : EMPTY_PATH_ARRAY;
+ fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[]) macroFiles.clone() : EMPTY_PATH_ARRAY;
}
/**
* Returns a new HashMap whereby all the strings used as keys and values are interned.
- *
+ *
* @param oldMap
* @return HashMap<String, String>
*/
protected HashMap<String, String> getInternedHashMap(Map<String, String> oldMap) {
- if(oldMap == null)
+ if (oldMap == null)
return null;
-
- if(oldMap.isEmpty())
+
+ if (oldMap.isEmpty())
return new HashMap<String, String>(oldMap);
-
+
HashMap<String, String> newMap = new HashMap<String, String>(oldMap.size());
- for(String key : oldMap.keySet()) {
+ for (String key : oldMap.keySet()) {
newMap.put(SafeStringInterner.safeIntern(key), SafeStringInterner.safeIntern(oldMap.get(key)));
}
-
+
return newMap;
}
- /**
- * Get include paths
- */
- public IPath[] getIncludePaths(){
- return fIncludePaths.length != 0 ? (IPath[])fIncludePaths.clone() : EMPTY_PATH_ARRAY;
- }
- /**
- * Get quote include paths (for #include "...")
- */
- public IPath[] getQuoteIncludePaths(){
- return fQuoteIncludePaths.length != 0 ? (IPath[])fQuoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
- }
- /**
- * Get defined symbols
- */
- @SuppressWarnings("unchecked")
- public Map<String, String> getSymbols(){
- return (Map<String, String>)fSymbols.clone();
- }
-
- /**
- * Get include files (gcc option -include)
- */
- public IPath[] getIncludeFiles(){
- return fIncludeFiles.length != 0 ? (IPath[])fIncludeFiles.clone() : EMPTY_PATH_ARRAY;
- }
- /**
- * Get macro files (gcc option -imacros)
- */
- public IPath[] getMacroFiles(){
- return fMacroFiles.length != 0 ? (IPath[])fMacroFiles.clone() : EMPTY_PATH_ARRAY;
- }
+ /**
+ * Get include paths
+ */
+ public IPath[] getIncludePaths() {
+ return fIncludePaths.length != 0 ? (IPath[]) fIncludePaths.clone() : EMPTY_PATH_ARRAY;
+ }
+
+ /**
+ * Get quote include paths (for #include "...")
+ */
+ public IPath[] getQuoteIncludePaths() {
+ return fQuoteIncludePaths.length != 0 ? (IPath[]) fQuoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
+ }
+
+ /**
+ * Get defined symbols
+ */
+ @SuppressWarnings("unchecked")
+ public Map<String, String> getSymbols() {
+ return (Map<String, String>) fSymbols.clone();
+ }
+
+ /**
+ * Get include files (gcc option -include)
+ */
+ public IPath[] getIncludeFiles() {
+ return fIncludeFiles.length != 0 ? (IPath[]) fIncludeFiles.clone() : EMPTY_PATH_ARRAY;
+ }
+
+ /**
+ * Get macro files (gcc option -imacros)
+ */
+ public IPath[] getMacroFiles() {
+ return fMacroFiles.length != 0 ? (IPath[]) fMacroFiles.clone() : EMPTY_PATH_ARRAY;
+ }
+
/**
* Returns if there is any discovered scanner info
*/
- public boolean isEmpty(){
- return fIncludePaths.length == 0
- && fQuoteIncludePaths.length == 0
- && fSymbols.size() == 0
- && fIncludeFiles.length == 0
- && fMacroFiles.length == 0;
+ public boolean isEmpty() {
+ return fIncludePaths.length == 0 && fQuoteIncludePaths.length == 0 && fSymbols.size() == 0
+ && fIncludeFiles.length == 0 && fMacroFiles.length == 0;
}
@Override
public boolean equals(Object obj) {
- if(this == obj)
+ if (this == obj)
return true;
-
- if(!(obj instanceof PathInfo))
+
+ if (!(obj instanceof PathInfo))
return false;
-
- PathInfo other = (PathInfo)obj;
-
- if(!Arrays.equals(fIncludePaths, other.fIncludePaths))
+
+ PathInfo other = (PathInfo) obj;
+
+ if (!Arrays.equals(fIncludePaths, other.fIncludePaths))
return false;
- if(!Arrays.equals(fQuoteIncludePaths, other.fQuoteIncludePaths))
+ if (!Arrays.equals(fQuoteIncludePaths, other.fQuoteIncludePaths))
return false;
- if(!fSymbols.equals(other.fSymbols))
+ if (!fSymbols.equals(other.fSymbols))
return false;
- if(!Arrays.equals(fIncludeFiles, other.fIncludeFiles))
+ if (!Arrays.equals(fIncludeFiles, other.fIncludeFiles))
return false;
- if(!Arrays.equals(fMacroFiles, other.fMacroFiles))
+ if (!Arrays.equals(fMacroFiles, other.fMacroFiles))
return false;
-
+
return true;
}
@Override
public int hashCode() {
int hash = fHash;
- if(hash == 0){
+ if (hash == 0) {
hash = EMPTY_CODE;
-
- if(fIncludePaths.length != 0){
- for(int i = 0; i < fIncludePaths.length; i++){
+
+ if (fIncludePaths.length != 0) {
+ for (int i = 0; i < fIncludePaths.length; i++) {
hash += fIncludePaths[i].hashCode();
}
}
- if(fQuoteIncludePaths.length != 0){
- for(int i = 0; i < fQuoteIncludePaths.length; i++){
+ if (fQuoteIncludePaths.length != 0) {
+ for (int i = 0; i < fQuoteIncludePaths.length; i++) {
hash += fQuoteIncludePaths[i].hashCode();
}
}
-
+
hash += fSymbols.hashCode();
-
- if(fIncludeFiles.length != 0){
- for(int i = 0; i < fIncludeFiles.length; i++){
+
+ if (fIncludeFiles.length != 0) {
+ for (int i = 0; i < fIncludeFiles.length; i++) {
hash += fIncludeFiles[i].hashCode();
}
}
-
- if(fMacroFiles.length != 0){
- for(int i = 0; i < fMacroFiles.length; i++){
+
+ if (fMacroFiles.length != 0) {
+ for (int i = 0; i < fMacroFiles.length; i++) {
hash += fMacroFiles[i].hashCode();
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
index b05c8ac6cbb..174f903fa07 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
@@ -56,105 +56,106 @@ public class ScannerConfigBuilder extends ACBuilder {
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- protected IProject [] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
if (DEBUG_EVENTS)
printEvent(kind, args);
// If auto discovery is disabled, do nothing
-// boolean autodiscoveryEnabled;
- if(buildNewStyle(getProject(), monitor))
+ // boolean autodiscoveryEnabled;
+ if (buildNewStyle(getProject(), monitor))
return getProject().getReferencedProjects();
-
+
if (!ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
return getProject().getReferencedProjects();
}
-
+
boolean autodiscoveryEnabled2;
IScannerConfigBuilderInfo2 buildInfo2 = null;
try {
-// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
-// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
-//
-// if (autodiscoveryEnabled) {
-// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
-// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
-// getProject().getName());
-// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
-// }
-
- buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
- autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
-
- if (autodiscoveryEnabled2) {
- monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
- getProject().getName());
-
- // get scanner info from all external providers
- SCJobsUtil.getProviderScannerInfo(getProject(), buildInfo2, new SubProgressMonitor(monitor, 70));
-
- // update and persist scanner configuration
- SCJobsUtil.updateScannerConfiguration(getProject(), buildInfo2, new SubProgressMonitor(monitor, 30));
- }
- }
- catch (CoreException e) {
+ // IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
+ // autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
+ //
+ // if (autodiscoveryEnabled) {
+ // monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
+ // monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ // getProject().getName());
+ // ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
+ // }
+
+ buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
+ autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
+
+ if (autodiscoveryEnabled2) {
+ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ getProject().getName());
+
+ // get scanner info from all external providers
+ SCJobsUtil.getProviderScannerInfo(getProject(), buildInfo2, new SubProgressMonitor(monitor, 70));
+
+ // update and persist scanner configuration
+ SCJobsUtil.updateScannerConfiguration(getProject(), buildInfo2, new SubProgressMonitor(monitor, 30));
+ }
+ } catch (CoreException e) {
// builder not installed or disabled
-// autodiscoveryEnabled = false;
+ // autodiscoveryEnabled = false;
autodiscoveryEnabled2 = false;
- MakeCorePlugin.log(e);
+ MakeCorePlugin.log(e);
}
return getProject().getReferencedProjects();
}
- protected boolean buildNewStyle(IProject project, IProgressMonitor monitor) throws CoreException{
+ protected boolean buildNewStyle(IProject project, IProgressMonitor monitor) throws CoreException {
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
- if(!CCorePlugin.getDefault().isNewStyleProject(des))
+ if (!CCorePlugin.getDefault().isNewStyleProject(des))
return false;
ICConfigurationDescription[] cfgs = des.getConfigurations();
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.0"), cfgs.length + 1); //$NON-NLS-1$
boolean wasbuilt = false;
- for(int i = 0; i < cfgs.length; i++){
+ for (int i = 0; i < cfgs.length; i++) {
ICConfigurationDescription cfg = cfgs[i];
CConfigurationData data = cfg.getConfigurationData();
InfoContext context = new InfoContext(project, data.getId());
IScannerConfigBuilderInfo2 info = container.getInfo(context);
- if(info == null){
-// context = new InfoContext(project);
+ if (info == null) {
+ // context = new InfoContext(project);
info = container.getInfo(new InfoContext(project));
}
- if(build(project, context, info, new SubProgressMonitor(monitor, 1)))
+ if (build(project, context, info, new SubProgressMonitor(monitor, 1)))
wasbuilt = true;
}
- if(wasbuilt)
- CCorePlugin.getDefault().updateProjectDescriptions(new IProject[]{project}, new SubProgressMonitor(monitor, 1));
+ if (wasbuilt)
+ CCorePlugin.getDefault().updateProjectDescriptions(new IProject[] { project },
+ new SubProgressMonitor(monitor, 1));
monitor.done();
return true;
}
- protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
+ protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2,
+ IProgressMonitor monitor) {
if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
if (autodiscoveryEnabled2) {
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
getProject().getName());
// get scanner info from all external providers
- SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
+ SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2,
+ new SubProgressMonitor(monitor, 70));
// update and persist scanner configuration
- SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 30));
+ SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2,
+ new SubProgressMonitor(monitor, 30));
return true;
}
}
return false;
}
-
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java
index 27b4a784e3a..75e707f500d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java
@@ -91,7 +91,7 @@ public class ScannerConfigNature implements IProjectNature {
* @see IProjectNature#getProject
*/
@Override
- public IProject getProject() {
+ public IProject getProject() {
return fProject;
}
@@ -99,7 +99,7 @@ public class ScannerConfigNature implements IProjectNature {
* @see IProjectNature#setProject
*/
@Override
- public void setProject(IProject project) {
+ public void setProject(IProject project) {
fProject = project;
}
@@ -159,8 +159,7 @@ public class ScannerConfigNature implements IProjectNature {
newCommands = new ICommand[oldCommands.length + 1];
System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length);
newCommands[oldCommands.length] = newCommand;
- }
- else {
+ } else {
for (int i = 0; i < oldCommands.length; i++) {
if (oldCommands[i] == oldCommand) {
oldCommands[i] = newCommand;
@@ -177,11 +176,11 @@ public class ScannerConfigNature implements IProjectNature {
public static void initializeDiscoveryOptions(IProject project) {
try {
- IScannerConfigBuilderInfo2 scPrefInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(
- MakeCorePlugin.getDefault().getPluginPreferences(), false);
+ IScannerConfigBuilderInfo2 scPrefInfo = ScannerConfigProfileManager
+ .createScannerConfigBuildInfo2(MakeCorePlugin.getDefault().getPluginPreferences(), false);
String selectedProfile = scPrefInfo.getSelectedProfileId();
- IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(
- project, selectedProfile);
+ IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project,
+ selectedProfile);
scProjInfo.setAutoDiscoveryEnabled(scPrefInfo.isAutoDiscoveryEnabled());
scProjInfo.setProblemReportingEnabled(scPrefInfo.isProblemReportingEnabled());
@@ -190,18 +189,19 @@ public class ScannerConfigNature implements IProjectNature {
scProjInfo.setBuildOutputFileActionEnabled(scPrefInfo.isBuildOutputFileActionEnabled());
scProjInfo.setBuildOutputFilePath(scPrefInfo.getBuildOutputFilePath());
- ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(selectedProfile);
+ ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(selectedProfile);
List<String> providerIdList = scPrefInfo.getProviderIdList();
for (Iterator<String> i = providerIdList.iterator(); i.hasNext();) {
String providerId = i.next();
- scProjInfo.setProviderOutputParserEnabled(providerId, scPrefInfo.isProviderOutputParserEnabled(providerId));
- if (profile.getScannerInfoProviderElement(providerId).getProviderKind().equals(
- ScannerConfigProfile.ScannerInfoProvider.RUN)) {
+ scProjInfo.setProviderOutputParserEnabled(providerId,
+ scPrefInfo.isProviderOutputParserEnabled(providerId));
+ if (profile.getScannerInfoProviderElement(providerId).getProviderKind()
+ .equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
scProjInfo.setProviderRunCommand(providerId, scPrefInfo.getProviderRunCommand(providerId));
scProjInfo.setProviderRunArguments(providerId, scPrefInfo.getProviderRunArguments(providerId));
- }
- else {
+ } else {
scProjInfo.setProviderOpenFilePath(providerId, scPrefInfo.getProviderOpenFilePath(providerId));
}
}
@@ -223,19 +223,19 @@ public class ScannerConfigNature implements IProjectNature {
if (!found) {
IPathEntry[] newRawPathEntries = new IPathEntry[rawPathEntries.length + 1];
System.arraycopy(rawPathEntries, 0, newRawPathEntries, 0, rawPathEntries.length);
- newRawPathEntries[rawPathEntries.length] = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
+ newRawPathEntries[rawPathEntries.length] = CoreModel
+ .newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
CoreModel.setRawPathEntries(cProject, newRawPathEntries, null);
}
-// if (profile.getProfileScope().equals(ScannerConfigScope.PROJECT_SCOPE)) {
-// CoreModel.setPathEntryContainer(new ICProject[]{cProject},
-// new DiscoveredPathContainer(project), null);
-// }
-// else { // file scope
-// CoreModel.setPathEntryContainer(new ICProject[]{cProject},
-// new PerFileDiscoveredPathContainer(project), null);
-// }
- }
- catch (CoreException e) {
+ // if (profile.getProfileScope().equals(ScannerConfigScope.PROJECT_SCOPE)) {
+ // CoreModel.setPathEntryContainer(new ICProject[]{cProject},
+ // new DiscoveredPathContainer(project), null);
+ // }
+ // else { // file scope
+ // CoreModel.setPathEntryContainer(new ICProject[]{cProject},
+ // new PerFileDiscoveredPathContainer(project), null);
+ // }
+ } catch (CoreException e) {
MakeCorePlugin.log(e);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigScope.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigScope.java
index 1bdbc0cc185..debc23bb47a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigScope.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigScope.java
@@ -15,40 +15,46 @@ package org.eclipse.cdt.make.core.scannerconfig;
/**
* Profile scope enum
- *
+ *
* @author vhirsl
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ScannerConfigScope {
- public static final ScannerConfigScope PROJECT_SCOPE = new ScannerConfigScope("project"); //$NON-NLS-1$
- public static final ScannerConfigScope FILE_SCOPE = new ScannerConfigScope("file"); //$NON-NLS-1$
-
- @Override
+ public static final ScannerConfigScope PROJECT_SCOPE = new ScannerConfigScope("project"); //$NON-NLS-1$
+ public static final ScannerConfigScope FILE_SCOPE = new ScannerConfigScope("file"); //$NON-NLS-1$
+
+ @Override
public String toString() {
- return scope;
- }
-
- private String scope;
- private ScannerConfigScope(String scope) {
- this.scope = scope;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
+ return scope;
+ }
+
+ private String scope;
+
+ private ScannerConfigScope(String scope) {
+ this.scope = scope;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
public boolean equals(Object arg0) {
- if (arg0 == null) return false;
- if (arg0 == this) return true;
- if (arg0 instanceof ScannerConfigScope) return scope.equals(((ScannerConfigScope)arg0).scope);
- return false;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
+ if (arg0 == null)
+ return false;
+ if (arg0 == this)
+ return true;
+ if (arg0 instanceof ScannerConfigScope)
+ return scope.equals(((ScannerConfigScope) arg0).scope);
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
public int hashCode() {
- return scope.hashCode();
- }
+ return scope.hashCode();
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
index d2ee7a2a9db..f93fbd016db 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
@@ -15,27 +15,28 @@ package org.eclipse.cdt.make.core.scannerconfig;
/**
* Typesafe enum pattern
- *
+ *
* @author vhirsl
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ScannerInfoTypes {
- public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
- public static final ScannerInfoTypes UNDISCOVERED_COMPILER_COMMAND = new ScannerInfoTypes(2); // CCommandDSC whose SI has not been resolved
- public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(10);
- public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(11);
- public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(12);
- public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(13) ;
- public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(14);
+ public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
+ public static final ScannerInfoTypes UNDISCOVERED_COMPILER_COMMAND = new ScannerInfoTypes(2); // CCommandDSC whose SI has not been resolved
+ public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(10);
+ public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(11);
+ public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(12);
+ public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(13);
+ public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(14);
+
+ private final int _enum;
- private final int _enum;
+ private ScannerInfoTypes(int val) {
+ _enum = val;
+ }
- private ScannerInfoTypes(int val) {
- _enum = val;
- }
- public final int toInt() {
- return _enum;
- }
+ public final int toInt() {
+ return _enum;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java
index 709c3936515..50507fe40a3 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java
@@ -88,7 +88,7 @@ public class BuildInfoFactory {
@Override
public String getBuildAttribute(String name, String defaultValue) {
String value = getString(name);
- if (value == null ) {
+ if (value == null) {
if (IMakeCommonBuildInfo.BUILD_COMMAND.equals(name)) {
value = getString(BuildInfoFactory.BUILD_COMMAND);
} else if (IMakeCommonBuildInfo.BUILD_ARGUMENTS.equals(name)) {
@@ -127,7 +127,8 @@ public class BuildInfoFactory {
// translate any string substitution variables
String translated = value;
try {
- translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false);
+ translated = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(value, false);
} catch (CoreException e) {
}
envMap.put(key, translated);
@@ -150,9 +151,11 @@ public class BuildInfoFactory {
}
return new Path(command);
}
- String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getString(BuildInfoFactory.BUILD_COMMAND));
+ String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND,
+ getString(BuildInfoFactory.BUILD_COMMAND));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return new Path(result);
@@ -187,9 +190,11 @@ public class BuildInfoFactory {
@Override
public IPath getBuildLocation() {
- String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, getString(BuildInfoFactory.BUILD_LOCATION));
+ String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION,
+ getString(BuildInfoFactory.BUILD_LOCATION));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return new Path(result);
@@ -197,12 +202,14 @@ public class BuildInfoFactory {
@Override
public String getBuildArguments() {
- String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getString(BuildInfoFactory.BUILD_ARGUMENTS));
+ String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS,
+ getString(BuildInfoFactory.BUILD_ARGUMENTS));
if (result == null) {
return ""; //$NON-NLS-1$
}
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return result;
@@ -232,9 +239,11 @@ public class BuildInfoFactory {
@Override
public String getAutoBuildTarget() {
- String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, getString(BuildInfoFactory.BUILD_TARGET_AUTO));
+ String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO,
+ getString(BuildInfoFactory.BUILD_TARGET_AUTO));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return result;
@@ -251,7 +260,8 @@ public class BuildInfoFactory {
String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL,
getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return result;
@@ -264,9 +274,11 @@ public class BuildInfoFactory {
@Override
public String getFullBuildTarget() {
- String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL));
+ String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL,
+ getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return result;
@@ -280,9 +292,11 @@ public class BuildInfoFactory {
@Override
public String getCleanBuildTarget() {
- String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, getString(BuildInfoFactory.BUILD_TARGET_CLEAN));
+ String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN,
+ getString(BuildInfoFactory.BUILD_TARGET_CLEAN));
try {
- result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false);
+ result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result,
+ false);
} catch (CoreException e) {
}
return result;
@@ -446,8 +460,9 @@ public class BuildInfoFactory {
}
protected abstract void putString(String name, String value) throws CoreException;
+
protected abstract String getString(String property);
- }
+ }
private static class BuildInfoPreference extends AbstractBuildInfo {
@@ -507,7 +522,7 @@ public class BuildInfoFactory {
// first, give the build-system a chance to return the build-command overlayed with data managed by it
ICProjectDescription cProjectDescription = CoreModel.getDefault().getProjectDescription(project, false);
- if(cProjectDescription != null) {
+ if (cProjectDescription != null) {
ICConfigurationDescription cConfigDescription = cProjectDescription.getActiveConfiguration();
CConfigurationData configurationData = cConfigDescription.getConfigurationData();
if (configurationData != null) {
@@ -518,7 +533,7 @@ public class BuildInfoFactory {
}
}
- if(builder == null) {
+ if (builder == null) {
builder = MakeProjectNature.getBuildSpec(project.getDescription(), builderID);
if (builder == null) {
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ListenerList.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ListenerList.java
index 3d24d9cc264..d49945a2071 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ListenerList.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ListenerList.java
@@ -20,7 +20,7 @@ package org.eclipse.cdt.make.internal.core;
* It is a fairly lightweight object, occupying minimal space when
* no listeners are registered.
* <p>
- * Note that the <code>add</code> method checks for and eliminates
+ * Note that the <code>add</code> method checks for and eliminates
* duplicates based on identity (not equality). Likewise, the
* <code>remove</code> method compares based on identity.
* </p>
@@ -72,7 +72,7 @@ public class ListenerList {
/**
* Creates a listener list with the given initial capacity.
*
- * @param capacity the number of listeners which this list can initially accept
+ * @param capacity the number of listeners which this list can initially accept
* without growing its internal representation; must be at least 1
*/
public ListenerList(int capacity) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.java
index f8e2a685ccc..5d154052fca 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.java
@@ -19,7 +19,7 @@ import java.util.ResourceBundle;
public class MakeMessages {
- private static final String RESOURCE_BUNDLE= MakeMessages.class.getName();
+ private static final String RESOURCE_BUNDLE = MakeMessages.class.getName();
private static ResourceBundle fgResourceBundle;
static {
try {
@@ -28,10 +28,10 @@ public class MakeMessages {
fgResourceBundle = null;
}
}
-
+
private MakeMessages() {
}
-
+
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
@@ -41,10 +41,10 @@ public class MakeMessages {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
/**
* Gets a string from the resource bundle and formats it with the argument
- *
+ *
* @param key the string used to get the bundle value, must not be null
*/
public static String getFormattedString(String key, Object arg) {
@@ -53,7 +53,7 @@ public class MakeMessages {
/**
* Gets a string from the resource bundle and formats it with arguments
- */
+ */
public static String getFormattedString(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java
index 63ced2109c3..47cd1297388 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeRecon.java
@@ -38,24 +38,24 @@ public class MakeRecon extends OutputStream {
class MyList extends ArrayList<String> {
private static final long serialVersionUID = 1L;
- public void removeInterval (int start, int len) {
+ public void removeInterval(int start, int len) {
removeRange(start, len);
}
}
- public MakeRecon(IPath buildCommand, String[] buildArguments,
- String[] env, IPath workingDirectory, IProgressMonitor mon, OutputStream cos) {
- this(buildCommand, new String[]{"-n"}, buildArguments, env, workingDirectory, mon, cos); //$NON-NLS-1$
+ public MakeRecon(IPath buildCommand, String[] buildArguments, String[] env, IPath workingDirectory,
+ IProgressMonitor mon, OutputStream cos) {
+ this(buildCommand, new String[] { "-n" }, buildArguments, env, workingDirectory, mon, cos); //$NON-NLS-1$
}
- public MakeRecon(IPath buildCommand, String[] options, String[] buildArguments,
- String[] env, IPath workingDirectory, IProgressMonitor mon, OutputStream cos) {
+ public MakeRecon(IPath buildCommand, String[] options, String[] buildArguments, String[] env,
+ IPath workingDirectory, IProgressMonitor mon, OutputStream cos) {
make = buildCommand;
args = new String[0];
if (options != null) {
- String[]array = new String[args.length + options.length];
+ String[] array = new String[args.length + options.length];
System.arraycopy(args, 0, array, 0, args.length);
System.arraycopy(options, 0, array, args.length, options.length);
args = array;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
index 73f44215043..3648088fa56 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
@@ -54,14 +54,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
private Map<String, String> buildEnvironment = new HashMap<>();
private final Map<String, String> targetAttributes = new HashMap<>();
- public MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
+ public MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name)
+ throws CoreException {
this.manager = manager;
this.project = project;
this.targetBuilderID = targetBuilderID;
this.name = name;
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(project, manager.getBuilderID(targetBuilderID));
- setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
- setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
+ setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND,
+ info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
+ setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS,
+ info.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
isDefaultBuildCmd = info.isDefaultBuildCmd();
isStopOnError = info.isStopOnError();
}
@@ -253,7 +256,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
String value = entry.getValue();
// translate any string substitution variables
String translated = value;
- translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value, false);
+ translated = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value,
+ false);
envMap.put(key, translated);
}
return envMap;
@@ -288,7 +292,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
@Override
public boolean appendEnvironment() {
- return appendEnvironment == USE_PROJECT_ENV_SETTING ? getProjectEnvSetting(): appendEnvironment == 1;
+ return appendEnvironment == USE_PROJECT_ENV_SETTING ? getProjectEnvSetting() : appendEnvironment == 1;
}
private boolean getProjectEnvSetting() {
@@ -311,15 +315,16 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
if (obj == this)
return true;
if (obj instanceof MakeTarget) {
- MakeTarget other = (MakeTarget)obj;
- return (container != null ? container.equals(other.getContainer()) : other.getContainer() == null) && name.equals(other.getName());
+ MakeTarget other = (MakeTarget) obj;
+ return (container != null ? container.equals(other.getContainer()) : other.getContainer() == null)
+ && name.equals(other.getName());
}
return false;
}
@Override
public int hashCode() {
- return container.hashCode() * 17 + name != null ? name.hashCode(): 0;
+ return container.hashCode() * 17 + name != null ? name.hashCode() : 0;
}
@Override
@@ -328,12 +333,15 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
final HashMap<String, String> infoMap = new HashMap<>();
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
- info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
- info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
+ info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND,
+ getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
+ info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS,
+ getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, "")); //$NON-NLS-1$
info.setUseDefaultBuildCmd(isDefaultBuildCmd());
info.setStopOnError(isStopOnError());
info.setIncrementalBuildEnable(true);
- info.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, getBuildAttribute(IMakeTarget.BUILD_TARGET, "")); //$NON-NLS-1$
+ info.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL,
+ getBuildAttribute(IMakeTarget.BUILD_TARGET, "")); //$NON-NLS-1$
info.setCleanBuildEnable(false);
info.setEnvironment(getExpandedEnvironment());
info.setAppendEnvironment(appendEnvironment());
@@ -356,7 +364,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
SubMonitor subMonitor = SubMonitor.convert(monitor, commands.length);
for (ICommand command : commands) {
if (command.getBuilderName().equals(builderID)) {
- project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, subMonitor.newChild(1));
+ project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap,
+ subMonitor.newChild(1));
} else {
project.build(IncrementalProjectBuilder.FULL_BUILD, command.getBuilderName(),
command.getArguments(), subMonitor.newChild(1));
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java
index 51474b5409b..ef8a33ccb67 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java
@@ -71,7 +71,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
@Override
public void addTarget(IContainer container, IMakeTarget target) throws CoreException {
if (container instanceof IWorkspaceRoot) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
}
ProjectTargets projectTargets = projectMap.get(target.getProject());
if (projectTargets == null) {
@@ -91,7 +92,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
@Override
public void setTargets(IContainer container, IMakeTarget[] targets) throws CoreException {
if (container instanceof IWorkspaceRoot) {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
}
ProjectTargets projectTargets = projectMap.get(targets[0].getProject());
if (projectTargets == null) {
@@ -251,39 +253,45 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
}
IResource resource = delta.getResource();
if (resource.getType() == IResource.PROJECT) {
- IProject project = (IProject)resource;
+ IProject project = (IProject) resource;
int flags = delta.getFlags();
int deltaKind = delta.getKind();
if (deltaKind == IResourceDelta.ADDED) {
if (hasTargetBuilder(project) && !fProjects.contains(project)) {
fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
+ notifyListeners(
+ new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
}
} else if (deltaKind == IResourceDelta.REMOVED) {
if (fProjects.contains(project)) {
deleteTargets(project);
fProjects.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
+ notifyListeners(
+ new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
}
} else if (deltaKind == IResourceDelta.CHANGED) {
if (0 != (flags & IResourceDelta.DESCRIPTION)) {
if (fProjects.contains(project) && !hasTargetBuilder(project)) {
fProjects.remove(project);
projectMap.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
+ notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED,
+ project));
} else if (!fProjects.contains(project) && hasTargetBuilder(project)) {
fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
+ notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED,
+ project));
}
}
if (0 != (flags & IResourceDelta.OPEN)) {
if (!project.isOpen() && fProjects.contains(project)) {
fProjects.remove(project);
projectMap.remove(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
+ notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED,
+ project));
} else if (project.isOpen() && hasTargetBuilder(project) && !fProjects.contains(project)) {
fProjects.add(project);
- notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
+ notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED,
+ project));
}
}
}
@@ -294,14 +302,14 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
}
protected void updateTarget(IMakeTarget target) throws CoreException {
- if (target.getContainer() != null ) { // target has not been added to manager.
+ if (target.getContainer() != null) { // target has not been added to manager.
ProjectTargets projectTargets = projectMap.get(target.getProject());
- if (projectTargets == null || !projectTargets.contains(target)) {
- return; // target has not been added to manager.
- }
- writeTargets(projectTargets);
- notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_CHANGED, target));
- }
+ if (projectTargets == null || !projectTargets.contains(target)) {
+ return; // target has not been added to manager.
+ }
+ writeTargets(projectTargets);
+ notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_CHANGED, target));
+ }
}
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
@@ -316,8 +324,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
protected void deleteTargets(IProject project) {
//Historical: We clean up after all other parts.
- IPath targetFilePath =
- MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(TARGETS_EXT);
+ IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName())
+ .addFileExtension(TARGETS_EXT);
File targetFile = targetFilePath.toFile();
if (targetFile.exists()) {
targetFile.delete();
@@ -327,7 +335,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
protected void initializeBuilders() {
builderMap = new HashMap<String, String>();
- IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID, MakeTargetManager.TARGET_BUILD_EXT);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID,
+ MakeTargetManager.TARGET_BUILD_EXT);
IExtension[] extensions = point.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] cfgElements = extension.getConfigurationElements();
@@ -343,7 +352,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
protected void notifyListeners(MakeTargetEvent event) {
for (Object listener : listeners.getListeners()) {
- ((IMakeTargetListener)listener).targetChanged(event);
+ ((IMakeTargetListener) listener).targetChanged(event);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/PreferenceInitializer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/PreferenceInitializer.java
index d332338a392..31b5022031f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/PreferenceInitializer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/PreferenceInitializer.java
@@ -27,7 +27,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc)
@@ -35,7 +34,8 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
*/
@Override
public void initializeDefaultPreferences() {
- IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, true);
+ IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(),
+ MakeBuilder.BUILDER_ID, true);
try {
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make"); //$NON-NLS-1$
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, ""); //$NON-NLS-1$
@@ -52,45 +52,45 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
info.setErrorParsers(CCorePlugin.getDefault().getAllErrorParsersIDs());
} catch (CoreException e) {
}
- MakeCorePlugin.getDefault().getPluginPreferences().setDefault(CCorePlugin.PREF_BINARY_PARSER, CCorePlugin.PLUGIN_ID + ".ELF"); //$NON-NLS-1$
+ MakeCorePlugin.getDefault().getPluginPreferences().setDefault(CCorePlugin.PREF_BINARY_PARSER,
+ CCorePlugin.PLUGIN_ID + ".ELF"); //$NON-NLS-1$
// default plugin preferences for scanner configuration discovery
- IScannerConfigBuilderInfo scInfo = MakeCorePlugin.createScannerConfigBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), ScannerConfigBuilder.BUILDER_ID, true);
+ IScannerConfigBuilderInfo scInfo = MakeCorePlugin.createScannerConfigBuildInfo(
+ MakeCorePlugin.getDefault().getPluginPreferences(), ScannerConfigBuilder.BUILDER_ID, true);
try {
scInfo.setAutoDiscoveryEnabled(true);
scInfo.setMakeBuilderConsoleParserEnabled(true);
scInfo.setESIProviderCommandEnabled(true);
scInfo.setUseDefaultESIProviderCmd(true);
scInfo.setESIProviderCommand(new Path("gcc")); //$NON-NLS-1$
- scInfo.setESIProviderArguments("-E -P -v -dD ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
+ scInfo.setESIProviderArguments("-E -P -v -dD ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
scInfo.setESIProviderConsoleParserId(MakeCorePlugin.GCC_SPECS_CONSOLE_PARSER_ID);
scInfo.setMakeBuilderConsoleParserId(MakeCorePlugin.GCC_SCANNER_INFO_CONSOLE_PARSER_ID);
scInfo.setSIProblemGenerationEnabled(true);
} catch (CoreException e) {
}
- // default plugin preferences for new scanner configuration discovery
- IScannerConfigBuilderInfo2 scInfo2 = ScannerConfigProfileManager.
- createScannerConfigBuildInfo2(MakeCorePlugin.getDefault().getPluginPreferences(),
- ScannerConfigProfileManager.NULL_PROFILE_ID, true);
- scInfo2.setAutoDiscoveryEnabled(true);
- scInfo2.setProblemReportingEnabled(true);
- scInfo2.setSelectedProfileId(ScannerConfigProfileManager.DEFAULT_SI_PROFILE_ID);
- scInfo2.setBuildOutputFileActionEnabled(true);
- scInfo2.setBuildOutputFilePath(""); //$NON-NLS-1$
- scInfo2.setBuildOutputParserEnabled(true);
- String providerId = "specsFile"; //$NON-NLS-1$
- scInfo2.setProviderOpenFilePath(providerId, "");//$NON-NLS-1$
- scInfo2.setProviderRunCommand(providerId, "gcc"); //$NON-NLS-1$
- scInfo2.setProviderRunArguments(providerId, "-E -P -v -dD ${plugin_state_location}/${specs_file}");//$NON-NLS-1$
- scInfo2.setProviderOutputParserEnabled(providerId, true);
- scInfo2.setProblemReportingEnabled(true);
- try {
- scInfo2.save();
- }
- catch (CoreException e) {
- }
-
+ // default plugin preferences for new scanner configuration discovery
+ IScannerConfigBuilderInfo2 scInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(
+ MakeCorePlugin.getDefault().getPluginPreferences(), ScannerConfigProfileManager.NULL_PROFILE_ID, true);
+ scInfo2.setAutoDiscoveryEnabled(true);
+ scInfo2.setProblemReportingEnabled(true);
+ scInfo2.setSelectedProfileId(ScannerConfigProfileManager.DEFAULT_SI_PROFILE_ID);
+ scInfo2.setBuildOutputFileActionEnabled(true);
+ scInfo2.setBuildOutputFilePath(""); //$NON-NLS-1$
+ scInfo2.setBuildOutputParserEnabled(true);
+ String providerId = "specsFile"; //$NON-NLS-1$
+ scInfo2.setProviderOpenFilePath(providerId, "");//$NON-NLS-1$
+ scInfo2.setProviderRunCommand(providerId, "gcc"); //$NON-NLS-1$
+ scInfo2.setProviderRunArguments(providerId, "-E -P -v -dD ${plugin_state_location}/${specs_file}");//$NON-NLS-1$
+ scInfo2.setProviderOutputParserEnabled(providerId, true);
+ scInfo2.setProblemReportingEnabled(true);
+ try {
+ scInfo2.save();
+ } catch (CoreException e) {
+ }
+
// Store default for makefile
MakeCorePlugin.getDefault().getPluginPreferences().setDefault(MakeCorePlugin.MAKEFILE_STYLE, "GNU"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java
index cad5db05273..47258024a0c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/ProjectTargets.java
@@ -76,8 +76,8 @@ public class ProjectTargets {
//Historical ... fall back to the workspace and look in previous XML file location
if (rootElement.getChildren().length == 0) {
- IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(
- TARGETS_EXT);
+ IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(project.getName())
+ .addFileExtension(TARGETS_EXT);
targetFile = targetFilePath.toFile();
try {
InputStream input = new FileInputStream(targetFile);
@@ -174,7 +174,7 @@ public class ProjectTargets {
/**
* Persist the MakeTarget as a child of parent
- *
+ *
* @return created ICStorageElement
*/
private ICStorageElement createTargetElement(ICStorageElement parent, IMakeTarget target) {
@@ -186,7 +186,7 @@ public class ProjectTargets {
elem.setValue(target.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
String targetAttr = target.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, null);
- if ( targetAttr != null) {
+ if (targetAttr != null) {
elem = targetElem.createChild(TARGET_ARGUMENTS);
elem.setValue(targetAttr);
}
@@ -232,7 +232,7 @@ public class ProjectTargets {
/**
* This method loads an old style XML document provided in the input stream
* and returns an ICStorageElemnt wrapping it.
- *
+ *
* @return ICStorageElement or null
*/
protected ICStorageElement translateInputStreamToDocument(InputStream input) {
@@ -272,11 +272,11 @@ public class ProjectTargets {
if (option.length > 0) {
target.setStopOnError(Boolean.valueOf(option[0].getValue()).booleanValue());
}
- option = node.getChildrenByName(TARGET_USE_DEFAULT_CMD);
+ option = node.getChildrenByName(TARGET_USE_DEFAULT_CMD);
if (option.length > 0) {
target.setUseDefaultBuildCmd(Boolean.valueOf(option[0].getValue()).booleanValue());
}
- option = node.getChildrenByName(TARGET_COMMAND);
+ option = node.getChildrenByName(TARGET_COMMAND);
if (option.length > 0) {
target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, option[0].getValue());
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeCDataFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeCDataFactory.java
index 023a4d08288..e0fe16e5b63 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeCDataFactory.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeCDataFactory.java
@@ -21,27 +21,26 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil;
public class MakeCDataFactory extends CDataFactory {
private static MakeCDataFactory fInstance;
-
- public static CDataFactory getDefault(){
- if(fInstance == null){
+
+ public static CDataFactory getDefault() {
+ if (fInstance == null) {
fInstance = new MakeCDataFactory();
}
return fInstance;
}
@Override
- public CLanguageData createLanguageData(CConfigurationData cfg,
- CResourceData rcBase, CLanguageData base, String id, boolean clone) {
- if(id == null)
+ public CLanguageData createLanguageData(CConfigurationData cfg, CResourceData rcBase, CLanguageData base, String id,
+ boolean clone) {
+ if (id == null)
id = clone ? base.getId() : CDataUtil.genId(rcBase.getId());
return new MakeLanguageData(id, base);
}
@Override
- public CLanguageData createLanguageData(CConfigurationData cfg,
- CResourceData rcBase, String id, String name, String languageId,
- int supportedKinds, String[] rcTypes, boolean isContentTypes) {
- if(id == null)
+ public CLanguageData createLanguageData(CConfigurationData cfg, CResourceData rcBase, String id, String name,
+ String languageId, int supportedKinds, String[] rcTypes, boolean isContentTypes) {
+ if (id == null)
id = CDataUtil.genId(rcBase.getId());
MakeLanguageData lData = new MakeLanguageData(id, name, languageId, supportedKinds, rcTypes, isContentTypes);
return lData;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeConfigurationDataProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeConfigurationDataProvider.java
index a9143f4124d..1e547d93e5c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeConfigurationDataProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeConfigurationDataProvider.java
@@ -46,19 +46,20 @@ public class MakeConfigurationDataProvider extends CDefaultConfigurationDataProv
@Override
public CConfigurationData applyConfiguration(ICConfigurationDescription cfgDescription,
- ICConfigurationDescription baseCfgDescription, CConfigurationData baseData,
- IProgressMonitor monitor) throws CoreException {
+ ICConfigurationDescription baseCfgDescription, CConfigurationData baseData, IProgressMonitor monitor)
+ throws CoreException {
CConfigurationData result = super.applyConfiguration(cfgDescription, baseCfgDescription, baseData, monitor);
- if(!cfgDescription.isPreferenceConfiguration())
+ if (!cfgDescription.isPreferenceConfiguration())
updateDiscoveredInfo(cfgDescription.getProjectDescription().getProject(), result);
return result;
}
@Override
- public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription, IProgressMonitor monitor) throws CoreException {
+ public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription, IProgressMonitor monitor)
+ throws CoreException {
CConfigurationData result = super.loadConfiguration(cfgDescription, monitor);
- if(!cfgDescription.isPreferenceConfiguration())
+ if (!cfgDescription.isPreferenceConfiguration())
updateDiscoveredInfo(cfgDescription.getProjectDescription().getProject(), result);
return result;
}
@@ -74,7 +75,7 @@ public class MakeConfigurationDataProvider extends CDefaultConfigurationDataProv
processor.applyDiscoveredInfo(cfgData, dsInfo);
}
- protected CDataDiscoveredInfoProcessor getInfoProcessor( ){
+ protected CDataDiscoveredInfoProcessor getInfoProcessor() {
return MakeDiscoveredInfoProcessor.getDefault();
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeDiscoveredInfoProcessor.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeDiscoveredInfoProcessor.java
index 42d6896a4ac..dbb30bb59f1 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeDiscoveredInfoProcessor.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeDiscoveredInfoProcessor.java
@@ -21,18 +21,17 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.CDataDiscoveredInfoProce
public class MakeDiscoveredInfoProcessor extends CDataDiscoveredInfoProcessor {
private static MakeDiscoveredInfoProcessor fInstance;
-
- public static MakeDiscoveredInfoProcessor getDefault(){
- if(fInstance == null)
+
+ public static MakeDiscoveredInfoProcessor getDefault() {
+ if (fInstance == null)
fInstance = new MakeDiscoveredInfoProcessor();
return fInstance;
}
@Override
- protected void setInfoForData(CConfigurationData cfgData,
- CResourceData rcData, CLanguageData data, PathInfo pi,
+ protected void setInfoForData(CConfigurationData cfgData, CResourceData rcData, CLanguageData data, PathInfo pi,
CResourceData baseRcData, CLanguageData baseLangData) {
- MakeLanguageData mld = (MakeLanguageData)data;
+ MakeLanguageData mld = (MakeLanguageData) data;
mld.setDiscoveredInfo(pi);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeLanguageData.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeLanguageData.java
index 67b9ae1fc85..6ee4e67a1ec 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeLanguageData.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/MakeLanguageData.java
@@ -21,7 +21,7 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.PathInfoToLangSetti
public class MakeLanguageData extends UserAndDiscoveredEntryLanguageData {
private PathInfo fDiscoveredCache;
-
+
public MakeLanguageData() {
super();
}
@@ -40,25 +40,22 @@ public class MakeLanguageData extends UserAndDiscoveredEntryLanguageData {
@Override
protected void copySettingsFrom(CLanguageData data) {
super.copySettingsFrom(data);
- if(data instanceof MakeLanguageData){
- fDiscoveredCache = ((MakeLanguageData)data).fDiscoveredCache;
+ if (data instanceof MakeLanguageData) {
+ fDiscoveredCache = ((MakeLanguageData) data).fDiscoveredCache;
}
}
@Override
protected ICLanguageSettingEntry[] getAllDiscoveredEntries(int kind) {
- if(fDiscoveredCache != null){
+ if (fDiscoveredCache != null) {
int roFlag = canDisableDiscoveredEntries(kind) ? 0 : ICLanguageSettingEntry.READONLY;
- return PathInfoToLangSettingsConverter.entriesForKind(kind,
- roFlag
- | ICLanguageSettingEntry.BUILTIN
- | ICLanguageSettingEntry.RESOLVED,
- fDiscoveredCache);
+ return PathInfoToLangSettingsConverter.entriesForKind(kind,
+ roFlag | ICLanguageSettingEntry.BUILTIN | ICLanguageSettingEntry.RESOLVED, fDiscoveredCache);
}
return null;
}
-
- protected void setDiscoveredInfo(PathInfo info){
+
+ protected void setDiscoveredInfo(PathInfo info) {
fDiscoveredCache = info;
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
index c8c9d9356c3..d61d5947e53 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
@@ -226,7 +226,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
StringBuilder macroName = new StringBuilder();
for (int i = 0; i < len; i++) {
char c = line.charAt(i);
- switch(c) {
+ switch (c) {
case '$':
// '$$' --> '$'
if (foundDollar) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java
index 7feadb00a31..69f4e9d92b9 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java
@@ -84,7 +84,7 @@ public class Command extends Directive implements ICommand {
@Override
public String toString() {
StringBuilder cmd = new StringBuilder();
- cmd.append( '\t');
+ cmd.append('\t');
if (getPrefix() != 0) {
cmd.append(getPrefix());
}
@@ -116,7 +116,7 @@ public class Command extends Directive implements ICommand {
*/
@Override
public Process execute(String shell, String[] envp, File dir) throws IOException {
- String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
+ String[] cmdArray = new String[] { shell, "-c", command }; //$NON-NLS-1$
return Runtime.getRuntime().exec(cmdArray, envp, dir);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java
index c230cf5f6a3..f435da77ca5 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java
@@ -38,7 +38,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
}
public void setName(String n) {
- name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$
+ name = (n == null) ? "" : n.trim(); //$NON-NLS-1$
}
@Override
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java
index ab873b2c053..fe44c962603 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java
@@ -13,15 +13,14 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.makefile;
-
public class MakeFileConstants {
- public static final String RULE_DEFAULT = ".DEFAULT"; //$NON-NLS-1$
- public static final String RULE_IGNORE =".IGNORE"; //$NON-NLS-1$
- public static final String RULE_POSIX = ".POSIX"; //$NON-NLS-1$
- public static final String RULE_PRECIOUS = ".PRECIOUS"; //$NON-NLS-1$
- public static final String RULE_SCCS_GET = ".SCCS_GET"; //$NON-NLS-1$
- public static final String RULE_SILENT = ".SILENT"; //$NON-NLS-1$
- public static final String RULE_SUFFIXES = ".SUFFIXES"; //$NON-NLS-1$
+ public static final String RULE_DEFAULT = ".DEFAULT"; //$NON-NLS-1$
+ public static final String RULE_IGNORE = ".IGNORE"; //$NON-NLS-1$
+ public static final String RULE_POSIX = ".POSIX"; //$NON-NLS-1$
+ public static final String RULE_PRECIOUS = ".PRECIOUS"; //$NON-NLS-1$
+ public static final String RULE_SCCS_GET = ".SCCS_GET"; //$NON-NLS-1$
+ public static final String RULE_SILENT = ".SILENT"; //$NON-NLS-1$
+ public static final String RULE_SUFFIXES = ".SUFFIXES"; //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java
index a93360addd7..f9079b416c0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java
@@ -18,19 +18,18 @@ import java.util.ResourceBundle;
public class MakefileMessages {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.core.makefile.MakeFileResources";//$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.core.makefile.MakeFileResources";//$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- private MakefileMessages() {
- }
+ private MakefileMessages() {
+ }
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileReader.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileReader.java
index 37e95bb189d..601a186bdb4 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileReader.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileReader.java
@@ -21,7 +21,6 @@ import java.io.Reader;
*/
public class MakefileReader extends LineNumberReader {
-
public MakefileReader(Reader reader) {
super(reader);
}
@@ -30,7 +29,6 @@ public class MakefileReader extends LineNumberReader {
super(reader, sz);
}
-
@Override
public String readLine() throws IOException {
boolean done = false;
@@ -47,7 +45,7 @@ public class MakefileReader extends LineNumberReader {
// Eat the spaces at the beginning.
int i = 0;
while (i < line.length() && (Util.isSpace(line.charAt(i)))) {
- i++ ;
+ i++;
}
line = line.substring(i);
} else if (escapedCommand && line.length() > 0) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java
index 52f15dbd29b..58970fc0805 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java
@@ -79,6 +79,7 @@ public class NullMakefile extends AbstractMakefile {
public void parse(String name, IMakefileReaderProvider makefileReaderProvider) throws IOException {
}
+
@Override
public void parse(URI fileURI, Reader makefile) throws IOException {
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Util.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Util.java
index 238321687d6..40af6a7b6b7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Util.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Util.java
@@ -45,7 +45,7 @@ public class Util {
}
public static boolean isSpace(char c) {
- return (c == ' ' || c == '\t' || c == '\r' || c == '\n');
+ return (c == ' ' || c == '\t' || c == '\r' || c == '\n');
}
public static int indexOf(String line, char c) {
@@ -65,7 +65,7 @@ public class Util {
char ch = line.charAt(i);
if (ch == '(' && prev == '$' && pprev != '\\') {
paren++;
- } else if (ch == '{' && prev == '$' && pprev != '\\') {
+ } else if (ch == '{' && prev == '$' && pprev != '\\') {
bracket++;
} else if (ch == ')' && prev != '\\') {
if (paren > 0) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java
index 47ad418802f..bd32d5afc77 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java
@@ -16,11 +16,10 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.core.makefile.IAutomaticVariable;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
/**
* Represents an automatic variable. Automatic variables are implicit and
* computed for each rule that is applied.
- *
+ *
* @author Sebastian Bauer <mail@sebastianbauer.info>
* @see "http://www.gnu.org/software/make/manual/make.html#Automatic-Variables"
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/BuiltinFunction.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/BuiltinFunction.java
index 21c512c0b2e..4a92e580d38 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/BuiltinFunction.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/BuiltinFunction.java
@@ -18,7 +18,6 @@ import org.eclipse.cdt.make.core.makefile.IDirective;
import org.eclipse.cdt.make.core.makefile.IMakefile;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
/**
* Represents GNUmakefile built-in internal functions.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java
index 7e519dacd30..28f6041ea21 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Parent;
public abstract class Conditional extends Parent implements IConditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
String cond;
String arg1;
String arg2;
@@ -41,7 +41,6 @@ public abstract class Conditional extends Parent implements IConditional {
cond = conditional;
}
-
@Override
public String getConditional() {
return cond;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java
index 6958122c513..417f7de4103 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class DefineVariable extends VariableDefinition {
public DefineVariable(Directive parent, String name, StringBuffer value) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java
index 8b04ca05004..084f37af7a7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class Else extends Conditional {
public Else(Directive parent) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java
index 3139689af63..6a4bad09da2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java
@@ -17,7 +17,6 @@ import org.eclipse.cdt.make.internal.core.makefile.Directive;
public class Endef extends Terminal {
-
public Endef(Directive parent) {
super(parent);
}
@@ -26,9 +25,9 @@ public class Endef extends Terminal {
public boolean isEndef() {
return true;
}
-
+
@Override
public String toString() {
- return GNUMakefileConstants.TERMINAL_ENDEF;
- }
+ return GNUMakefileConstants.TERMINAL_ENDEF;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java
index fed01dde7b8..6694633cf06 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java
@@ -25,9 +25,9 @@ public class Endif extends Terminal {
public boolean isEndif() {
return true;
}
-
- @Override
+
+ @Override
public String toString() {
- return GNUMakefileConstants.TERMINAL_ENDIF;
- }
+ return GNUMakefileConstants.TERMINAL_ENDIF;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportVariable.java
index 8bd7b088e79..d3d3a35b059 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportVariable.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class ExportVariable extends VariableDefinition {
public ExportVariable(Directive parent, String name, StringBuffer value, int type) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
index 234948257d8..c173fe8aee2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
@@ -81,68 +81,46 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
private String[] includeDirectories = new String[0];
private IDirective[] builtins = new IDirective[0];
@SuppressWarnings("nls")
- private IAutomaticVariable[] autoVariables = new IAutomaticVariable[]{
- new AutomaticVariable(this, "@", MakefileMessages.getString("GNUMakefile.automaticVariable.at")),
- new AutomaticVariable(this, "%", MakefileMessages.getString("GNUMakefile.automaticVariable.percent")),
- new AutomaticVariable(this, "<", MakefileMessages.getString("GNUMakefile.automaticVariable.less")),
- new AutomaticVariable(this, "?", MakefileMessages.getString("GNUMakefile.automaticVariable.question")),
- new AutomaticVariable(this, "^", MakefileMessages.getString("GNUMakefile.automaticVariable.carrot")),
- new AutomaticVariable(this, "+", MakefileMessages.getString("GNUMakefile.automaticVariable.plus")),
- new AutomaticVariable(this, "|", MakefileMessages.getString("GNUMakefile.automaticVariable.pipe")),
- new AutomaticVariable(this, "*", MakefileMessages.getString("GNUMakefile.automaticVariable.star")),
- };
+ private IAutomaticVariable[] autoVariables = new IAutomaticVariable[] {
+ new AutomaticVariable(this, "@", MakefileMessages.getString("GNUMakefile.automaticVariable.at")),
+ new AutomaticVariable(this, "%", MakefileMessages.getString("GNUMakefile.automaticVariable.percent")),
+ new AutomaticVariable(this, "<", MakefileMessages.getString("GNUMakefile.automaticVariable.less")),
+ new AutomaticVariable(this, "?", MakefileMessages.getString("GNUMakefile.automaticVariable.question")),
+ new AutomaticVariable(this, "^", MakefileMessages.getString("GNUMakefile.automaticVariable.carrot")),
+ new AutomaticVariable(this, "+", MakefileMessages.getString("GNUMakefile.automaticVariable.plus")),
+ new AutomaticVariable(this, "|", MakefileMessages.getString("GNUMakefile.automaticVariable.pipe")),
+ new AutomaticVariable(this, "*", MakefileMessages.getString("GNUMakefile.automaticVariable.star")), };
@SuppressWarnings("nls")
- private final static String[] functions = {
- "subst", "patsubst", "strip", "findstring",
- "filter", "filter-out", "sort",
- "word", "words", "wordlist", "firstword", "lastword",
- "dir", "notdir",
- "suffix", "basename", "addsuffix", "addprefix",
- "join", "wildcard", "realpath", "abspath",
- "if", "or", "and", "foreach",
- "call", "value", "eval", "origin", "flavor",
- "shell", "error", "warning", "info",
- };
+ private final static String[] functions = { "subst", "patsubst", "strip", "findstring", "filter", "filter-out",
+ "sort", "word", "words", "wordlist", "firstword", "lastword", "dir", "notdir", "suffix", "basename",
+ "addsuffix", "addprefix", "join", "wildcard", "realpath", "abspath", "if", "or", "and", "foreach", "call",
+ "value", "eval", "origin", "flavor", "shell", "error", "warning", "info", };
@SuppressWarnings("nls")
- private IBuiltinFunction[] builtinFunctions = new IBuiltinFunction[]{
- new BuiltinFunction(this, "$(subst from,to,text)"),
- new BuiltinFunction(this, "$(patsubst pattern,replacement,text)"),
- new BuiltinFunction(this, "$(strip string)"),
- new BuiltinFunction(this, "$(findstring find,in)"),
- new BuiltinFunction(this, "$(filter pattern,text)"),
- new BuiltinFunction(this, "$(filter-out pattern,text)"),
- new BuiltinFunction(this, "$(sort list)"),
- new BuiltinFunction(this, "$(word n,text)"),
- new BuiltinFunction(this, "$(words text)"),
- new BuiltinFunction(this, "$(wordlist s,e,text)"),
- new BuiltinFunction(this, "$(firstword names)"),
- new BuiltinFunction(this, "$(lastword names)"),
- new BuiltinFunction(this, "$(dir names)"),
- new BuiltinFunction(this, "$(notdir names)"),
- new BuiltinFunction(this, "$(suffix names)"),
- new BuiltinFunction(this, "$(basename names)"),
- new BuiltinFunction(this, "$(addsuffix suffix,names)"),
- new BuiltinFunction(this, "$(addprefix prefix,names)"),
- new BuiltinFunction(this, "$(join list1,list2)"),
- new BuiltinFunction(this, "$(wildcard pattern)"),
- new BuiltinFunction(this, "$(realpath names)"),
- new BuiltinFunction(this, "$(abspath names)"),
- new BuiltinFunction(this, "$(if condition,then-part,else-part)"),
- new BuiltinFunction(this, "$(or condition1,condition2,...)"),
- new BuiltinFunction(this, "$(and condition1,condition2,...)"),
- new BuiltinFunction(this, "$(foreach var,list,text)"),
- new BuiltinFunction(this, "$(call variable,param,...)"),
- new BuiltinFunction(this, "$(value variable)"),
- new BuiltinFunction(this, "$(eval expression)"),
- new BuiltinFunction(this, "$(origin variable)"),
- new BuiltinFunction(this, "$(flavor variable)"),
- new BuiltinFunction(this, "$(shell command)"),
- new BuiltinFunction(this, "$(error error: text)"),
- new BuiltinFunction(this, "$(warning warning: text)"),
- new BuiltinFunction(this, "$(info info: text)"),
- };
+ private IBuiltinFunction[] builtinFunctions = new IBuiltinFunction[] {
+ new BuiltinFunction(this, "$(subst from,to,text)"),
+ new BuiltinFunction(this, "$(patsubst pattern,replacement,text)"),
+ new BuiltinFunction(this, "$(strip string)"), new BuiltinFunction(this, "$(findstring find,in)"),
+ new BuiltinFunction(this, "$(filter pattern,text)"),
+ new BuiltinFunction(this, "$(filter-out pattern,text)"), new BuiltinFunction(this, "$(sort list)"),
+ new BuiltinFunction(this, "$(word n,text)"), new BuiltinFunction(this, "$(words text)"),
+ new BuiltinFunction(this, "$(wordlist s,e,text)"), new BuiltinFunction(this, "$(firstword names)"),
+ new BuiltinFunction(this, "$(lastword names)"), new BuiltinFunction(this, "$(dir names)"),
+ new BuiltinFunction(this, "$(notdir names)"), new BuiltinFunction(this, "$(suffix names)"),
+ new BuiltinFunction(this, "$(basename names)"), new BuiltinFunction(this, "$(addsuffix suffix,names)"),
+ new BuiltinFunction(this, "$(addprefix prefix,names)"), new BuiltinFunction(this, "$(join list1,list2)"),
+ new BuiltinFunction(this, "$(wildcard pattern)"), new BuiltinFunction(this, "$(realpath names)"),
+ new BuiltinFunction(this, "$(abspath names)"),
+ new BuiltinFunction(this, "$(if condition,then-part,else-part)"),
+ new BuiltinFunction(this, "$(or condition1,condition2,...)"),
+ new BuiltinFunction(this, "$(and condition1,condition2,...)"),
+ new BuiltinFunction(this, "$(foreach var,list,text)"),
+ new BuiltinFunction(this, "$(call variable,param,...)"), new BuiltinFunction(this, "$(value variable)"),
+ new BuiltinFunction(this, "$(eval expression)"), new BuiltinFunction(this, "$(origin variable)"),
+ new BuiltinFunction(this, "$(flavor variable)"), new BuiltinFunction(this, "$(shell command)"),
+ new BuiltinFunction(this, "$(error error: text)"), new BuiltinFunction(this, "$(warning warning: text)"),
+ new BuiltinFunction(this, "$(info info: text)"), };
private IMakefileReaderProvider makefileReaderProvider;
@@ -161,8 +139,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
}
@Override
- public void parse(URI fileURI,
- IMakefileReaderProvider makefileReaderProvider) throws IOException {
+ public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException {
this.makefileReaderProvider = makefileReaderProvider;
MakefileReader reader;
if (makefileReaderProvider == null) {
@@ -173,8 +150,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
throw new IOException();
}
- reader = new MakefileReader(new InputStreamReader(
- store.openInputStream(EFS.NONE, null)));
+ reader = new MakefileReader(new InputStreamReader(store.openInputStream(EFS.NONE, null)));
} catch (CoreException e) {
MakeCorePlugin.log(e);
throw new IOException(e.getMessage());
@@ -190,7 +166,6 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
parse(filePath, new MakefileReader(reader));
}
-
protected void parse(URI fileURI, MakefileReader reader) throws IOException {
String line;
Rule[] rules = null;
@@ -485,7 +460,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
protected SpecialRule parseSpecialRule(String line) {
line = line.trim();
- String keyword = null;
+ String keyword = null;
String[] reqs = null;
SpecialRule special = null;
int index = Util.indexOf(line, ':');
@@ -693,7 +668,8 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
GNUTargetRule[] rules = new GNUTargetRule[targetNames.length];
for (int i = 0; i < targetNames.length; i++) {
- rules[i] = new GNUTargetRule(this, new Target(targetNames[i]), doubleColon, normalReqs, orderReqs, new Command[0]);
+ rules[i] = new GNUTargetRule(this, new Target(targetNames[i]), doubleColon, normalReqs, orderReqs,
+ new Command[0]);
if (cmd != null) {
rules[i].addDirective(new Command(this, cmd));
}
@@ -773,8 +749,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
// Check for "+=", ":=", "?="
if (index > 0) {
type = line.charAt(index - 1);
- if (type == VariableDefinition.TYPE_SIMPLE_EXPAND
- || type == VariableDefinition.TYPE_APPEND
+ if (type == VariableDefinition.TYPE_SIMPLE_EXPAND || type == VariableDefinition.TYPE_APPEND
|| type == VariableDefinition.TYPE_CONDITIONAL) {
separator = index - 1;
} else {
@@ -836,7 +811,8 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
StaticTargetRule[] staticRules = new StaticTargetRule[targets.length];
for (int i = 0; i < targets.length; i++) {
- staticRules[i] = new StaticTargetRule(this, new Target(targets[i]), targetPattern, prereqPatterns, new Command[0]);
+ staticRules[i] = new StaticTargetRule(this, new Target(targets[i]), targetPattern, prereqPatterns,
+ new Command[0]);
}
return staticRules;
}
@@ -861,12 +837,12 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
public IAutomaticVariable[] getAutomaticVariables() {
return autoVariables;
}
-
+
@Override
public IBuiltinFunction[] getBuiltinFunctions() {
return builtinFunctions;
}
-
+
@Override
public void setIncludeDirectories(String[] dirs) {
includeDirectories = dirs;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java
index 74d189d6d59..c22fa966e3a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java
@@ -70,7 +70,8 @@ public class GNUMakefileChecker extends ACBuilder {
* @see IncrementalProjectBuilder#build
*/
@Override
- protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor) throws CoreException {
+ protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
+ throws CoreException {
if (DEBUG_EVENTS) {
@SuppressWarnings("unchecked")
Map<String, String> pargs = args;
@@ -135,7 +136,7 @@ public class GNUMakefileChecker extends ACBuilder {
// FIXME: Find the candidate in the store somewhere.
IFile defaultMakefile = proj.getFile(new Path("Makefile")); //$NON-NLS-1$
if (defaultMakefile.exists()) {
- return new IFile[] {defaultMakefile};
+ return new IFile[] { defaultMakefile };
}
return new IFile[0];
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
index 5144963fded..a33dc7ee27e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
@@ -15,33 +15,32 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants;
-
public class GNUMakefileConstants extends MakeFileConstants {
- public static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
- public static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
- public static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
- public static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
- public static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
-
- public static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
- public static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
-
- public static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
- public static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
-
- public static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
- public static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
- public static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
-
- public static final String FUNCTION_CALL = "call"; //$NON-NLS-1$
-
- public static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
-
- public static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
- public static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
- public static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
- public static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
- public static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
- public static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
- public static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
+ public static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
+
+ public static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
+ public static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
+
+ public static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
+ public static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
+
+ public static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
+ public static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
+ public static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
+
+ public static final String FUNCTION_CALL = "call"; //$NON-NLS-1$
+
+ public static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
+
+ public static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
+ public static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
+ public static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
+ public static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
+ public static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
+ public static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
+ public static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java
index 2dda288c899..9f14100a01b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java
@@ -23,30 +23,39 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
public static boolean isInclude(String line) {
line = line.trim();
- boolean isInclude = line.startsWith(GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 7 && Character.isWhitespace(line.charAt(7));
- boolean isDashInclude = line.startsWith("-" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$
- boolean isSInclude = line.startsWith("s" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$
+ boolean isInclude = line.startsWith(GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 7
+ && Character.isWhitespace(line.charAt(7));
+ boolean isDashInclude = line.startsWith("-" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 //$NON-NLS-1$
+ && Character.isWhitespace(line.charAt(8));
+ boolean isSInclude = line.startsWith("s" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 //$NON-NLS-1$
+ && Character.isWhitespace(line.charAt(8));
return isInclude || isDashInclude || isSInclude;
}
public static boolean isVPath(String line) {
line = line.trim();
- return line.equals(GNUMakefileConstants.DIRECTIVE_VPATH) || line.startsWith(GNUMakefileConstants.DIRECTIVE_VPATH) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.equals(GNUMakefileConstants.DIRECTIVE_VPATH)
+ || line.startsWith(GNUMakefileConstants.DIRECTIVE_VPATH) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isExport(String line) {
line = line.trim();
- return line.equals(GNUMakefileConstants.VARIABLE_EXPORT) || line.startsWith(GNUMakefileConstants.VARIABLE_EXPORT) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.equals(GNUMakefileConstants.VARIABLE_EXPORT)
+ || line.startsWith(GNUMakefileConstants.VARIABLE_EXPORT) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isUnExport(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.DIRECTIVE_UNEXPORT) && line.length() > 8 && Character.isWhitespace(line.charAt(8));
+ return line.startsWith(GNUMakefileConstants.DIRECTIVE_UNEXPORT) && line.length() > 8
+ && Character.isWhitespace(line.charAt(8));
}
public static boolean isDefine(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isEndef(String line) {
@@ -55,27 +64,32 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
public static boolean isOverride(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8));
+ return line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE) && line.length() > 8
+ && Character.isWhitespace(line.charAt(8));
}
public static boolean isIfeq(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFEQ) && line.length() > 4 && Character.isWhitespace(line.charAt(4));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFEQ) && line.length() > 4
+ && Character.isWhitespace(line.charAt(4));
}
public static boolean isIfneq(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNEQ) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNEQ) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isIfdef(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFDEF) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFDEF) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isIfndef(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNDEF) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNDEF) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isElse(String line) {
@@ -90,7 +104,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
line = line.trim();
if (line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE)) {
int i = 8;
- while(i < line.length() && Character.isWhitespace(line.charAt(i))) {
+ while (i < line.length() && Character.isWhitespace(line.charAt(i))) {
i++;
}
if (line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE, i)) {
@@ -114,12 +128,8 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
}
public static boolean isVariableDefinition(String line) {
- return isOverrideDefine(line)
- || isTargetVariable(line)
- || isDefine(line)
- || isOverride(line)
- || isExport(line)
- || isMacroDefinition(line);
+ return isOverrideDefine(line) || isTargetVariable(line) || isDefine(line) || isOverride(line) || isExport(line)
+ || isMacroDefinition(line);
}
public static boolean isStaticTargetRule(String line) {
@@ -128,7 +138,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
if (colon1 > 0) {
// move pass colon1
line = line.substring(colon1 + 1);
- int colon2 = Util.indexOf(line, ':');
+ int colon2 = Util.indexOf(line, ':');
// Catch operator "::" not a static pattern rule
return (colon2 > 0);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java
index 49ebafc8034..d5ffa304e9c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java
@@ -55,12 +55,11 @@ public class GNUMakefileValidator implements IMakefileValidator {
@Override
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
- ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar, null);
+ ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity,
+ errorVar, null);
addMarker(problemMarkerInfo);
}
-
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
*/
@@ -71,14 +70,15 @@ public class GNUMakefileValidator implements IMakefileValidator {
name = problemMarkerInfo.file.getName();
}
StringBuilder sb = new StringBuilder(name);
- sb.append(':').append(problemMarkerInfo.lineNumber).append(':').append(getSeverity(problemMarkerInfo.severity));
+ sb.append(':').append(problemMarkerInfo.lineNumber).append(':')
+ .append(getSeverity(problemMarkerInfo.severity));
if (problemMarkerInfo.description != null) {
sb.append(':').append(problemMarkerInfo.description);
}
- if (problemMarkerInfo.variableName != null ) {
+ if (problemMarkerInfo.variableName != null) {
sb.append(':').append(problemMarkerInfo.variableName);
}
- if (problemMarkerInfo.externalPath != null ) {
+ if (problemMarkerInfo.externalPath != null) {
sb.append(':').append(problemMarkerInfo.externalPath);
}
sb.append('\n');
@@ -86,8 +86,6 @@ public class GNUMakefileValidator implements IMakefileValidator {
}
-
-
public String getSeverity(int severity) {
if (severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
return MakefileMessages.getString("MakefileValidator.errorBuild"); //$NON-NLS-1$
@@ -141,7 +139,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
for (int i = 0; i < directives.length; i++) {
directive = directives[i];
if (directive instanceof IConditional) {
- IConditional condition = (IConditional)directive;
+ IConditional condition = (IConditional) directive;
validateCondition(condition);
if (!condition.isElse()) {
conditionCount++;
@@ -156,7 +154,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
}
}
} else if (directive instanceof ITerminal) {
- ITerminal terminal = (ITerminal)directive;
+ ITerminal terminal = (ITerminal) directive;
if (terminal.isEndif()) {
if (conditionCount == 0) {
// ERROR missing condition.
@@ -181,7 +179,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
}
}
} else if (directive instanceof IVariableDefinition) {
- IVariableDefinition definition = (IVariableDefinition)directive;
+ IVariableDefinition definition = (IVariableDefinition) directive;
if (definition.isMultiLine()) {
defineCount++;
}
@@ -193,7 +191,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
String varName = directive.toString().trim();
marker.addMarker(res, startLine, msg, severity, varName);
} else if (directive instanceof ISpecialRule) {
- validateSpecialRule((ISpecialRule)directive);
+ validateSpecialRule((ISpecialRule) directive);
}
}
if (conditionCount > 0) {
@@ -218,7 +216,7 @@ public class GNUMakefileValidator implements IMakefileValidator {
int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
for (int i = directives.length - 1; i >= 0; i--) {
if (directives[i] instanceof IVariableDefinition) {
- IVariableDefinition definition = (IVariableDefinition)directives[i];
+ IVariableDefinition definition = (IVariableDefinition) directives[i];
if (definition.isMultiLine()) {
startLine = definition.getStartLine();
varName = definition.toString().trim();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java
index 65678c3c968..e518ff0c2e0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java
@@ -26,7 +26,8 @@ public class GNUTargetRule extends TargetRule {
String[] orderOnlyPrerequisites;
boolean doubleColon;
- public GNUTargetRule(Directive parent, Target target, boolean double_colon, String[] normal_prereqs, String[] order_prereqs, Command[] commands) {
+ public GNUTargetRule(Directive parent, Target target, boolean double_colon, String[] normal_prereqs,
+ String[] order_prereqs, Command[] commands) {
super(parent, target, normal_prereqs, commands);
orderOnlyPrerequisites = order_prereqs;
doubleColon = double_colon;
@@ -44,7 +45,6 @@ public class GNUTargetRule extends TargetRule {
return orderOnlyPrerequisites;
}
-
/**
* @see java.lang.Object#toString()
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java
index 5189eefe781..4324e4a96b7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java
@@ -15,10 +15,9 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class Ifdef extends Conditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
-
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
public Ifdef(Directive parent, String var) {
super(parent, var, EMPTY, EMPTY);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java
index abad73fe7f7..9fd7cec7eb7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class Ifeq extends Conditional {
public Ifeq(Directive parent, String cond) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java
index ac0bce611ff..d5fcfea45be 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java
@@ -15,10 +15,10 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class Ifndef extends Conditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
public Ifndef(Directive parent, String var) {
super(parent, var, EMPTY, EMPTY);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java
index 4d6dc748091..51897b8b642 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class Ifneq extends Conditional {
public Ifneq(Directive parent, String cond) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
index 13c99a38bba..8ba67ddcae5 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
@@ -65,7 +65,6 @@ public class Include extends Parent implements IInclude {
return null;
}
-
@Override
public IDirective[] getDirectives() {
clearDirectives();
@@ -95,13 +94,14 @@ public class Include extends Parent implements IInclude {
} else if (dirs != null) {
for (int j = 0; j < dirs.length; j++) {
try {
- IPath testIncludeFilePath= new Path(dirs[j]).append(includeFilePath);
+ IPath testIncludeFilePath = new Path(dirs[j]).append(includeFilePath);
String uriPath = testIncludeFilePath.toString();
if (testIncludeFilePath.getDevice() != null) {
// special case: device prefix is seen as relative path by URI
uriPath = '/' + uriPath;
}
- URI includeURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uriPath, null, null);
+ URI includeURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
+ uriPath, null, null);
if (!isAlreadyIncluded(includeURI)) {
GNUMakefile gnu = new GNUMakefile();
gnu.parse(includeURI, makefileReaderProvider);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java
index 5e93da101f6..6209a23b647 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class OverrideDefine extends DefineVariable {
public OverrideDefine(Directive parent, String name, StringBuffer value) {
@@ -24,7 +23,8 @@ public class OverrideDefine extends DefineVariable {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$
+ StringBuffer sb = new StringBuffer(
+ GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$
sb.append(getName()).append('\n');
sb.append(getValue());
sb.append(GNUMakefileConstants.TERMINAL_ENDEF);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideVariable.java
index 3e803e14246..747f392a2d2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideVariable.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu;
import org.eclipse.cdt.make.internal.core.makefile.Directive;
-
public class OverrideVariable extends VariableDefinition {
public OverrideVariable(Directive parent, String name, StringBuffer value, int type) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/StaticTargetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/StaticTargetRule.java
index 418821ed4b8..33f8e2d17f1 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/StaticTargetRule.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/StaticTargetRule.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.make.internal.core.makefile.Directive;
import org.eclipse.cdt.make.internal.core.makefile.InferenceRule;
import org.eclipse.cdt.make.internal.core.makefile.Target;
-
/**
* Here is the syntax of a static pattern rule:
*
@@ -33,7 +32,8 @@ public class StaticTargetRule extends InferenceRule implements IInferenceRule {
String targetPattern;
String[] prereqPatterns;
- public StaticTargetRule(Directive parent, Target target, String target_pattern, String[] prereq_patterns, Command[] commands) {
+ public StaticTargetRule(Directive parent, Target target, String target_pattern, String[] prereq_patterns,
+ Command[] commands) {
super(parent, target, commands);
targetPattern = target_pattern;
prereqPatterns = prereq_patterns;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/TargetVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/TargetVariable.java
index 72835ee3593..6435d2ff295 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/TargetVariable.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/TargetVariable.java
@@ -25,7 +25,8 @@ public class TargetVariable extends VariableDefinition {
boolean override;
- public TargetVariable(Directive parent, String target, String name, StringBuffer value, boolean override, int type) {
+ public TargetVariable(Directive parent, String target, String name, StringBuffer value, boolean override,
+ int type) {
super(parent, target, name, value, type);
this.override = override;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java
index 03501766ec4..52ed0318d2f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.make.internal.core.makefile.MacroDefinition;
/**
*/
-public class VariableDefinition extends MacroDefinition implements IVariableDefinition {
+public class VariableDefinition extends MacroDefinition implements IVariableDefinition {
/**
* ? is Conditional
@@ -39,7 +39,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
}
public VariableDefinition(Directive parent, String name, StringBuffer value, int type) {
- this(parent, "", name, value, type); //$NON-NLS-1$
+ this(parent, "", name, value, type); //$NON-NLS-1$
}
public VariableDefinition(Directive parent, String target, String name, StringBuffer value, int type) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java
index ad1e6664a05..18017728947 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java
@@ -86,14 +86,13 @@ public class PosixMakefile extends AbstractMakefile {
}
@Override
- public void parse(URI fileURI,
- IMakefileReaderProvider makefileReaderProvider) throws IOException {
+ public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException {
this.makefileReaderProvider = makefileReaderProvider;
MakefileReader reader;
if (makefileReaderProvider == null) {
try {
- reader = new MakefileReader(new InputStreamReader(
- EFS.getStore(fileURI).openInputStream(EFS.NONE, null)));
+ reader = new MakefileReader(
+ new InputStreamReader(EFS.getStore(fileURI).openInputStream(EFS.NONE, null)));
} catch (CoreException e) {
MakeCorePlugin.log(e);
throw new IOException(e.getMessage());
@@ -165,7 +164,7 @@ public class PosixMakefile extends AbstractMakefile {
// 3- Empty lines ?
if (Util.isEmptyLine(line)) {
- Directive empty = new EmptyLine(this);
+ Directive empty = new EmptyLine(this);
empty.setLines(startLine, endLine);
if (rules != null) {
for (Rule rule : rules) {
@@ -197,7 +196,7 @@ public class PosixMakefile extends AbstractMakefile {
InferenceRule irule = parseInferenceRule(line);
irule.setLines(startLine, endLine);
addDirective(irule);
- rules = new Rule[]{irule};
+ rules = new Rule[] { irule };
continue;
}
@@ -235,15 +234,15 @@ public class PosixMakefile extends AbstractMakefile {
public IDirective[] getBuiltins() {
return builtins;
}
+
@Override
public IAutomaticVariable[] getAutomaticVariables() {
return automaticVariables;
}
-
protected SpecialRule processSpecialRule(String line) {
line = line.trim();
- String keyword = null;
+ String keyword = null;
String[] reqs = null;
SpecialRule special = null;
int index = Util.indexOf(line, ':');
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java
index 70be3adfd9d..68e7bbfb379 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java
@@ -43,26 +43,25 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-
public class CDataDiscoveredInfoCalculator {
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static CDataDiscoveredInfoCalculator fInstance;
- public static class DiscoveredSettingInfo{
+ public static class DiscoveredSettingInfo {
private boolean fIsPerFileDiscovery;
private IRcSettingInfo[] fInfos;
- public DiscoveredSettingInfo(boolean isPerFileDiscovery, IRcSettingInfo[] infos){
+ public DiscoveredSettingInfo(boolean isPerFileDiscovery, IRcSettingInfo[] infos) {
fIsPerFileDiscovery = isPerFileDiscovery;
fInfos = infos;
}
- public boolean isPerFileDiscovery(){
+ public boolean isPerFileDiscovery() {
return fIsPerFileDiscovery;
}
- public IRcSettingInfo[] getRcSettingInfos(){
+ public IRcSettingInfo[] getRcSettingInfos() {
return fInfos;
}
}
@@ -79,17 +78,17 @@ public class CDataDiscoveredInfoCalculator {
PathInfo getFilePathInfo();
}
- private static class RcSettingInfo implements IRcSettingInfo{
+ private static class RcSettingInfo implements IRcSettingInfo {
private ArrayList<ILangSettingInfo> fLangInfoList;
private CResourceData fRcData;
- RcSettingInfo(CResourceData rcData){
+ RcSettingInfo(CResourceData rcData) {
fRcData = rcData;
}
@Override
public ILangSettingInfo[] getLangInfos() {
- if(fLangInfoList != null && fLangInfoList.size() != 0)
+ if (fLangInfoList != null && fLangInfoList.size() != 0)
return fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]);
return new ILangSettingInfo[0];
}
@@ -99,8 +98,8 @@ public class CDataDiscoveredInfoCalculator {
return fRcData;
}
- void add(ILangSettingInfo info){
- if(fLangInfoList == null)
+ void add(ILangSettingInfo info) {
+ if (fLangInfoList == null)
fLangInfoList = new ArrayList<ILangSettingInfo>();
fLangInfoList.add(info);
}
@@ -110,7 +109,7 @@ public class CDataDiscoveredInfoCalculator {
private CLanguageData fLangData;
private PathInfo fPathInfo;
- LangSettingInfo(CLanguageData langData, PathInfo info){
+ LangSettingInfo(CLanguageData langData, PathInfo info) {
fLangData = langData;
fPathInfo = info;
}
@@ -131,8 +130,8 @@ public class CDataDiscoveredInfoCalculator {
private int fMaxIndex;
private List<PathFilePathInfo>[] fStore;
- public ListIndexStore(int size){
- if(size < 0)
+ public ListIndexStore(int size) {
+ if (size < 0)
size = 0;
@SuppressWarnings("unchecked")
@@ -140,25 +139,25 @@ public class CDataDiscoveredInfoCalculator {
fStore = lists;
}
- public void add(int index, PathFilePathInfo value){
+ public void add(int index, PathFilePathInfo value) {
List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<PathFilePathInfo>() : fStore[index];
- if(list == null){
+ if (list == null) {
list = new ArrayList<PathFilePathInfo>();
fStore[index] = list;
}
- if(fMaxIndex < index)
+ if (fMaxIndex < index)
fMaxIndex = index;
list.add(value);
}
- private boolean checkResize(int index){
- if(index >= fStore.length){
+ private boolean checkResize(int index) {
+ if (index >= fStore.length) {
int newSize = ++index;
@SuppressWarnings("unchecked")
List<PathFilePathInfo> resized[] = new List[newSize];
- if(fStore != null && fStore.length != 0){
+ if (fStore != null && fStore.length != 0) {
System.arraycopy(fStore, 0, resized, 0, fStore.length);
}
fStore = resized;
@@ -167,13 +166,13 @@ public class CDataDiscoveredInfoCalculator {
return false;
}
- public List<PathFilePathInfo>[] getLists(){
+ public List<PathFilePathInfo>[] getLists() {
int size = fMaxIndex + 1;
List<List<PathFilePathInfo>> list = new ArrayList<List<PathFilePathInfo>>(size);
List<PathFilePathInfo> l;
- for(int i = 0; i < size; i++){
+ for (int i = 0; i < size; i++) {
l = fStore[i];
- if(l != null)
+ if (l != null)
list.add(l);
}
@@ -187,15 +186,15 @@ public class CDataDiscoveredInfoCalculator {
IPath fPath;
PathInfo fInfo;
- PathFilePathInfo(IPath path, PathInfo info){
+ PathFilePathInfo(IPath path, PathInfo info) {
fPath = path;
fInfo = info;
}
}
private static class ExtsSetSettings {
-// String[] fExts;
-// HashSet fExtsSet;
+ // String[] fExts;
+ // HashSet fExtsSet;
private ExtsSet fExtsSet;
Map<PathInfo, List<PathFilePathInfo>> fPathFilePathInfoMap;
CLanguageData fBaseLangData;
@@ -210,8 +209,8 @@ public class CDataDiscoveredInfoCalculator {
fIsDerived = isDerived;
}
- void add(ExtsSetSettings setting){
- if(setting.fPathFilePathInfoMap != null){
+ void add(ExtsSetSettings setting) {
+ if (setting.fPathFilePathInfoMap != null) {
Collection<List<PathFilePathInfo>> infoLists = setting.fPathFilePathInfoMap.values();
for (List<PathFilePathInfo> infoList : infoLists) {
for (PathFilePathInfo info : infoList) {
@@ -221,26 +220,27 @@ public class CDataDiscoveredInfoCalculator {
}
}
- public void add(PathFilePathInfo pInfo){
- if(fPathFilePathInfoMap == null)
+ public void add(PathFilePathInfo pInfo) {
+ if (fPathFilePathInfoMap == null)
fPathFilePathInfoMap = new HashMap<PathInfo, List<PathFilePathInfo>>(3);
PathInfo fileInfo = pInfo.fInfo;
- List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : fPathFilePathInfoMap.get(fileInfo);
- if(list == null){
+ List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList
+ : fPathFilePathInfoMap.get(fileInfo);
+ if (list == null) {
list = new ArrayList<PathFilePathInfo>();
fPathFilePathInfoMap.put(fileInfo, list);
- if(fMaxMatchInfo == null){
+ if (fMaxMatchInfo == null) {
fMaxMatchInfo = fileInfo;
fMaxMatchInfoList = list;
}
-// else {
-// fIsMultiple = true;
-// }
- } else if(fMaxMatchInfoList != list){
-// fIsMultiple = true;
+ // else {
+ // fIsMultiple = true;
+ // }
+ } else if (fMaxMatchInfoList != list) {
+ // fIsMultiple = true;
- if(fMaxMatchInfoList.size() == list.size()){
+ if (fMaxMatchInfoList.size() == list.size()) {
fMaxMatchInfoList = list;
fMaxMatchInfo = fileInfo;
}
@@ -248,29 +248,29 @@ public class CDataDiscoveredInfoCalculator {
list.add(pInfo);
}
- public boolean isMultiple(){
+ public boolean isMultiple() {
return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1;
}
@Override
public boolean equals(Object obj) {
- if(obj == this)
+ if (obj == this)
return true;
- if(isMultiple())
+ if (isMultiple())
return false;
- if(!(obj instanceof ExtsSetSettings))
+ if (!(obj instanceof ExtsSetSettings))
return false;
- ExtsSetSettings other = (ExtsSetSettings)obj;
- if(other.isMultiple())
+ ExtsSetSettings other = (ExtsSetSettings) obj;
+ if (other.isMultiple())
return false;
- if(!fExtsSet.equals(other.fExtsSet))
+ if (!fExtsSet.equals(other.fExtsSet))
return false;
- if(!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo))
+ if (!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo))
return false;
return true;
@@ -279,13 +279,13 @@ public class CDataDiscoveredInfoCalculator {
@Override
public int hashCode() {
int hash = fHash;
- if(hash == 0){
- if(isMultiple())
+ if (hash == 0) {
+ if (isMultiple())
hash = super.hashCode();
else {
hash = fExtsSet.hashCode();
- if(fMaxMatchInfo != null)
+ if (fMaxMatchInfo != null)
hash += fMaxMatchInfo.hashCode();
}
@@ -301,27 +301,27 @@ public class CDataDiscoveredInfoCalculator {
private HashSet<String> fExtsSet;
private int fHash;
- public ExtsSet(String[] exts){
- fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[])exts.clone();
+ public ExtsSet(String[] exts) {
+ fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[]) exts.clone();
}
@Override
public boolean equals(Object obj) {
- if(this == obj)
+ if (this == obj)
return true;
- if(!(obj instanceof ExtsSet))
+ if (!(obj instanceof ExtsSet))
return false;
- ExtsSet other = (ExtsSet)obj;
- if(fExts.length != other.fExts.length)
+ ExtsSet other = (ExtsSet) obj;
+ if (fExts.length != other.fExts.length)
return false;
- if(fExts.length != 0){
+ if (fExts.length != 0) {
@SuppressWarnings("unchecked")
- HashSet<String> set = (HashSet<String>)calcExtsSet().clone();
+ HashSet<String> set = (HashSet<String>) calcExtsSet().clone();
set.removeAll(other.calcExtsSet());
- if(set.size() != 0)
+ if (set.size() != 0)
return false;
}
return true;
@@ -330,9 +330,9 @@ public class CDataDiscoveredInfoCalculator {
@Override
public int hashCode() {
int hash = fHash;
- if(hash == 0){
+ if (hash == 0) {
hash = 47;
- for(int i = 0; i < fExts.length; i++){
+ for (int i = 0; i < fExts.length; i++) {
hash += fExts[i].hashCode();
}
fHash = hash;
@@ -340,21 +340,21 @@ public class CDataDiscoveredInfoCalculator {
return hash;
}
- private HashSet<String> calcExtsSet(){
- if(fExtsSet == null)
+ private HashSet<String> calcExtsSet() {
+ if (fExtsSet == null)
fExtsSet = new HashSet<String>(Arrays.asList(fExts));
return fExtsSet;
}
@Override
public String toString() {
- if(fExts.length == 0)
+ if (fExts.length == 0)
return "<empty>"; //$NON-NLS-1$
StringBuilder buf = new StringBuilder();
- for(int i = 0; i < fExts.length; i++){
- if(i != 0)
+ for (int i = 0; i < fExts.length; i++) {
+ if (i != 0)
buf.append(","); //$NON-NLS-1$
buf.append(fExts[i]);
}
@@ -369,78 +369,78 @@ public class CDataDiscoveredInfoCalculator {
private PathSettingsContainer fContainer;
private boolean fIsDerived;
- RcSetSettings(PathSettingsContainer cr, CResourceData rcData, boolean isDerived){
+ RcSetSettings(PathSettingsContainer cr, CResourceData rcData, boolean isDerived) {
this.fContainer = cr;
this.fRcData = rcData;
this.fIsDerived = isDerived;
cr.setValue(this);
}
- public RcSetSettings getChild(IPath path, boolean exactPath){
+ public RcSetSettings getChild(IPath path, boolean exactPath) {
PathSettingsContainer cr = fContainer.getChildContainer(path, false, exactPath);
- if(cr != null)
- return (RcSetSettings)cr.getValue();
+ if (cr != null)
+ return (RcSetSettings) cr.getValue();
return null;
}
- public RcSetSettings getChild(IPath path){
+ public RcSetSettings getChild(IPath path) {
PathSettingsContainer cr = fContainer.getChildContainer(path, false, true);
- if(cr != null)
- return (RcSetSettings)cr.getValue();
+ if (cr != null)
+ return (RcSetSettings) cr.getValue();
return null;
}
- public RcSetSettings createChild(IPath path, CResourceData data, boolean isDerived){
+ public RcSetSettings createChild(IPath path, CResourceData data, boolean isDerived) {
PathSettingsContainer cr = fContainer.getChildContainer(path, true, true);
- RcSetSettings child = (RcSetSettings)cr.getValue();
- if(child == null){
+ RcSetSettings child = (RcSetSettings) cr.getValue();
+ if (child == null) {
child = new RcSetSettings(cr, data, isDerived);
-// cr.setValue(child);
+ // cr.setValue(child);
}
return child;
}
- void updateRcData(CResourceData data, boolean isDerived){
+ void updateRcData(CResourceData data, boolean isDerived) {
fRcData = data;
fIsDerived = data != null ? isDerived : false;
updateLangDatas();
}
- private void updateLangDatas(){
- if(fRcData.getType() == ICSettingBase.SETTING_FILE){
- CLanguageData lData = ((CFileData)fRcData).getLanguageData();
+ private void updateLangDatas() {
+ if (fRcData.getType() == ICSettingBase.SETTING_FILE) {
+ CLanguageData lData = ((CFileData) fRcData).getLanguageData();
ExtsSetSettings extSetting = fExtToExtsSetMap.get(getFileExt(fRcData.getPath()));
- if(extSetting != null){
+ if (extSetting != null) {
extSetting.fBaseLangData = lData;
extSetting.fIsDerived = lData != null ? fIsDerived : false;
}
- if(extSetting != null ?
- fExtsSetToExtsSetSettingsMap.size() > 1
- : fExtsSetToExtsSetSettingsMap.size() > 0){
+ if (extSetting != null ? fExtsSetToExtsSetSettingsMap.size() > 1
+ : fExtsSetToExtsSetSettingsMap.size() > 0) {
for (ExtsSetSettings s : fExtsSetToExtsSetSettingsMap.values()) {
- if(s != extSetting){
+ if (s != extSetting) {
s.fBaseLangData = null;
s.fIsDerived = false;
}
}
}
} else {
- CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas();
+ CLanguageData[] lDatas = ((CFolderData) fRcData).getLanguageDatas();
@SuppressWarnings("unchecked")
- Map<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>)fExtsSetToExtsSetSettingsMap.clone();
+ Map<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>) fExtsSetToExtsSetSettingsMap
+ .clone();
CLanguageData lData;
- for(int i = 0; i < lDatas.length; i++){
+ for (int i = 0; i < lDatas.length; i++) {
lData = lDatas[i];
ExtsSetSettings extSetting = map.remove(new ExtsSet(lData.getSourceExtensions()));
- if(extSetting != null){
+ if (extSetting != null) {
extSetting.fBaseLangData = lData;
extSetting.fIsDerived = this.fIsDerived;
}
}
- if(map.size() != 0){
+ if (map.size() != 0) {
Collection<ExtsSetSettings> extSettings = map.values();
for (ExtsSetSettings extSetting : extSettings) {
extSetting.fBaseLangData = null;
@@ -450,29 +450,29 @@ public class CDataDiscoveredInfoCalculator {
}
}
- public IPath getPath(){
+ public IPath getPath() {
return fContainer.getPath();
}
- public RcSetSettings getParent(){
+ public RcSetSettings getParent() {
PathSettingsContainer cr = fContainer.getParentContainer();
- if(cr != null)
- return (RcSetSettings)cr.getValue();
+ if (cr != null)
+ return (RcSetSettings) cr.getValue();
return null;
}
- void internalSetSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map){
+ void internalSetSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map) {
fExtsSetToExtsSetSettingsMap = map;
fExtToExtsSetMap = calcExtToExtSetSettingsMap(map);
}
- void internalAdd(ExtsSetSettings setting){
- if(fExtsSetToExtsSetSettingsMap == null){
+ void internalAdd(ExtsSetSettings setting) {
+ if (fExtsSetToExtsSetSettingsMap == null) {
fExtsSetToExtsSetSettingsMap = new HashMap<ExtsSet, ExtsSetSettings>();
}
ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet);
- if(cur != null){
+ if (cur != null) {
cur.add(setting);
} else {
fExtsSetToExtsSetSettingsMap.put(setting.fExtsSet, setting);
@@ -480,29 +480,29 @@ public class CDataDiscoveredInfoCalculator {
}
}
- void internalAddSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map){
+ void internalAddSettingsMap(HashMap<ExtsSet, ExtsSetSettings> map) {
Collection<ExtsSetSettings> settings = map.values();
for (ExtsSetSettings setting : settings) {
internalAdd(setting);
-// ExtsSet extsSet;
-// extsSet = setting.fExtsSet;
-// thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(extsSet);
-// if(thisSetting != null){
-// thisSetting.add(setting);
-// } else {
-// fExtsSetToExtsSetSettingsMap.put(extsSet, setting);
-// fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap);
-// }
+ // ExtsSet extsSet;
+ // extsSet = setting.fExtsSet;
+ // thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(extsSet);
+ // if(thisSetting != null){
+ // thisSetting.add(setting);
+ // } else {
+ // fExtsSetToExtsSetSettingsMap.put(extsSet, setting);
+ // fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap);
+ // }
}
}
- public RcSetSettings[] getChildren(final boolean includeCurrent){
+ public RcSetSettings[] getChildren(final boolean includeCurrent) {
final List<Object> list = new ArrayList<Object>();
- fContainer.accept(new IPathSettingsContainerVisitor(){
+ fContainer.accept(new IPathSettingsContainerVisitor() {
@Override
public boolean visit(PathSettingsContainer container) {
- if(includeCurrent || container != fContainer){
+ if (includeCurrent || container != fContainer) {
list.add(container.getValue());
}
return true;
@@ -513,31 +513,31 @@ public class CDataDiscoveredInfoCalculator {
return list.toArray(new RcSetSettings[list.size()]);
}
- public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){
- if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size())
+ public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated) {
+ if (!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size())
return false;
Set<Entry<ExtsSet, ExtsSetSettings>> entrySet = other.fExtsSetToExtsSetSettingsMap.entrySet();
for (Entry<ExtsSet, ExtsSetSettings> entry : entrySet) {
ExtsSetSettings otherSetting = entry.getValue();
- if(ignoreGenerated && otherSetting.fBaseLangData == null)
+ if (ignoreGenerated && otherSetting.fBaseLangData == null)
continue;
ExtsSetSettings thisSetting = fExtsSetToExtsSetSettingsMap.get(entry.getKey());
- if(thisSetting == null)
+ if (thisSetting == null)
return false;
- if(otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo))
+ if (otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo))
return false;
}
return true;
}
- void removeChild(RcSetSettings setting){
+ void removeChild(RcSetSettings setting) {
IPath path = setting.fContainer.getPath();
IPath thisPath = fContainer.getPath();
- if(!thisPath.isPrefixOf(path))
+ if (!thisPath.isPrefixOf(path))
throw new IllegalArgumentException();
path = path.removeFirstSegments(thisPath.segmentCount());
@@ -545,7 +545,8 @@ public class CDataDiscoveredInfoCalculator {
}
}
- private static HashMap<String, ExtsSetSettings> calcExtToExtSetSettingsMap(Map<ExtsSet, ExtsSetSettings> extsSetMap){
+ private static HashMap<String, ExtsSetSettings> calcExtToExtSetSettingsMap(
+ Map<ExtsSet, ExtsSetSettings> extsSetMap) {
HashMap<String, ExtsSetSettings> result = null;
Collection<ExtsSetSettings> settings = extsSetMap.values();
for (ExtsSetSettings setting : settings) {
@@ -554,31 +555,32 @@ public class CDataDiscoveredInfoCalculator {
return result;
}
- private static HashMap<String, ExtsSetSettings> addExtsInfoToMap(ExtsSetSettings setting, HashMap<String, ExtsSetSettings> map){
+ private static HashMap<String, ExtsSetSettings> addExtsInfoToMap(ExtsSetSettings setting,
+ HashMap<String, ExtsSetSettings> map) {
boolean forceAdd = false;
String[] exts = setting.fExtsSet.fExts;
String ext;
- if(map == null){
+ if (map == null) {
map = new HashMap<String, ExtsSetSettings>();
forceAdd = true;
}
- for(int i = 0; i < exts.length; i++){
+ for (int i = 0; i < exts.length; i++) {
ext = exts[i];
- if(forceAdd || !map.containsKey(ext)){
+ if (forceAdd || !map.containsKey(ext)) {
map.put(ext, setting);
}
}
return map;
}
- private RcSetSettings createRcSetInfo (CConfigurationData data){
+ private RcSetSettings createRcSetInfo(CConfigurationData data) {
CFolderData rootData = data.getRootFolderData();
PathSettingsContainer container = PathSettingsContainer.createRootContainer();
RcSetSettings rcSet = new RcSetSettings(container, rootData, false);
rcSet.internalSetSettingsMap(createExtsSetSettingsMap(rootData));
-// rcSet.fExtToExtsSetMap = new HashMap();
-// rcSet.fExtsSetToExtsSetSettingsMap = new HashMap();
+ // rcSet.fExtToExtsSetMap = new HashMap();
+ // rcSet.fExtsSetToExtsSetSettingsMap = new HashMap();
CResourceData[] rcDatas = data.getResourceDatas();
CResourceData rcData;
@@ -587,46 +589,49 @@ public class CDataDiscoveredInfoCalculator {
ExtsSetSettings fileSetting;
IPath path;
- for(int i = 0; i < rcDatas.length; i++){
+ for (int i = 0; i < rcDatas.length; i++) {
rcData = rcDatas[i];
- if(rcData == rootData)
+ if (rcData == rootData)
continue;
- if(!includeRcDataInCalculation(data, rcData))
+ if (!includeRcDataInCalculation(data, rcData))
continue;
path = rcData.getPath();
curRcSet = rcSet.createChild(path, rcData, false);
- if(rcData.getType() == ICSettingBase.SETTING_FILE){
+ if (rcData.getType() == ICSettingBase.SETTING_FILE) {
fileMap = new HashMap<ExtsSet, ExtsSetSettings>(1);
- fileSetting = createExtsSetSettings(path, (CFileData)rcData);
+ fileSetting = createExtsSetSettings(path, (CFileData) rcData);
fileMap.put(fileSetting.fExtsSet, fileSetting);
curRcSet.internalSetSettingsMap(fileMap);
} else {
- curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData)rcData));
+ curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData) rcData));
}
}
return rcSet;
}
- protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData){
+ protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData) {
return true;
}
- protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException{
+ protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException {
return cfgData.createFileData(path, base);
}
- protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFolderData base, CLanguageData langBase) throws CoreException{
+ protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFolderData base, CLanguageData langBase)
+ throws CoreException {
return cfgData.createFileData(path, base, langBase);
}
- protected CFolderData createFolderData(CConfigurationData cfgData, IPath path, CFolderData base) throws CoreException{
+ protected CFolderData createFolderData(CConfigurationData cfgData, IPath path, CFolderData base)
+ throws CoreException {
return cfgData.createFolderData(path, base);
}
- private RcSetSettings createRcSetSettings(CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo){
+ private RcSetSettings createRcSetSettings(CConfigurationData data,
+ IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo) {
RcSetSettings rcSet = createRcSetInfo(data);
Map<IResource, PathInfo> map = discoveredInfo.getPathInfoMap();
PathFilePathInfo pInfos[] = createOrderedInfo(map);
@@ -638,11 +643,11 @@ public class CDataDiscoveredInfoCalculator {
/*
* utility method for creating empty IRcSettingInfo
*/
- public static IRcSettingInfo createEmptyRcSettingInfo(CFolderData data){
+ public static IRcSettingInfo createEmptyRcSettingInfo(CFolderData data) {
return createRcSettingInfo(data, PathInfo.EMPTY_INFO);
}
- public static IRcSettingInfo createRcSettingInfo(CFolderData data, PathInfo info){
+ public static IRcSettingInfo createRcSettingInfo(CFolderData data, PathInfo info) {
RcSettingInfo rcInfo = new RcSettingInfo(data);
CLanguageData[] lDatas = data.getLanguageDatas();
addLanguageInfos(rcInfo, lDatas, info);
@@ -652,38 +657,39 @@ public class CDataDiscoveredInfoCalculator {
/*
* utility method for creating empty IRcSettingInfo
*/
- public static IRcSettingInfo createEmptyRcSettingInfo(CFileData data){
+ public static IRcSettingInfo createEmptyRcSettingInfo(CFileData data) {
return createRcSettingInfo(data, PathInfo.EMPTY_INFO);
}
- public static IRcSettingInfo createRcSettingInfo(CFileData data, PathInfo info){
+ public static IRcSettingInfo createRcSettingInfo(CFileData data, PathInfo info) {
RcSettingInfo rcInfo = new RcSettingInfo(data);
CLanguageData lData = data.getLanguageData();
- if(lData != null)
- addLanguageInfos(rcInfo, new CLanguageData[]{lData}, info);
+ if (lData != null)
+ addLanguageInfos(rcInfo, new CLanguageData[] { lData }, info);
return rcInfo;
}
- private static void addLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas, PathInfo info){
+ private static void addLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas, PathInfo info) {
ArrayList<ILangSettingInfo> list = rcInfo.fLangInfoList;
- if(list == null){
+ if (list == null) {
list = new ArrayList<ILangSettingInfo>(lDatas.length);
rcInfo.fLangInfoList = list;
} else {
list.ensureCapacity(lDatas.length);
}
- for(int i = 0; i < lDatas.length; i++){
+ for (int i = 0; i < lDatas.length; i++) {
list.add(new LangSettingInfo(lDatas[i], info));
}
}
- private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){
-// IResource rc;
+ private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet,
+ PathFilePathInfo[] pfpis) {
+ // IResource rc;
PathInfo pInfo;
IPath projRelPath;
CResourceData rcData;
-// RcSetSettings dataSetting;
+ // RcSetSettings dataSetting;
List<RcSettingInfo> list = new ArrayList<RcSettingInfo>(pfpis.length);
RcSettingInfo rcInfo;
ILangSettingInfo lInfo;
@@ -691,15 +697,15 @@ public class CDataDiscoveredInfoCalculator {
ArrayList<ILangSettingInfo> tmpList;
PathFilePathInfo pfpi;
- for(int i = 0; i < pfpis.length; i++){
+ for (int i = 0; i < pfpis.length; i++) {
pfpi = pfpis[i];
projRelPath = pfpi.fPath;
pInfo = pfpi.fInfo;
- if(pInfo.isEmpty())
+ if (pInfo.isEmpty())
continue;
- if(projRelPath.segmentCount() == 0){
- CFolderData rootData = (CFolderData)rcSet.fRcData;
+ if (projRelPath.segmentCount() == 0) {
+ CFolderData rootData = (CFolderData) rcSet.fRcData;
CLanguageData lDatas[] = rootData.getLanguageDatas();
IPath[] incPaths = pInfo.getIncludePaths();
IPath[] quotedIncPaths = pInfo.getQuoteIncludePaths();
@@ -708,22 +714,22 @@ public class CDataDiscoveredInfoCalculator {
Map<String, String> symbolMap = pInfo.getSymbols();
int kinds = 0;
- if(incPaths.length != 0 || quotedIncPaths.length != 0)
+ if (incPaths.length != 0 || quotedIncPaths.length != 0)
kinds |= ICLanguageSettingEntry.INCLUDE_PATH;
- if(incFiles.length != 0)
+ if (incFiles.length != 0)
kinds |= ICLanguageSettingEntry.INCLUDE_FILE;
- if(macroFiles.length != 0)
+ if (macroFiles.length != 0)
kinds |= ICLanguageSettingEntry.MACRO_FILE;
- if(symbolMap.size() != 0)
+ if (symbolMap.size() != 0)
kinds |= ICLanguageSettingEntry.MACRO;
rcInfo = null;
- for(int k = 0; k < lDatas.length; k++){
+ for (int k = 0; k < lDatas.length; k++) {
lData = lDatas[k];
- if((lData.getSupportedEntryKinds() & kinds) == 0)
+ if ((lData.getSupportedEntryKinds() & kinds) == 0)
continue;
- if(rcInfo == null){
+ if (rcInfo == null) {
rcInfo = new RcSettingInfo(rootData);
tmpList = new ArrayList<ILangSettingInfo>(lDatas.length - k);
rcInfo.fLangInfoList = tmpList;
@@ -733,68 +739,69 @@ public class CDataDiscoveredInfoCalculator {
rcInfo.add(lInfo);
}
- if(rcInfo != null)
+ if (rcInfo != null)
list.add(rcInfo);
continue;
}
-// switch(rc.getType()){
-// case IResource.FILE:
-// projRelPath = rc.getProjectRelativePath();
-// dataSetting = rcSet.getChild(projRelPath, false);
-// rcData = dataSetting.fRcData;
- rcData = rcSet.getChild(projRelPath, false).fRcData;
- if(!rcData.getPath().equals(projRelPath)){
- if(rcData.getType() == ICSettingBase.SETTING_FOLDER){
- CFolderData foData = (CFolderData)rcData;
- lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData)rcData);
- try {
- rcData = createFileData(data, projRelPath, foData, lData);
- } catch (CoreException e) {
- rcData = null;
- MakeCorePlugin.log(e);
- }
- } else {
- try {
- rcData = createFileData(data, projRelPath, (CFileData)rcData);
- } catch (CoreException e) {
- rcData = null;
- MakeCorePlugin.log(e);
- }
+ // switch(rc.getType()){
+ // case IResource.FILE:
+ // projRelPath = rc.getProjectRelativePath();
+ // dataSetting = rcSet.getChild(projRelPath, false);
+ // rcData = dataSetting.fRcData;
+ rcData = rcSet.getChild(projRelPath, false).fRcData;
+ if (!rcData.getPath().equals(projRelPath)) {
+ if (rcData.getType() == ICSettingBase.SETTING_FOLDER) {
+ CFolderData foData = (CFolderData) rcData;
+ lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData) rcData);
+ try {
+ rcData = createFileData(data, projRelPath, foData, lData);
+ } catch (CoreException e) {
+ rcData = null;
+ MakeCorePlugin.log(e);
+ }
+ } else {
+ try {
+ rcData = createFileData(data, projRelPath, (CFileData) rcData);
+ } catch (CoreException e) {
+ rcData = null;
+ MakeCorePlugin.log(e);
}
-// if(rcData != null)
-// dataSetting = rcSet.createChild(projRelPath, rcData, false);
-// else
-// dataSetting = null;
}
+ // if(rcData != null)
+ // dataSetting = rcSet.createChild(projRelPath, rcData, false);
+ // else
+ // dataSetting = null;
+ }
- if(rcData != null){
- if(rcData.getType() == ICSettingBase.SETTING_FILE){
- lData = ((CFileData)rcData).getLanguageData();
- } else {
- lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData)rcData);
-
- }
+ if (rcData != null) {
+ if (rcData.getType() == ICSettingBase.SETTING_FILE) {
+ lData = ((CFileData) rcData).getLanguageData();
+ } else {
+ lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData) rcData);
- if(lData != null){
- rcInfo = new RcSettingInfo(rcData);
- lInfo = new LangSettingInfo(lData, pInfo);
- tmpList = new ArrayList<ILangSettingInfo>(1);
- tmpList.add(lInfo);
- rcInfo.fLangInfoList = tmpList;
- list.add(rcInfo);
- }
+ }
+ if (lData != null) {
+ rcInfo = new RcSettingInfo(rcData);
+ lInfo = new LangSettingInfo(lData, pInfo);
+ tmpList = new ArrayList<ILangSettingInfo>(1);
+ tmpList.add(lInfo);
+ rcInfo.fLangInfoList = tmpList;
+ list.add(rcInfo);
}
-// break;
-// }
+ }
+
+ // break;
+ // }
}
return list.toArray(new RcSettingInfo[list.size()]);
}
- public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){
- if(fileDataMode){
+ public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data,
+ IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode) {
+ if (fileDataMode) {
RcSetSettings rcSettings = createRcSetInfo(data);
PathFilePathInfo pInfos[] = createOrderedInfo(discoveredInfo.getPathInfoMap());
return mapFileDiscoveredInfo(project, data, rcSettings, pInfos);
@@ -803,7 +810,7 @@ public class CDataDiscoveredInfoCalculator {
return createInfos(data, settings);
}
- private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting){
+ private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting) {
RcSetSettings settings[] = rootSetting.getChildren(true);
RcSetSettings setting;
CResourceData rcData;
@@ -811,20 +818,20 @@ public class CDataDiscoveredInfoCalculator {
LangSettingInfo langInfo;
RcSettingInfo rcInfo;
PathInfo pathInfo;
- for(int i = 0; i < settings.length; i++){
+ for (int i = 0; i < settings.length; i++) {
setting = settings[i];
rcData = setting.fRcData;
- if(rcData == null)
+ if (rcData == null)
continue;
- if(setting.fIsDerived){
-// rcData = null;
+ if (setting.fIsDerived) {
+ // rcData = null;
try {
rcData = createFolderData(data, rcData, setting);
} catch (CoreException e) {
rcData = null;
MakeCorePlugin.log(e);
}
- if(rcData != null){
+ if (rcData != null) {
setting.updateRcData(rcData, false);
} else {
//TODO:
@@ -832,50 +839,51 @@ public class CDataDiscoveredInfoCalculator {
}
}
- if(rcData.getType() == ICSettingBase.SETTING_FILE){
+ if (rcData.getType() == ICSettingBase.SETTING_FILE) {
ExtsSetSettings extSetting = setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath()));
- if(extSetting != null){
+ if (extSetting != null) {
pathInfo = extSetting.fMaxMatchInfo;
- if(pathInfo != null){
+ if (pathInfo != null) {
langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo);
rcInfo = new RcSettingInfo(rcData);
- rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo> (1);
+ rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(1);
rcInfo.fLangInfoList.add(langInfo);
resultList.add(rcInfo);
}
}
} else {
- if(setting.fExtsSetToExtsSetSettingsMap.size() != 0 ){
+ if (setting.fExtsSetToExtsSetSettingsMap.size() != 0) {
rcInfo = new RcSettingInfo(rcData);
rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(setting.fExtsSetToExtsSetSettingsMap.size());
resultList.add(rcInfo);
Collection<ExtsSetSettings> extSettings = setting.fExtsSetToExtsSetSettingsMap.values();
for (ExtsSetSettings extSetting : extSettings) {
- if(extSetting.fMaxMatchInfo == null)
+ if (extSetting.fMaxMatchInfo == null)
continue;
- if(extSetting.fBaseLangData == null)
+ if (extSetting.fBaseLangData == null)
continue;
- if(extSetting.fIsDerived){
+ if (extSetting.fIsDerived) {
throw new IllegalStateException();
}
-
rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo));
- if(extSetting.isMultiple()){
- Set<Entry<PathInfo, List<PathFilePathInfo>>> entries = extSetting.fPathFilePathInfoMap.entrySet();
+ if (extSetting.isMultiple()) {
+ Set<Entry<PathInfo, List<PathFilePathInfo>>> entries = extSetting.fPathFilePathInfoMap
+ .entrySet();
for (Entry<PathInfo, List<PathFilePathInfo>> entry : entries) {
- if(entry.getKey().equals(extSetting.fMaxMatchInfo))
+ if (entry.getKey().equals(extSetting.fMaxMatchInfo))
continue;
List<PathFilePathInfo> piList = entry.getValue();
for (PathFilePathInfo pi : piList) {
try {
- CFileData fiData = createFileData(data, pi.fPath, (CFolderData)rcData, extSetting.fBaseLangData);
+ CFileData fiData = createFileData(data, pi.fPath, (CFolderData) rcData,
+ extSetting.fBaseLangData);
CLanguageData fiLangData = fiData.getLanguageData();
- if(fiLangData != null){
+ if (fiLangData != null) {
RcSettingInfo fiInfo = new RcSettingInfo(fiData);
fiInfo.add(new LangSettingInfo(fiLangData, pi.fInfo));
resultList.add(fiInfo);
@@ -890,57 +898,58 @@ public class CDataDiscoveredInfoCalculator {
}
}
}
-// }
+ // }
return resultList.toArray(new RcSettingInfo[resultList.size()]);
}
- private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{
- if(base.getType() == ICSettingBase.SETTING_FOLDER)
- return createFolderData(cfg, setting.getPath(), (CFolderData)base);
+ private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting)
+ throws CoreException {
+ if (base.getType() == ICSettingBase.SETTING_FOLDER)
+ return createFolderData(cfg, setting.getPath(), (CFolderData) base);
//should not be here
throw new IllegalStateException();
}
- private static void checkRemoveDups(RcSetSettings rcSet){
+ private static void checkRemoveDups(RcSetSettings rcSet) {
RcSetSettings settings[] = rcSet.getChildren(true);
RcSetSettings setting, parent;
- for(int i = 0; i < settings.length; i++){
+ for (int i = 0; i < settings.length; i++) {
setting = settings[i];
- if(!setting.fIsDerived)
+ if (!setting.fIsDerived)
continue;
parent = setting.getParent();
- if(parent == null)
+ if (parent == null)
continue;
- if(parent.containsEqualMaxMatches(setting, true))
+ if (parent.containsEqualMaxMatches(setting, true))
removeChildAddingChildSettings(parent, setting);
}
}
- private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child){
+ private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child) {
parent.internalAddSettingsMap(child.fExtsSetToExtsSetSettingsMap);
parent.removeChild(child);
}
- private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos){
+ private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos) {
PathFilePathInfo pInfo;
RcSetSettings child, parent;
String ext;
ExtsSetSettings extsSet;
-// boolean isDerived;
+ // boolean isDerived;
IPath dirPath;
- for(int i = 0; i < pInfos.length; i++){
+ for (int i = 0; i < pInfos.length; i++) {
pInfo = pInfos[i];
child = rcSet.getChild(pInfo.fPath);
- if(child == null) {
+ if (child == null) {
dirPath = pInfo.fPath.removeLastSegments(1);
child = rcSet.getChild(dirPath);
- if(child == null){
+ if (child == null) {
child = rcSet.createChild(dirPath, null, true);
- if(child.fExtToExtsSetMap == null){
+ if (child.fExtToExtsSetMap == null) {
parent = child.getParent();
child.fRcData = parent.fRcData;
child.internalSetSettingsMap(createEmptyExtSetMapCopy(parent.fExtsSetToExtsSetSettingsMap));
@@ -948,40 +957,40 @@ public class CDataDiscoveredInfoCalculator {
}
}
-// isDerived = child.fIsDerived;
+ // isDerived = child.fIsDerived;
- if(pInfo.fPath.segmentCount() == 0){
+ if (pInfo.fPath.segmentCount() == 0) {
processProjectPaths(child, pInfo);
} else {
ext = getFileExt(pInfo.fPath);
extsSet = child.fExtToExtsSetMap.get(ext);
- if(extsSet == null){
- extsSet = new ExtsSetSettings(null, new ExtsSet(new String[]{ext}), false);
+ if (extsSet == null) {
+ extsSet = new ExtsSetSettings(null, new ExtsSet(new String[] { ext }), false);
child.internalAdd(extsSet);
-// child.fExtToExtsSetMap.put(ext, extsSet);
+ // child.fExtToExtsSetMap.put(ext, extsSet);
}
extsSet.add(pInfo);
}
}
}
- private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){
+ private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi) {
Collection<ExtsSetSettings> settings = rcSet.fExtsSetToExtsSetSettingsMap.values();
for (ExtsSetSettings setting : settings) {
setting.add(pfpi);
}
}
- private static String getFileExt(IPath path){
+ private static String getFileExt(IPath path) {
String ext = path.getFileExtension();
- if(ext != null)
+ if (ext != null)
return ext;
return ""; //$NON-NLS-1$
}
- private static HashMap<ExtsSet, ExtsSetSettings> createEmptyExtSetMapCopy(HashMap<ExtsSet, ExtsSetSettings> base){
+ private static HashMap<ExtsSet, ExtsSetSettings> createEmptyExtSetMapCopy(HashMap<ExtsSet, ExtsSetSettings> base) {
@SuppressWarnings("unchecked")
- HashMap<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>)base.clone();
+ HashMap<ExtsSet, ExtsSetSettings> map = (HashMap<ExtsSet, ExtsSetSettings>) base.clone();
Set<Entry<ExtsSet, ExtsSetSettings>> entries = map.entrySet();
for (Entry<ExtsSet, ExtsSetSettings> entry : entries) {
ExtsSetSettings extsSet = entry.getValue();
@@ -991,55 +1000,55 @@ public class CDataDiscoveredInfoCalculator {
return map;
}
- private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data){
+ private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data) {
CLanguageData lData = data.getLanguageData();
- if(lData != null){
+ if (lData != null) {
String ext = getFileExt(path);
- return createExtsSetSettings(lData, new String[]{ext});
+ return createExtsSetSettings(lData, new String[] { ext });
}
return new ExtsSetSettings(null, new ExtsSet(EMPTY_STRING_ARRAY), false);
}
- private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]){
+ private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]) {
return new ExtsSetSettings(lData, new ExtsSet(exts), false);
}
- private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data){
+ private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data) {
CLanguageData[] lDatas = data.getLanguageDatas();
HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<ExtsSet, ExtsSetSettings>(lDatas.length);
ExtsSetSettings settings;
- if(lDatas.length != 0) {
+ if (lDatas.length != 0) {
CLanguageData lData;
- for( int i = 0; i < lDatas.length; i++){
+ for (int i = 0; i < lDatas.length; i++) {
lData = lDatas[i];
- settings = createExtsSetSettings(lData, lData.getSourceExtensions());
- map.put(settings.fExtsSet, settings);
+ settings = createExtsSetSettings(lData, lData.getSourceExtensions());
+ map.put(settings.fExtsSet, settings);
}
}
return map;
}
- private static PathFilePathInfo[] createOrderedInfo(Map<IResource, PathInfo> map){
+ private static PathFilePathInfo[] createOrderedInfo(Map<IResource, PathInfo> map) {
ListIndexStore store = new ListIndexStore(10);
HashMap<PathInfo, PathInfo> infoMap = new HashMap<PathInfo, PathInfo>();
-// LinkedHashMap result;
+ // LinkedHashMap result;
Set<Entry<IResource, PathInfo>> entries = map.entrySet();
for (Entry<IResource, PathInfo> entry : entries) {
IResource rc = entry.getKey();
IPath path = rc.getProjectRelativePath();
int segCount = path.segmentCount();
-// if(segCount < 1)
-// continue;
+ // if(segCount < 1)
+ // continue;
-// path = path.removeFirstSegments(1);
-// segCount--;
+ // path = path.removeFirstSegments(1);
+ // segCount--;
PathInfo info = entry.getValue();
PathInfo storedInfo = infoMap.get(info);
- if(storedInfo == null){
+ if (storedInfo == null) {
storedInfo = info;
infoMap.put(storedInfo, storedInfo);
}
@@ -1048,23 +1057,23 @@ public class CDataDiscoveredInfoCalculator {
}
List<PathFilePathInfo> lists[] = store.getLists();
-// result = new LinkedHashMap(map.size());
-// List l;
-// int lSize;
-// PathFilePathInfo pfpi;
-// for(int i = 0; i < lists.length; i++){
-// l = lists[i];
-// lSize = l.size();
-// if(lSize != 0){
-// for(int k = 0; k < lSize; k++){
-// pfpi = (PathFilePathInfo)l.get(k);
-// result.put(pfpi.fPath, pfpi.fInfo);
-// }
-// }
-// }
+ // result = new LinkedHashMap(map.size());
+ // List l;
+ // int lSize;
+ // PathFilePathInfo pfpi;
+ // for(int i = 0; i < lists.length; i++){
+ // l = lists[i];
+ // lSize = l.size();
+ // if(lSize != 0){
+ // for(int k = 0; k < lSize; k++){
+ // pfpi = (PathFilePathInfo)l.get(k);
+ // result.put(pfpi.fPath, pfpi.fInfo);
+ // }
+ // }
+ // }
int size = 0;
PathFilePathInfo infos[];
- for(int i = 0; i < lists.length; i++){
+ for (int i = 0; i < lists.length; i++) {
size += lists[i].size();
}
@@ -1072,10 +1081,10 @@ public class CDataDiscoveredInfoCalculator {
int num = 0;
int listSize;
List<PathFilePathInfo> list;
- for(int i = 0; i < lists.length; i++){
+ for (int i = 0; i < lists.length; i++) {
list = lists[i];
listSize = list.size();
- for(int k = 0; k < listSize; k++){
+ for (int k = 0; k < listSize; k++) {
infos[num++] = list.get(k);
}
}
@@ -1083,20 +1092,21 @@ public class CDataDiscoveredInfoCalculator {
return infos;
}
- public static CDataDiscoveredInfoCalculator getDefault(){
- if(fInstance == null)
+ public static CDataDiscoveredInfoCalculator getDefault() {
+ if (fInstance == null)
fInstance = new CDataDiscoveredInfoCalculator();
return fInstance;
}
- public DiscoveredSettingInfo getSettingInfos(IProject project,
- CConfigurationData cfgData){
+ public DiscoveredSettingInfo getSettingInfos(IProject project, CConfigurationData cfgData) {
InfoContext context = createContext(project, cfgData);
try {
- IDiscoveredPathManager.IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
- if(info instanceof IDiscoveredPathManager.IPerFileDiscoveredPathInfo2){
- IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 perFileInfo = (IDiscoveredPathManager.IPerFileDiscoveredPathInfo2)info;
- DiscoveredSettingInfo dsInfo = new DiscoveredSettingInfo(true, getSettingInfos(project, cfgData, perFileInfo, true));
+ IDiscoveredPathManager.IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager()
+ .getDiscoveredInfo(project, context);
+ if (info instanceof IDiscoveredPathManager.IPerFileDiscoveredPathInfo2) {
+ IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 perFileInfo = (IDiscoveredPathManager.IPerFileDiscoveredPathInfo2) info;
+ DiscoveredSettingInfo dsInfo = new DiscoveredSettingInfo(true,
+ getSettingInfos(project, cfgData, perFileInfo, true));
return dsInfo;
}
IPath[] includes = info.getIncludePaths();
@@ -1105,18 +1115,18 @@ public class CDataDiscoveredInfoCalculator {
PathInfo pathInfo = new PathInfo(includes, null, symbols, null, null);
CFolderData rootData = cfgData.getRootFolderData();
IRcSettingInfo rcInfo = createRcSettingInfo(rootData, pathInfo);
- return new DiscoveredSettingInfo(false, new IRcSettingInfo[]{rcInfo});
+ return new DiscoveredSettingInfo(false, new IRcSettingInfo[] { rcInfo });
} catch (CoreException e) {
MakeCorePlugin.log(e);
}
return new DiscoveredSettingInfo(false, new IRcSettingInfo[0]);
}
- protected InfoContext createContext(IProject project, CConfigurationData data){
+ protected InfoContext createContext(IProject project, CConfigurationData data) {
return new InfoContext(project, idForData(data));
}
- protected String idForData(CDataObject data){
+ protected String idForData(CDataObject data) {
return data.getId();
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoProcessor.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoProcessor.java
index 1965cfbf58e..a3ab5b5cf0d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoProcessor.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoProcessor.java
@@ -35,106 +35,102 @@ import org.eclipse.core.runtime.Path;
public abstract class CDataDiscoveredInfoProcessor {
- public void applyDiscoveredInfo(CConfigurationData cfgData, DiscoveredSettingInfo dsIinfo){
+ public void applyDiscoveredInfo(CConfigurationData cfgData, DiscoveredSettingInfo dsIinfo) {
Map<IPath, CResourceData> map = CDataUtil.createPathRcDataMap(cfgData);
IRcSettingInfo info;
PathSettingsContainer cr = PathSettingsContainer.createRootContainer();
-
+
IRcSettingInfo[] infos = dsIinfo.getRcSettingInfos();
-
- for(int i = 0; i < infos.length; i++){
+
+ for (int i = 0; i < infos.length; i++) {
info = infos[i];
applyInfo(cfgData, info, cr);
map.remove(info.getResourceData().getPath());
}
-
- if(map.size() != 0){
+
+ if (map.size() != 0) {
CResourceData rcData = map.get(Path.EMPTY);
- if(rcData != null){
- info = CDataDiscoveredInfoCalculator.createEmptyRcSettingInfo((CFolderData)rcData);
+ if (rcData != null) {
+ info = CDataDiscoveredInfoCalculator.createEmptyRcSettingInfo((CFolderData) rcData);
applyInfo(cfgData, info, cr);
map.remove(Path.EMPTY);
}
-
- if(map.size() != 0){
+
+ if (map.size() != 0) {
Set<Entry<IPath, CResourceData>> entries = map.entrySet();
for (Entry<IPath, CResourceData> entry : entries) {
IPath path = entry.getKey();
PathSettingsContainer curCr = cr.getChildContainer(path, false, false);
rcData = entry.getValue();
- info = (IRcSettingInfo)curCr.getValue();
+ info = (IRcSettingInfo) curCr.getValue();
applyInfo(cfgData, rcData, info);
}
}
}
}
- protected void applyInfo(CConfigurationData cfgData, CResourceData rcData, IRcSettingInfo info){
+ protected void applyInfo(CConfigurationData cfgData, CResourceData rcData, IRcSettingInfo info) {
CLanguageData[] lDatas = getLangDatas(rcData);
ILangSettingInfo lInfo;
ILangSettingInfo lInfos[] = info.getLangInfos();
CLanguageData lData;
- for(int k = 0; k < lDatas.length; k++){
+ for (int k = 0; k < lDatas.length; k++) {
lData = lDatas[k];
lInfo = getMatch(lData, lInfos);
- if(lInfo != null){
- setInfoForData(cfgData,
- rcData,
- lData,
- lInfo.getFilePathInfo(),
- info.getResourceData(),
+ if (lInfo != null) {
+ setInfoForData(cfgData, rcData, lData, lInfo.getFilePathInfo(), info.getResourceData(),
lInfo.getLanguageData());
} else {
setInfoForData(cfgData, rcData, lData, null, null, null);
}
}
}
-
- protected CLanguageData[] getLangDatas(CResourceData rcData){
- if(rcData.getType() == ICSettingBase.SETTING_FILE){
- CLanguageData lData = ((CFileData)rcData).getLanguageData();
- if(lData != null)
- return new CLanguageData[]{lData};
+
+ protected CLanguageData[] getLangDatas(CResourceData rcData) {
+ if (rcData.getType() == ICSettingBase.SETTING_FILE) {
+ CLanguageData lData = ((CFileData) rcData).getLanguageData();
+ if (lData != null)
+ return new CLanguageData[] { lData };
return new CLanguageData[0];
}
- return ((CFolderData)rcData).getLanguageDatas();
+ return ((CFolderData) rcData).getLanguageDatas();
}
- protected ILangSettingInfo getMatch(CLanguageData lData, ILangSettingInfo lInfos[]){
+ protected ILangSettingInfo getMatch(CLanguageData lData, ILangSettingInfo lInfos[]) {
ILangSettingInfo lInfo;
- for(int i = 0; i < lInfos.length; i++){
+ for (int i = 0; i < lInfos.length; i++) {
lInfo = lInfos[i];
- if(langDatasMatch(lData, lInfo.getLanguageData()))
+ if (langDatasMatch(lData, lInfo.getLanguageData()))
return lInfo;
}
return null;
}
- protected CLanguageData getMatch(CLanguageData lData, CLanguageData[] datas){
- for(int i = 0; i < datas.length; i++){
- if(langDatasMatch(lData, datas[i]))
+ protected CLanguageData getMatch(CLanguageData lData, CLanguageData[] datas) {
+ for (int i = 0; i < datas.length; i++) {
+ if (langDatasMatch(lData, datas[i]))
return datas[i];
}
return null;
}
- protected boolean langDatasMatch(CLanguageData lData1, CLanguageData lData2){
- if(!CDataUtil.objectsEqual(lData1.getLanguageId(), lData2.getLanguageId()))
+ protected boolean langDatasMatch(CLanguageData lData1, CLanguageData lData2) {
+ if (!CDataUtil.objectsEqual(lData1.getLanguageId(), lData2.getLanguageId()))
return false;
-
+
String[] tmp = lData1.getSourceContentTypeIds();
- if(tmp != null && tmp.length != 0){
- if(!Arrays.equals(tmp, lData2.getSourceContentTypeIds()))
+ if (tmp != null && tmp.length != 0) {
+ if (!Arrays.equals(tmp, lData2.getSourceContentTypeIds()))
return false;
} else {
- if(!Arrays.equals(lData1.getSourceExtensions(), lData2.getSourceExtensions()))
+ if (!Arrays.equals(lData1.getSourceExtensions(), lData2.getSourceExtensions()))
return false;
}
return true;
}
- protected void applyInfo(CConfigurationData cfgData, IRcSettingInfo info, PathSettingsContainer cr){
+ protected void applyInfo(CConfigurationData cfgData, IRcSettingInfo info, PathSettingsContainer cr) {
CResourceData rcData;
CLanguageData lData;
ILangSettingInfo lInfo;
@@ -143,18 +139,14 @@ public abstract class CDataDiscoveredInfoProcessor {
PathSettingsContainer curCr = cr.getChildContainer(path, true, true);
curCr.setValue(info);
ILangSettingInfo lInfos[] = info.getLangInfos();
- for(int k = 0; k < lInfos.length; k++){
+ for (int k = 0; k < lInfos.length; k++) {
lInfo = lInfos[k];
lData = lInfo.getLanguageData();
setInfoForData(cfgData, rcData, lData, lInfo.getFilePathInfo(), null, null);
}
}
-
- protected abstract void setInfoForData(CConfigurationData cfgData,
- CResourceData rcData,
- CLanguageData lData,
- PathInfo pi,
- CResourceData baseRcData,
- CLanguageData baseLangData);
-
+
+ protected abstract void setInfoForData(CConfigurationData cfgData, CResourceData rcData, CLanguageData lData,
+ PathInfo pi, CResourceData baseRcData, CLanguageData baseLangData);
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
index b52ffe110ea..4fccc0ade94 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
@@ -31,64 +31,63 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class DiscoveredPathContainer implements IPathEntryContainer {
- public static final IPath CONTAINER_ID = new Path("org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"); //$NON-NLS-1$
+ public static final IPath CONTAINER_ID = new Path("org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"); //$NON-NLS-1$
- protected final IProject fProject;
- private IPathEntry[] fPathEntries;
+ protected final IProject fProject;
+ private IPathEntry[] fPathEntries;
- public DiscoveredPathContainer(IProject project) {
- fProject = project;
- fPathEntries = null;
- }
+ public DiscoveredPathContainer(IProject project) {
+ fProject = project;
+ fPathEntries = null;
+ }
-// public IPathEntry[] getPathEntries() {
-// IPathEntry[] fPathEntries;
-// try {
-// fPathEntries = getPathEntries(getPathEntryMap());
-// } catch (CoreException e) {
-// MakeCorePlugin.log(e);
-// return new IPathEntry[0];
-// }
-// return fPathEntries;
-// }
+ // public IPathEntry[] getPathEntries() {
+ // IPathEntry[] fPathEntries;
+ // try {
+ // fPathEntries = getPathEntries(getPathEntryMap());
+ // } catch (CoreException e) {
+ // MakeCorePlugin.log(e);
+ // return new IPathEntry[0];
+ // }
+ // return fPathEntries;
+ // }
- @Override
+ @Override
public String getDescription() {
- return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$
- }
+ return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public IPath getPath() {
- return CONTAINER_ID;
- }
+ return CONTAINER_ID;
+ }
- @Override
+ @Override
public IPathEntry[] getPathEntries() {
- if (fPathEntries == null) {
- try {
- fPathEntries = computeNewPathEntries();
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- return new IPathEntry[0];
- }
- }
- return fPathEntries;
- }
+ if (fPathEntries == null) {
+ try {
+ fPathEntries = computeNewPathEntries();
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ return new IPathEntry[0];
+ }
+ }
+ return fPathEntries;
+ }
- private IPathEntry[] computeNewPathEntries() throws CoreException {
- IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
- IPath[] includes = info.getIncludePaths();
- Map<String, String> syms = info.getSymbols();
- List<IPathEntry> entries = new ArrayList<IPathEntry>(includes.length + syms.size());
- for (IPath inc : includes) {
- entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, inc, true));
- }
- Set<Entry<String, String>> entrySet = syms.entrySet();
- for (Entry<String, String> entry : entrySet) {
- entries.add(CoreModel.newMacroEntry(Path.EMPTY, entry.getKey(), entry.getValue()));
- }
- return entries.toArray(new IPathEntry[entries.size()]);
- }
+ private IPathEntry[] computeNewPathEntries() throws CoreException {
+ IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
+ IPath[] includes = info.getIncludePaths();
+ Map<String, String> syms = info.getSymbols();
+ List<IPathEntry> entries = new ArrayList<IPathEntry>(includes.length + syms.size());
+ for (IPath inc : includes) {
+ entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, inc, true));
+ }
+ Set<Entry<String, String>> entrySet = syms.entrySet();
+ for (Entry<String, String> entry : entrySet) {
+ entries.add(CoreModel.newMacroEntry(Path.EMPTY, entry.getKey(), entry.getValue()));
+ }
+ return entries.toArray(new IPathEntry[entries.size()]);
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
index 961174379a4..308a6564a3c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
@@ -33,7 +33,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDiscoveredScannerInfoSerializable {
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
public static final String PATH = "path"; //$NON-NLS-1$
@@ -70,7 +69,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
@Override
public synchronized IPath[] getIncludePaths() {
- if ( activePaths == null) {
+ if (activePaths == null) {
createPathLists();
}
return activePaths.toArray(new IPath[activePaths.size()]);
@@ -161,8 +160,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
Set<String> symbolsSet = symbols.keySet();
for (String symbol : symbolsSet) {
SymbolEntry se = symbols.get(symbol);
- if (se != null)
- {
+ if (se != null) {
List<String> activeValues = se.getActiveRaw();
for (String value : activeValues) {
Element symbolElement = doc.createElement(DEFINED_SYMBOL);
@@ -192,11 +190,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
while (child != null) {
if (child.getNodeName().equals(INCLUDE_PATH)) {
// Add the path to the property list
- includes.put( SafeStringInterner.safeIntern(((Element)child).getAttribute(PATH)), Boolean.valueOf( ((Element)child).getAttribute(REMOVED)));
+ includes.put(SafeStringInterner.safeIntern(((Element) child).getAttribute(PATH)),
+ Boolean.valueOf(((Element) child).getAttribute(REMOVED)));
} else if (child.getNodeName().equals(DEFINED_SYMBOL)) {
// Add the symbol to the symbol list
- String symbol = SafeStringInterner.safeIntern(((Element)child).getAttribute(SYMBOL));
- String removed = ((Element)child).getAttribute(REMOVED);
+ String symbol = SafeStringInterner.safeIntern(((Element) child).getAttribute(SYMBOL));
+ String removed = ((Element) child).getAttribute(REMOVED);
boolean bRemoved = (removed != null && removed.equals("true")); //$NON-NLS-1$
ScannerConfigUtil.scAddSymbolString2SymbolEntryMap(symbols, symbol, !bRemoved);
}
@@ -215,12 +214,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
return PerProjectSICollector.COLLECTOR_ID;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
+ */
+ @Override
public IDiscoveredScannerInfoSerializable getSerializable() {
- return this;
- }
+ return this;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
index d86428fbc1e..7504b298376 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
@@ -27,29 +27,27 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
public class DiscoveredPathInitializer extends PathEntryContainerInitializer {
@Override
public void initialize(IPath containerPath, ICProject cProject) throws CoreException {
- IProject project = cProject.getProject();
- IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
- String selectedProfileId = buildInfo.getSelectedProfileId();
- if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfileId))
- return;
-
- ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(selectedProfileId).getProfileScope();
- if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
- CoreModel.setPathEntryContainer(new ICProject[]{cProject}, new DiscoveredPathContainer(project), null);
- }
- else if (ScannerConfigScope.FILE_SCOPE.equals(profileScope)) {
- CoreModel.setPathEntryContainer(new ICProject[]{cProject}, new PerFileDiscoveredPathContainer(project), null);
- }
- else {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
- MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
- }
+ IProject project = cProject.getProject();
+ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+ String selectedProfileId = buildInfo.getSelectedProfileId();
+ if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfileId))
+ return;
+
+ ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(selectedProfileId).getProfileScope();
+ if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
+ CoreModel.setPathEntryContainer(new ICProject[] { cProject }, new DiscoveredPathContainer(project), null);
+ } else if (ScannerConfigScope.FILE_SCOPE.equals(profileScope)) {
+ CoreModel.setPathEntryContainer(new ICProject[] { cProject }, new PerFileDiscoveredPathContainer(project),
+ null);
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
+ MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
+ }
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
index f52b35361a9..61800a1a04c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
@@ -53,47 +53,48 @@ import org.eclipse.core.runtime.Status;
public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceChangeListener {
private Map<IProject, DiscoveredInfoHolder> fDiscoveredInfoHolderMap = new HashMap<IProject, DiscoveredInfoHolder>();
- private List<IDiscoveredInfoListener> listeners = Collections.synchronizedList(new ArrayList<IDiscoveredInfoListener>());
+ private List<IDiscoveredInfoListener> listeners = Collections
+ .synchronizedList(new ArrayList<IDiscoveredInfoListener>());
private static final int INFO_CHANGED = 1;
private static final int INFO_REMOVED = 2;
private static class DiscoveredInfoHolder {
Map<InfoContext, IDiscoveredPathInfo> fInfoMap = new HashMap<InfoContext, IDiscoveredPathInfo>();
-// PathSettingsContainer fContainer = PathSettingsContainer.createRootContainer();
+ // PathSettingsContainer fContainer = PathSettingsContainer.createRootContainer();
- public IDiscoveredPathInfo getInfo(InfoContext context){
+ public IDiscoveredPathInfo getInfo(InfoContext context) {
return fInfoMap.get(context);
}
-// private Map getMap(IPath path, boolean create, boolean exactPath){
-// PathSettingsContainer child = fContainer.getChildContainer(path, create, exactPath);
-// Map map = null;
-// if(child != null){
-// map = (Map)child.getValue();
-// if(map == null && create){
-// map = new HashMap();
-// child.setValue(map);
-// }
-// }
-//
-// return map;
-// }
-
-// public IDiscoveredPathInfo getInfo(IFile file, String instanceId){
-// IPath path = file.getProjectRelativePath();
-// Map map = getMap(path, false, false);
-// for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
-// Map.Entry entry = (Map.Entry)iter.next();
-// InfoContext context = (InfoContext)entry.getKey();
-// if(context.matches(file))
-// return (IDiscoveredPathInfo)entry.getValue();
-// }
-// return null;
-// }
-
- public IDiscoveredPathInfo setInfo(InfoContext context, IDiscoveredPathInfo info){
- if(info != null)
+ // private Map getMap(IPath path, boolean create, boolean exactPath){
+ // PathSettingsContainer child = fContainer.getChildContainer(path, create, exactPath);
+ // Map map = null;
+ // if(child != null){
+ // map = (Map)child.getValue();
+ // if(map == null && create){
+ // map = new HashMap();
+ // child.setValue(map);
+ // }
+ // }
+ //
+ // return map;
+ // }
+
+ // public IDiscoveredPathInfo getInfo(IFile file, String instanceId){
+ // IPath path = file.getProjectRelativePath();
+ // Map map = getMap(path, false, false);
+ // for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
+ // Map.Entry entry = (Map.Entry)iter.next();
+ // InfoContext context = (InfoContext)entry.getKey();
+ // if(context.matches(file))
+ // return (IDiscoveredPathInfo)entry.getValue();
+ // }
+ // return null;
+ // }
+
+ public IDiscoveredPathInfo setInfo(InfoContext context, IDiscoveredPathInfo info) {
+ if (info != null)
return fInfoMap.put(context, info);
return fInfoMap.remove(context);
}
@@ -121,39 +122,38 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
IResource resource = event.getResource();
switch (event.getType()) {
- case IResourceChangeEvent.POST_CHANGE :
- DiscoveredScannerInfoStore.getInstance().updateScannerConfigStore(event.getDelta());
- break;
- case IResourceChangeEvent.PRE_DELETE :
- case IResourceChangeEvent.PRE_CLOSE :
- if (resource.getType() == IResource.PROJECT) {
- //TODO: better handlind of resource remove/rename
- fDiscoveredInfoHolderMap.remove(resource);
- ScannerConfigProfileManager.getInstance().handleProjectRemoved(resource.getProject());
- }
- break;
+ case IResourceChangeEvent.POST_CHANGE:
+ DiscoveredScannerInfoStore.getInstance().updateScannerConfigStore(event.getDelta());
+ break;
+ case IResourceChangeEvent.PRE_DELETE:
+ case IResourceChangeEvent.PRE_CLOSE:
+ if (resource.getType() == IResource.PROJECT) {
+ //TODO: better handlind of resource remove/rename
+ fDiscoveredInfoHolderMap.remove(resource);
+ ScannerConfigProfileManager.getInstance().handleProjectRemoved(resource.getProject());
+ }
+ break;
}
}
}
-
-
@Override
public IDiscoveredPathInfo getDiscoveredInfo(IProject project) throws CoreException {
return getDiscoveredInfo(project, new InfoContext(project));
}
@Override
- public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context) throws CoreException{
+ public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context) throws CoreException {
return getDiscoveredInfo(project, context, true);
}
@Override
- public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException{
+ public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context,
+ boolean defaultToProjectSettings) throws CoreException {
DiscoveredInfoHolder holder = getHolder(project, true);
IDiscoveredPathInfo info = holder.getInfo(context);
- if(info == null){
+ if (info == null) {
info = loadPathInfo(project, context, defaultToProjectSettings);
holder.setInfo(context, info);
}
@@ -161,63 +161,61 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
return info;
}
- private DiscoveredInfoHolder getHolder(IProject project, boolean create){
+ private DiscoveredInfoHolder getHolder(IProject project, boolean create) {
DiscoveredInfoHolder holder = fDiscoveredInfoHolderMap.get(project);
- if(holder == null && create){
+ if (holder == null && create) {
holder = new DiscoveredInfoHolder();
fDiscoveredInfoHolderMap.put(project, holder);
}
return holder;
}
- private IDiscoveredPathInfo loadPathInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException {
- IDiscoveredPathInfo pathInfo = null;
-
- IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
- IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context);
- if(buildInfo == null && defaultToProjectSettings)
- buildInfo = container.getInfo(new InfoContext(project));
-
- if(buildInfo != null){
- String profileId = buildInfo.getSelectedProfileId();
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, context, profileId);
- IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
-
- if (collector instanceof IScannerInfoCollector2) {
- IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
- pathInfo = collector2.createPathInfoObject();
- }
- }
- if(pathInfo == null) {
- pathInfo = new DiscoveredPathInfo(project);
- }
- return pathInfo;
- }
-
+ private IDiscoveredPathInfo loadPathInfo(IProject project, InfoContext context, boolean defaultToProjectSettings)
+ throws CoreException {
+ IDiscoveredPathInfo pathInfo = null;
+ IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
+ IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context);
+ if (buildInfo == null && defaultToProjectSettings)
+ buildInfo = container.getInfo(new InfoContext(project));
+ if (buildInfo != null) {
+ String profileId = buildInfo.getSelectedProfileId();
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ context, profileId);
+ IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
-// private DiscoveredInfoHolder getHolder
+ if (collector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
+ pathInfo = collector2.createPathInfoObject();
+ }
+ }
+ if (pathInfo == null) {
+ pathInfo = new DiscoveredPathInfo(project);
+ }
+ return pathInfo;
+ }
-// private IDiscoveredPathInfo loadPathInfo(IProject project) throws CoreException {
-// IDiscoveredPathInfo pathInfo = null;
-//
-// IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
-// String profileId = buildInfo.getSelectedProfileId();
-// SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
-// getSCProfileInstance(project, profileId);
-// IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
-//
-// if (collector instanceof IScannerInfoCollector2) {
-// IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
-// pathInfo = collector2.createPathInfoObject();
-// }
-// else {
-// pathInfo = new DiscoveredPathInfo(project);
-// }
-// return pathInfo;
-// }
+ // private DiscoveredInfoHolder getHolder
+
+ // private IDiscoveredPathInfo loadPathInfo(IProject project) throws CoreException {
+ // IDiscoveredPathInfo pathInfo = null;
+ //
+ // IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+ // String profileId = buildInfo.getSelectedProfileId();
+ // SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
+ // getSCProfileInstance(project, profileId);
+ // IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+ //
+ // if (collector instanceof IScannerInfoCollector2) {
+ // IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
+ // pathInfo = collector2.createPathInfoObject();
+ // }
+ // else {
+ // pathInfo = new DiscoveredPathInfo(project);
+ // }
+ // return pathInfo;
+ // }
@Override
public void removeDiscoveredInfo(IProject project) {
@@ -227,7 +225,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
@Override
public void removeDiscoveredInfo(IProject project, InfoContext context) {
DiscoveredInfoHolder holder = getHolder(project, false);
- if(holder != null){
+ if (holder != null) {
IDiscoveredPathInfo info = holder.setInfo(context, null);
if (info != null) {
fireUpdate(INFO_REMOVED, info);
@@ -235,144 +233,145 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
+ */
+ @Override
public void updateDiscoveredInfo(IDiscoveredPathInfo info, List<IResource> changedResources) throws CoreException {
- updateDiscoveredInfo(new InfoContext(info.getProject()), info, true, changedResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
- */
- @Override
- public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources) throws CoreException {
- DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
- IDiscoveredPathInfo oldInfo = holder.getInfo(context);
+ updateDiscoveredInfo(new InfoContext(info.getProject()), info, true, changedResources);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
+ */
+ @Override
+ public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer,
+ List<IResource> changedResources) throws CoreException {
+ DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
+ IDiscoveredPathInfo oldInfo = holder.getInfo(context);
if (oldInfo != null) {
- IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
+ IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
if (serializable != null) {
holder.setInfo(context, info);
- IProject project = info.getProject();
- DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
+ IProject project = info.getProject();
+ DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context,
+ serializable);
fireUpdate(INFO_CHANGED, info);
- if(updateContainer){
+ if (updateContainer) {
- IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
- String profileId = buildInfo.getSelectedProfileId();
- ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId).getProfileScope();
- changeDiscoveredContainer(project, profileScope, changedResources);
+ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager
+ .createScannerConfigBuildInfo2(project);
+ String profileId = buildInfo.getSelectedProfileId();
+ ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId).getProfileScope();
+ changeDiscoveredContainer(project, profileScope, changedResources);
}
- }
- else {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
}
}
}
- /**
- * Allows one to update the discovered information for a particular scanner discovery profile ID.
- * TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from.
- *
- * @param context
- * @param info
- * @param updateContainer
- * @param changedResources
- * @param profileId
- * @throws CoreException
- */
- public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources, String profileId) throws CoreException {
- DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
- IDiscoveredPathInfo oldInfo = holder.getInfo(context);
+ /**
+ * Allows one to update the discovered information for a particular scanner discovery profile ID.
+ * TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from.
+ *
+ * @param context
+ * @param info
+ * @param updateContainer
+ * @param changedResources
+ * @param profileId
+ * @throws CoreException
+ */
+ public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer,
+ List<IResource> changedResources, String profileId) throws CoreException {
+ DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
+ IDiscoveredPathInfo oldInfo = holder.getInfo(context);
if (oldInfo != null) {
- IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
+ IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
if (serializable != null) {
holder.setInfo(context, info);
- IProject project = info.getProject();
- DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
+ IProject project = info.getProject();
+ DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context,
+ serializable);
fireUpdate(INFO_CHANGED, info);
- if(updateContainer){
+ if (updateContainer) {
- IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager
+ .createScannerConfigBuildInfo2(project);
- ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId).getProfileScope();
- changeDiscoveredContainer(project, profileScope, changedResources);
+ ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId).getProfileScope();
+ changeDiscoveredContainer(project, profileScope, changedResources);
}
- }
- else {
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
- */
- @Override
- public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List<IResource> changedResources) {
- // order here is of essence
- // 1. clear DiscoveredPathManager's path info cache
- DiscoveredInfoHolder holder = getHolder(project, false);
- InfoContext context = new InfoContext(project);
- IDiscoveredPathInfo oldInfo = holder.getInfo(context);
-
- // 2. switch the containers
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
+ */
+ @Override
+ public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope,
+ final List<IResource> changedResources) {
+ // order here is of essence
+ // 1. clear DiscoveredPathManager's path info cache
+ DiscoveredInfoHolder holder = getHolder(project, false);
+ InfoContext context = new InfoContext(project);
+ IDiscoveredPathInfo oldInfo = holder.getInfo(context);
+
+ // 2. switch the containers
+ try {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- ICProject cProject = CoreModel.getDefault().create(project);
- if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
- CoreModel.setPathEntryContainer(new ICProject[]{cProject},
- new DiscoveredPathContainer(project), null);
- }
- else if (ScannerConfigScope.FILE_SCOPE.equals(profileScope)) {
- PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project);
- CoreModel.setPathEntryContainer(new ICProject[]{cProject},
- container, null);
- if (changedResources != null) {
- List<PathEntryContainerChanged> changeDelta = new ArrayList<PathEntryContainerChanged>(changedResources.size());
- for (IResource resource : changedResources) {
- IPath path = resource.getFullPath();
- changeDelta.add(new PathEntryContainerChanged(path,
- PathEntryContainerChanged.INCLUDE_CHANGED |
- PathEntryContainerChanged.MACRO_CHANGED)); // both include paths and symbols changed
- }
- CoreModel.pathEntryContainerUpdates(container,
- changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]),
- null);
- }
- }
- else {
- MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
- MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
- }
-
- }
- };
- CoreModel.run(runnable, null);
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
-
- // 3. clear the container's path entry cache
- if (oldInfo != null) {
- fireUpdate(INFO_REMOVED, oldInfo);
- }
- }
+ ICProject cProject = CoreModel.getDefault().create(project);
+ if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
+ CoreModel.setPathEntryContainer(new ICProject[] { cProject },
+ new DiscoveredPathContainer(project), null);
+ } else if (ScannerConfigScope.FILE_SCOPE.equals(profileScope)) {
+ PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project);
+ CoreModel.setPathEntryContainer(new ICProject[] { cProject }, container, null);
+ if (changedResources != null) {
+ List<PathEntryContainerChanged> changeDelta = new ArrayList<PathEntryContainerChanged>(
+ changedResources.size());
+ for (IResource resource : changedResources) {
+ IPath path = resource.getFullPath();
+ changeDelta.add(
+ new PathEntryContainerChanged(path, PathEntryContainerChanged.INCLUDE_CHANGED
+ | PathEntryContainerChanged.MACRO_CHANGED)); // both include paths and symbols changed
+ }
+ CoreModel.pathEntryContainerUpdates(container,
+ changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]), null);
+ }
+ } else {
+ MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
+ MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
+ }
+
+ }
+ };
+ CoreModel.run(runnable, null);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+
+ // 3. clear the container's path entry cache
+ if (oldInfo != null) {
+ fireUpdate(INFO_REMOVED, oldInfo);
+ }
+ }
private void fireUpdate(final int type, final IDiscoveredPathInfo info) {
Object[] list = listeners.toArray();
for (int i = 0; i < list.length; i++) {
- final IDiscoveredInfoListener listener = (IDiscoveredInfoListener)list[i];
+ final IDiscoveredInfoListener listener = (IDiscoveredInfoListener) list[i];
if (listener != null) {
SafeRunner.run(new ISafeRunnable() {
@@ -386,12 +385,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
@Override
public void run() throws Exception {
switch (type) {
- case INFO_CHANGED :
- listener.infoChanged(info);
- break;
- case INFO_REMOVED :
- listener.infoRemoved(info);
- break;
+ case INFO_CHANGED:
+ listener.infoChanged(info);
+ break;
+ case INFO_REMOVED:
+ listener.infoRemoved(info);
+ break;
}
}
});
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java
index 6ee238732d7..f8a2707ccce 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java
@@ -61,15 +61,15 @@ import org.xml.sax.SAXException;
* @author vhirsl
*/
public final class DiscoveredScannerInfoStore {
- private static final QualifiedName dscFileNameProperty = new
- QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "discoveredScannerConfigFileName"); //$NON-NLS-1$
+ private static final QualifiedName dscFileNameProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(),
+ "discoveredScannerConfigFileName"); //$NON-NLS-1$
private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".discoveredScannerInfo"; //$NON-NLS-1$
- public static final String SCD_STORE_VERSION = "scdStore"; //$NON-NLS-1$
+ public static final String SCD_STORE_VERSION = "scdStore"; //$NON-NLS-1$
public static final String SI_ELEM = "scannerInfo"; //$NON-NLS-1$
public static final String COLLECTOR_ELEM = "collector"; //$NON-NLS-1$
public static final String ID_ATTR = "id"; //$NON-NLS-1$
- private static final String INSTANCE_ELEM = "instance"; //$NON-NLS-1$
+ private static final String INSTANCE_ELEM = "instance"; //$NON-NLS-1$
private static DiscoveredScannerInfoStore instance;
@@ -84,6 +84,7 @@ public final class DiscoveredScannerInfoStore {
}
return instance;
}
+
/**
*
*/
@@ -95,31 +96,31 @@ public final class DiscoveredScannerInfoStore {
loadDiscoveredScannerInfoFromState(project, new InfoContext(project), serializable);
}
- public void loadDiscoveredScannerInfoFromState(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable)
- throws CoreException {
+ public void loadDiscoveredScannerInfoFromState(IProject project, InfoContext context,
+ IDiscoveredScannerInfoSerializable serializable) throws CoreException {
// Get the document
Element rootElem = getRootElement(project, context, serializable);
- if(rootElem != null){
- // get the collector element
- NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM);
- if (collectorList.getLength() > 0) {
- // find the collector element
- for (int i = 0; i < collectorList.getLength(); ++i) {
- Element collectorElem = (Element) collectorList.item(i);
- String collectorId = collectorElem.getAttribute(ID_ATTR);
- if (serializable.getCollectorId().equals(collectorId)) {
- serializable.deserialize(collectorElem);
- break;
- }
- }
- }
+ if (rootElem != null) {
+ // get the collector element
+ NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM);
+ if (collectorList.getLength() > 0) {
+ // find the collector element
+ for (int i = 0; i < collectorList.getLength(); ++i) {
+ Element collectorElem = (Element) collectorList.item(i);
+ String collectorId = collectorElem.getAttribute(ID_ATTR);
+ if (serializable.getCollectorId().equals(collectorId)) {
+ serializable.deserialize(collectorElem);
+ break;
+ }
+ }
+ }
}
}
- public boolean hasInfo(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable){
+ public boolean hasInfo(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) {
try {
- if(getRootElement(project, context, serializable) != null)
+ if (getRootElement(project, context, serializable) != null)
return true;
} catch (CoreException e) {
MakeCorePlugin.log(e);
@@ -127,8 +128,9 @@ public final class DiscoveredScannerInfoStore {
return false;
}
- private Element getRootElement(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException{
- if(serializable == null)
+ private Element getRootElement(IProject project, InfoContext context,
+ IDiscoveredScannerInfoSerializable serializable) throws CoreException {
+ if (serializable == null)
return null;
Document document = getDocument(project);
@@ -138,12 +140,12 @@ public final class DiscoveredScannerInfoStore {
if (rootList.getLength() > 0) {
rootElem = (Element) rootList.item(0);
- if(!context.isDefaultContext()){
+ if (!context.isDefaultContext()) {
String instanceId = context.getInstanceId();
- Element instanceElem = findChild(rootElem, INSTANCE_ELEM, ID_ATTR, instanceId);
+ Element instanceElem = findChild(rootElem, INSTANCE_ELEM, ID_ATTR, instanceId);
- rootElem = instanceElem;
+ rootElem = instanceElem;
}
}
}
@@ -153,48 +155,44 @@ public final class DiscoveredScannerInfoStore {
private Document getDocument(IProject project) throws CoreException {
// Get the document
- Reference<Document> ref= fDocumentCache.get(project);
+ Reference<Document> ref = fDocumentCache.get(project);
Document document = ref != null ? ref.get() : null;
if (document == null) {
- try {
- DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- IPath path = getDiscoveredScannerConfigStore(project);
- if (path.toFile().exists()) {
- // read form file
- FileInputStream file = new FileInputStream(path.toFile());
- document = builder.parse(file);
- Node rootElem = document.getFirstChild();
- if (rootElem.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) {
- // no version info; upgrade
- upgradeDocument(document, project);
- }
- }
- else {
- // create new document
- document = builder.newDocument();
- ProcessingInstruction pi = document.createProcessingInstruction(SCD_STORE_VERSION, "version=\"2\""); //$NON-NLS-1$
- document.appendChild(pi);
- Element rootElement = document.createElement(SI_ELEM);
- rootElement.setAttribute(ID_ATTR, CDESCRIPTOR_ID);
- document.appendChild(rootElement);
- }
- fDocumentCache.put(project, new SoftReference<Document>(document));
- }
- catch (IOException e) {
- MakeCorePlugin.log(e);
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
- }
- catch (ParserConfigurationException e) {
- MakeCorePlugin.log(e);
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
- }
- catch (SAXException e) {
- MakeCorePlugin.log(e);
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
- }
+ try {
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ IPath path = getDiscoveredScannerConfigStore(project);
+ if (path.toFile().exists()) {
+ // read form file
+ FileInputStream file = new FileInputStream(path.toFile());
+ document = builder.parse(file);
+ Node rootElem = document.getFirstChild();
+ if (rootElem.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) {
+ // no version info; upgrade
+ upgradeDocument(document, project);
+ }
+ } else {
+ // create new document
+ document = builder.newDocument();
+ ProcessingInstruction pi = document.createProcessingInstruction(SCD_STORE_VERSION, "version=\"2\""); //$NON-NLS-1$
+ document.appendChild(pi);
+ Element rootElement = document.createElement(SI_ELEM);
+ rootElement.setAttribute(ID_ATTR, CDESCRIPTOR_ID);
+ document.appendChild(rootElement);
+ }
+ fDocumentCache.put(project, new SoftReference<Document>(document));
+ } catch (IOException e) {
+ MakeCorePlugin.log(e);
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
+ } catch (ParserConfigurationException e) {
+ MakeCorePlugin.log(e);
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
+ } catch (SAXException e) {
+ MakeCorePlugin.log(e);
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$
+ }
}
return document;
}
@@ -212,78 +210,81 @@ public final class DiscoveredScannerInfoStore {
rootElem.appendChild(collectorElem);
}
- private Element findChild(Element parentElem, String name, String attr, String attrValue){
- Element cfgElem = null;
- NodeList cfgList = parentElem.getElementsByTagName(name);
- if (cfgList.getLength() > 0) {
- // find per file collector element and remove children
- for (int i = 0; i < cfgList.getLength(); ++i) {
- Element cElem = (Element) cfgList.item(i);
- String value = cElem.getAttribute(attr);
- if (value.equals(attrValue)) {
- cfgElem = cElem;
- break;
- }
- }
- }
-
- return cfgElem;
+ private Element findChild(Element parentElem, String name, String attr, String attrValue) {
+ Element cfgElem = null;
+ NodeList cfgList = parentElem.getElementsByTagName(name);
+ if (cfgList.getLength() > 0) {
+ // find per file collector element and remove children
+ for (int i = 0; i < cfgList.getLength(); ++i) {
+ Element cElem = (Element) cfgList.item(i);
+ String value = cElem.getAttribute(attr);
+ if (value.equals(attrValue)) {
+ cfgElem = cElem;
+ break;
+ }
+ }
+ }
+
+ return cfgElem;
}
- private void saveDiscoveredScannerInfo(InfoContext context, IDiscoveredScannerInfoSerializable serializable, Document doc) {
+ private void saveDiscoveredScannerInfo(InfoContext context, IDiscoveredScannerInfoSerializable serializable,
+ Document doc) {
NodeList rootList = doc.getElementsByTagName(SI_ELEM);
if (rootList.getLength() > 0) {
Element rootElem = (Element) rootList.item(0);
// get the collector element
- if(!context.isDefaultContext()){
+ if (!context.isDefaultContext()) {
String instanceId = context.getInstanceId();
Element instanceElem = findChild(rootElem, INSTANCE_ELEM, ID_ATTR, instanceId);
- if(instanceElem == null){
- instanceElem = doc.createElement(INSTANCE_ELEM);
- instanceElem.setAttribute(ID_ATTR, instanceId);
- rootElem.appendChild(instanceElem);
- }
+ if (instanceElem == null) {
+ instanceElem = doc.createElement(INSTANCE_ELEM);
+ instanceElem.setAttribute(ID_ATTR, instanceId);
+ rootElem.appendChild(instanceElem);
+ }
- rootElem = instanceElem;
+ rootElem = instanceElem;
}
// get the collector element
- Element collectorElem = null;
- NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM);
- if (collectorList.getLength() > 0) {
- // find per file collector element and remove children
- for (int i = 0; i < collectorList.getLength(); ++i) {
- Element cElem = (Element) collectorList.item(i);
- String collectorId = cElem.getAttribute(ID_ATTR);
- if (serializable.getCollectorId().equals(collectorId)) {
- for (Node child = cElem.getFirstChild(); child != null;
- child = cElem.getFirstChild()) {
- cElem.removeChild(child);
- }
- collectorElem = cElem;
- break;
- }
- }
- }
- if (collectorElem == null) {
- // create per profile element
- collectorElem = doc.createElement(COLLECTOR_ELEM);
- collectorElem.setAttribute(ID_ATTR, serializable.getCollectorId());
- rootElem.appendChild(collectorElem);
- }
+ Element collectorElem = null;
+ NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM);
+ if (collectorList.getLength() > 0) {
+ // find per file collector element and remove children
+ for (int i = 0; i < collectorList.getLength(); ++i) {
+ Element cElem = (Element) collectorList.item(i);
+ String collectorId = cElem.getAttribute(ID_ATTR);
+ if (serializable.getCollectorId().equals(collectorId)) {
+ for (Node child = cElem.getFirstChild(); child != null; child = cElem.getFirstChild()) {
+ cElem.removeChild(child);
+ }
+ collectorElem = cElem;
+ break;
+ }
+ }
+ }
+ if (collectorElem == null) {
+ // create per profile element
+ collectorElem = doc.createElement(COLLECTOR_ELEM);
+ collectorElem.setAttribute(ID_ATTR, serializable.getCollectorId());
+ rootElem.appendChild(collectorElem);
+ }
// Save the discovered scanner info
serializable.serialize(collectorElem);
}
}
- public void saveDiscoveredScannerInfoToState(IProject project, IDiscoveredScannerInfoSerializable serializable) throws CoreException {
+
+ public void saveDiscoveredScannerInfoToState(IProject project, IDiscoveredScannerInfoSerializable serializable)
+ throws CoreException {
saveDiscoveredScannerInfoToState(project, new InfoContext(project), serializable);
}
- public void saveDiscoveredScannerInfoToState(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException {
+ public void saveDiscoveredScannerInfoToState(IProject project, InfoContext context,
+ IDiscoveredScannerInfoSerializable serializable) throws CoreException {
Document document = getDocument(project);
// Create document
try {
@@ -323,98 +324,95 @@ public final class DiscoveredScannerInfoStore {
}
}
- public IPath getDiscoveredScannerConfigStore(IProject project) {
- String fileName = project.getName() + ".sc"; //$NON-NLS-1$
- String storedFileName = null;
- try {
- storedFileName = project.getPersistentProperty(dscFileNameProperty);
- } catch (CoreException e) {
- MakeCorePlugin.log(e.getStatus());
- }
- if (storedFileName != null && !storedFileName.equals(fileName)) {
- // try to move 2.x file name format to 3.x file name format
- movePluginStateFile(storedFileName, fileName);
- }
- try {
- project.setPersistentProperty(dscFileNameProperty, fileName);
- } catch (CoreException e) {
- MakeCorePlugin.log(e.getStatus());
- }
-
- return MakeCorePlugin.getWorkingDirectory().append(fileName);
- }
-
- public void updateScannerConfigStore(IResourceDelta delta) {
- try {
- delta.accept(new IResourceDeltaVisitor() {
-
- @Override
+ public IPath getDiscoveredScannerConfigStore(IProject project) {
+ String fileName = project.getName() + ".sc"; //$NON-NLS-1$
+ String storedFileName = null;
+ try {
+ storedFileName = project.getPersistentProperty(dscFileNameProperty);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e.getStatus());
+ }
+ if (storedFileName != null && !storedFileName.equals(fileName)) {
+ // try to move 2.x file name format to 3.x file name format
+ movePluginStateFile(storedFileName, fileName);
+ }
+ try {
+ project.setPersistentProperty(dscFileNameProperty, fileName);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e.getStatus());
+ }
+
+ return MakeCorePlugin.getWorkingDirectory().append(fileName);
+ }
+
+ public void updateScannerConfigStore(IResourceDelta delta) {
+ try {
+ delta.accept(new IResourceDeltaVisitor() {
+
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
- IResource resource = delta.getResource();
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- int kind = delta.getKind();
- switch (kind) {
- case IResourceDelta.REMOVED:
- if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
- // project renamed
- IPath newPath = delta.getMovedToPath();
- IProject newProject = delta.getResource().getWorkspace().
- getRoot().getProject(newPath.toString());
- scProjectRenamed(project, newProject);
- }
- else {
- // project deleted
- scProjectDeleted(project);
- }
- // remove from cache
- fDocumentCache.remove(project);
- }
- return false;
- }
- return true;
- }
-
- });
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
-
- private void scProjectDeleted(IProject project) {
- String scFileName = project.getName() + ".sc"; //$NON-NLS-1$
- deletePluginStateFile(scFileName);
- }
-
- private void deletePluginStateFile(String scFileName) {
- IPath path = MakeCorePlugin.getWorkingDirectory().append(scFileName);
- File file = path.toFile();
- if (file.exists()) {
- file.delete();
- }
- }
-
- private void scProjectRenamed(IProject project, IProject newProject) {
- String scOldFileName = project.getName() + ".sc"; //$NON-NLS-1$
- String scNewFileName = newProject.getName() + ".sc"; //$NON-NLS-1$
- movePluginStateFile(scOldFileName, scNewFileName);
- try {
- newProject.setPersistentProperty(dscFileNameProperty, scNewFileName);
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
-
- private void movePluginStateFile(String oldFileName, String newFileName) {
- IPath oldPath = MakeCorePlugin.getWorkingDirectory().append(oldFileName);
- IPath newPath = MakeCorePlugin.getWorkingDirectory().append(newFileName);
- File oldFile = oldPath.toFile();
- File newFile = newPath.toFile();
- if (oldFile.exists()) {
- oldFile.renameTo(newFile);
- }
- }
+ IResource resource = delta.getResource();
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ int kind = delta.getKind();
+ switch (kind) {
+ case IResourceDelta.REMOVED:
+ if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
+ // project renamed
+ IPath newPath = delta.getMovedToPath();
+ IProject newProject = delta.getResource().getWorkspace().getRoot()
+ .getProject(newPath.toString());
+ scProjectRenamed(project, newProject);
+ } else {
+ // project deleted
+ scProjectDeleted(project);
+ }
+ // remove from cache
+ fDocumentCache.remove(project);
+ }
+ return false;
+ }
+ return true;
+ }
+
+ });
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+
+ private void scProjectDeleted(IProject project) {
+ String scFileName = project.getName() + ".sc"; //$NON-NLS-1$
+ deletePluginStateFile(scFileName);
+ }
+
+ private void deletePluginStateFile(String scFileName) {
+ IPath path = MakeCorePlugin.getWorkingDirectory().append(scFileName);
+ File file = path.toFile();
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ private void scProjectRenamed(IProject project, IProject newProject) {
+ String scOldFileName = project.getName() + ".sc"; //$NON-NLS-1$
+ String scNewFileName = newProject.getName() + ".sc"; //$NON-NLS-1$
+ movePluginStateFile(scOldFileName, scNewFileName);
+ try {
+ newProject.setPersistentProperty(dscFileNameProperty, scNewFileName);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+
+ private void movePluginStateFile(String oldFileName, String newFileName) {
+ IPath oldPath = MakeCorePlugin.getWorkingDirectory().append(oldFileName);
+ IPath newPath = MakeCorePlugin.getWorkingDirectory().append(newFileName);
+ File oldFile = oldPath.toFile();
+ File newFile = newPath.toFile();
+ if (oldFile.exists()) {
+ oldFile.renameTo(newFile);
+ }
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
index e4b0f54cf87..94f53c116e2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
@@ -89,8 +89,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer impl
}
}
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
//
}
return entries.toArray(new IPathEntry[entries.size()]);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java
index e6efd5b51d9..08930b92ee0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java
@@ -81,8 +81,8 @@ public class ScannerConfigInfoFactory {
*/
@Override
public boolean isMakeBuilderConsoleParserEnabled() {
- if (getString(MAKE_BUILDER_PARSER_ENABLED) == null ||
- getString(MAKE_BUILDER_PARSER_ENABLED).length() == 0) { // if no property then default to true
+ if (getString(MAKE_BUILDER_PARSER_ENABLED) == null
+ || getString(MAKE_BUILDER_PARSER_ENABLED).length() == 0) { // if no property then default to true
return true;
}
return getBoolean(MAKE_BUILDER_PARSER_ENABLED);
@@ -103,13 +103,13 @@ public class ScannerConfigInfoFactory {
public String getMakeBuilderConsoleParserId() {
String parserId = getString(MAKE_BUILDER_PARSER_ID);
if (parserId == null || parserId.length() == 0) {
- String[] parserIds = MakeCorePlugin.getDefault().
- getScannerInfoConsoleParserIds("makeBuilder"); //$NON-NLS-1$
+ String[] parserIds = MakeCorePlugin.getDefault().getScannerInfoConsoleParserIds("makeBuilder"); //$NON-NLS-1$
// the default is the first one in the registry
parserId = parserIds[0];
}
return parserId;
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setMakeBuilderConsoleParserId(java.lang.String)
*/
@@ -123,8 +123,8 @@ public class ScannerConfigInfoFactory {
*/
@Override
public boolean isESIProviderCommandEnabled() {
- if (getString(ESI_PROVIDER_COMMAND_ENABLED) == null ||
- getString(ESI_PROVIDER_COMMAND_ENABLED).length() == 0) { // if no property then default to true
+ if (getString(ESI_PROVIDER_COMMAND_ENABLED) == null
+ || getString(ESI_PROVIDER_COMMAND_ENABLED).length() == 0) { // if no property then default to true
return true;
}
return getBoolean(ESI_PROVIDER_COMMAND_ENABLED);
@@ -143,8 +143,8 @@ public class ScannerConfigInfoFactory {
*/
@Override
public boolean isDefaultESIProviderCmd() {
- if (getString(USE_DEFAULT_ESI_PROVIDER_CMD) == null ||
- getString(USE_DEFAULT_ESI_PROVIDER_CMD).length() == 0) { // if no property then default to true
+ if (getString(USE_DEFAULT_ESI_PROVIDER_CMD) == null
+ || getString(USE_DEFAULT_ESI_PROVIDER_CMD).length() == 0) { // if no property then default to true
return true;
}
return getBoolean(USE_DEFAULT_ESI_PROVIDER_CMD);
@@ -211,8 +211,8 @@ public class ScannerConfigInfoFactory {
public String getESIProviderConsoleParserId() {
String parserId = getString(ESI_PROVIDER_PARSER_ID);
if (parserId == null || parserId.length() == 0) {
- String[] parserIds = MakeCorePlugin.getDefault().
- getScannerInfoConsoleParserIds("externalScannerInfoProvider"); //$NON-NLS-1$
+ String[] parserIds = MakeCorePlugin.getDefault()
+ .getScannerInfoConsoleParserIds("externalScannerInfoProvider"); //$NON-NLS-1$
// the default is the first one in the registry
parserId = parserIds[0];
}
@@ -232,9 +232,9 @@ public class ScannerConfigInfoFactory {
*/
@Override
public boolean isSIProblemGenerationEnabled() {
- if (getString(SI_PROBLEM_GENERATION_ENABLED) == null ||
- getString(SI_PROBLEM_GENERATION_ENABLED).length() == 0) { // if no property then default to true
- return true;
+ if (getString(SI_PROBLEM_GENERATION_ENABLED) == null
+ || getString(SI_PROBLEM_GENERATION_ENABLED).length() == 0) { // if no property then default to true
+ return true;
}
return getBoolean(SI_PROBLEM_GENERATION_ENABLED);
}
@@ -252,16 +252,16 @@ public class ScannerConfigInfoFactory {
}
protected abstract String getBuilderID();
+
protected abstract String getString(String property);
+
protected abstract void putString(String name, String value) throws CoreException;
protected String getESIProviderParameter(String name) {
- IExtension extension =
- Platform.getExtensionRegistry().getExtension(
- MakeCorePlugin.getUniqueIdentifier(),
- MakeCorePlugin.EXTERNAL_SI_PROVIDER_SIMPLE_ID,
- // TODO VMIR make this configurable
- MakeCorePlugin.DEFAULT_EXTERNAL_SI_PROVIDER_ID);
+ IExtension extension = Platform.getExtensionRegistry().getExtension(MakeCorePlugin.getUniqueIdentifier(),
+ MakeCorePlugin.EXTERNAL_SI_PROVIDER_SIMPLE_ID,
+ // TODO VMIR make this configurable
+ MakeCorePlugin.DEFAULT_EXTERNAL_SI_PROVIDER_ID);
if (extension == null)
return null;
IConfigurationElement[] configs = extension.getConfigurationElements();
@@ -322,12 +322,12 @@ public class ScannerConfigInfoFactory {
this.builderID = builderID;
ICommand builder = ScannerConfigNature.getBuildSpec(project.getDescription(), builderID);
if (builder == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- MakeCorePlugin.getUniqueIdentifier(), -1,
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
MakeMessages.getString("ScannerConfigInfoFactory.Missing_Builder")//$NON-NLS-1$
- + builderID, null));
+ + builderID,
+ null));
}
- Map<String,String> bArgs = builder.getArguments();
+ Map<String, String> bArgs = builder.getArguments();
args = bArgs;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigUtil.java
index 371de2d3e9a..a03c3b98cce 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigUtil.java
@@ -26,16 +26,17 @@ import org.eclipse.core.runtime.IPath;
/**
* Utility class that handles some Scanner Config specifig collection conversions
- *
+ *
* @author vhirsl
*/
public final class ScannerConfigUtil {
- /**
+ /**
* Adds all new discovered symbols/values to the existing ones.
- *
+ *
* @param sumSymbols - a map of [String, Map] where Map is a SymbolEntry
*/
- public static boolean scAddSymbolsList2SymbolEntryMap(Map<String, SymbolEntry> sumSymbols, List<String> symbols, boolean active) {
+ public static boolean scAddSymbolsList2SymbolEntryMap(Map<String, SymbolEntry> sumSymbols, List<String> symbols,
+ boolean active) {
boolean rc = false;
for (String symbol : symbols) {
String key;
@@ -52,8 +53,7 @@ public final class ScannerConfigUtil {
// make only the first one to be active
sEntry = new SymbolEntry(key, value, true);
rc = true;
- }
- else {
+ } else {
rc |= sEntry.add(value, active);
}
sumSymbols.put(key, sEntry);
@@ -71,17 +71,16 @@ public final class ScannerConfigUtil {
SymbolEntry sEntry = symbol.getValue();
if (active) {
rv.addAll(sEntry.getActiveRaw());
- }
- else {
+ } else {
rv.addAll(sEntry.getRemovedRaw());
}
}
return rv;
}
-
+
/**
* MapsSymbolEntryMap to a plain Map
- *
+ *
* @param sumSymbols (in) - discovered symbols in SymbolEntryMap
* @return - active symbols as a plain Map
*/
@@ -101,7 +100,8 @@ public final class ScannerConfigUtil {
/**
* Adds a single symbol definition string ("DEBUG_LEVEL=4") to the SymbolEntryMap
*/
- public static boolean scAddSymbolString2SymbolEntryMap(Map<String, SymbolEntry> symbols, String symbol, boolean active) {
+ public static boolean scAddSymbolString2SymbolEntryMap(Map<String, SymbolEntry> symbols, String symbol,
+ boolean active) {
boolean rc = false;
String key;
String value = null;
@@ -117,8 +117,7 @@ public final class ScannerConfigUtil {
// make only the first one to be active
sEntry = new SymbolEntry(key, value, active);
rc = true;
- }
- else {
+ } else {
rc |= sEntry.add(value, active);
}
symbols.put(key, sEntry);
@@ -129,7 +128,8 @@ public final class ScannerConfigUtil {
* @param result (out)
* @param addend (in)
*/
- public static boolean scAddSymbolEntryMap2SymbolEntryMap(Map<String, SymbolEntry> result, Map<String, SymbolEntry> addend) {
+ public static boolean scAddSymbolEntryMap2SymbolEntryMap(Map<String, SymbolEntry> result,
+ Map<String, SymbolEntry> addend) {
boolean rc = false;
Set<String> keySet = addend.keySet();
for (String key : keySet) {
@@ -152,8 +152,7 @@ public final class ScannerConfigUtil {
rc |= true;
}
}
- }
- else {
+ } else {
// result does not contain the symbol; add it
// shallow copy
SymbolEntry aSymbolEntry = addend.get(key);
@@ -174,14 +173,14 @@ public final class ScannerConfigUtil {
}
return symbol;
}
-
+
/**
* Returns a symbol value (i.e. for DEF=1 returns 1), may be null
*/
public static String getSymbolValue(String symbol) {
int index = symbol.indexOf('=');
if (index != -1) {
- return symbol.substring(index+1).trim();
+ return symbol.substring(index + 1).trim();
}
return null;
}
@@ -189,7 +188,7 @@ public final class ScannerConfigUtil {
/**
* Removes a symbol value from the symbol entry. If it was an only value than
* it symbol entry will be removed alltogether.
- *
+ *
* @param symbolEntryMap map of [symbol's key, symbolEntry]
*/
public static void removeSymbolEntryValue(String symbol, Map<String, SymbolEntry> symbolEntryMap) {
@@ -204,18 +203,17 @@ public final class ScannerConfigUtil {
}
}
}
-
+
/**
* Swaps two include paths in the include paths Map.
* Used by Up/Down discovered paths
- *
+ *
* @return new map of include paths
*/
- public static LinkedHashMap<String, SymbolEntry> swapIncludePaths(LinkedHashMap<String, SymbolEntry> sumPaths, int index1, int index2) {
+ public static LinkedHashMap<String, SymbolEntry> swapIncludePaths(LinkedHashMap<String, SymbolEntry> sumPaths,
+ int index1, int index2) {
int size = sumPaths.size();
- if (index1 == index2 ||
- !(index1 >= 0 && index1 < size &&
- index2 >= 0 && index2 < size)) {
+ if (index1 == index2 || !(index1 >= 0 && index1 < size && index2 >= 0 && index2 < size)) {
return sumPaths;
}
ArrayList<String> pathKeyList = new ArrayList<String>(sumPaths.keySet());
@@ -223,14 +221,14 @@ public final class ScannerConfigUtil {
String temp2 = pathKeyList.get(index2);
pathKeyList.set(index1, temp2);
pathKeyList.set(index2, temp1);
-
+
LinkedHashMap<String, SymbolEntry> newSumPaths = new LinkedHashMap<String, SymbolEntry>(sumPaths.size());
for (String key : pathKeyList) {
newSumPaths.put(key, sumPaths.get(key));
}
return newSumPaths;
}
-
+
/**
* Tokenizes string with quotes
*/
@@ -240,9 +238,9 @@ public final class ScannerConfigUtil {
for (int i = 0; i < tokens.length; ++i) {
if (i % 2 == 0) { // even tokens need further tokenization
String[] sTokens = tokens[i].split("\\s+"); //$NON-NLS-1$
- for (int j = 0; j < sTokens.length; allTokens.add(sTokens[j++])) {}
- }
- else {
+ for (int j = 0; j < sTokens.length; allTokens.add(sTokens[j++])) {
+ }
+ } else {
allTokens.add(tokens[i]);
}
}
@@ -255,9 +253,9 @@ public final class ScannerConfigUtil {
public static String[] iPathArray2StringArray(IPath[] paths) {
String[] rv = new String[paths.length];
for (int i = 0; i < paths.length; ++i) {
- rv[i] = paths[i].toString();
+ rv[i] = paths[i].toString();
}
return rv;
}
-
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java
index 80686a04a46..f26653ffc3f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java
@@ -47,31 +47,24 @@ public class ScannerInfoConsoleParserFactory {
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
* and a utility.
*/
- public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
- OutputStream errorStream,
- IProject project,
- String id,
- IScannerConfigBuilderInfo2 info2,
- IScannerInfoCollector collector,
+ public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream, OutputStream errorStream,
+ IProject project, String id, IScannerConfigBuilderInfo2 info2, IScannerInfoCollector collector,
IMarkerGenerator markerGenerator) {
- return getESIProviderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), id, info2, collector, markerGenerator);
+ return getESIProviderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), id, info2,
+ collector, markerGenerator);
}
/**
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
* and a utility.
*/
- public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
- OutputStream errorStream,
- IProject project,
- InfoContext infoContext,
- String id,
- IScannerConfigBuilderInfo2 info2,
- IScannerInfoCollector collector,
- IMarkerGenerator markerGenerator) {
+ public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream, OutputStream errorStream,
+ IProject project, InfoContext infoContext, String id, IScannerConfigBuilderInfo2 info2,
+ IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
- IScannerInfoConsoleParser parser = getESIConsoleParser(project, infoContext, id, info2, collector, markerGenerator);
+ IScannerInfoConsoleParser parser = getESIConsoleParser(project, infoContext, id, info2, collector,
+ markerGenerator);
if (parser != null) {
return new ConsoleOutputSniffer(outputStream, errorStream, new IScannerInfoConsoleParser[] { parser });
}
@@ -81,16 +74,12 @@ public class ScannerInfoConsoleParserFactory {
/**
/* Get the ESIProvider console parser.
*/
- public static IScannerInfoConsoleParser getESIConsoleParser(IProject project,
- InfoContext infoContext,
- String id,
- IScannerConfigBuilderInfo2 info2,
- IScannerInfoCollector collector,
- IMarkerGenerator markerGenerator) {
+ public static IScannerInfoConsoleParser getESIConsoleParser(IProject project, InfoContext infoContext, String id,
+ IScannerConfigBuilderInfo2 info2, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
if (info2.isProviderOutputParserEnabled(id)) {
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, infoContext, info2.getSelectedProfileId());
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ infoContext, info2.getSelectedProfileId());
IScannerInfoConsoleParser parser = profileInstance.createExternalScannerInfoParser(id);
IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
@@ -105,112 +94,104 @@ public class ScannerInfoConsoleParserFactory {
* Creates a ConsoleOutputStreamSniffer, ESI provider scanner info console parser
* and a utility.
*/
- public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
- OutputStream outputStream,
- OutputStream errorStream,
- IProject project,
- IPath workingDirectory,
- IScannerConfigBuilderInfo2 info2,
- IMarkerGenerator markerGenerator,
- IScannerInfoCollector collector) {
-
- return getMakeBuilderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), workingDirectory, info2, markerGenerator, collector);
+ public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(OutputStream outputStream, OutputStream errorStream,
+ IProject project, IPath workingDirectory, IScannerConfigBuilderInfo2 info2,
+ IMarkerGenerator markerGenerator, IScannerInfoCollector collector) {
+
+ return getMakeBuilderOutputSniffer(outputStream, errorStream, project, new InfoContext(project),
+ workingDirectory, info2, markerGenerator, collector);
}
/**
* Creates a ConsoleOutputStreamSniffer, ESI provider scanner info console parser
* and a utility.
*/
- public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
- OutputStream outputStream,
- OutputStream errorStream,
- IProject project,
- InfoContext infoContext,
- IPath workingDirectory,
- IScannerConfigBuilderInfo2 info2,
- IMarkerGenerator markerGenerator,
- IScannerInfoCollector collector) {
+ public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(OutputStream outputStream, OutputStream errorStream,
+ IProject project, InfoContext infoContext, IPath workingDirectory, IScannerConfigBuilderInfo2 info2,
+ IMarkerGenerator markerGenerator, IScannerInfoCollector collector) {
- IScannerInfoConsoleParser parser = getScannerInfoConsoleParserInternal(project, infoContext, workingDirectory, info2, markerGenerator, collector);
+ IScannerInfoConsoleParser parser = getScannerInfoConsoleParserInternal(project, infoContext, workingDirectory,
+ info2, markerGenerator, collector);
if (parser != null) {
// create an output stream sniffer
- return new ConsoleOutputSniffer(outputStream, errorStream, new IScannerInfoConsoleParser[] {parser});
+ return new ConsoleOutputSniffer(outputStream, errorStream, new IScannerInfoConsoleParser[] { parser });
}
return null;
}
private static IScannerInfoConsoleParser getScannerInfoConsoleParserInternal(IProject project,
- InfoContext infoContext,
- IPath workingDirectory,
- IScannerConfigBuilderInfo2 info2,
- IMarkerGenerator markerGenerator,
- IScannerInfoCollector collector) {
+ InfoContext infoContext, IPath workingDirectory, IScannerConfigBuilderInfo2 info2,
+ IMarkerGenerator markerGenerator, IScannerInfoCollector collector) {
IScannerInfoConsoleParser parser = null;
-// try {
- // get the SC builder settings
- /*if (currentProject.hasNature(ScannerConfigNature.NATURE_ID))*/ {
- if (info2 == null) {
- try {
- IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
- info2 = container.getInfo(infoContext);
- } catch (CoreException e) {
- // builder not installed or disabled
- }
+ // try {
+ // get the SC builder settings
+ /*if (currentProject.hasNature(ScannerConfigNature.NATURE_ID))*/ {
+ if (info2 == null) {
+ try {
+ IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager
+ .createScannerConfigBuildInfo2Set(project);
+ info2 = container.getInfo(infoContext);
+ } catch (CoreException e) {
+ // builder not installed or disabled
}
- if (info2 != null && info2.isAutoDiscoveryEnabled() && info2.isBuildOutputParserEnabled()) {
- String id = info2.getSelectedProfileId();
-
- // get the make builder console parser
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project, infoContext, id);
- parser = profileInstance.createBuildOutputParser();
- if (parser != null){
- if (collector == null) {
- collector = profileInstance.getScannerInfoCollector();
- }
- parser.startup(project, workingDirectory, collector, info2.isProblemReportingEnabled() ? markerGenerator : null);
+ }
+ if (info2 != null && info2.isAutoDiscoveryEnabled() && info2.isBuildOutputParserEnabled()) {
+ String id = info2.getSelectedProfileId();
+
+ // get the make builder console parser
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance()
+ .getSCProfileInstance(project, infoContext, id);
+ parser = profileInstance.createBuildOutputParser();
+ if (parser != null) {
+ if (collector == null) {
+ collector = profileInstance.getScannerInfoCollector();
}
+ parser.startup(project, workingDirectory, collector,
+ info2.isProblemReportingEnabled() ? markerGenerator : null);
}
}
-// }
-// catch (CoreException e) {
-// MakeCorePlugin.log(e.getStatus());
-// }
+ }
+ // }
+ // catch (CoreException e) {
+ // MakeCorePlugin.log(e.getStatus());
+ // }
return parser;
}
- public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project, URI workingDirectoryURI, IMarkerGenerator markerGenerator) {
+ public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project, URI workingDirectoryURI,
+ IMarkerGenerator markerGenerator) {
String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
- if(pathFromURI == null) {
+ if (pathFromURI == null) {
// fallback to CWD
pathFromURI = System.getProperty("user.dir"); //$NON-NLS-1$
}
- return getScannerInfoConsoleParserInternal(project, new InfoContext(project), new Path(pathFromURI), null, markerGenerator, null);
+ return getScannerInfoConsoleParserInternal(project, new InfoContext(project), new Path(pathFromURI), null,
+ markerGenerator, null);
}
// TODO - perhaps this be unified with the other one?
- public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project,
- InfoContext infoContext,
- IPath workingDirectory,
- IScannerConfigBuilderInfo2 info2,
- IMarkerGenerator markerGenerator,
+ public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project, InfoContext infoContext,
+ IPath workingDirectory, IScannerConfigBuilderInfo2 info2, IMarkerGenerator markerGenerator,
IScannerInfoCollector collector) {
IScannerInfoConsoleParser parser = null;
if (info2 != null && info2.isAutoDiscoveryEnabled() && info2.isBuildOutputParserEnabled()) {
String id = info2.getSelectedProfileId();
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(id);
- if(profile.getBuildOutputProviderElement() != null){
+ if (profile.getBuildOutputProviderElement() != null) {
// get the make builder console parser
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project, infoContext, id);
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance()
+ .getSCProfileInstance(project, infoContext, id);
parser = profileInstance.createBuildOutputParser();
- if(parser != null){
+ if (parser != null) {
if (collector == null) {
collector = profileInstance.getScannerInfoCollector();
}
- parser.startup(project, workingDirectory, collector, info2.isProblemReportingEnabled() ? markerGenerator : null);
+ parser.startup(project, workingDirectory, collector,
+ info2.isProblemReportingEnabled() ? markerGenerator : null);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
index 49d951a47af..e869b3a7985 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java
@@ -32,147 +32,147 @@ import org.eclipse.core.resources.IProject;
* @author vhirsl
*/
public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsoleParser {
- protected static final String[] COMPILER_INVOCATION = {
- "gcc", "g++", "cc", "c++" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- };
- protected static final String DASHIDASH= "-I-"; //$NON-NLS-1$
- protected static final String DASHI= "-I"; //$NON-NLS-1$
- protected static final String DASHD= "-D"; //$NON-NLS-1$
+ protected static final String[] COMPILER_INVOCATION = { "gcc", "g++", "cc", "c++" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ };
+ protected static final String DASHIDASH = "-I-"; //$NON-NLS-1$
+ protected static final String DASHI = "-I"; //$NON-NLS-1$
+ protected static final String DASHD = "-D"; //$NON-NLS-1$
- private IProject project;
- protected IScannerInfoCollector collector;
+ private IProject project;
+ protected IScannerInfoCollector collector;
- private boolean bMultiline = false;
- private String sMultiline = ""; //$NON-NLS-1$
+ private boolean bMultiline = false;
+ private String sMultiline = ""; //$NON-NLS-1$
protected String[] fCompilerCommands;
- /**
- * @return Returns the project.
- */
- protected IProject getProject() {
- return project;
- }
- /**
- * @return Returns the collector.
- */
- protected IScannerInfoCollector getCollector() {
- return collector;
- }
+ /**
+ * @return Returns the project.
+ */
+ protected IProject getProject() {
+ return project;
+ }
- public void startup(IProject project, IScannerInfoCollector collector) {
- this.project = project;
- this.collector = collector;
- fCompilerCommands= computeCompilerCommands();
- }
+ /**
+ * @return Returns the collector.
+ */
+ protected IScannerInfoCollector getCollector() {
+ return collector;
+ }
- /**
- * Returns array of additional compiler commands to look for
- *
- * @return String[]
- */
- private String[] computeCompilerCommands() {
- if (project != null) {
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
- BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
- if (boProvider != null) {
- String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
- if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
- String[] compilerCommands = compilerCommandsString.split(",\\s*"); //$NON-NLS-1$
- if (compilerCommands.length > 0) {
- String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
- System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
- System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length, compilerCommands.length);
- return compilerInvocation;
- }
- }
- }
- }
- return COMPILER_INVOCATION;
- }
+ public void startup(IProject project, IScannerInfoCollector collector) {
+ this.project = project;
+ this.collector = collector;
+ fCompilerCommands = computeCompilerCommands();
+ }
+
+ /**
+ * Returns array of additional compiler commands to look for
+ *
+ * @return String[]
+ */
+ private String[] computeCompilerCommands() {
+ if (project != null) {
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ ScannerConfigProfileManager.NULL_PROFILE_ID);
+ BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
+ if (boProvider != null) {
+ String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
+ if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
+ String[] compilerCommands = compilerCommandsString.split(",\\s*"); //$NON-NLS-1$
+ if (compilerCommands.length > 0) {
+ String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
+ System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
+ System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length,
+ compilerCommands.length);
+ return compilerInvocation;
+ }
+ }
+ }
+ }
+ return COMPILER_INVOCATION;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
+ */
+ @Override
public boolean processLine(String line) {
if (line.trim().length() == 0) {
return false;
}
- boolean rc = false;
- int lineBreakPos = line.length()-1;
- char[] lineChars = line.toCharArray();
- while (lineBreakPos >= 0 && Character.isWhitespace(lineChars[lineBreakPos])) {
- lineBreakPos--;
- }
- if (lineBreakPos >= 0) {
- if (lineChars[lineBreakPos] != '\\'
- || (lineBreakPos > 0 && lineChars[lineBreakPos-1] == '\\')) {
- lineBreakPos = -1;
- }
- }
- // check for multiline commands (ends with '\')
- if (lineBreakPos >= 0) {
- sMultiline += line.substring(0, lineBreakPos);
- bMultiline = true;
- return rc;
- }
- if (bMultiline) {
- line = sMultiline + line;
- bMultiline = false;
- sMultiline = ""; //$NON-NLS-1$
- }
- line= line.trim();
- TraceUtil.outputTrace("AbstractGCCBOPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
- // make\[[0-9]*\]: error_desc
- int firstColon= line.indexOf(':');
- String make = line.substring(0, firstColon + 1);
- if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$
- boolean enter = false;
- String msg = line.substring(firstColon + 1).trim();
- if ((enter = msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_EnteringDirectory"))) || //$NON-NLS-1$
- (msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_LeavingDirectory")))) { //$NON-NLS-1$
- int s = msg.indexOf('`');
- int e = msg.indexOf('\'');
- if (s != -1 && e != -1) {
- String dir = msg.substring(s+1, e);
- if (getUtility() != null) {
- getUtility().changeMakeDirectory(dir, getDirectoryLevel(line), enter);
- }
- return rc;
- }
- }
- }
- // call sublclass to process a single line
- return processSingleLine(line.trim());
- }
+ boolean rc = false;
+ int lineBreakPos = line.length() - 1;
+ char[] lineChars = line.toCharArray();
+ while (lineBreakPos >= 0 && Character.isWhitespace(lineChars[lineBreakPos])) {
+ lineBreakPos--;
+ }
+ if (lineBreakPos >= 0) {
+ if (lineChars[lineBreakPos] != '\\' || (lineBreakPos > 0 && lineChars[lineBreakPos - 1] == '\\')) {
+ lineBreakPos = -1;
+ }
+ }
+ // check for multiline commands (ends with '\')
+ if (lineBreakPos >= 0) {
+ sMultiline += line.substring(0, lineBreakPos);
+ bMultiline = true;
+ return rc;
+ }
+ if (bMultiline) {
+ line = sMultiline + line;
+ bMultiline = false;
+ sMultiline = ""; //$NON-NLS-1$
+ }
+ line = line.trim();
+ TraceUtil.outputTrace("AbstractGCCBOPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ // make\[[0-9]*\]: error_desc
+ int firstColon = line.indexOf(':');
+ String make = line.substring(0, firstColon + 1);
+ if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$
+ boolean enter = false;
+ String msg = line.substring(firstColon + 1).trim();
+ if ((enter = msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_EnteringDirectory"))) || //$NON-NLS-1$
+ (msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_LeavingDirectory")))) { //$NON-NLS-1$
+ int s = msg.indexOf('`');
+ int e = msg.indexOf('\'');
+ if (s != -1 && e != -1) {
+ String dir = msg.substring(s + 1, e);
+ if (getUtility() != null) {
+ getUtility().changeMakeDirectory(dir, getDirectoryLevel(line), enter);
+ }
+ return rc;
+ }
+ }
+ }
+ // call sublclass to process a single line
+ return processSingleLine(line.trim());
+ }
- private int getDirectoryLevel(String line) {
- int s = line.indexOf('[');
- int num = 0;
- if (s != -1) {
- int e = line.indexOf(']');
- String number = line.substring(s + 1, e).trim();
- try {
- num = Integer.parseInt(number);
- } catch (NumberFormatException exc) {
- }
- }
- return num;
- }
+ private int getDirectoryLevel(String line) {
+ int s = line.indexOf('[');
+ int num = 0;
+ if (s != -1) {
+ int e = line.indexOf(']');
+ String number = line.substring(s + 1, e).trim();
+ try {
+ num = Integer.parseInt(number);
+ } catch (NumberFormatException exc) {
+ }
+ }
+ return num;
+ }
- protected abstract AbstractGCCBOPConsoleParserUtility getUtility();
+ protected abstract AbstractGCCBOPConsoleParserUtility getUtility();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
+ */
+ @Override
public void shutdown() {
- if (getUtility() != null) {
- getUtility().reportProblems();
- }
- }
+ if (getUtility() != null) {
+ getUtility().reportProblems();
+ }
+ }
/**
* Tokenizes a line into an array of commands. Commands are separated by
@@ -187,78 +187,74 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
* @return array of commands
*/
protected String[][] tokenize(String line, boolean escapeInsideDoubleQuotes) {
- ArrayList<String[]> commands= new ArrayList<String[]>();
- ArrayList<String> tokens= new ArrayList<String>();
- StringBuilder token= new StringBuilder();
+ ArrayList<String[]> commands = new ArrayList<String[]>();
+ ArrayList<String> tokens = new ArrayList<String>();
+ StringBuilder token = new StringBuilder();
- final char[] input= line.toCharArray();
- boolean nextEscaped= false;
- char currentQuote= 0;
+ final char[] input = line.toCharArray();
+ boolean nextEscaped = false;
+ char currentQuote = 0;
for (int i = 0; i < input.length; i++) {
final char c = input[i];
- final boolean escaped= nextEscaped; nextEscaped= false;
+ final boolean escaped = nextEscaped;
+ nextEscaped = false;
if (currentQuote != 0) {
if (c == currentQuote) {
if (escaped) {
token.append(c);
- }
- else {
- if (c=='`') {
- token.append(c); // preserve back-quotes
+ } else {
+ if (c == '`') {
+ token.append(c); // preserve back-quotes
}
- currentQuote= 0;
+ currentQuote = 0;
}
- }
- else {
+ } else {
if (escapeInsideDoubleQuotes && currentQuote == '"' && c == '\\') {
- nextEscaped= !escaped;
+ nextEscaped = !escaped;
if (escaped) {
token.append(c);
}
- }
- else {
+ } else {
if (escaped) {
token.append('\\');
}
token.append(c);
}
}
- }
- else {
- switch(c) {
+ } else {
+ switch (c) {
case '\\':
if (escaped) {
token.append(c);
- }
- else {
- nextEscaped= true;
+ } else {
+ nextEscaped = true;
}
break;
- case '\'': case '"': case '`':
+ case '\'':
+ case '"':
+ case '`':
if (escaped) {
token.append(c);
- }
- else {
+ } else {
if (c == '`') {
token.append(c);
}
- currentQuote= c;
+ currentQuote = c;
}
break;
case ';':
if (escaped) {
token.append(c);
- }
- else {
+ } else {
endCommand(token, tokens, commands);
}
break;
- case '&': case '|':
- if (escaped || i+1 >= input.length || input[i+1] != c) {
+ case '&':
+ case '|':
+ if (escaped || i + 1 >= input.length || input[i + 1] != c) {
token.append(c);
- }
- else {
+ } else {
i++;
endCommand(token, tokens, commands);
}
@@ -268,14 +264,12 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
if (Character.isWhitespace(c)) {
if (escaped) {
token.append(c);
- }
- else {
+ } else {
endToken(token, tokens);
}
- }
- else {
+ } else {
if (escaped) {
- token.append('\\'); // for windows put backslash back onto the token.
+ token.append('\\'); // for windows put backslash back onto the token.
}
token.append(c);
}
@@ -293,6 +287,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
tokens.clear();
}
}
+
private void endToken(StringBuilder token, ArrayList<String> tokens) {
if (token.length() > 0) {
tokens.add(token.toString());
@@ -300,22 +295,21 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
}
}
- protected boolean processSingleLine(String line) {
- boolean rc= false;
- String[][] tokens= tokenize(line, true);
+ protected boolean processSingleLine(String line) {
+ boolean rc = false;
+ String[][] tokens = tokenize(line, true);
for (int i = 0; i < tokens.length; i++) {
String[] command = tokens[i];
if (processCommand(command)) {
- rc= true;
- }
- else { // go inside quotes, if the compiler is called per wrapper or shell script
+ rc = true;
+ } else { // go inside quotes, if the compiler is called per wrapper or shell script
for (int j = 0; j < command.length; j++) {
- String[][] subtokens= tokenize(command[j], true);
+ String[][] subtokens = tokenize(command[j], true);
for (int k = 0; k < subtokens.length; k++) {
String[] subcommand = subtokens[k];
- if (subcommand.length > 1) { // only proceed if there is any additional info
+ if (subcommand.length > 1) { // only proceed if there is any additional info
if (processCommand(subcommand)) {
- rc= true;
+ rc = true;
}
}
}
@@ -323,20 +317,20 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
}
}
return rc;
- }
+ }
- protected int findCompilerInvocation(String[] tokens) {
- for (int i = 0; i < tokens.length; i++) {
+ protected int findCompilerInvocation(String[] tokens) {
+ for (int i = 0; i < tokens.length; i++) {
final String token = tokens[i].toLowerCase();
- final int searchFromOffset= Math.max(token.lastIndexOf('/'), token.lastIndexOf('\\')) + 1;
- for (int j=0; j < fCompilerCommands.length; j++) {
- if (token.indexOf(fCompilerCommands[j], searchFromOffset) != -1) {
- return i;
- }
- }
- }
- return -1;
- }
+ final int searchFromOffset = Math.max(token.lastIndexOf('/'), token.lastIndexOf('\\')) + 1;
+ for (int j = 0; j < fCompilerCommands.length; j++) {
+ if (token.indexOf(fCompilerCommands[j], searchFromOffset) != -1) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
- abstract protected boolean processCommand(String[] command);
+ abstract protected boolean processCommand(String[] command);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java
index 46bb7932107..f6abd11f199 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParserUtility.java
@@ -26,177 +26,173 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
- * Common utilities for GCC build output console parsers
- *
+ * Common utilities for GCC build output console parsers
+ *
* @author vhirsl
*/
public abstract class AbstractGCCBOPConsoleParserUtility {
- private IProject project;
- private IPath fBaseDirectory;
- private Vector<IPath> fDirectoryStack;
- private IMarkerGenerator fMarkerGenerator;
- private ArrayList<Problem> fErrors;
-
- /**
- *
- */
- public AbstractGCCBOPConsoleParserUtility(IProject project, IPath workingDirectory,
- IMarkerGenerator markerGenerator) {
- fDirectoryStack = new Vector<IPath>();
- fErrors = new ArrayList<Problem>();
- this.project = project;
- fBaseDirectory = new Path(EFSExtensionManager.getDefault().getPathFromURI(project.getLocationURI()));
- if (workingDirectory != null) {
- pushDirectory(workingDirectory);
- }
- }
-
- /**
- * @return Returns the fBaseDirectory.
- */
- public IPath getBaseDirectory() {
- return fBaseDirectory;
- }
- /**
- * @return Returns the fDirectoryStack.
- */
- protected Vector<IPath> getDirectoryStack() {
- return fDirectoryStack;
- }
- /**
- * @return Returns the fErrors.
- */
- protected ArrayList<Problem> getErrors() {
- return fErrors;
- }
- /**
- * @return Returns the fMarkerGenerator.
- */
- protected IMarkerGenerator getMarkerGenerator() {
- return fMarkerGenerator;
- }
- /**
- * @return Returns the project.
- */
- protected IProject getProject() {
- return project;
- }
-
- public IPath getWorkingDirectory() {
- if (fDirectoryStack.size() != 0) {
- return fDirectoryStack.lastElement();
- }
- // Fallback to the Project Location
- // FIXME: if the build did not start in the Project ?
- return fBaseDirectory;
- }
-
- protected void pushDirectory(IPath dir) {
- if (dir != null) {
- IPath pwd = null;
- if (fBaseDirectory != null && fBaseDirectory.isPrefixOf(dir)) {
- pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount());
- } else {
- // check if it is a cygpath
- pwd= convertCygpath(dir);
- }
- fDirectoryStack.addElement(pwd);
- }
- }
-
- public static IPath convertCygpath(IPath path) {
- if (path.segmentCount() > 1 && path.segment(0).equals("cygdrive")) { //$NON-NLS-1$
- StringBuilder buf = new StringBuilder(2);
- buf.append(Character.toUpperCase(path.segment(1).charAt(0)));
- buf.append(':');
- path = path.removeFirstSegments(2);
- path = path.setDevice(buf.toString());
- path = path.makeAbsolute();
- }
- return path;
+ private IProject project;
+ private IPath fBaseDirectory;
+ private Vector<IPath> fDirectoryStack;
+ private IMarkerGenerator fMarkerGenerator;
+ private ArrayList<Problem> fErrors;
+
+ /**
+ *
+ */
+ public AbstractGCCBOPConsoleParserUtility(IProject project, IPath workingDirectory,
+ IMarkerGenerator markerGenerator) {
+ fDirectoryStack = new Vector<IPath>();
+ fErrors = new ArrayList<Problem>();
+ this.project = project;
+ fBaseDirectory = new Path(EFSExtensionManager.getDefault().getPathFromURI(project.getLocationURI()));
+ if (workingDirectory != null) {
+ pushDirectory(workingDirectory);
+ }
+ }
+
+ /**
+ * @return Returns the fBaseDirectory.
+ */
+ public IPath getBaseDirectory() {
+ return fBaseDirectory;
+ }
+
+ /**
+ * @return Returns the fDirectoryStack.
+ */
+ protected Vector<IPath> getDirectoryStack() {
+ return fDirectoryStack;
+ }
+
+ /**
+ * @return Returns the fErrors.
+ */
+ protected ArrayList<Problem> getErrors() {
+ return fErrors;
+ }
+
+ /**
+ * @return Returns the fMarkerGenerator.
+ */
+ protected IMarkerGenerator getMarkerGenerator() {
+ return fMarkerGenerator;
+ }
+
+ /**
+ * @return Returns the project.
+ */
+ protected IProject getProject() {
+ return project;
+ }
+
+ public IPath getWorkingDirectory() {
+ if (fDirectoryStack.size() != 0) {
+ return fDirectoryStack.lastElement();
+ }
+ // Fallback to the Project Location
+ // FIXME: if the build did not start in the Project ?
+ return fBaseDirectory;
+ }
+
+ protected void pushDirectory(IPath dir) {
+ if (dir != null) {
+ IPath pwd = null;
+ if (fBaseDirectory != null && fBaseDirectory.isPrefixOf(dir)) {
+ pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount());
+ } else {
+ // check if it is a cygpath
+ pwd = convertCygpath(dir);
+ }
+ fDirectoryStack.addElement(pwd);
+ }
+ }
+
+ public static IPath convertCygpath(IPath path) {
+ if (path.segmentCount() > 1 && path.segment(0).equals("cygdrive")) { //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder(2);
+ buf.append(Character.toUpperCase(path.segment(1).charAt(0)));
+ buf.append(':');
+ path = path.removeFirstSegments(2);
+ path = path.setDevice(buf.toString());
+ path = path.makeAbsolute();
+ }
+ return path;
}
protected IPath popDirectory() {
- int i = getDirectoryLevel();
- if (i != 0) {
- IPath dir = fDirectoryStack.lastElement();
- fDirectoryStack.removeElementAt(i - 1);
- return dir;
- }
- return new Path(""); //$NON-NLS-1$
- }
-
- protected int getDirectoryLevel() {
- return fDirectoryStack.size();
- }
-
- public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
- if (enterDir) {
- /* Sometimes make screws up the output, so
- * "leave" events can't be seen. Double-check level
- * here.
- */
- for (int parseLevel = getDirectoryLevel(); dirLevel < parseLevel; parseLevel = getDirectoryLevel()) {
- popDirectory();
- }
- pushDirectory(new Path(dir));
- } else {
- popDirectory();
- /* Could check to see if they match */
- }
- }
-
- public boolean reportProblems() {
- boolean reset = false;
- for (Iterator<Problem> iter = fErrors.iterator(); iter.hasNext(); ) {
- Problem problem = iter.next();
- if (problem.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
- reset = true;
- }
- if (problem.file == null) {
- fMarkerGenerator.addMarker(new ProblemMarkerInfo(
- project,
- problem.lineNumber,
- problem.description,
- problem.severity,
- problem.variableName));
- } else {
- fMarkerGenerator.addMarker(new ProblemMarkerInfo(
- problem.file,
- problem.lineNumber,
- problem.description,
- problem.severity,
- problem.variableName));
- }
- }
- fErrors.clear();
- return reset;
- }
-
- protected class Problem {
- protected IResource file;
- protected int lineNumber;
- protected String description;
- protected int severity;
- protected String variableName;
-
- public Problem(IResource file, int lineNumber, String desciption, int severity, String variableName) {
- this.file = file;
- this.lineNumber = lineNumber;
- this.description = desciption;
- this.severity = severity;
- this.variableName = variableName;
- }
- }
-
- /**
- * Called by the console line parsers to generate a problem marker.
- */
- public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
- // No need to collect markers if marker generator is not present
- if (fMarkerGenerator != null) {
- Problem problem = new Problem(file, lineNumber, desc, severity, varName);
- fErrors.add(problem);
- }
- }
+ int i = getDirectoryLevel();
+ if (i != 0) {
+ IPath dir = fDirectoryStack.lastElement();
+ fDirectoryStack.removeElementAt(i - 1);
+ return dir;
+ }
+ return new Path(""); //$NON-NLS-1$
+ }
+
+ protected int getDirectoryLevel() {
+ return fDirectoryStack.size();
+ }
+
+ public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
+ if (enterDir) {
+ /* Sometimes make screws up the output, so
+ * "leave" events can't be seen. Double-check level
+ * here.
+ */
+ for (int parseLevel = getDirectoryLevel(); dirLevel < parseLevel; parseLevel = getDirectoryLevel()) {
+ popDirectory();
+ }
+ pushDirectory(new Path(dir));
+ } else {
+ popDirectory();
+ /* Could check to see if they match */
+ }
+ }
+
+ public boolean reportProblems() {
+ boolean reset = false;
+ for (Iterator<Problem> iter = fErrors.iterator(); iter.hasNext();) {
+ Problem problem = iter.next();
+ if (problem.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
+ reset = true;
+ }
+ if (problem.file == null) {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(project, problem.lineNumber, problem.description,
+ problem.severity, problem.variableName));
+ } else {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(problem.file, problem.lineNumber, problem.description,
+ problem.severity, problem.variableName));
+ }
+ }
+ fErrors.clear();
+ return reset;
+ }
+
+ protected class Problem {
+ protected IResource file;
+ protected int lineNumber;
+ protected String description;
+ protected int severity;
+ protected String variableName;
+
+ public Problem(IResource file, int lineNumber, String desciption, int severity, String variableName) {
+ this.file = file;
+ this.lineNumber = lineNumber;
+ this.description = desciption;
+ this.severity = severity;
+ this.variableName = variableName;
+ }
+ }
+
+ /**
+ * Called by the console line parsers to generate a problem marker.
+ */
+ public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
+ // No need to collect markers if marker generator is not present
+ if (fMarkerGenerator != null) {
+ Problem problem = new Problem(file, lineNumber, desc, severity, varName);
+ fErrors.add(problem);
+ }
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
index be42b3bedde..354248e07ef 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
@@ -33,99 +33,96 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-
/**
* GCC per file build output parser
*
* @author vhirsl
*/
public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
- private final static String[] FILE_EXTENSIONS = {
- ".c", ".cc", ".cpp", ".cxx", ".C", ".CC", ".CPP", ".CXX" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- };
- private final static List<String> FILE_EXTENSIONS_LIST = Arrays.asList(FILE_EXTENSIONS);
+ private final static String[] FILE_EXTENSIONS = { ".c", ".cc", ".cpp", ".cxx", ".C", ".CC", ".CPP", ".CXX" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ };
+ private final static List<String> FILE_EXTENSIONS_LIST = Arrays.asList(FILE_EXTENSIONS);
- private GCCPerFileBOPConsoleParserUtility fUtil;
+ private GCCPerFileBOPConsoleParserUtility fUtil;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
- */
- @Override
- public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
- fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
- new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
- super.startup(project, collector);
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
+ */
+ @Override
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
+ fUtil = (project != null && workingDirectory != null && markerGenerator != null)
+ ? new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator)
+ : null;
+ super.startup(project, collector);
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#getUtility()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#getUtility()
+ */
+ @Override
protected AbstractGCCBOPConsoleParserUtility getUtility() {
- return fUtil;
- }
+ return fUtil;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#processSingleLine(java.lang.String)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#processSingleLine(java.lang.String)
+ */
+ @Override
protected boolean processCommand(String[] tokens) {
- // GCC C/C++ compiler invocation
- int compilerInvocationIndex= findCompilerInvocation(tokens);
- if (compilerInvocationIndex < 0) {
- return false;
- }
+ // GCC C/C++ compiler invocation
+ int compilerInvocationIndex = findCompilerInvocation(tokens);
+ if (compilerInvocationIndex < 0) {
+ return false;
+ }
- // find a file name
- int extensionsIndex = -1;
- boolean found = false;
- String filePath = null;
- for (int i = compilerInvocationIndex+1; i < tokens.length; i++) {
- String token= tokens[i];
- int k = token.lastIndexOf('.');
- if (k != -1 && (token.length() - k < 5)) {
- String fileExtension = token.substring(k);
- extensionsIndex = FILE_EXTENSIONS_LIST.indexOf(fileExtension);
- if (extensionsIndex != -1) {
- filePath = token;
- found = true;
- break;
- }
- }
- }
- if (!found) {
- TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
- return false;
- }
- // sanity check
- if (filePath==null || filePath.indexOf(FILE_EXTENSIONS[extensionsIndex]) == -1) {
- TraceUtil.outputTrace("Error identifying file name :2", tokens, TraceUtil.EOL); //$NON-NLS-1$
- return false;
- }
- if (fUtil != null) {
- IPath pFilePath = fUtil.getAbsolutePath(filePath);
- String shortFileName = pFilePath.removeFileExtension().lastSegment();
+ // find a file name
+ int extensionsIndex = -1;
+ boolean found = false;
+ String filePath = null;
+ for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
+ String token = tokens[i];
+ int k = token.lastIndexOf('.');
+ if (k != -1 && (token.length() - k < 5)) {
+ String fileExtension = token.substring(k);
+ extensionsIndex = FILE_EXTENSIONS_LIST.indexOf(fileExtension);
+ if (extensionsIndex != -1) {
+ filePath = token;
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ // sanity check
+ if (filePath == null || filePath.indexOf(FILE_EXTENSIONS[extensionsIndex]) == -1) {
+ TraceUtil.outputTrace("Error identifying file name :2", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ if (fUtil != null) {
+ IPath pFilePath = fUtil.getAbsolutePath(filePath);
+ String shortFileName = pFilePath.removeFileExtension().lastSegment();
- // generalize occurrences of the file name
- for (int i = compilerInvocationIndex+1; i < tokens.length; i++) {
+ // generalize occurrences of the file name
+ for (int i = compilerInvocationIndex + 1; i < tokens.length; i++) {
String token = tokens[i];
if (token.equals("-include")) { //$NON-NLS-1$
++i;
- }
- else if (token.equals("-imacros")) { //$NON-NLS-1$
+ } else if (token.equals("-imacros")) { //$NON-NLS-1$
++i;
- }
- else if (token.equals(filePath)) {
- tokens[i]= "LONG_NAME"; //$NON-NLS-1$
- }
- else if (token.startsWith(shortFileName)) {
- tokens[i]= "SHORT_NAME" + token.substring(shortFileName.length()); //$NON-NLS-1$
+ } else if (token.equals(filePath)) {
+ tokens[i] = "LONG_NAME"; //$NON-NLS-1$
+ } else if (token.startsWith(shortFileName)) {
+ tokens[i] = "SHORT_NAME" + token.substring(shortFileName.length()); //$NON-NLS-1$
}
}
- IFile file= null;
- IPath baseDirectory= fUtil.getBaseDirectory();
- if (baseDirectory.isPrefixOf(pFilePath) || baseDirectory.setDevice(null).isPrefixOf(pFilePath)) {
+ IFile file = null;
+ IPath baseDirectory = fUtil.getBaseDirectory();
+ if (baseDirectory.isPrefixOf(pFilePath) || baseDirectory.setDevice(null).isPrefixOf(pFilePath)) {
IPath relPath = pFilePath.removeFirstSegments(baseDirectory.segmentCount());
//Note: We add the scanner-config even if the resource doesn't actually
//exist below this project (which may happen when reading existing
@@ -133,22 +130,22 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
//and may not exist at the time of analyzing the config but re-built
//later on.
//if (getProject().exists(relPath)) {
- file = getProject().getFile(relPath);
- } else {
- // search linked resources
- final IProject prj= fUtil.getProject();
- file= ResourceLookup.selectFileForLocation(pFilePath, prj);
- }
- if (file != null) {
- CCommandDSC cmd = fUtil.getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0);
- List<CCommandDSC> cmdList = new CopyOnWriteArrayList<CCommandDSC>();
- cmdList.add(cmd);
- Map<ScannerInfoTypes, List<CCommandDSC>> sc = new HashMap<ScannerInfoTypes, List<CCommandDSC>>(1);
- sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
- getCollector().contributeToScannerConfig(file, sc);
- } else
- TraceUtil.outputError("Build command for file outside project: "+pFilePath.toString(), tokens); //$NON-NLS-1$
- }
- return true;
- }
+ file = getProject().getFile(relPath);
+ } else {
+ // search linked resources
+ final IProject prj = fUtil.getProject();
+ file = ResourceLookup.selectFileForLocation(pFilePath, prj);
+ }
+ if (file != null) {
+ CCommandDSC cmd = fUtil.getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0);
+ List<CCommandDSC> cmdList = new CopyOnWriteArrayList<CCommandDSC>();
+ cmdList.add(cmd);
+ Map<ScannerInfoTypes, List<CCommandDSC>> sc = new HashMap<ScannerInfoTypes, List<CCommandDSC>>(1);
+ sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
+ getCollector().contributeToScannerConfig(file, sc);
+ } else
+ TraceUtil.outputError("Build command for file outside project: " + pFilePath.toString(), tokens); //$NON-NLS-1$
+ }
+ return true;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
index a0a1031a29e..51774fab885 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
@@ -33,262 +33,253 @@ import org.eclipse.core.runtime.Path;
/**
* TODO Provide description
- *
+ *
* @author vhirsl
*/
public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsoleParserUtility {
- private Map<String, List<Map<String, List<String>>>> directoryCommandListMap;
- private List<String> compiledFileList;
-
- private List<CCommandDSC> commandsList2;
-
- private int workingDirsN = 0;
- private int commandsN = 0;
- private int filesN = 0;
- private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$
+ private Map<String, List<Map<String, List<String>>>> directoryCommandListMap;
+ private List<String> compiledFileList;
+ private List<CCommandDSC> commandsList2;
- public GCCPerFileBOPConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) {
- super(project, workingDirectory, markerGenerator);
- }
+ private int workingDirsN = 0;
+ private int commandsN = 0;
+ private int filesN = 0;
+ private String fDefaultMacroDefinitionValue = "1"; //$NON-NLS-1$
- void addGenericCommandForFile(String longFileName, String genericCommand) {
- // if a file name has already been added once, return
- if (compiledFileList.contains(longFileName))
- return;
- compiledFileList.add(longFileName);
-
- String workingDir = getWorkingDirectory().toString();
- List<Map<String, List<String>>> directoryCommandList = directoryCommandListMap.get(workingDir);
- if (directoryCommandList == null) {
- directoryCommandList = new CopyOnWriteArrayList<Map<String, List<String>>>();
- directoryCommandListMap.put(workingDir, directoryCommandList);
- ++workingDirsN;
- }
- Map<String, List<String>> command21FileListMap = null;
- for (Map<String, List<String>> map : directoryCommandList) {
- command21FileListMap = map;
- List<String> fileList = command21FileListMap.get(genericCommand);
- if (fileList != null) {
- if (!fileList.contains(longFileName)) {
- fileList.add(longFileName);
- ++filesN;
- }
- return;
- }
- }
- command21FileListMap = new HashMap<String, List<String>>(1);
- directoryCommandList.add(command21FileListMap);
- ++commandsN;
- List<String> fileList = new CopyOnWriteArrayList<String>();
- command21FileListMap.put(genericCommand, fileList);
- fileList.add(longFileName);
- ++filesN;
- }
+ public GCCPerFileBOPConsoleParserUtility(IProject project, IPath workingDirectory,
+ IMarkerGenerator markerGenerator) {
+ super(project, workingDirectory, markerGenerator);
+ }
- /**
- *
- */
- void generateReport() {
- TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
- "Generic command: '", "' applicable for:", //$NON-NLS-1$ //$NON-NLS-2$
- directoryCommandListMap);
- TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
- }
+ void addGenericCommandForFile(String longFileName, String genericCommand) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
- /**
- * Adds a mapping command line -> file, this time without a dir
- */
- void addGenericCommandForFile2(String longFileName, String genericLine) {
- // if a file name has already been added once, return
- if (compiledFileList.contains(longFileName))
- return;
- compiledFileList.add(longFileName);
+ String workingDir = getWorkingDirectory().toString();
+ List<Map<String, List<String>>> directoryCommandList = directoryCommandListMap.get(workingDir);
+ if (directoryCommandList == null) {
+ directoryCommandList = new CopyOnWriteArrayList<Map<String, List<String>>>();
+ directoryCommandListMap.put(workingDir, directoryCommandList);
+ ++workingDirsN;
+ }
+ Map<String, List<String>> command21FileListMap = null;
+ for (Map<String, List<String>> map : directoryCommandList) {
+ command21FileListMap = map;
+ List<String> fileList = command21FileListMap.get(genericCommand);
+ if (fileList != null) {
+ if (!fileList.contains(longFileName)) {
+ fileList.add(longFileName);
+ ++filesN;
+ }
+ return;
+ }
+ }
+ command21FileListMap = new HashMap<String, List<String>>(1);
+ directoryCommandList.add(command21FileListMap);
+ ++commandsN;
+ List<String> fileList = new CopyOnWriteArrayList<String>();
+ command21FileListMap.put(genericCommand, fileList);
+ fileList.add(longFileName);
+ ++filesN;
+ }
- String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$
- CCommandDSC command = getNewCCommandDSC(tokens, 0, false); // assume .c file type
- int index = commandsList2.indexOf(command);
- if (index == -1) {
- commandsList2.add(command);
- ++commandsN;
- }
- else {
- command = commandsList2.get(index);
- }
-// // add a file
-// command.addFile(longFileName);
-// ++filesN;
- }
+ /**
+ *
+ */
+ void generateReport() {
+ TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
+ "Generic command: '", "' applicable for:", //$NON-NLS-1$ //$NON-NLS-2$
+ directoryCommandListMap);
+ TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
+ }
+
+ /**
+ * Adds a mapping command line -> file, this time without a dir
+ */
+ void addGenericCommandForFile2(String longFileName, String genericLine) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
+
+ String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$
+ CCommandDSC command = getNewCCommandDSC(tokens, 0, false); // assume .c file type
+ int index = commandsList2.indexOf(command);
+ if (index == -1) {
+ commandsList2.add(command);
+ ++commandsN;
+ } else {
+ command = commandsList2.get(index);
+ }
+ // // add a file
+ // command.addFile(longFileName);
+ // ++filesN;
+ }
- /**
- * @return CCommandDSC compile command description
- */
- public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
+ /**
+ * @return CCommandDSC compile command description
+ */
+ public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
CopyOnWriteArrayList<KVStringPair> dirafter = new CopyOnWriteArrayList<KVStringPair>();
CopyOnWriteArrayList<String> includes = new CopyOnWriteArrayList<String>();
- CCommandDSC command = new CCommandDSC(cppFileType, getProject());
- command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
- for (int i = idxOfCompilerCommand+1; i < tokens.length; ++i) {
- String token = tokens[i];
- //Target specific options: see GccScannerInfoConsoleParser
- if (token.startsWith("-m") || //$NON-NLS-1$
- token.startsWith("--sysroot") || //$NON-NLS-1$
- token.equals("-ansi") || //$NON-NLS-1$
- token.equals("-posix") || //$NON-NLS-1$
- token.equals("-pthread") || //$NON-NLS-1$
- token.startsWith("-O") || //$NON-NLS-1$
- token.equals("-fno-inline") || //$NON-NLS-1$
- token.startsWith("-finline") || //$NON-NLS-1$
- token.equals("-fno-exceptions") || //$NON-NLS-1$
- token.equals("-fexceptions") || //$NON-NLS-1$
- token.equals("-fshort-wchar") || //$NON-NLS-1$
- token.equals("-fshort-double") || //$NON-NLS-1$
- token.equals("-fno-signed-char") || //$NON-NLS-1$
- token.equals("-fsigned-char") || //$NON-NLS-1$
- token.startsWith("-fabi-version=") //$NON-NLS-1$
- ) {
- command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
+ CCommandDSC command = new CCommandDSC(cppFileType, getProject());
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
+ for (int i = idxOfCompilerCommand + 1; i < tokens.length; ++i) {
+ String token = tokens[i];
+ //Target specific options: see GccScannerInfoConsoleParser
+ if (token.startsWith("-m") || //$NON-NLS-1$
+ token.startsWith("--sysroot") || //$NON-NLS-1$
+ token.equals("-ansi") || //$NON-NLS-1$
+ token.equals("-posix") || //$NON-NLS-1$
+ token.equals("-pthread") || //$NON-NLS-1$
+ token.startsWith("-O") || //$NON-NLS-1$
+ token.equals("-fno-inline") || //$NON-NLS-1$
+ token.startsWith("-finline") || //$NON-NLS-1$
+ token.equals("-fno-exceptions") || //$NON-NLS-1$
+ token.equals("-fexceptions") || //$NON-NLS-1$
+ token.equals("-fshort-wchar") || //$NON-NLS-1$
+ token.equals("-fshort-double") || //$NON-NLS-1$
+ token.equals("-fno-signed-char") || //$NON-NLS-1$
+ token.equals("-fsigned-char") || //$NON-NLS-1$
+ token.startsWith("-fabi-version=") //$NON-NLS-1$
+ ) {
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
continue;
- }
- for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) {
- final SCDOptionsEnum optionKind = SCDOptionsEnum.getSCDOptionsEnum(j);
+ }
+ for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) {
+ final SCDOptionsEnum optionKind = SCDOptionsEnum.getSCDOptionsEnum(j);
if (token.startsWith(optionKind.toString())) {
- String option = token.substring(
- optionKind.toString().length()).trim();
- if (option.length() > 0) {
- // ex. -I/dir
- }
- else if (optionKind.equals(SCDOptionsEnum.IDASH)) {
- for (String inc : includes) {
- option = inc;
- KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
- command.addSCOption(pair);
- }
- includes = new CopyOnWriteArrayList<String>();
- // -I- has no parameter
- }
- else {
- // ex. -I /dir
- // take a next token
- if (i+1 < tokens.length && !tokens[i+1].startsWith("-")) { //$NON-NLS-1$
- option = tokens[++i];
- }
- else break;
- }
-
- if (option.length() > 0 && (
- optionKind.equals(SCDOptionsEnum.INCLUDE) ||
- optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) ||
- optionKind.equals(SCDOptionsEnum.IMACROS_FILE) ||
- optionKind.equals(SCDOptionsEnum.IDIRAFTER) ||
- optionKind.equals(SCDOptionsEnum.ISYSTEM) ||
- optionKind.equals(SCDOptionsEnum.IQUOTE) )) {
- option = (getAbsolutePath(option)).toString();
- }
-
- if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
- KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
- dirafter.add(pair);
- }
- else if (optionKind.equals(SCDOptionsEnum.INCLUDE)) {
- includes.add(option);
- }
- else { // add the pair
- if (optionKind.equals(SCDOptionsEnum.DEFINE)) {
- if (option.indexOf('=') == -1) {
- option += '='+ fDefaultMacroDefinitionValue;
- }
- }
- KVStringPair pair = new KVStringPair(optionKind.toString(), option);
- command.addSCOption(pair);
- }
- break;
- }
- }
- }
- for (String option : includes) {
- KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
- command.addSCOption(pair);
- }
- for (KVStringPair kvStringPair : dirafter) {
- command.addSCOption(kvStringPair);
- }
- return command;
- }
+ String option = token.substring(optionKind.toString().length()).trim();
+ if (option.length() > 0) {
+ // ex. -I/dir
+ } else if (optionKind.equals(SCDOptionsEnum.IDASH)) {
+ for (String inc : includes) {
+ option = inc;
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
+ command.addSCOption(pair);
+ }
+ includes = new CopyOnWriteArrayList<String>();
+ // -I- has no parameter
+ } else {
+ // ex. -I /dir
+ // take a next token
+ if (i + 1 < tokens.length && !tokens[i + 1].startsWith("-")) { //$NON-NLS-1$
+ option = tokens[++i];
+ } else
+ break;
+ }
+
+ if (option.length() > 0 && (optionKind.equals(SCDOptionsEnum.INCLUDE)
+ || optionKind.equals(SCDOptionsEnum.INCLUDE_FILE)
+ || optionKind.equals(SCDOptionsEnum.IMACROS_FILE)
+ || optionKind.equals(SCDOptionsEnum.IDIRAFTER) || optionKind.equals(SCDOptionsEnum.ISYSTEM)
+ || optionKind.equals(SCDOptionsEnum.IQUOTE))) {
+ option = (getAbsolutePath(option)).toString();
+ }
- public void setDefaultMacroDefinitionValue(String val) {
- if (val != null) {
- fDefaultMacroDefinitionValue= val;
- }
+ if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ dirafter.add(pair);
+ } else if (optionKind.equals(SCDOptionsEnum.INCLUDE)) {
+ includes.add(option);
+ } else { // add the pair
+ if (optionKind.equals(SCDOptionsEnum.DEFINE)) {
+ if (option.indexOf('=') == -1) {
+ option += '=' + fDefaultMacroDefinitionValue;
+ }
+ }
+ KVStringPair pair = new KVStringPair(optionKind.toString(), option);
+ command.addSCOption(pair);
+ }
+ break;
+ }
+ }
+ }
+ for (String option : includes) {
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ command.addSCOption(pair);
+ }
+ for (KVStringPair kvStringPair : dirafter) {
+ command.addSCOption(kvStringPair);
+ }
+ return command;
+ }
+
+ public void setDefaultMacroDefinitionValue(String val) {
+ if (val != null) {
+ fDefaultMacroDefinitionValue = val;
+ }
}
/**
- * @param filePath : String
- * @return filePath : IPath - not <code>null</code>
- */
- public IPath getAbsolutePath(String filePath) {
- IPath pFilePath;
- if (filePath.startsWith("/")) { //$NON-NLS-1$
- pFilePath = convertCygpath(new Path(filePath));
- } else if (filePath.startsWith("\\") || //$NON-NLS-1$
- (!filePath.startsWith(".") && //$NON-NLS-1$
- filePath.length() > 2 && filePath.charAt(1) == ':' &&
- (filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
- // absolute path
- pFilePath = new Path(filePath);
- } else {
- // relative path
- IPath cwd = getWorkingDirectory();
- if (!cwd.isAbsolute()) {
- cwd = getBaseDirectory().append(cwd);
- }
- if (filePath.startsWith("`pwd`")) { //$NON-NLS-1$
- if (filePath.length() > 5 && (filePath.charAt(5) == '/' || filePath.charAt(5) == '\\')) {
- filePath = filePath.substring(6);
- }
- else {
- filePath = filePath.substring(5);
- }
- }
- pFilePath = cwd.append(filePath);
- }
-
- if (pFilePath.getDevice()==null) {
- pFilePath = pFilePath.setDevice(getWorkingDirectory().getDevice());
- }
- return pFilePath;
- }
+ * @param filePath : String
+ * @return filePath : IPath - not <code>null</code>
+ */
+ public IPath getAbsolutePath(String filePath) {
+ IPath pFilePath;
+ if (filePath.startsWith("/")) { //$NON-NLS-1$
+ pFilePath = convertCygpath(new Path(filePath));
+ } else if (filePath.startsWith("\\") || //$NON-NLS-1$
+ (!filePath.startsWith(".") && //$NON-NLS-1$
+ filePath.length() > 2 && filePath.charAt(1) == ':'
+ && (filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
+ // absolute path
+ pFilePath = new Path(filePath);
+ } else {
+ // relative path
+ IPath cwd = getWorkingDirectory();
+ if (!cwd.isAbsolute()) {
+ cwd = getBaseDirectory().append(cwd);
+ }
+ if (filePath.startsWith("`pwd`")) { //$NON-NLS-1$
+ if (filePath.length() > 5 && (filePath.charAt(5) == '/' || filePath.charAt(5) == '\\')) {
+ filePath = filePath.substring(6);
+ } else {
+ filePath = filePath.substring(5);
+ }
+ }
+ pFilePath = cwd.append(filePath);
+ }
- /**
- *
- */
-// void generateReport2() {
-// StringWriter buffer = new StringWriter();
-// PrintWriter writer = new PrintWriter(buffer);
-// for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
-// CCommandDSC cmd = (CCommandDSC)i.next();
-// writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
-// Integer.toString(cmd.getNumberOfFiles()) + " files: ");
-// List filesList = cmd.getFilesList();
-// if (filesList != null) {
-// for (Iterator j = filesList.iterator(); j.hasNext(); ) {
-// writer.println(" " + (String)j.next());
-// }
-// }
-// }
-// writer.close();
-//
-// TraceUtil.metricsTrace(buffer.toString());
-// TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN);
-// }
+ if (pFilePath.getDevice() == null) {
+ pFilePath = pFilePath.setDevice(getWorkingDirectory().getDevice());
+ }
+ return pFilePath;
+ }
- /**
- * Returns all CCommandDSC collected so far.
- * Currently this list is not filled, so it will always return an empty list.
- * @return List of CCommandDSC
- */
- public List<CCommandDSC> getCCommandDSCList() {
- return new CopyOnWriteArrayList<CCommandDSC>(commandsList2);
- }
+ /**
+ *
+ */
+ // void generateReport2() {
+ // StringWriter buffer = new StringWriter();
+ // PrintWriter writer = new PrintWriter(buffer);
+ // for (Iterator i = commandsList2.iterator(); i.hasNext(); ) {
+ // CCommandDSC cmd = (CCommandDSC)i.next();
+ // writer.println("Stats for generic command: '" + cmd.getCommandAsString() + "' applicable for " +
+ // Integer.toString(cmd.getNumberOfFiles()) + " files: ");
+ // List filesList = cmd.getFilesList();
+ // if (filesList != null) {
+ // for (Iterator j = filesList.iterator(); j.hasNext(); ) {
+ // writer.println(" " + (String)j.next());
+ // }
+ // }
+ // }
+ // writer.close();
+ //
+ // TraceUtil.metricsTrace(buffer.toString());
+ // TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN);
+ // }
+
+ /**
+ * Returns all CCommandDSC collected so far.
+ * Currently this list is not filled, so it will always return an empty list.
+ * @return List of CCommandDSC
+ */
+ public List<CCommandDSC> getCCommandDSCList() {
+ return new CopyOnWriteArrayList<CCommandDSC>(commandsList2);
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
index a81b5cf780a..32d2ed6f4b8 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
@@ -33,107 +33,103 @@ import org.eclipse.core.runtime.IPath;
* @author vhirsl
*/
public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
- private final static String INCLUDE_PREAMBLE = "#include <...>"; //$NON-NLS-1$
- private final static String QUOTE_INCLUDE_PREAMBLE = "#include \"...\""; //$NON-NLS-1$
- private final static String DEFINE_PREAMBLE = "#define"; //$NON-NLS-1$
- private final static String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
- private final static String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String INCLUDE_PREAMBLE = "#include <...>"; //$NON-NLS-1$
+ private final static String QUOTE_INCLUDE_PREAMBLE = "#include \"...\""; //$NON-NLS-1$
+ private final static String DEFINE_PREAMBLE = "#define"; //$NON-NLS-1$
+ private final static String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
- private final static int NO_INCLUDES = 0;
- private final static int QUOTE_INCLUDES = 1;
- private final static int INCLUDES = 2;
+ private final static int NO_INCLUDES = 0;
+ private final static int QUOTE_INCLUDES = 1;
+ private final static int INCLUDES = 2;
- private IScannerInfoCollector fCollector = null;
+ private IScannerInfoCollector fCollector = null;
- private int expectingIncludes = NO_INCLUDES;
- private List<String> symbols;
- private List<String> includes;
- private List<String> quoteIncludes;
- private int commandId = -1;
+ private int expectingIncludes = NO_INCLUDES;
+ private List<String> symbols;
+ private List<String> includes;
+ private List<String> quoteIncludes;
+ private int commandId = -1;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
- */
- @Override
- public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
- this.fCollector = collector;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
+ */
+ @Override
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
+ this.fCollector = collector;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
+ */
+ @Override
public boolean processLine(String line) {
- boolean rc = false;
- line= line.trim();
- TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$//$NON-NLS-2$
+ boolean rc = false;
+ line = line.trim();
+ TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$//$NON-NLS-2$
- if (line.startsWith(COMMAND_ID_BEGIN)) {
- commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
- symbols = new ArrayList<String>();
- includes = new ArrayList<String>();
- quoteIncludes = new ArrayList<String>();
- }
- else if (line.startsWith(COMMAND_ID_END)) {
- Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
- scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
- scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes);
- scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
- fCollector.contributeToScannerConfig(Integer.valueOf(commandId), scannerInfo);
- commandId = -1;
- rc = true;
- }
- // contribution of -dD option
- else if (line.startsWith(DEFINE_PREAMBLE)) {
- String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
- if (defineParts[0].equals(DEFINE_PREAMBLE)) {
- String symbol = null;
- switch (defineParts.length) {
- case 2:
- symbol = defineParts[1];
- break;
- case 3:
- symbol = defineParts[1] + "=" + defineParts[2]; //$NON-NLS-1$
- break;
- }
- if (symbol != null && !symbols.contains(symbol)) {
- symbols.add(symbol);
- }
- }
- }
- // now get all the includes
- else if (line.startsWith(QUOTE_INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
- expectingIncludes = QUOTE_INCLUDES;
- }
- else if (line.startsWith(INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
- expectingIncludes = INCLUDES;
- }
- else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
- expectingIncludes = NO_INCLUDES;
- }
- else if (expectingIncludes == QUOTE_INCLUDES) {
- if (!quoteIncludes.contains(line))
- quoteIncludes.add(line);
- }
- else if (expectingIncludes == INCLUDES) {
- if (!includes.contains(line))
- includes.add(line);
- }
+ if (line.startsWith(COMMAND_ID_BEGIN)) {
+ commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
+ symbols = new ArrayList<String>();
+ includes = new ArrayList<String>();
+ quoteIncludes = new ArrayList<String>();
+ } else if (line.startsWith(COMMAND_ID_END)) {
+ Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
+ scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
+ scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes);
+ scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ fCollector.contributeToScannerConfig(Integer.valueOf(commandId), scannerInfo);
+ commandId = -1;
+ rc = true;
+ }
+ // contribution of -dD option
+ else if (line.startsWith(DEFINE_PREAMBLE)) {
+ String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
+ if (defineParts[0].equals(DEFINE_PREAMBLE)) {
+ String symbol = null;
+ switch (defineParts.length) {
+ case 2:
+ symbol = defineParts[1];
+ break;
+ case 3:
+ symbol = defineParts[1] + "=" + defineParts[2]; //$NON-NLS-1$
+ break;
+ }
+ if (symbol != null && !symbols.contains(symbol)) {
+ symbols.add(symbol);
+ }
+ }
+ }
+ // now get all the includes
+ else if (line.startsWith(QUOTE_INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = QUOTE_INCLUDES;
+ } else if (line.startsWith(INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = INCLUDES;
+ } else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
+ expectingIncludes = NO_INCLUDES;
+ } else if (expectingIncludes == QUOTE_INCLUDES) {
+ if (!quoteIncludes.contains(line))
+ quoteIncludes.add(line);
+ } else if (expectingIncludes == INCLUDES) {
+ if (!includes.contains(line))
+ includes.add(line);
+ }
- return rc;
- }
+ return rc;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
+ */
+ @Override
public void shutdown() {
-// Map scannerInfo = new HashMap();
-// scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
-// scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
-// fCollector.contributeToScannerConfig(fProject, scannerInfo);
-// TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
-// "Include paths", includes, new ArrayList(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
- }
+ // Map scannerInfo = new HashMap();
+ // scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
+ // scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ // fCollector.contributeToScannerConfig(fProject, scannerInfo);
+ // TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
+ // "Include paths", includes, new ArrayList(), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java
index 92b19e78584..4edcdf4815c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java
@@ -26,12 +26,12 @@ import org.eclipse.core.runtime.Status;
/**
* GCC related utility class
- *
+ *
* @author vhirsl
*/
public class GCCScannerConfigUtil {
- public static final String CPP_SPECS_FILE = "specs.cpp"; //$NON-NLS-1$
- public static final String C_SPECS_FILE = "specs.c"; //$NON-NLS-1$
+ public static final String CPP_SPECS_FILE = "specs.cpp"; //$NON-NLS-1$
+ public static final String C_SPECS_FILE = "specs.c"; //$NON-NLS-1$
public static void createSpecs() {
IPath path = MakeCorePlugin.getWorkingDirectory();
@@ -52,9 +52,8 @@ public class GCCScannerConfigUtil {
file.write('\n');
file.close();
} catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR,
- MakeCorePlugin.getUniqueIdentifier(), -1,
- MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$
}
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java
index 37e93a27391..e834b093a0f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java
@@ -40,179 +40,173 @@ import org.eclipse.core.runtime.Path;
public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
protected ScannerInfoConsoleParserUtility fUtil = null;
- private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
- */
- @Override
- public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
- fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
- new ScannerInfoConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
- super.startup(project, collector);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#getUtility()
- */
- @Override
- protected AbstractGCCBOPConsoleParserUtility getUtility() {
- return fUtil;
- }
-
- @Override
- protected boolean processCommand(String[] tokens) {
- int compilerInvocationIdx= findCompilerInvocation(tokens);
- if (compilerInvocationIdx<0) {
- return false;
- }
-
- if (compilerInvocationIdx+1 >= tokens.length) {
- return false;
- }
-
- // Recognized gcc or g++ compiler invocation
- List<String> includes = new CopyOnWriteArrayList<String>();
- List<String> symbols = new CopyOnWriteArrayList<String>();
- List<String> targetSpecificOptions = new CopyOnWriteArrayList<String>();
-
- String fileName = null;
- for (int j= compilerInvocationIdx+1; j < tokens.length; j++) {
+ private String fDefaultMacroDefinitionValue = "1"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
+ */
+ @Override
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
+ fUtil = (project != null && workingDirectory != null && markerGenerator != null)
+ ? new ScannerInfoConsoleParserUtility(project, workingDirectory, markerGenerator)
+ : null;
+ super.startup(project, collector);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#getUtility()
+ */
+ @Override
+ protected AbstractGCCBOPConsoleParserUtility getUtility() {
+ return fUtil;
+ }
+
+ @Override
+ protected boolean processCommand(String[] tokens) {
+ int compilerInvocationIdx = findCompilerInvocation(tokens);
+ if (compilerInvocationIdx < 0) {
+ return false;
+ }
+
+ if (compilerInvocationIdx + 1 >= tokens.length) {
+ return false;
+ }
+
+ // Recognized gcc or g++ compiler invocation
+ List<String> includes = new CopyOnWriteArrayList<String>();
+ List<String> symbols = new CopyOnWriteArrayList<String>();
+ List<String> targetSpecificOptions = new CopyOnWriteArrayList<String>();
+
+ String fileName = null;
+ for (int j = compilerInvocationIdx + 1; j < tokens.length; j++) {
String token = tokens[j];
if (token.equals(DASHIDASH)) {
- }
- else if (token.startsWith(DASHI)) {
- String candidate= null;
+ } else if (token.startsWith(DASHI)) {
+ String candidate = null;
if (token.length() > 2) {
- candidate= token.substring(2).trim();
- }
- else if (j+1 < tokens.length) {
- candidate= tokens[j+1];
+ candidate = token.substring(2).trim();
+ } else if (j + 1 < tokens.length) {
+ candidate = tokens[j + 1];
if (candidate.startsWith("-")) { //$NON-NLS-1$
- candidate= null;
- }
- else {
+ candidate = null;
+ } else {
j++;
}
}
if (candidate != null && candidate.length() > 0) {
if (fUtil != null) {
- candidate= fUtil.normalizePath(candidate);
+ candidate = fUtil.normalizePath(candidate);
}
if (!includes.contains(candidate)) {
includes.add(candidate);
}
}
- }
- else if (token.startsWith(DASHD)) {
- String candidate= null;
+ } else if (token.startsWith(DASHD)) {
+ String candidate = null;
if (token.length() > 2) {
- candidate= token.substring(2).trim();
- }
- else if (j+1 < tokens.length) {
- candidate= tokens[j+1];
+ candidate = token.substring(2).trim();
+ } else if (j + 1 < tokens.length) {
+ candidate = tokens[j + 1];
if (candidate.startsWith("-")) { //$NON-NLS-1$
- candidate= null;
- }
- else {
+ candidate = null;
+ } else {
j++;
}
}
- if (candidate != null && candidate.length() > 0) {
- if (candidate.indexOf('=') == -1) {
- candidate+= '='+ fDefaultMacroDefinitionValue;
- }
- if (!symbols.contains(candidate)) {
- symbols.add(candidate);
- }
- }
- }
- else if (token.startsWith("-m") || //$NON-NLS-1$
+ if (candidate != null && candidate.length() > 0) {
+ if (candidate.indexOf('=') == -1) {
+ candidate += '=' + fDefaultMacroDefinitionValue;
+ }
+ if (!symbols.contains(candidate)) {
+ symbols.add(candidate);
+ }
+ }
+ } else if (token.startsWith("-m") || //$NON-NLS-1$
token.startsWith("--sysroot") || //$NON-NLS-1$
- token.equals("-ansi") || //$NON-NLS-1$
- token.equals("-nostdinc") || //$NON-NLS-1$
- token.equals("-posix") || //$NON-NLS-1$
- token.equals("-pthread") || //$NON-NLS-1$
- token.startsWith("-O") || //$NON-NLS-1$
- token.equals("-fno-inline") || //$NON-NLS-1$
- token.startsWith("-finline") || //$NON-NLS-1$
- token.equals("-fno-exceptions") || //$NON-NLS-1$
- token.equals("-fexceptions") || //$NON-NLS-1$
- token.equals("-fshort-wchar") || //$NON-NLS-1$
- token.equals("-fshort-double") || //$NON-NLS-1$
- token.equals("-fno-signed-char") || //$NON-NLS-1$
- token.equals("-fsigned-char") || //$NON-NLS-1$
- token.startsWith("-fabi-version=")) { //$NON-NLS-1$
- if (!targetSpecificOptions.contains(token))
- targetSpecificOptions.add(token);
- }
- else if (fileName == null) {
- String possibleFileName = token.toLowerCase();
- if (possibleFileName.endsWith(".c") || //$NON-NLS-1$
- possibleFileName.endsWith(".cpp") || //$NON-NLS-1$
- possibleFileName.endsWith(".cc") || //$NON-NLS-1$
- possibleFileName.endsWith(".cxx") || //$NON-NLS-1$
- possibleFileName.endsWith(".C") || //$NON-NLS-1$
- possibleFileName.endsWith(".CPP") || //$NON-NLS-1$
- possibleFileName.endsWith(".CC") || //$NON-NLS-1$
- possibleFileName.endsWith(".CXX") || //$NON-NLS-1$
- possibleFileName.endsWith(".c++")) { //$NON-NLS-1$
- fileName = token;
- }
- }
- }
-
- if (fileName != null && fileName.startsWith("/cygdrive/")) { //$NON-NLS-1$
- fileName= AbstractGCCBOPConsoleParserUtility.convertCygpath(new Path(fileName)).toOSString();
- }
- if (fileName == null || fileName.trim().length()==0) {
- return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
- }
-
- IProject project = getProject();
- IFile file = null;
- List<String> translatedIncludes = new LinkedList<String>();
- translatedIncludes.addAll(includes);
- if (includes.size() > 0) {
- if (fUtil != null) {
- file = fUtil.findFile(fileName);
- if (file != null) {
- project = file.getProject();
- translatedIncludes = fUtil.translateRelativePaths(file, fileName, includes);
- }
- }
- if (file == null && fUtil != null) { // real world case
- // remove non-absolute include paths since there was no chance to translate them
- Iterator<String> iterator = translatedIncludes.iterator();
- while (iterator.hasNext()) {
- String include = iterator.next();
- IPath includePath = new Path(include);
- if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths
- iterator.remove();
- }
- }
- }
- }
-
- CopyOnWriteArrayList<String> translatedIncludesToPut = new CopyOnWriteArrayList<String>(translatedIncludes);
-
- // Contribute discovered includes and symbols to the ScannerInfoCollector
- if (translatedIncludesToPut.size() > 0 || symbols.size() > 0) {
- Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
- scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludesToPut);
- scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
- scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions);
- getCollector().contributeToScannerConfig(project, scannerInfo);
-
- TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
- "Include paths", includes, translatedIncludesToPut, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ token.equals("-ansi") || //$NON-NLS-1$
+ token.equals("-nostdinc") || //$NON-NLS-1$
+ token.equals("-posix") || //$NON-NLS-1$
+ token.equals("-pthread") || //$NON-NLS-1$
+ token.startsWith("-O") || //$NON-NLS-1$
+ token.equals("-fno-inline") || //$NON-NLS-1$
+ token.startsWith("-finline") || //$NON-NLS-1$
+ token.equals("-fno-exceptions") || //$NON-NLS-1$
+ token.equals("-fexceptions") || //$NON-NLS-1$
+ token.equals("-fshort-wchar") || //$NON-NLS-1$
+ token.equals("-fshort-double") || //$NON-NLS-1$
+ token.equals("-fno-signed-char") || //$NON-NLS-1$
+ token.equals("-fsigned-char") || //$NON-NLS-1$
+ token.startsWith("-fabi-version=")) { //$NON-NLS-1$
+ if (!targetSpecificOptions.contains(token))
+ targetSpecificOptions.add(token);
+ } else if (fileName == null) {
+ String possibleFileName = token.toLowerCase();
+ if (possibleFileName.endsWith(".c") || //$NON-NLS-1$
+ possibleFileName.endsWith(".cpp") || //$NON-NLS-1$
+ possibleFileName.endsWith(".cc") || //$NON-NLS-1$
+ possibleFileName.endsWith(".cxx") || //$NON-NLS-1$
+ possibleFileName.endsWith(".C") || //$NON-NLS-1$
+ possibleFileName.endsWith(".CPP") || //$NON-NLS-1$
+ possibleFileName.endsWith(".CC") || //$NON-NLS-1$
+ possibleFileName.endsWith(".CXX") || //$NON-NLS-1$
+ possibleFileName.endsWith(".c++")) { //$NON-NLS-1$
+ fileName = token;
+ }
+ }
+ }
+
+ if (fileName != null && fileName.startsWith("/cygdrive/")) { //$NON-NLS-1$
+ fileName = AbstractGCCBOPConsoleParserUtility.convertCygpath(new Path(fileName)).toOSString();
+ }
+ if (fileName == null || fileName.trim().length() == 0) {
+ return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
+ }
+
+ IProject project = getProject();
+ IFile file = null;
+ List<String> translatedIncludes = new LinkedList<String>();
+ translatedIncludes.addAll(includes);
+ if (includes.size() > 0) {
+ if (fUtil != null) {
+ file = fUtil.findFile(fileName);
+ if (file != null) {
+ project = file.getProject();
+ translatedIncludes = fUtil.translateRelativePaths(file, fileName, includes);
+ }
+ }
+ if (file == null && fUtil != null) { // real world case
+ // remove non-absolute include paths since there was no chance to translate them
+ Iterator<String> iterator = translatedIncludes.iterator();
+ while (iterator.hasNext()) {
+ String include = iterator.next();
+ IPath includePath = new Path(include);
+ if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths
+ iterator.remove();
+ }
+ }
+ }
+ }
+
+ CopyOnWriteArrayList<String> translatedIncludesToPut = new CopyOnWriteArrayList<String>(translatedIncludes);
+
+ // Contribute discovered includes and symbols to the ScannerInfoCollector
+ if (translatedIncludesToPut.size() > 0 || symbols.size() > 0) {
+ Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>();
+ scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludesToPut);
+ scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions);
+ getCollector().contributeToScannerConfig(project, scannerInfo);
+
+ TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
+ "Include paths", includes, translatedIncludesToPut, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
+ }
return true;
}
- public void setDefaultMacroDefinitionValue(String val) {
- if (val != null) {
- fDefaultMacroDefinitionValue= val;
- }
+ public void setDefaultMacroDefinitionValue(String val) {
+ if (val != null) {
+ fDefaultMacroDefinitionValue = val;
+ }
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java
index 593809b4d1e..48c69b69534 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java
@@ -48,7 +48,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
protected List<String> includes = new ArrayList<String>();
@Override
- public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
this.fProject = project;
this.fCollector = collector;
}
@@ -58,9 +59,9 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
*/
@Override
public boolean processLine(String line) {
- TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
- line= line.trim();
+ line = line.trim();
if (line.length() == 0) {
return false;
}
@@ -83,7 +84,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
defineParts[2] = line.substring(i + 1).trim();
}
} else {
- MakeCorePlugin.log(new Exception("GCCSpecsConsoleParser ERROR: Unmatched brackets: ["+ line+ "]")); //$NON-NLS-1$ //$NON-NLS-2$
+ MakeCorePlugin
+ .log(new Exception("GCCSpecsConsoleParser ERROR: Unmatched brackets: [" + line + "]")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -103,11 +105,9 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
// now get all the includes
else if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
expectingIncludes = true;
- }
- else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
+ } else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
expectingIncludes = false;
- }
- else if (expectingIncludes) {
+ } else if (expectingIncludes) {
if (!includes.contains(line))
includes.add(line);
}
@@ -130,8 +130,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
fCollector.contributeToScannerConfig(fProject, scannerInfo);
}
}
- TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
- "Include paths", includes, new ArrayList<String>(0), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
+ TraceUtil.outputTrace("Scanner info from \'specs\' file", //$NON-NLS-1$
+ "Include paths", includes, new ArrayList<String>(0), "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/ScannerInfoConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/ScannerInfoConsoleParserUtility.java
index 5307c788a37..0e270d2c62f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/ScannerInfoConsoleParserUtility.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/ScannerInfoConsoleParserUtility.java
@@ -39,7 +39,7 @@ import org.eclipse.core.runtime.Path;
/**
* Implements error reporting mechanism and file/path translation mechanism
* Taken from ErrorParserManager and modified.
- *
+ *
* @author vhirsl
*/
public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParserUtility {
@@ -49,10 +49,10 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
private Map<String, IFile> fFilesInProject;
private List<IResource> fCollectedFiles;
private List<String> fNameConflicts;
-
+
public ScannerInfoConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) {
- super(project, workingDirectory, markerGenerator);
-
+ super(project, workingDirectory, markerGenerator);
+
fFilesInProject = new HashMap<String, IFile>();
fCollectedFiles = new ArrayList<IResource>();
fNameConflicts = new ArrayList<String>();
@@ -67,7 +67,7 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
}
}
}
-
+
/**
* Called by the console line parsers to find a file with a given name.
* @return IFile or null
@@ -81,21 +81,21 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
// If there is a conflict then try all files in the project.
if (isConflictingName(fileName)) {
file = null;
-
+
// Create a problem marker
final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$
TraceUtil.outputError(error, fileName);
- generateMarker(getProject(), -1, error+fileName, IMarkerGenerator.SEVERITY_WARNING, null);
+ generateMarker(getProject(), -1, error + fileName, IMarkerGenerator.SEVERITY_WARNING, null);
}
}
}
-
- if (file!=null) {
+
+ if (file != null) {
IPath filePath = new Path(fileName);
- if(filePath.segment(0).compareTo("..") == 0) { //$NON-NLS-1$
+ if (filePath.segment(0).compareTo("..") == 0) { //$NON-NLS-1$
filePath = filePath.removeFirstSegments(1);
}
-
+
String foundLocation = file.getLocationURI().toString();
if (!foundLocation.endsWith(filePath.toString())) {
file = null;
@@ -103,7 +103,7 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
}
return file;
}
-
+
/**
* @return file in workspace as {@link IFile} or {@code null} if not found
*/
@@ -155,10 +155,10 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
IFile file = null;
if (path.isAbsolute()) {
IWorkspaceRoot root = getProject().getWorkspace().getRoot();
- file = root.getFileForLocation(path);
+ file = root.getFileForLocation(path);
// It may be a link resource so we must check it also.
if (file == null) {
- file= ResourceLookup.selectFileForLocation(path, getProject());
+ file = ResourceLookup.selectFileForLocation(path, getProject());
}
} else {
file = getProject().getFile(path);
@@ -194,16 +194,17 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
if (includePath.isUNC()) {
// do not translate UNC paths
} else if (includePath.isAbsolute()) {
- if (includePath.getDevice()==null) {
+ if (includePath.getDevice() == null) {
String device = getWorkingDirectory().getDevice();
IPath candidatePath = includePath.setDevice(device);
File dir = candidatePath.toFile();
if (dir.exists()) {
include = candidatePath.toString();
} else {
- final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
+ final String error = MakeMessages
+ .getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
TraceUtil.outputError(error, include);
-// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ // generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
}
}
} else {
@@ -212,10 +213,10 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
if (!cwd.isAbsolute()) {
cwd = getBaseDirectory().append(cwd);
}
-
+
IPath filePath = new Path(fileName);
if (filePath.isAbsolute()) {
- if (filePath.getDevice()==null) {
+ if (filePath.getDevice() == null) {
String device = getWorkingDirectory().getDevice();
filePath = filePath.setDevice(device);
}
@@ -228,35 +229,35 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
if (!filePath.toString().equalsIgnoreCase(fileLocation.toString())) {
// must be the cwd is wrong
// check if file name starts with ".."
- if (fileName.startsWith("..")) { //$NON-NLS-1$
+ if (fileName.startsWith("..")) { //$NON-NLS-1$
// probably multiple choices for cwd, hopeless
final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$
TraceUtil.outputError(error, fileName);
- generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
break;
- }
- else {
- // remove common segments at the end
+ } else {
+ // remove common segments at the end
IPath tPath = new Path(fileName);
- if (fileName.startsWith(".")) { //$NON-NLS-1$
+ if (fileName.startsWith(".")) { //$NON-NLS-1$
tPath = tPath.removeFirstSegments(1);
}
// get the file path from the file
filePath = fileLocation;
- IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
+ IPath lastFileSegment = filePath
+ .removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) {
cwd = filePath.removeLastSegments(tPath.segmentCount());
}
}
}
-
+
IPath candidatePath = cwd.append(includePath);
File dir = candidatePath.toFile();
include = candidatePath.toString();
if (!dir.exists()) {
final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
TraceUtil.outputError(error, include);
-// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ // generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
}
}
// TODO VMIR for now add unresolved paths as well
@@ -272,25 +273,25 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
if (Character.isLowerCase(driveLetter)) {
StringBuilder sb = new StringBuilder();
if (column - 1 > 0) {
- sb.append(path.substring(0, column-1));
+ sb.append(path.substring(0, column - 1));
}
sb.append(Character.toUpperCase(driveLetter));
sb.append(path.substring(column));
path = sb.toString();
}
}
- if (path.indexOf('.') == -1 || path.equals(".")) { //$NON-NLS-1$
- return (new Path(path)).toString(); // convert separators to '/'
+ if (path.indexOf('.') == -1 || path.equals(".")) { //$NON-NLS-1$
+ return (new Path(path)).toString(); // convert separators to '/'
}
// lose "./" segments since they confuse the Path normalization
StringBuilder buf = new StringBuilder(path);
int len = buf.length();
StringBuilder newBuf = new StringBuilder(buf.length());
int scp = 0; // starting copy point
- int ssp = 0; // starting search point
+ int ssp = 0; // starting search point
int sdot;
boolean validPrefix;
- while (ssp < len && (sdot = buf.indexOf(".", ssp)) != -1) { //$NON-NLS-1$
+ while (ssp < len && (sdot = buf.indexOf(".", ssp)) != -1) { //$NON-NLS-1$
validPrefix = false;
int ddot = buf.indexOf("..", ssp);//$NON-NLS-1$
if (sdot < ddot || ddot == -1) {
@@ -305,26 +306,23 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
if (validPrefix && nextChar == '/') {
++ssp;
scp = ssp;
- }
- else if (validPrefix && nextChar == '\\') {
+ } else if (validPrefix && nextChar == '\\') {
++ssp;
if (ssp < len - 1 && buf.charAt(ssp) == '\\') {
++ssp;
}
scp = ssp;
- }
- else {
+ } else {
// no path delimiter, must be '.' inside the path
scp = ssp - 1;
}
}
- }
- else if (sdot == ddot) {
+ } else if (sdot == ddot) {
ssp = sdot + 2;
}
}
newBuf.append(buf.substring(scp, len));
-
+
IPath orgPath = new Path(newBuf.toString());
return orgPath.toString();
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/BuildOutputReaderJob.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/BuildOutputReaderJob.java
index 7e0f969f881..222144cf6fd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/BuildOutputReaderJob.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/BuildOutputReaderJob.java
@@ -26,46 +26,47 @@ import org.eclipse.core.runtime.jobs.Job;
/**
* Build output reader job
- *
+ *
* @author vhirsl
*/
public class BuildOutputReaderJob extends Job {
private static final String JOB_NAME = "Build Output Reader"; //$NON-NLS-1$
-
- private IResource resource;
- private InfoContext context;
- private IScannerConfigBuilderInfo2 buildInfo;
- public BuildOutputReaderJob(IProject project, IScannerConfigBuilderInfo2 buildInfo) {
- this(project, buildInfo.getContext(), buildInfo);
- }
+ private IResource resource;
+ private InfoContext context;
+ private IScannerConfigBuilderInfo2 buildInfo;
- public BuildOutputReaderJob(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo) {
- super(JOB_NAME);
- this.resource = project;
- this.context = context;
- this.buildInfo = buildInfo;
- setUser(true);
- }
+ public BuildOutputReaderJob(IProject project, IScannerConfigBuilderInfo2 buildInfo) {
+ this(project, buildInfo.getContext(), buildInfo);
+ }
- /* (non-Javadoc)
+ public BuildOutputReaderJob(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo) {
+ super(JOB_NAME);
+ this.resource = project;
+ this.context = context;
+ this.buildInfo = buildInfo;
+ setUser(true);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
- IProject project = resource.getProject();
- monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
- project.getName());
+ IProject project = resource.getProject();
+ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ project.getName());
+
+ boolean rc = SCJobsUtil.readBuildOutputFile(project, context, buildInfo, new SubProgressMonitor(monitor, 70));
+ rc |= SCJobsUtil.getProviderScannerInfo(project, context, buildInfo, new SubProgressMonitor(monitor, 20));
+ if (rc) {
+ rc = SCJobsUtil.updateScannerConfiguration(project, context, buildInfo,
+ new SubProgressMonitor(monitor, 10));
+ }
- boolean rc = SCJobsUtil.readBuildOutputFile(project, context, buildInfo, new SubProgressMonitor(monitor, 70));
- rc |= SCJobsUtil.getProviderScannerInfo(project, context, buildInfo, new SubProgressMonitor(monitor, 20));
- if (rc) {
- rc = SCJobsUtil.updateScannerConfiguration(project, context, buildInfo, new SubProgressMonitor(monitor, 10));
- }
-
- monitor.done();
- return (rc == true) ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ monitor.done();
+ return (rc == true) ? Status.OK_STATUS : Status.CANCEL_STATUS;
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java
index 3a15bf6211d..ea4126a38f8 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java
@@ -41,170 +41,166 @@ import org.eclipse.core.runtime.SafeRunner;
* @author vhirsl
*/
public class SCJobsUtil {
- private static class RC {
- public RC(boolean init) {
- rc = init;
- }
- /**
- * @return Returns the rc.
- */
- public boolean get() {
- return rc;
- }
- /**
- * @param rc The rc to set.
- */
- public void set(boolean rc) {
- this.rc = rc;
- }
-
- @Override
+ private static class RC {
+ public RC(boolean init) {
+ rc = init;
+ }
+
+ /**
+ * @return Returns the rc.
+ */
+ public boolean get() {
+ return rc;
+ }
+
+ /**
+ * @param rc The rc to set.
+ */
+ public void set(boolean rc) {
+ this.rc = rc;
+ }
+
+ @Override
public String toString() {
- return rc ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- private boolean rc;
- }
- /**
- * Call ESI providers to get scanner info
- */
- public static boolean getProviderScannerInfo(final IProject project,
- final IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
- return getProviderScannerInfo(project, buildInfo.getContext(), buildInfo, monitor);
- }
-
- public static boolean getProviderScannerInfo(final IProject project,
- final InfoContext context,
- final IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
-
- final RC rc = new RC(false);
- // get the collector
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, context, buildInfo.getSelectedProfileId());
- final IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
-
- List<String> providerIds = buildInfo.getProviderIdList();
- for (int i = 0; i < providerIds.size(); ++i) {
- final String providerId = providerIds.get(i);
- if (buildInfo.isProviderOutputParserEnabled(providerId)) {
- final IExternalScannerInfoProvider esiProvider = profileInstance.
- createExternalScannerInfoProvider(providerId);
- if (esiProvider != null) {
- ISafeRunnable runnable = new ISafeRunnable() {
-
- @Override
+ return rc ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private boolean rc;
+ }
+
+ /**
+ * Call ESI providers to get scanner info
+ */
+ public static boolean getProviderScannerInfo(final IProject project, final IScannerConfigBuilderInfo2 buildInfo,
+ final IProgressMonitor monitor) {
+ return getProviderScannerInfo(project, buildInfo.getContext(), buildInfo, monitor);
+ }
+
+ public static boolean getProviderScannerInfo(final IProject project, final InfoContext context,
+ final IScannerConfigBuilderInfo2 buildInfo, final IProgressMonitor monitor) {
+
+ final RC rc = new RC(false);
+ // get the collector
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ context, buildInfo.getSelectedProfileId());
+ final IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+
+ List<String> providerIds = buildInfo.getProviderIdList();
+ for (int i = 0; i < providerIds.size(); ++i) {
+ final String providerId = providerIds.get(i);
+ if (buildInfo.isProviderOutputParserEnabled(providerId)) {
+ final IExternalScannerInfoProvider esiProvider = profileInstance
+ .createExternalScannerInfoProvider(providerId);
+ if (esiProvider != null) {
+ ISafeRunnable runnable = new ISafeRunnable() {
+
+ @Override
public void run() {
- // TODO we need the environment for the project here...
- ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
- ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
- IEnvironmentVariableManager envVarManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
- IEnvironmentVariable[] envVars = envVarManager.getVariables(configDesc, true);
- Properties env = new Properties();
- for (int i = 0; i < envVars.length; ++i) {
- IEnvironmentVariable envVar = envVars[i];
- env.put(envVar.getName(), envVar.getValue());
- }
- esiProvider.invokeProvider(monitor, project, context, providerId, buildInfo, collector, env);
- rc.set(true);
- }
-
- @Override
+ // TODO we need the environment for the project here...
+ ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
+ ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
+ IEnvironmentVariableManager envVarManager = CCorePlugin.getDefault()
+ .getBuildEnvironmentManager();
+ IEnvironmentVariable[] envVars = envVarManager.getVariables(configDesc, true);
+ Properties env = new Properties();
+ for (int i = 0; i < envVars.length; ++i) {
+ IEnvironmentVariable envVar = envVars[i];
+ env.put(envVar.getName(), envVar.getValue());
+ }
+ esiProvider.invokeProvider(monitor, project, context, providerId, buildInfo, collector,
+ env);
+ rc.set(true);
+ }
+
+ @Override
public void handleException(Throwable exception) {
- rc.set(false);
- MakeCorePlugin.log(exception);
- }
-
- };
- SafeRunner.run(runnable);
- }
- }
- }
- return rc.get();
- }
-
- /**
- * Update and persist scanner configuration
- */
- public static boolean updateScannerConfiguration(IProject project,
- IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
- return updateScannerConfiguration(project, buildInfo.getContext(), buildInfo, monitor);
- }
-
- /**
- * Update and persist scanner configuration
- */
- public static boolean updateScannerConfiguration(IProject project,
- InfoContext context,
- IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
- final RC rc = new RC(false);
- // get the collector
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, context, buildInfo.getSelectedProfileId());
- IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
- if (collector instanceof IScannerInfoCollector2) {
- final IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
- ISafeRunnable runnable = new ISafeRunnable() {
-
- @Override
+ rc.set(false);
+ MakeCorePlugin.log(exception);
+ }
+
+ };
+ SafeRunner.run(runnable);
+ }
+ }
+ }
+ return rc.get();
+ }
+
+ /**
+ * Update and persist scanner configuration
+ */
+ public static boolean updateScannerConfiguration(IProject project, IScannerConfigBuilderInfo2 buildInfo,
+ final IProgressMonitor monitor) {
+ return updateScannerConfiguration(project, buildInfo.getContext(), buildInfo, monitor);
+ }
+
+ /**
+ * Update and persist scanner configuration
+ */
+ public static boolean updateScannerConfiguration(IProject project, InfoContext context,
+ IScannerConfigBuilderInfo2 buildInfo, final IProgressMonitor monitor) {
+ final RC rc = new RC(false);
+ // get the collector
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ context, buildInfo.getSelectedProfileId());
+ IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+ if (collector instanceof IScannerInfoCollector2) {
+ final IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
+ ISafeRunnable runnable = new ISafeRunnable() {
+
+ @Override
public void run() throws Exception {
- collector2.updateScannerConfiguration(monitor);
- rc.set(true);
- }
+ collector2.updateScannerConfiguration(monitor);
+ rc.set(true);
+ }
- @Override
+ @Override
public void handleException(Throwable exception) {
- rc.set(false);
- MakeCorePlugin.log(exception);
- }
-
- };
- SafeRunner.run(runnable);
- }
-
- return rc.get();
- }
-
- public static boolean readBuildOutputFile(final IProject project,
- final IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
- return readBuildOutputFile(project, buildInfo.getContext(), buildInfo, monitor);
- }
-
- public static boolean readBuildOutputFile(final IProject project,
- final InfoContext context,
- final IScannerConfigBuilderInfo2 buildInfo,
- final IProgressMonitor monitor) {
- final RC rc = new RC(false);
- // get the collector
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, context, buildInfo.getSelectedProfileId());
- final IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
- final IExternalScannerInfoProvider esiProvider = profileInstance.
- createBuildOutputProvider();
-
- if (buildInfo.isBuildOutputFileActionEnabled()) {
- ISafeRunnable runnable = new ISafeRunnable() {
-
- @Override
+ rc.set(false);
+ MakeCorePlugin.log(exception);
+ }
+
+ };
+ SafeRunner.run(runnable);
+ }
+
+ return rc.get();
+ }
+
+ public static boolean readBuildOutputFile(final IProject project, final IScannerConfigBuilderInfo2 buildInfo,
+ final IProgressMonitor monitor) {
+ return readBuildOutputFile(project, buildInfo.getContext(), buildInfo, monitor);
+ }
+
+ public static boolean readBuildOutputFile(final IProject project, final InfoContext context,
+ final IScannerConfigBuilderInfo2 buildInfo, final IProgressMonitor monitor) {
+ final RC rc = new RC(false);
+ // get the collector
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ context, buildInfo.getSelectedProfileId());
+ final IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+ final IExternalScannerInfoProvider esiProvider = profileInstance.createBuildOutputProvider();
+
+ if (buildInfo.isBuildOutputFileActionEnabled()) {
+ ISafeRunnable runnable = new ISafeRunnable() {
+
+ @Override
public void run() {
- esiProvider.invokeProvider(monitor, project, context, null, buildInfo, collector, null);
- rc.set(true);
- }
+ esiProvider.invokeProvider(monitor, project, context, null, buildInfo, collector, null);
+ rc.set(true);
+ }
- @Override
+ @Override
public void handleException(Throwable exception) {
- rc.set(false);
- MakeCorePlugin.log(exception);
- }
+ rc.set(false);
+ MakeCorePlugin.log(exception);
+ }
- };
- SafeRunner.run(runnable);
- }
+ };
+ SafeRunner.run(runnable);
+ }
- return rc.get();
- }
+ return rc.get();
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index a3df4120477..c8ec3492bfa 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -33,58 +33,56 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/**
- * Class that represents a compiler command and related scanner configuration
- *
+ * Class that represents a compiler command and related scanner configuration
+ *
* @author vhirsl
*/
public class CCommandDSC {
- protected final static String SINGLE_SPACE = " "; //$NON-NLS-1$
- protected final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
- protected final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
- protected final static String OPTION_ELEM = "option"; //$NON-NLS-1$
- protected final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
- protected final static String KEY_ATTR = "key"; //$NON-NLS-1$
- protected final static String VALUE_ATTR = "value"; //$NON-NLS-1$
- protected final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
- protected final static String KIND_ATTR = "kind"; //$NON-NLS-1$
-
+ protected final static String SINGLE_SPACE = " "; //$NON-NLS-1$
+ protected final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
+ protected final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
+ protected final static String OPTION_ELEM = "option"; //$NON-NLS-1$
+ protected final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
+ protected final static String KEY_ATTR = "key"; //$NON-NLS-1$
+ protected final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ protected final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
+ protected final static String KIND_ATTR = "kind"; //$NON-NLS-1$
+
protected int commandId;
- protected List<KVStringPair> compilerCommand; // members are KVStringPair objects
+ protected List<KVStringPair> compilerCommand; // members are KVStringPair objects
protected boolean discovered;
- protected boolean cppFileType; // C or C++ file type
+ protected boolean cppFileType; // C or C++ file type
protected IProject project;
- protected List<String> symbols;
- protected List<String> includes;
- protected List<String> quoteIncludes;
+ protected List<String> symbols;
+ protected List<String> includes;
+ protected List<String> quoteIncludes;
public CCommandDSC(boolean cppFileType) {
this(cppFileType, null);
}
-
+
public CCommandDSC(boolean cppFileType, IProject project) {
compilerCommand = new ArrayList<KVStringPair>();
discovered = false;
this.cppFileType = cppFileType;
-
- symbols = new ArrayList<String>();
- includes = new ArrayList<String>();
- quoteIncludes = new ArrayList<String>();
- this.project = project;
+
+ symbols = new ArrayList<String>();
+ includes = new ArrayList<String>();
+ quoteIncludes = new ArrayList<String>();
+ this.project = project;
+ }
+
+ public boolean appliesToCPPFileType() {
+ return cppFileType;
}
- public boolean appliesToCPPFileType() {
- return cppFileType;
- }
-
public void addSCOption(KVStringPair option) {
- if (project != null &&
- (option.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()) ||
- option.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
- option.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
- option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString()) ||
- option.getKey().equals(SCDOptionsEnum.IQUOTE.toString())))
- {
+ if (project != null && (option.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString())
+ || option.getKey().equals(SCDOptionsEnum.INCLUDE.toString())
+ || option.getKey().equals(SCDOptionsEnum.ISYSTEM.toString())
+ || option.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())
+ || option.getKey().equals(SCDOptionsEnum.IQUOTE.toString()))) {
String value = option.getValue();
value = CygpathTranslator.translateIncludePaths(project, Collections.singletonList(value)).get(0);
value = SafeStringInterner.safeIntern(makeRelative(project, new Path(value)).toOSString());
@@ -92,39 +90,40 @@ public class CCommandDSC {
}
compilerCommand.add(option);
}
-
- public Integer getCommandIdAsInteger() {
- return Integer.valueOf(getCommandId());
- }
- /**
- * @return Returns the commandId.
- */
- public int getCommandId() {
- return commandId;
- }
- /**
- * @param commandId The commandId to set.
- */
- public void setCommandId(int commandId) {
- this.commandId = commandId;
- }
-
+
+ public Integer getCommandIdAsInteger() {
+ return Integer.valueOf(getCommandId());
+ }
+
+ /**
+ * @return Returns the commandId.
+ */
+ public int getCommandId() {
+ return commandId;
+ }
+
+ /**
+ * @param commandId The commandId to set.
+ */
+ public void setCommandId(int commandId) {
+ this.commandId = commandId;
+ }
+
@Override
public String toString() {
String commandAsString = ""; //$NON-NLS-1$
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next();
String value = optionPair.getValue();
- commandAsString += optionPair.getKey() + SINGLE_SPACE +
- value + SINGLE_SPACE;
+ commandAsString += optionPair.getKey() + SINGLE_SPACE + value + SINGLE_SPACE;
}
return commandAsString.trim();
}
-
+
public int getId() {
return commandId;
}
-
+
/**
* Returns a command where -imacros and -include options have been removed
* @param quoteIncludePaths whether or not paths for includes must be put inside double quotes.
@@ -132,99 +131,96 @@ public class CCommandDSC {
*/
public String getSCDRunnableCommand(boolean quoteIncludePaths, boolean quoteDefines) {
String commandAsString = ""; //$NON-NLS-1$
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next();
- if (optionPair.getKey().equals(SCDOptionsEnum.COMMAND.toString())) {
- commandAsString += optionPair.getValue() + SINGLE_SPACE;
- }
- else {
- // skip -include and -imacros options
- if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString()) ||
- optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()))
- continue;
- String value = optionPair.getValue();
- if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE.toString()) ||
- optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString()) ||
- optionPair.getKey().equals(SCDOptionsEnum.IQUOTE.toString())) {
- value = makeAbsolute(project, value);
- if (quoteIncludePaths) {
- value= "\"" + value + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (quoteDefines && optionPair.getKey().equals(SCDOptionsEnum.DEFINE.toString())) {
- if (value.indexOf('\'') == -1) {
- value= "'" + value + "'"; //$NON-NLS-1$//$NON-NLS-2$
- }
- else {
- value= value.replaceAll("\"", "\\\\\""); //$NON-NLS-1$//$NON-NLS-2$
- value= "\"" + value + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- commandAsString += optionPair.getKey() + SINGLE_SPACE + value + SINGLE_SPACE;
- }
+ if (optionPair.getKey().equals(SCDOptionsEnum.COMMAND.toString())) {
+ commandAsString += optionPair.getValue() + SINGLE_SPACE;
+ } else {
+ // skip -include and -imacros options
+ if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())
+ || optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString()))
+ continue;
+ String value = optionPair.getValue();
+ if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE.toString())
+ || optionPair.getKey().equals(SCDOptionsEnum.ISYSTEM.toString())
+ || optionPair.getKey().equals(SCDOptionsEnum.IQUOTE.toString())) {
+ value = makeAbsolute(project, value);
+ if (quoteIncludePaths) {
+ value = "\"" + value + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else if (quoteDefines && optionPair.getKey().equals(SCDOptionsEnum.DEFINE.toString())) {
+ if (value.indexOf('\'') == -1) {
+ value = "'" + value + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ value = value.replaceAll("\"", "\\\\\""); //$NON-NLS-1$//$NON-NLS-2$
+ value = "\"" + value + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ commandAsString += optionPair.getKey() + SINGLE_SPACE + value + SINGLE_SPACE;
+ }
}
return commandAsString.trim();
}
-
+
/**
* @return the compiler command
*/
public String getCompilerName() {
String compiler = ""; //$NON-NLS-1$
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next();
- if (optionPair.getKey().equals(SCDOptionsEnum.COMMAND.toString())) {
- compiler = optionPair.getValue();
- break;
- }
+ if (optionPair.getKey().equals(SCDOptionsEnum.COMMAND.toString())) {
+ compiler = optionPair.getValue();
+ break;
+ }
}
return compiler.trim();
}
-
+
/**
* @return list of strings
*/
public List<String> getImacrosFile() {
List<String> imacrosFiles = new ArrayList<String>();
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next();
if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())) {
- imacrosFiles.add(makeAbsolute(project,optionPair.getValue()));
+ imacrosFiles.add(makeAbsolute(project, optionPair.getValue()));
}
}
return imacrosFiles;
}
-
+
/**
* @return list of strings
*/
public List<String> getIncludeFile() {
List<String> includeFiles = new ArrayList<String>();
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next();
if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString())) {
- includeFiles.add(makeAbsolute(project,optionPair.getValue()));
+ includeFiles.add(makeAbsolute(project, optionPair.getValue()));
}
}
return includeFiles;
}
-
-// public List getFilesList() {
-// return files;
-// }
-
+
+ // public List getFilesList() {
+ // return files;
+ // }
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object arg0) {
if (arg0 != null && arg0.getClass().equals(this.getClass())) {
- CCommandDSC other = (CCommandDSC)arg0;
- return (compilerCommand.equals(other.compilerCommand) &&
- cppFileType == other.cppFileType);
+ CCommandDSC other = (CCommandDSC) arg0;
+ return (compilerCommand.equals(other.compilerCommand) && cppFileType == other.cppFileType);
}
return false;
}
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@@ -233,167 +229,170 @@ public class CCommandDSC {
return compilerCommand.hashCode();
}
- /**
- * @return Returns the includes as strings.
- */
- public List<String> getIncludes() {
- return makeAbsolute(project, includes);
- }
- /**
- * @param includes The includes to set.
- */
- public void setIncludes(List<String> includes) {
- this.includes = includes;
- }
- /**
- * @return Returns the quote include paths as strings (for #include "...")
- */
- public List<String> getQuoteIncludes() {
- return makeAbsolute(project, quoteIncludes);
- }
- /**
- * @param includes - quote include paths (for #include "...")
- */
- public void setQuoteIncludes(List<String> includes) {
- quoteIncludes = includes;
- }
- /**
- * @return Returns the symbols.
- */
- public List<String> getSymbols() {
- return symbols;
- }
- /**
- * @param symbols The symbols to set.
- */
- public void setSymbols(List<String> symbols) {
- this.symbols = symbols;
- }
- /**
- * @return Returns the discovered.
- */
- public boolean isDiscovered() {
- return discovered;
- }
- /**
- * @param discovered The discovered to set.
- */
- public void setDiscovered(boolean discovered) {
- this.discovered = discovered;
- }
-
- public void serialize(Element cmdElem) {
- Document doc = cmdElem.getOwnerDocument();
- // serialize the command
- Element cmdDescElem = doc.createElement(CMD_DESCRIPTION_ELEM);
- for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext(); ) {
- Element optionElem = doc.createElement(OPTION_ELEM);
- KVStringPair option = i.next();
- optionElem.setAttribute(KEY_ATTR, option.getKey());
- optionElem.setAttribute(VALUE_ATTR, option.getValue());
- cmdDescElem.appendChild(optionElem);
- }
- cmdElem.appendChild(cmdDescElem);
- // serialize includes and symbols
- Element siElem = doc.createElement(CMD_SI_ELEM);
- for (Iterator<String> j = quoteIncludes.iterator(); j.hasNext(); ) {
- Element siItem = doc.createElement(SI_ITEM_ELEM);
- siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
- siItem.setAttribute(VALUE_ATTR, j.next());
- siItem.setAttribute(QUOTE_INCLUDE_ATTR, "true"); //$NON-NLS-1$
- siElem.appendChild(siItem);
- }
- for (Iterator<String> j = includes.iterator(); j.hasNext(); ) {
- Element siItem = doc.createElement(SI_ITEM_ELEM);
- siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
- siItem.setAttribute(VALUE_ATTR, j.next());
- siElem.appendChild(siItem);
- }
- for (Iterator<String> j = symbols.iterator(); j.hasNext(); ) {
- Element siItem = doc.createElement(SI_ITEM_ELEM);
- siItem.setAttribute(KIND_ATTR, "SYMBOL_DEFINITION"); //$NON-NLS-1$
- siItem.setAttribute(VALUE_ATTR, j.next());
- siElem.appendChild(siItem);
- }
- cmdElem.appendChild(siElem);
- }
-
- public void deserialize(Element cmdElem) {
- // read command options
- NodeList descList = cmdElem.getElementsByTagName(CMD_DESCRIPTION_ELEM);
- if (descList.getLength() > 0) {
- Element descElem = (Element) descList.item(0);
- NodeList optionList = descElem.getElementsByTagName(OPTION_ELEM);
- for (int i = 0; i < optionList.getLength(); ++i) {
- Element optionElem = (Element) optionList.item(i);
- String key = SafeStringInterner.safeIntern(optionElem.getAttribute(KEY_ATTR));
- String value = SafeStringInterner.safeIntern(optionElem.getAttribute(VALUE_ATTR));
- KVStringPair option = new KVStringPair(key, value);
- addSCOption(option);
- }
- }
- // read associated scanner info
- NodeList siList = cmdElem.getElementsByTagName(CMD_SI_ELEM);
- if (siList.getLength() > 0) {
- Element siElem = (Element) siList.item(0);
- NodeList siItemList = siElem.getElementsByTagName(SI_ITEM_ELEM);
- for (int i = 0; i < siItemList.getLength(); ++i) {
- Element siItemElem = (Element) siItemList.item(i);
- String kind = siItemElem.getAttribute(KIND_ATTR);
- String value = siItemElem.getAttribute(VALUE_ATTR);
- String quote = siItemElem.getAttribute(QUOTE_INCLUDE_ATTR);
- if (kind.equals("INCLUDE_PATH")) { //$NON-NLS-1$
- if (quote.equals("true")) { //$NON-NLS-1$
- quoteIncludes.add(SafeStringInterner.safeIntern(value));
- }
- else {
- includes.add(value);
- }
- }
- else if (kind.equals("SYMBOL_DEFINITION")) { //$NON-NLS-1$
- symbols.add(SafeStringInterner.safeIntern(value));
- }
- }
- setDiscovered(true);
- }
- }
-
- public void resolveOptions(IProject project) {
- if (!isDiscovered()) {
- // that's wrong for sure, options cannot be resolved fron the optionPairs??
- ArrayList<String> symbols = new ArrayList<String>();
- ArrayList<String> includes = new ArrayList<String>();
- ArrayList<String> quoteincludes = new ArrayList<String>();
- for (Iterator<KVStringPair> options = compilerCommand.iterator(); options.hasNext(); ) {
- KVStringPair optionPair = options.next();
- String key = optionPair.getKey();
- String value = optionPair.getValue();
- if (key.equals(SCDOptionsEnum.INCLUDE.toString()) || key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
- includes.add(SafeStringInterner.safeIntern(value));
- }
- else if (key.equals(SCDOptionsEnum.IQUOTE.toString())) {
- quoteincludes.add(SafeStringInterner.safeIntern(value));
- }
- else if (key.equals(SCDOptionsEnum.DEFINE.toString())) {
- symbols.add(SafeStringInterner.safeIntern(value));
- }
- }
- setIncludes(includes);
- setQuoteIncludes(quoteincludes);
- setSymbols(symbols);
- }
- setDiscovered(true);
- }
-
+ /**
+ * @return Returns the includes as strings.
+ */
+ public List<String> getIncludes() {
+ return makeAbsolute(project, includes);
+ }
+
+ /**
+ * @param includes The includes to set.
+ */
+ public void setIncludes(List<String> includes) {
+ this.includes = includes;
+ }
+
+ /**
+ * @return Returns the quote include paths as strings (for #include "...")
+ */
+ public List<String> getQuoteIncludes() {
+ return makeAbsolute(project, quoteIncludes);
+ }
+
+ /**
+ * @param includes - quote include paths (for #include "...")
+ */
+ public void setQuoteIncludes(List<String> includes) {
+ quoteIncludes = includes;
+ }
+
+ /**
+ * @return Returns the symbols.
+ */
+ public List<String> getSymbols() {
+ return symbols;
+ }
+
+ /**
+ * @param symbols The symbols to set.
+ */
+ public void setSymbols(List<String> symbols) {
+ this.symbols = symbols;
+ }
+
+ /**
+ * @return Returns the discovered.
+ */
+ public boolean isDiscovered() {
+ return discovered;
+ }
+
+ /**
+ * @param discovered The discovered to set.
+ */
+ public void setDiscovered(boolean discovered) {
+ this.discovered = discovered;
+ }
+
+ public void serialize(Element cmdElem) {
+ Document doc = cmdElem.getOwnerDocument();
+ // serialize the command
+ Element cmdDescElem = doc.createElement(CMD_DESCRIPTION_ELEM);
+ for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
+ Element optionElem = doc.createElement(OPTION_ELEM);
+ KVStringPair option = i.next();
+ optionElem.setAttribute(KEY_ATTR, option.getKey());
+ optionElem.setAttribute(VALUE_ATTR, option.getValue());
+ cmdDescElem.appendChild(optionElem);
+ }
+ cmdElem.appendChild(cmdDescElem);
+ // serialize includes and symbols
+ Element siElem = doc.createElement(CMD_SI_ELEM);
+ for (Iterator<String> j = quoteIncludes.iterator(); j.hasNext();) {
+ Element siItem = doc.createElement(SI_ITEM_ELEM);
+ siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
+ siItem.setAttribute(VALUE_ATTR, j.next());
+ siItem.setAttribute(QUOTE_INCLUDE_ATTR, "true"); //$NON-NLS-1$
+ siElem.appendChild(siItem);
+ }
+ for (Iterator<String> j = includes.iterator(); j.hasNext();) {
+ Element siItem = doc.createElement(SI_ITEM_ELEM);
+ siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
+ siItem.setAttribute(VALUE_ATTR, j.next());
+ siElem.appendChild(siItem);
+ }
+ for (Iterator<String> j = symbols.iterator(); j.hasNext();) {
+ Element siItem = doc.createElement(SI_ITEM_ELEM);
+ siItem.setAttribute(KIND_ATTR, "SYMBOL_DEFINITION"); //$NON-NLS-1$
+ siItem.setAttribute(VALUE_ATTR, j.next());
+ siElem.appendChild(siItem);
+ }
+ cmdElem.appendChild(siElem);
+ }
+
+ public void deserialize(Element cmdElem) {
+ // read command options
+ NodeList descList = cmdElem.getElementsByTagName(CMD_DESCRIPTION_ELEM);
+ if (descList.getLength() > 0) {
+ Element descElem = (Element) descList.item(0);
+ NodeList optionList = descElem.getElementsByTagName(OPTION_ELEM);
+ for (int i = 0; i < optionList.getLength(); ++i) {
+ Element optionElem = (Element) optionList.item(i);
+ String key = SafeStringInterner.safeIntern(optionElem.getAttribute(KEY_ATTR));
+ String value = SafeStringInterner.safeIntern(optionElem.getAttribute(VALUE_ATTR));
+ KVStringPair option = new KVStringPair(key, value);
+ addSCOption(option);
+ }
+ }
+ // read associated scanner info
+ NodeList siList = cmdElem.getElementsByTagName(CMD_SI_ELEM);
+ if (siList.getLength() > 0) {
+ Element siElem = (Element) siList.item(0);
+ NodeList siItemList = siElem.getElementsByTagName(SI_ITEM_ELEM);
+ for (int i = 0; i < siItemList.getLength(); ++i) {
+ Element siItemElem = (Element) siItemList.item(i);
+ String kind = siItemElem.getAttribute(KIND_ATTR);
+ String value = siItemElem.getAttribute(VALUE_ATTR);
+ String quote = siItemElem.getAttribute(QUOTE_INCLUDE_ATTR);
+ if (kind.equals("INCLUDE_PATH")) { //$NON-NLS-1$
+ if (quote.equals("true")) { //$NON-NLS-1$
+ quoteIncludes.add(SafeStringInterner.safeIntern(value));
+ } else {
+ includes.add(value);
+ }
+ } else if (kind.equals("SYMBOL_DEFINITION")) { //$NON-NLS-1$
+ symbols.add(SafeStringInterner.safeIntern(value));
+ }
+ }
+ setDiscovered(true);
+ }
+ }
+
+ public void resolveOptions(IProject project) {
+ if (!isDiscovered()) {
+ // that's wrong for sure, options cannot be resolved fron the optionPairs??
+ ArrayList<String> symbols = new ArrayList<String>();
+ ArrayList<String> includes = new ArrayList<String>();
+ ArrayList<String> quoteincludes = new ArrayList<String>();
+ for (Iterator<KVStringPair> options = compilerCommand.iterator(); options.hasNext();) {
+ KVStringPair optionPair = options.next();
+ String key = optionPair.getKey();
+ String value = optionPair.getValue();
+ if (key.equals(SCDOptionsEnum.INCLUDE.toString()) || key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
+ includes.add(SafeStringInterner.safeIntern(value));
+ } else if (key.equals(SCDOptionsEnum.IQUOTE.toString())) {
+ quoteincludes.add(SafeStringInterner.safeIntern(value));
+ } else if (key.equals(SCDOptionsEnum.DEFINE.toString())) {
+ symbols.add(SafeStringInterner.safeIntern(value));
+ }
+ }
+ setIncludes(includes);
+ setQuoteIncludes(quoteincludes);
+ setSymbols(symbols);
+ }
+ setDiscovered(true);
+ }
+
public static IPath makeRelative(IProject project, IPath path) {
IResource resource = findResource(project, path);
if (resource != null) {
if (resource.getProject() == project) {
path = resource.getProjectRelativePath();
}
-// else {
-// path = resource.getFullPath();
-// }
+ // else {
+ // path = resource.getFullPath();
+ // }
}
return path;
}
@@ -404,7 +403,7 @@ public class CCommandDSC {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
resource = root.findMember(path, false);
if (resource == null) {
- resource= ResourceLookup.selectFileForLocation(path, project);
+ resource = ResourceLookup.selectFileForLocation(path, project);
}
}
return resource;
@@ -412,7 +411,7 @@ public class CCommandDSC {
public static List<String> makeRelative(IProject project, List<String> paths) {
List<String> list = new ArrayList<String>(paths.size());
- for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
+ for (Iterator<String> iter = paths.iterator(); iter.hasNext();) {
String path = iter.next();
path = makeRelative(project, new Path(path)).toOSString();
list.add(SafeStringInterner.safeIntern(path));
@@ -420,7 +419,6 @@ public class CCommandDSC {
return list;
}
-
public static final String makeAbsolute(IProject project, String path) {
IPath ppath = new Path(path);
if (project != null && !ppath.isAbsolute()) {
@@ -435,14 +433,14 @@ public class CCommandDSC {
path = ppath.toOSString();
}
}
-// path = new File(project.getLocation().toOSString(), path).getAbsolutePath();
+ // path = new File(project.getLocation().toOSString(), path).getAbsolutePath();
}
return SafeStringInterner.safeIntern(path);
}
public static List<String> makeAbsolute(IProject project, List<String> paths) {
List<String> list = new ArrayList<String>(paths.size());
- for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
+ for (Iterator<String> iter = paths.iterator(); iter.hasNext();) {
String path = iter.next();
path = makeAbsolute(project, path);
list.add(SafeStringInterner.safeIntern(path));
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java
index c19dfd95f6b..5ed1a7e566a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java
@@ -42,7 +42,7 @@ import org.eclipse.core.runtime.Platform;
/**
* Use binary parser's 'cygpath' command to translate cygpaths to absolute paths.
* Note that this class does not support build configurations.
- *
+ *
* @author vhirsl
*/
public class CygpathTranslator {
@@ -63,8 +63,7 @@ public class CygpathTranslator {
} catch (ClassCastException e) {
}
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
}
}
@@ -72,7 +71,7 @@ public class CygpathTranslator {
// first check if cygpath translation is needed at all
boolean translationNeeded = false;
if (Platform.getOS().equals(Platform.OS_WIN32)) {
- for (Iterator<String> i = sumIncludes.iterator(); i.hasNext(); ) {
+ for (Iterator<String> i = sumIncludes.iterator(); i.hasNext();) {
String include = i.next();
if (include.startsWith("/")) { //$NON-NLS-1$
translationNeeded = true;
@@ -113,22 +112,20 @@ public class CygpathTranslator {
}
List<String> translatedIncludePaths = new ArrayList<String>();
- for (Iterator<String> i = sumIncludes.iterator(); i.hasNext(); ) {
+ for (Iterator<String> i = sumIncludes.iterator(); i.hasNext();) {
String includePath = i.next();
IPath realPath = new Path(includePath);
// only allow native pathes if they have a device prefix
// to avoid matches on the current drive, e.g. /usr/bin = C:\\usr\\bin
if (realPath.getDevice() != null && realPath.toFile().exists()) {
translatedIncludePaths.add(includePath);
- }
- else {
+ } else {
String translatedPath = includePath;
if (useCygPathExtension) {
try {
translatedPath = cygpath.cygPath.getFileName(includePath);
- }
- catch (IOException e) {
+ } catch (IOException e) {
TraceUtil.outputError("CygpathTranslator unable to translate path: ", includePath); //$NON-NLS-1$
}
} else if (useCygwinFromPath) {
@@ -141,9 +138,10 @@ public class CygpathTranslator {
// try default conversions
// /cygdrive/x/ --> X:\
if ("cygdrive".equals(realPath.segment(0))) { //$NON-NLS-1$
- String drive= realPath.segment(1);
+ String drive = realPath.segment(1);
if (drive.length() == 1) {
- translatedPath= realPath.removeFirstSegments(2).makeAbsolute().setDevice(drive.toUpperCase() + ':').toOSString();
+ translatedPath = realPath.removeFirstSegments(2).makeAbsolute()
+ .setDevice(drive.toUpperCase() + ':').toOSString();
}
}
}
@@ -151,16 +149,13 @@ public class CygpathTranslator {
// Check if the translated path exists
if (new File(translatedPath).exists()) {
translatedIncludePaths.add(translatedPath);
- }
- else if (useCygPathExtension || useCygwinFromPath) {
+ } else if (useCygPathExtension || useCygwinFromPath) {
// TODO VMIR for now add even if it does not exist
translatedIncludePaths.add(translatedPath);
- }
- else {
+ } else {
translatedIncludePaths.add(includePath);
}
- }
- else {
+ } else {
// TODO VMIR for now add even if it does not exist
translatedIncludePaths.add(translatedPath);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/KVStringPair.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/KVStringPair.java
index d05ead6a63f..71fe959e9ee 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/KVStringPair.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/KVStringPair.java
@@ -15,28 +15,29 @@ package org.eclipse.cdt.make.internal.core.scannerconfig.util;
/**
* Key - Value String Pair
- *
+ *
* @author vhirsl
*/
public class KVStringPair {
private String key;
private String value;
-
+
/**
- *
+ *
*/
public KVStringPair(String key, String value) {
this.key = key;
this.value = value;
}
-
+
public String getKey() {
return key;
}
-
+
public String getValue() {
return value;
}
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@@ -48,6 +49,7 @@ public class KVStringPair {
}
return false;
}
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@@ -55,6 +57,7 @@ public class KVStringPair {
public int hashCode() {
return 17 * key.hashCode() + value.hashCode();
}
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/LogWriter.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/LogWriter.java
index d30d1f434db..6a90e090447 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/LogWriter.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/LogWriter.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM - Initial API and implementation
*******************************************************************************/
@@ -29,14 +29,14 @@ import org.eclipse.core.runtime.IStatus;
/**
* Log writer utility
- *
+ *
* @author vhirsl
*/
public class LogWriter {
protected File logFile = null;
protected Writer log = null;
protected boolean newSession = true;
-
+
protected static final String SESSION = "*** SESSION";//$NON-NLS-1$
protected static final String ENTRY = "ENTRY";//$NON-NLS-1$
protected static final String SUBENTRY = "SUBENTRY";//$NON-NLS-1$
@@ -52,16 +52,16 @@ public class LogWriter {
}
/**
- *
+ *
*/
public LogWriter(File log) {
this.logFile = log;
- if(log.length() > MAXLOG_SIZE){
- log.delete();
+ if (log.length() > MAXLOG_SIZE) {
+ log.delete();
}
openLogFile();
}
-
+
protected void closeLogFile() throws IOException {
try {
if (log != null) {
@@ -72,10 +72,11 @@ public class LogWriter {
log = null;
}
}
-
+
protected void openLogFile() {
try {
- log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), "UTF-8"));//$NON-NLS-1$
+ log = new BufferedWriter(
+ new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), "UTF-8"));//$NON-NLS-1$
if (newSession) {
writeHeader();
newSession = false;
@@ -85,6 +86,7 @@ public class LogWriter {
//log = logForStream(System.err);
}
}
+
protected void writeHeader() throws IOException {
writeln();
write(SESSION);
@@ -92,12 +94,12 @@ public class LogWriter {
String date = getDate();
write(date);
writeSpace();
- for (int i=SESSION.length()+date.length(); i<78; i++) {
+ for (int i = SESSION.length() + date.length(); i < 78; i++) {
write("-");//$NON-NLS-1$
}
writeln();
}
-
+
protected String getDate() {
try {
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$
@@ -117,6 +119,7 @@ public class LogWriter {
write(s);
writeln();
}
+
/**
* Shuts down the log.
*/
@@ -151,17 +154,18 @@ public class LogWriter {
writeln("0");//$NON-NLS-1$
throwable.printStackTrace(new PrintWriter(log));
if (isCoreException) {
- CoreException e = (CoreException) throwable;
- write(e.getStatus(), 0);
+ CoreException e = (CoreException) throwable;
+ write(e.getStatus(), 0);
}
}
- public synchronized void log(IStatus status){
+ public synchronized void log(IStatus status) {
try {
this.write(status, 0);
} catch (IOException e) {
}
}
+
protected void write(IStatus status, int depth) throws IOException {
if (depth == 0) {
write(ENTRY);
@@ -190,7 +194,7 @@ public class LogWriter {
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
for (int i = 0; i < children.length; i++) {
- write(children[i], depth+1);
+ write(children[i], depth + 1);
}
}
}
@@ -198,19 +202,21 @@ public class LogWriter {
protected void writeln() throws IOException {
write(LINE_SEPARATOR);
}
+
protected void write(String message) throws IOException {
if (message != null)
log.write(message);
}
+
protected void writeSpace() throws IOException {
write(" ");//$NON-NLS-1$
}
-
- public synchronized void flushLog(){
+
+ public synchronized void flushLog() {
try {
log.flush();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/PathInfoToLangSettingsConverter.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/PathInfoToLangSettingsConverter.java
index fd81f98cbfa..9067165d611 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/PathInfoToLangSettingsConverter.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/PathInfoToLangSettingsConverter.java
@@ -26,28 +26,25 @@ import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
import org.eclipse.core.runtime.IPath;
public class PathInfoToLangSettingsConverter {
- public static int getSupportedEntryKinds(IDiscoveredPathInfo info){
- if(info instanceof IPerFileDiscoveredPathInfo){
- return getSupportedEntryKinds((IPerFileDiscoveredPathInfo)info);
+ public static int getSupportedEntryKinds(IDiscoveredPathInfo info) {
+ if (info instanceof IPerFileDiscoveredPathInfo) {
+ return getSupportedEntryKinds((IPerFileDiscoveredPathInfo) info);
}
- return ICLanguageSettingEntry.INCLUDE_PATH
- | ICLanguageSettingEntry.MACRO;
+ return ICLanguageSettingEntry.INCLUDE_PATH | ICLanguageSettingEntry.MACRO;
}
- public static int getSupportedEntryKinds(IPerFileDiscoveredPathInfo info){
- return ICLanguageSettingEntry.INCLUDE_FILE
- | ICLanguageSettingEntry.INCLUDE_PATH
- | ICLanguageSettingEntry.MACRO
- | ICLanguageSettingEntry.MACRO_FILE;
+ public static int getSupportedEntryKinds(IPerFileDiscoveredPathInfo info) {
+ return ICLanguageSettingEntry.INCLUDE_FILE | ICLanguageSettingEntry.INCLUDE_PATH | ICLanguageSettingEntry.MACRO
+ | ICLanguageSettingEntry.MACRO_FILE;
}
- public static ICLanguageSettingEntry[] entriesForKind(int kind, int flags, PathInfo info){
+ public static ICLanguageSettingEntry[] entriesForKind(int kind, int flags, PathInfo info) {
switch (kind) {
case ICLanguageSettingEntry.INCLUDE_PATH:
ICLanguageSettingEntry[] incPaths = calculateEntries(kind, flags, info.getIncludePaths());
IPath[] quotedPaths = info.getQuoteIncludePaths();
- if(quotedPaths.length != 0){
- if(incPaths.length != 0){
+ if (quotedPaths.length != 0) {
+ if (incPaths.length != 0) {
ICLanguageSettingEntry quotedEntries[] = calculateEntries(kind, flags, quotedPaths);
ICLanguageSettingEntry[] tmp = new ICLanguageSettingEntry[incPaths.length + quotedEntries.length];
System.arraycopy(incPaths, 0, tmp, 0, incPaths.length);
@@ -68,15 +65,15 @@ public class PathInfoToLangSettingsConverter {
return new ICLanguageSettingEntry[0];
}
- private static ICLanguageSettingEntry[] calculateEntries(int kind, int flags, IPath[] values){
+ private static ICLanguageSettingEntry[] calculateEntries(int kind, int flags, IPath[] values) {
ICLanguageSettingEntry entries[] = new ICLanguageSettingEntry[values.length];
- for(int i = 0; i < values.length; i++){
- entries[i] = (ICLanguageSettingEntry)CDataUtil.createEntry(kind, values[i].toString(), null, null, flags);
+ for (int i = 0; i < values.length; i++) {
+ entries[i] = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, values[i].toString(), null, null, flags);
}
return entries;
}
- private static ICMacroEntry[] calculateEntries(int flags, Map<String, String> map){
+ private static ICMacroEntry[] calculateEntries(int flags, Map<String, String> map) {
ICMacroEntry entries[] = new ICMacroEntry[map.size()];
int num = 0;
Set<Entry<String, String>> entrySet = map.entrySet();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
index 5efa17f273f..84bfbf56f67 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
@@ -16,53 +16,51 @@ package org.eclipse.cdt.make.internal.core.scannerconfig.util;
/**
* Enumeration class for scanner configuration affecting command line options
- *
+ *
* @author vhirsl
*/
public final class SCDOptionsEnum {
- public static final SCDOptionsEnum COMMAND = new SCDOptionsEnum(0); // gcc or similar command
+ public static final SCDOptionsEnum COMMAND = new SCDOptionsEnum(0); // gcc or similar command
public static final int MIN = 1;
- public static final SCDOptionsEnum DEFINE = new SCDOptionsEnum(1); // -D name
- public static final SCDOptionsEnum UNDEFINE = new SCDOptionsEnum(2); // -U name
- public static final SCDOptionsEnum IDASH = new SCDOptionsEnum(3); // -I-
- public static final SCDOptionsEnum INCLUDE = new SCDOptionsEnum(4); // -I dir
- public static final SCDOptionsEnum NOSTDINC = new SCDOptionsEnum(5); // -nostdinc
- public static final SCDOptionsEnum NOSTDINCPP = new SCDOptionsEnum(6); // -nostdinc++
- public static final SCDOptionsEnum INCLUDE_FILE = new SCDOptionsEnum(7); // -include file
- public static final SCDOptionsEnum IMACROS_FILE = new SCDOptionsEnum(8); // -imacros file
- public static final SCDOptionsEnum IDIRAFTER = new SCDOptionsEnum(9); // -idirafter dir
- public static final SCDOptionsEnum ISYSTEM = new SCDOptionsEnum(10); // -isystem dir
- public static final SCDOptionsEnum IPREFIX = new SCDOptionsEnum(11); // -iprefix prefix
- public static final SCDOptionsEnum IWITHPREFIX = new SCDOptionsEnum(12); // -iwithprefix dir
- public static final SCDOptionsEnum IWITHPREFIXBEFORE = new SCDOptionsEnum(13); // -iwithprefixbefore dir
- public static final SCDOptionsEnum IQUOTE = new SCDOptionsEnum(14); // -iquote dir
+ public static final SCDOptionsEnum DEFINE = new SCDOptionsEnum(1); // -D name
+ public static final SCDOptionsEnum UNDEFINE = new SCDOptionsEnum(2); // -U name
+ public static final SCDOptionsEnum IDASH = new SCDOptionsEnum(3); // -I-
+ public static final SCDOptionsEnum INCLUDE = new SCDOptionsEnum(4); // -I dir
+ public static final SCDOptionsEnum NOSTDINC = new SCDOptionsEnum(5); // -nostdinc
+ public static final SCDOptionsEnum NOSTDINCPP = new SCDOptionsEnum(6); // -nostdinc++
+ public static final SCDOptionsEnum INCLUDE_FILE = new SCDOptionsEnum(7); // -include file
+ public static final SCDOptionsEnum IMACROS_FILE = new SCDOptionsEnum(8); // -imacros file
+ public static final SCDOptionsEnum IDIRAFTER = new SCDOptionsEnum(9); // -idirafter dir
+ public static final SCDOptionsEnum ISYSTEM = new SCDOptionsEnum(10); // -isystem dir
+ public static final SCDOptionsEnum IPREFIX = new SCDOptionsEnum(11); // -iprefix prefix
+ public static final SCDOptionsEnum IWITHPREFIX = new SCDOptionsEnum(12); // -iwithprefix dir
+ public static final SCDOptionsEnum IWITHPREFIXBEFORE = new SCDOptionsEnum(13); // -iwithprefixbefore dir
+ public static final SCDOptionsEnum IQUOTE = new SCDOptionsEnum(14); // -iquote dir
public static final int MAX = 14;
-
- private static final String[] SCDOPTION_STRING_VALS = {
- "cc", //$NON-NLS-1$
- "-D", //$NON-NLS-1$
- "-U", //$NON-NLS-1$
- "-I-", //$NON-NLS-1$
- "-I", //$NON-NLS-1$
- "-nostdinc", //$NON-NLS-1$
- "-nostdinc++", //$NON-NLS-1$
- "-include", //$NON-NLS-1$
- "-imacros", //$NON-NLS-1$
- "-idirafter", //$NON-NLS-1$
- "-isystem", //$NON-NLS-1$
- "-iprefix", //$NON-NLS-1$
- "-iwithprefix", //$NON-NLS-1$
- "-iwithprefixbefore", //$NON-NLS-1$
- "-iquote" //$NON-NLS-1$
- };
- private static final SCDOptionsEnum SCDOPTIONS[] = {
- COMMAND, DEFINE, UNDEFINE, IDASH, INCLUDE, NOSTDINC, NOSTDINCPP, INCLUDE_FILE, IMACROS_FILE,
- IDIRAFTER, ISYSTEM, IPREFIX, IWITHPREFIX, IWITHPREFIXBEFORE, IQUOTE
+
+ private static final String[] SCDOPTION_STRING_VALS = { "cc", //$NON-NLS-1$
+ "-D", //$NON-NLS-1$
+ "-U", //$NON-NLS-1$
+ "-I-", //$NON-NLS-1$
+ "-I", //$NON-NLS-1$
+ "-nostdinc", //$NON-NLS-1$
+ "-nostdinc++", //$NON-NLS-1$
+ "-include", //$NON-NLS-1$
+ "-imacros", //$NON-NLS-1$
+ "-idirafter", //$NON-NLS-1$
+ "-isystem", //$NON-NLS-1$
+ "-iprefix", //$NON-NLS-1$
+ "-iwithprefix", //$NON-NLS-1$
+ "-iwithprefixbefore", //$NON-NLS-1$
+ "-iquote" //$NON-NLS-1$
};
-
+ private static final SCDOptionsEnum SCDOPTIONS[] = { COMMAND, DEFINE, UNDEFINE, IDASH, INCLUDE, NOSTDINC,
+ NOSTDINCPP, INCLUDE_FILE, IMACROS_FILE, IDIRAFTER, ISYSTEM, IPREFIX, IWITHPREFIX, IWITHPREFIXBEFORE,
+ IQUOTE };
+
/**
- *
+ *
*/
private SCDOptionsEnum(int val) {
this._enum = val;
@@ -71,40 +69,45 @@ public final class SCDOptionsEnum {
public int getEnumValue() {
return _enum;
}
-
+
public static SCDOptionsEnum getSCDOptionsEnum(int val) {
if (val >= 0 && val <= MAX) {
return SCDOPTIONS[val];
}
return null;
}
-
- public static SCDOptionsEnum getSCDOptionsEnum(String desc) {
- for (int i = 0; i <= MAX; ++i) {
- if (desc.equals(SCDOPTION_STRING_VALS[i])) {
- return SCDOPTIONS[i];
- }
- }
- return null;
- }
-
+
+ public static SCDOptionsEnum getSCDOptionsEnum(String desc) {
+ for (int i = 0; i <= MAX; ++i) {
+ if (desc.equals(SCDOPTION_STRING_VALS[i])) {
+ return SCDOPTIONS[i];
+ }
+ }
+ return null;
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object arg0) {
- if (arg0 == null) return false;
- if (arg0 == this) return true;
- if (arg0 instanceof SCDOptionsEnum) return (_enum == ((SCDOptionsEnum)arg0)._enum);
+ if (arg0 == null)
+ return false;
+ if (arg0 == this)
+ return true;
+ if (arg0 instanceof SCDOptionsEnum)
+ return (_enum == ((SCDOptionsEnum) arg0)._enum);
return false;
}
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
- return _enum*17 + 11;
+ return _enum * 17 + 11;
}
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -112,6 +115,6 @@ public final class SCDOptionsEnum {
public String toString() {
return SCDOPTION_STRING_VALS[_enum];
}
-
+
private final int _enum;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
index 1d88ea545aa..9b01afc6710 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
@@ -21,7 +21,6 @@ import java.util.Map;
import org.eclipse.cdt.internal.core.SafeStringInterner;
-
/**
* Represents a symbol definition with possible multiple values
* example:
@@ -31,10 +30,10 @@ import org.eclipse.cdt.internal.core.SafeStringInterner;
* @author vhirsl
*/
public class SymbolEntry {
- private static final String UNSPECIFIED_VALUE = "1"; //$NON-NLS-1$
+ private static final String UNSPECIFIED_VALUE = "1"; //$NON-NLS-1$
private String name;
- private Map<String, Boolean> values; // Values can be either in the active (selected) group or in the removed group
-
+ private Map<String, Boolean> values; // Values can be either in the active (selected) group or in the removed group
+
public SymbolEntry(String name, String value, boolean active) {
this.name = SafeStringInterner.safeIntern(name);
if (values == null) {
@@ -44,42 +43,45 @@ public class SymbolEntry {
}
public boolean add(String value, boolean active) {
- Boolean old= values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
+ Boolean old = values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
return old == null || old.booleanValue() != active;
}
-
+
public void remove(String value) {
values.remove(value);
}
-
+
public void removeAll() {
values = null;
}
-
+
public List<String> getActive() {
return get(true, true, true);
}
+
public List<String> getActiveRaw() {
return get(false, true, true);
}
-
+
public List<String> getRemoved() {
return get(true, true, false);
}
+
public List<String> getRemovedRaw() {
return get(false, true, false);
}
-
+
public List<String> getAll() {
return get(true, false, true /*don't care*/);
}
+
public List<String> getAllRaw() {
return get(false, false, true /*don't care*/);
}
/**
* Utility function to retrieve values as a set.
- *
+ *
* @param format - false = raw
* @param subset - false = all
* @param active - false = removed
@@ -92,13 +94,13 @@ public class SymbolEntry {
continue;
if (format) {
rv.add(name + "=" + (val == null ? UNSPECIFIED_VALUE : val));//$NON-NLS-1$
- }
- else {
+ } else {
rv.add(name + (val == null ? "" : "=" + val));//$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
}
return rv;
}
+
/**
* Returns only value part of all active entries
* @return List
@@ -113,11 +115,11 @@ public class SymbolEntry {
}
return rv;
}
-
+
public int numberOfValues() {
return values.size();
}
-
+
@Override
public String toString() {
StringBuilder buffer = new StringBuilder(name);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java
index 427cc0b56d1..b7570a541fb 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
@@ -31,11 +31,12 @@ public class TraceUtil {
public static final String EOL = System.getProperty("line.separator"); //$NON-NLS-1$
public static boolean SCANNER_CONFIG = false;
private static LogWriter logger = null;
-
+
static {
- if (MakeCorePlugin.getDefault()!=null) // in case of running simple junit tests
+ if (MakeCorePlugin.getDefault() != null) // in case of running simple junit tests
logger = new LogWriter(MakeCorePlugin.getDefault().getStateLocation().append(".log").toFile()); //$NON-NLS-1$
}
+
/* (non-Javadoc)
* @see java.lang.Object#finalize()
*/
@@ -44,17 +45,17 @@ public class TraceUtil {
logger.shutdown();
super.finalize();
}
-
+
public static boolean isTracing() {
return SCANNER_CONFIG;
}
-
+
public static void outputTrace(String prefix, String[] tokens, String postfix) {
if (isTracing()) {
System.out.print(prefix + ' ');
for (int i = 0; i < tokens.length; i++) {
System.out.print(tokens[i] + ' ');
-
+
}
System.out.println(postfix);
}
@@ -65,7 +66,7 @@ public class TraceUtil {
System.out.println(prefix + ' ' + msg + ' ' + postfix);
}
}
-
+
/**
* For traces of type:
* Title:
@@ -78,21 +79,23 @@ public class TraceUtil {
* item2[1]
* ...
*/
- public static void outputTrace(String title, String subtitle1, List<String> item1, List<String> item1new, String subtitle2, List<String> item2) {
+ public static void outputTrace(String title, String subtitle1, List<String> item1, List<String> item1new,
+ String subtitle2, List<String> item2) {
if (isTracing()) {
//System.out.println();
System.out.println(title);
- final String prefix = " "; //$NON-NLS-1$
- final String doublePrefix = " "; //$NON-NLS-1$
- System.out.println(prefix + subtitle1 + " (" + item1.size() + "):"); //$NON-NLS-1$ //$NON-NLS-2$
+ final String prefix = " "; //$NON-NLS-1$
+ final String doublePrefix = " "; //$NON-NLS-1$
+ System.out.println(prefix + subtitle1 + " (" + item1.size() + "):"); //$NON-NLS-1$ //$NON-NLS-2$
int count = 0;
- for (Iterator<String> i = item1.iterator(), j = item1new.iterator(); i.hasNext(); ) {
- System.out.println(doublePrefix + String.valueOf(++count) + "\t\'" +i.next() + (j.hasNext()?"\' -> \'" + j.next():"") + '\''); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ for (Iterator<String> i = item1.iterator(), j = item1new.iterator(); i.hasNext();) {
+ System.out.println(doublePrefix + String.valueOf(++count) + "\t\'" + i.next() //$NON-NLS-1$
+ + (j.hasNext() ? "\' -> \'" + j.next() : "") + '\''); //$NON-NLS-1$ //$NON-NLS-2$
}
- System.out.println(prefix + subtitle2 + " (" + item2.size() + "):"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println(prefix + subtitle2 + " (" + item2.size() + "):"); //$NON-NLS-1$ //$NON-NLS-2$
count = 0;
- for (Iterator<String> i = item2.iterator(); i.hasNext(); ) {
- System.out.println(doublePrefix + String.valueOf(++count) + "\t\'" + i.next() + '\''); //$NON-NLS-1$
+ for (Iterator<String> i = item2.iterator(); i.hasNext();) {
+ System.out.println(doublePrefix + String.valueOf(++count) + "\t\'" + i.next() + '\''); //$NON-NLS-1$
}
}
}
@@ -139,8 +142,8 @@ public class TraceUtil {
}
}
logger.flushLog();
+ } catch (IOException e) {
}
- catch (IOException e) {}
}
public static void summaryTrace(String title, int workingDirsN, int commandsN, int filesN) {
@@ -153,8 +156,8 @@ public class TraceUtil {
logger.writeln(" Number of generic commands: " + Integer.toString(commandsN)); //$NON-NLS-1$
logger.writeln(" Number of compiled files: " + Integer.toString(filesN)); //$NON-NLS-1$
logger.flushLog();
+ } catch (IOException e) {
}
- catch (IOException e) {}
}
/**
@@ -167,8 +170,8 @@ public class TraceUtil {
logger.writeln();
logger.writeln(trace);
logger.flushLog();
+ } catch (IOException e) {
}
- catch (IOException e) {}
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
index 687f7609f15..fb3e725896b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
@@ -76,20 +76,15 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
private SCMarkerGenerator markerGenerator = new SCMarkerGenerator();
@Override
- public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
- String providerId, IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector) {
- return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null);
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector) {
+ return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo,
+ collector, null);
}
@Override
- public boolean invokeProvider(IProgressMonitor monitor,
- IResource resource,
- InfoContext context,
- String providerId,
- IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector,
- Properties env) {
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, InfoContext context, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector, Properties env) {
// initialize fields
this.resource = resource;
this.providerId = providerId;
@@ -113,9 +108,10 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
ILanguage language = context.getLanguage();
IConsole console;
- if (language!=null && isConsoleEnabled()) {
+ if (language != null && isConsoleEnabled()) {
String consoleId = MakeCorePlugin.PLUGIN_ID + '.' + providerId + '.' + language.getId();
- String consoleName = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Console_Name", language.getName()); //$NON-NLS-1$
+ String consoleName = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Console_Name", //$NON-NLS-1$
+ language.getName());
console = CCorePlugin.getDefault().getBuildConsole(consoleId, consoleName, null);
} else {
// that looks in extension points registry and won't find the id
@@ -127,24 +123,29 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
launcher.setProject(project);
IPath program = getCommandToLaunch();
- if (! program.isEmpty()) {
+ if (!program.isEmpty()) {
String[] comandLineOptions = getCommandLineOptions();
URI workingDirectoryURI = MakeBuilderUtil.getBuildDirectoryURI(project, MakeBuilder.BUILDER_ID);
String[] envp = setEnvironment(launcher, env);
-
- ErrorParserManager epm = new ErrorParserManager(project, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID});
-
+
+ ErrorParserManager epm = new ErrorParserManager(project, markerGenerator,
+ new String[] { GMAKE_ERROR_PARSER_ID });
+
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>();
- IConsoleParser parser = ScannerInfoConsoleParserFactory.getESIConsoleParser(project, context, providerId, buildInfo, collector, markerGenerator);
+ IConsoleParser parser = ScannerInfoConsoleParserFactory.getESIConsoleParser(project, context,
+ providerId, buildInfo, collector, markerGenerator);
if (parser != null) {
parsers.add(parser);
}
-
- buildRunnerHelper.setLaunchParameters(launcher, program, comandLineOptions, workingDirectoryURI, envp );
- buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor, TICKS_STREAM_PROGRESS_MONITOR, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
-
- buildRunnerHelper.greeting(MakeMessages.getFormattedString("ExternalScannerInfoProvider.Greeting", project.getName())); //$NON-NLS-1$
- buildRunnerHelper.build(new SubProgressMonitor(monitor, TICKS_EXECUTE_PROGRAM, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
+
+ buildRunnerHelper.setLaunchParameters(launcher, program, comandLineOptions, workingDirectoryURI, envp);
+ buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor,
+ TICKS_STREAM_PROGRESS_MONITOR, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
+
+ buildRunnerHelper.greeting(
+ MakeMessages.getFormattedString("ExternalScannerInfoProvider.Greeting", project.getName())); //$NON-NLS-1$
+ buildRunnerHelper.build(new SubProgressMonitor(monitor, TICKS_EXECUTE_PROGRAM,
+ SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
buildRunnerHelper.close();
buildRunnerHelper.goodbye();
}
@@ -169,8 +170,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
protected String[] getCommandLineOptions() {
// add additional arguments
// subclass can change default behavior
- return prepareArguments(
- buildInfo.isUseDefaultProviderCommand(providerId));
+ return prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId));
}
/**
@@ -183,7 +183,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
//fWorkingDirectory = resource.getProject().getLocation();
URI workingDirURI = MakeBuilderUtil.getBuildDirectoryURI(currProject, MakeBuilder.BUILDER_ID);
String pathString = EFSExtensionManager.getDefault().getPathFromURI(workingDirURI);
- if(pathString != null) {
+ if (pathString != null) {
fWorkingDirectory = new Path(pathString);
}
@@ -193,7 +193,8 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
}
fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
- fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$
+ fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId),
+ "\"");//$NON-NLS-1$
return (fCompileCommand != null);
}
@@ -220,7 +221,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
// of the language as long as the encoding is set to UTF-8.
// English language is chosen because parser relies on English messages
// in the output of the 'gcc -v' command.
- props.put("LANGUAGE", "en"); // override for GNU gettext //$NON-NLS-1$ //$NON-NLS-2$
+ props.put("LANGUAGE", "en"); // override for GNU gettext //$NON-NLS-1$ //$NON-NLS-2$
props.put("LC_ALL", "en_US.UTF-8"); // for other parts of the system libraries //$NON-NLS-1$ //$NON-NLS-2$
return props;
}
@@ -240,7 +241,6 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
return env;
}
-
/**
* Set preference to stream output of scanner discovery to a console.
*/
@@ -260,8 +260,8 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
* @return boolean preference value
*/
public static boolean isConsoleEnabled() {
- boolean value = InstanceScope.INSTANCE.getNode(MakeCorePlugin.PLUGIN_ID)
- .getBoolean(PREF_CONSOLE_ENABLED, false);
+ boolean value = InstanceScope.INSTANCE.getNode(MakeCorePlugin.PLUGIN_ID).getBoolean(PREF_CONSOLE_ENABLED,
+ false);
return value;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java
index 755a5678fe7..01440717b9a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java
@@ -47,51 +47,46 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @author vhirsl
*/
public class DefaultSIFileReader implements IExternalScannerInfoProvider {
- private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$
+ private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier()
+ + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$
- private long fileSize = 0;
+ private long fileSize = 0;
- private SCMarkerGenerator markerGenerator = new SCMarkerGenerator();
+ private SCMarkerGenerator markerGenerator = new SCMarkerGenerator();
- @Override
- public boolean invokeProvider(IProgressMonitor monitor, IResource resource,
- String providerId, IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector) {
- return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null);
- }
+ @Override
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector) {
+ return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo,
+ collector, null);
+ }
- @Override
- public boolean invokeProvider(IProgressMonitor monitor,
- IResource resource,
- InfoContext context,
- String providerId,
- IScannerConfigBuilderInfo2 buildInfo,
- IScannerInfoCollector collector,
- Properties env) {
- boolean rc = false;
- IProject project = resource.getProject();
- // input
- BufferedReader reader = getStreamReader(buildInfo.getBuildOutputFilePath());
- if (reader == null)
- return rc;
+ @Override
+ public boolean invokeProvider(IProgressMonitor monitor, IResource resource, InfoContext context, String providerId,
+ IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector, Properties env) {
+ boolean rc = false;
+ IProject project = resource.getProject();
+ // input
+ BufferedReader reader = getStreamReader(buildInfo.getBuildOutputFilePath());
+ if (reader == null)
+ return rc;
- try {
- // output
- IConsole console = CCorePlugin.getDefault().getConsole(EXTERNAL_SI_PROVIDER_CONSOLE_ID);
- console.start(project);
- OutputStream ostream;
- try {
- ostream = console.getOutputStream();
- }
- catch (CoreException e) {
- ostream = null;
- }
+ try {
+ // output
+ IConsole console = CCorePlugin.getDefault().getConsole(EXTERNAL_SI_PROVIDER_CONSOLE_ID);
+ console.start(project);
+ OutputStream ostream;
+ try {
+ ostream = console.getOutputStream();
+ } catch (CoreException e) {
+ ostream = null;
+ }
- // get build location
- IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
+ // get build location
+ IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
- ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.
- getMakeBuilderOutputSniffer(ostream, null, project, context, buildDirectory, buildInfo, markerGenerator, collector);
+ ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getMakeBuilderOutputSniffer(ostream, null,
+ project, context, buildDirectory, buildInfo, markerGenerator, collector);
if (sniffer != null) {
ostream = sniffer.getOutputStream();
}
@@ -99,62 +94,62 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider {
if (ostream != null) {
rc = readFileToOutputStream(monitor, reader, ostream);
}
- } finally {
+ } finally {
try {
reader.close();
} catch (IOException e) {
- MakeCorePlugin.log(e);
+ MakeCorePlugin.log(e);
}
- }
- return rc;
+ }
+ return rc;
}
- private BufferedReader getStreamReader(String inputFileName) {
- BufferedReader reader = null;
- try {
- fileSize = new File(inputFileName).length();
- reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFileName)));
- } catch (FileNotFoundException e) {
- MakeCorePlugin.log(e);
- }
- return reader;
- }
+ private BufferedReader getStreamReader(String inputFileName) {
+ BufferedReader reader = null;
+ try {
+ fileSize = new File(inputFileName).length();
+ reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFileName)));
+ } catch (FileNotFoundException e) {
+ MakeCorePlugin.log(e);
+ }
+ return reader;
+ }
- /**
- * Precondition: Neither input nor output are null
- */
- private boolean readFileToOutputStream(IProgressMonitor monitor, BufferedReader reader, OutputStream ostream) {
- final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
- monitor.beginTask("Reading build output ...", (int)((fileSize == 0) ? 10000 : fileSize)); //$NON-NLS-1$
- // check if build output file exists
- String line;
- try {
- while ((line = reader.readLine()) != null) {
- if (monitor.isCanceled()) {
- return false;
- }
+ /**
+ * Precondition: Neither input nor output are null
+ */
+ private boolean readFileToOutputStream(IProgressMonitor monitor, BufferedReader reader, OutputStream ostream) {
+ final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
+ monitor.beginTask("Reading build output ...", (int) ((fileSize == 0) ? 10000 : fileSize)); //$NON-NLS-1$
+ // check if build output file exists
+ String line;
+ try {
+ while ((line = reader.readLine()) != null) {
+ if (monitor.isCanceled()) {
+ return false;
+ }
- line += lineSeparator;
- byte[] bytes = line.getBytes();
- ostream.write(bytes);
- monitor.worked(bytes.length);
- }
- } catch (IOException e) {
- MakeCorePlugin.log(e);
- } finally {
- try {
- ostream.flush();
- } catch (IOException e) {
- MakeCorePlugin.log(e);
- }
- try {
- ostream.close();
- } catch (IOException e) {
- MakeCorePlugin.log(e);
- }
- }
- monitor.done();
- return true;
- }
+ line += lineSeparator;
+ byte[] bytes = line.getBytes();
+ ostream.write(bytes);
+ monitor.worked(bytes.length);
+ }
+ } catch (IOException e) {
+ MakeCorePlugin.log(e);
+ } finally {
+ try {
+ ostream.flush();
+ } catch (IOException e) {
+ MakeCorePlugin.log(e);
+ }
+ try {
+ ostream.close();
+ } catch (IOException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+ monitor.done();
+ return true;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
index 51a3c84cc32..169465f360e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
@@ -25,72 +25,71 @@ import org.eclipse.core.runtime.CoreException;
/**
* Runs a command to retrieve compiler intrinsic scanner info from 'specs' file.
- *
+ *
* @author vhirsl
*/
public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
+ */
+ @Override
protected boolean initialize() {
- boolean rc = super.initialize();
-
- if (rc) {
- String targetFile = "dummy"; //$NON-NLS-1$
- IProject project = resource.getProject();
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
- }
- else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
- }
- // replace string variables in compile arguments
- // TODO Vmir - use string variable replacement
- for (int i = 0; i < fCompileArguments.length; ++i) {
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
- MakeCorePlugin.getWorkingDirectory().toString());
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- //TODO VMIR better error handling
- MakeCorePlugin.log(e.getStatus());
- rc = false;
- }
- }
- return rc;
- }
+ boolean rc = super.initialize();
+
+ if (rc) {
+ String targetFile = "dummy"; //$NON-NLS-1$
+ IProject project = resource.getProject();
+ try {
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
+ } else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
+ }
+ // replace string variables in compile arguments
+ // TODO Vmir - use string variable replacement
+ for (int i = 0; i < fCompileArguments.length; ++i) {
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
+ MakeCorePlugin.getWorkingDirectory().toString());
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ //TODO VMIR better error handling
+ MakeCorePlugin.log(e.getStatus());
+ rc = false;
+ }
+ }
+ return rc;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
+ */
@Override
protected String[] prepareArguments(boolean isDefaultCommand) {
- if (collector == null)
- return fCompileArguments;
-
- @SuppressWarnings("unchecked")
- List<String> tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
- if (tso == null || tso.size() == 0) {
- return fCompileArguments;
- }
-
- String[] rv = null;
- // commandArguments may have multiple arguments; tokenizing
- int nTokens = 0;
- if (fCompileArguments != null && fCompileArguments.length > 0) {
- nTokens = fCompileArguments.length;
- rv = new String[nTokens + tso.size()];
- System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
- }
- else {
- rv = new String[tso.size()];
- }
- for (int i = 0; i < tso.size(); ++i) {
- rv[nTokens + i] = tso.get(i);
- }
- return rv;
- }
+ if (collector == null)
+ return fCompileArguments;
+
+ @SuppressWarnings("unchecked")
+ List<String> tso = collector.getCollectedScannerInfo(resource.getProject(),
+ ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
+ if (tso == null || tso.size() == 0) {
+ return fCompileArguments;
+ }
+
+ String[] rv = null;
+ // commandArguments may have multiple arguments; tokenizing
+ int nTokens = 0;
+ if (fCompileArguments != null && fCompileArguments.length > 0) {
+ nTokens = fCompileArguments.length;
+ rv = new String[nTokens + tso.size()];
+ System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
+ } else {
+ rv = new String[tso.size()];
+ }
+ for (int i = 0; i < tso.size(); ++i) {
+ rv[nTokens + i] = tso.get(i);
+ }
+ return rv;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/MakeConfigurationDataProviderMessages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/MakeConfigurationDataProviderMessages.java
index 758169db481..b72ef9aa242 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/MakeConfigurationDataProviderMessages.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/MakeConfigurationDataProviderMessages.java
@@ -19,8 +19,7 @@ import java.util.ResourceBundle;
public class MakeConfigurationDataProviderMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.core.scannerconfig2.MakeConfigurationDataProvider"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
private MakeConfigurationDataProviderMessages() {
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index 76f357c753e..07793c72111 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -64,115 +64,113 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
- protected static final int INCLUDE_PATH = 1;
+ protected static final int INCLUDE_PATH = 1;
protected static final int QUOTE_INCLUDE_PATH = 2;
- protected static final int INCLUDE_FILE = 3;
- protected static final int MACROS_FILE = 4;
-
- protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
- protected final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
- protected final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
- protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
-
- public ScannerInfoData() {
- commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
- fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId]
- commandIdToFilesMap = new HashMap<Integer, Set<IFile>>(); // [commandId, set of files]
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
- */
- @Override
+ protected static final int INCLUDE_FILE = 3;
+ protected static final int MACROS_FILE = 4;
+
+ protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
+ protected final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
+ protected final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
+ protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
+
+ public ScannerInfoData() {
+ commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
+ fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId]
+ commandIdToFilesMap = new HashMap<Integer, Set<IFile>>(); // [commandId, set of files]
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element)
+ */
+ @Override
public void serialize(Element collectorElem) {
- synchronized (PerFileSICollector.this.fLock) {
- Document doc = collectorElem.getOwnerDocument();
-
- List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
- Collections.sort(commandIds);
- for (Integer commandId : commandIds) {
- CCommandDSC command = commandIdCommandMap.get(commandId);
-
- Element cmdElem = doc.createElement(CC_ELEM);
- collectorElem.appendChild(cmdElem);
- cmdElem.setAttribute(ID_ATTR, commandId.toString());
- cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
- // write command and scanner info
- command.serialize(cmdElem);
- // write files command applies to
- Element filesElem = doc.createElement(APPLIES_TO_ATTR);
- cmdElem.appendChild(filesElem);
- Set<IFile> files = commandIdToFilesMap.get(commandId);
- if (files != null) {
- for (IFile file : files) {
- Element fileElem = doc.createElement(FILE_ELEM);
- IPath path = file.getProjectRelativePath();
- fileElem.setAttribute(PATH_ATTR, path.toString());
- filesElem.appendChild(fileElem);
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ Document doc = collectorElem.getOwnerDocument();
+
+ List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet());
+ Collections.sort(commandIds);
+ for (Integer commandId : commandIds) {
+ CCommandDSC command = commandIdCommandMap.get(commandId);
+
+ Element cmdElem = doc.createElement(CC_ELEM);
+ collectorElem.appendChild(cmdElem);
+ cmdElem.setAttribute(ID_ATTR, commandId.toString());
+ cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$
+ // write command and scanner info
+ command.serialize(cmdElem);
+ // write files command applies to
+ Element filesElem = doc.createElement(APPLIES_TO_ATTR);
+ cmdElem.appendChild(filesElem);
+ Set<IFile> files = commandIdToFilesMap.get(commandId);
+ if (files != null) {
+ for (IFile file : files) {
+ Element fileElem = doc.createElement(FILE_ELEM);
+ IPath path = file.getProjectRelativePath();
+ fileElem.setAttribute(PATH_ATTR, path.toString());
+ filesElem.appendChild(fileElem);
+ }
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element)
+ */
+ @Override
public void deserialize(Element collectorElem) {
- synchronized (PerFileSICollector.this.fLock) {
- for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
- if (child.getNodeName().equals(CC_ELEM)) {
- Element cmdElem = (Element) child;
- boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
- CCommandDSC command = new CCommandDSC(cppFileType, project);
- command.setCommandId(Integer.parseInt(cmdElem.getAttribute(ID_ATTR)));
- // deserialize command
- command.deserialize(cmdElem);
- // get set of files the command applies to
- NodeList appliesList = cmdElem.getElementsByTagName(APPLIES_TO_ATTR);
- if (appliesList.getLength() > 0) {
- Element appliesElem = (Element) appliesList.item(0);
- NodeList fileList = appliesElem.getElementsByTagName(FILE_ELEM);
- for (int i = 0; i < fileList.getLength(); ++i) {
- Element fileElem = (Element) fileList.item(i);
- String fileName = fileElem.getAttribute(PATH_ATTR);
- IFile file = project.getFile(fileName);
- addCompilerCommand(file, command);
- }
+ synchronized (PerFileSICollector.this.fLock) {
+ for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child.getNodeName().equals(CC_ELEM)) {
+ Element cmdElem = (Element) child;
+ boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$
+ CCommandDSC command = new CCommandDSC(cppFileType, project);
+ command.setCommandId(Integer.parseInt(cmdElem.getAttribute(ID_ATTR)));
+ // deserialize command
+ command.deserialize(cmdElem);
+ // get set of files the command applies to
+ NodeList appliesList = cmdElem.getElementsByTagName(APPLIES_TO_ATTR);
+ if (appliesList.getLength() > 0) {
+ Element appliesElem = (Element) appliesList.item(0);
+ NodeList fileList = appliesElem.getElementsByTagName(FILE_ELEM);
+ for (int i = 0; i < fileList.getLength(); ++i) {
+ Element fileElem = (Element) fileList.item(i);
+ String fileName = fileElem.getAttribute(PATH_ATTR);
+ IFile file = project.getFile(fileName);
+ addCompilerCommand(file, command);
+ }
applyFileDeltas();
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
- */
- @Override
+ }
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId()
+ */
+ @Override
public String getCollectorId() {
- return COLLECTOR_ID;
- }
+ return COLLECTOR_ID;
+ }
+
+ }
- }
+ protected static class ProjectScannerInfo {
+ IPath[] includePaths;
+ IPath[] quoteIncludePaths;
+ IPath[] includeFiles;
+ IPath[] macrosFiles;
+ Map<String, String> definedSymbols;
- protected static class ProjectScannerInfo {
- IPath[] includePaths;
- IPath[] quoteIncludePaths;
- IPath[] includeFiles;
- IPath[] macrosFiles;
- Map<String, String> definedSymbols;
public boolean isEmpty() {
- return (includePaths.length == 0 &&
- quoteIncludePaths.length == 0 &&
- includeFiles.length == 0 &&
- macrosFiles.length == 0 &&
- definedSymbols.size() == 0);
+ return (includePaths.length == 0 && quoteIncludePaths.length == 0 && includeFiles.length == 0
+ && macrosFiles.length == 0 && definedSymbols.size() == 0);
}
- }
+ }
- public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$
+ public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$
protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
protected static final String ID_ATTR = "id"; //$NON-NLS-1$
protected static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
@@ -180,55 +178,54 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected static final String FILE_ELEM = "file"; //$NON-NLS-1$
protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
- protected IProject project;
- protected InfoContext context;
+ protected IProject project;
+ protected InfoContext context;
- protected ScannerInfoData sid; // scanner info data
- protected ProjectScannerInfo psi = null; // sum of all scanner info
+ protected ScannerInfoData sid; // scanner info data
+ protected ProjectScannerInfo psi = null; // sum of all scanner info
-// protected List siChangedForFileList; // list of files for which scanner info has changed
- protected final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
- protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
+ // protected List siChangedForFileList; // list of files for which scanner info has changed
+ protected final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
+ protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
- protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
- protected int commandIdCounter = 0;
+ protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
+ protected int commandIdCounter = 0;
- /** monitor for data access */
- protected final Object fLock = new Object();
+ /** monitor for data access */
+ protected final Object fLock = new Object();
- /**
- *
- */
- public PerFileSICollector() {
- sid = new ScannerInfoData();
+ /**
+ *
+ */
+ public PerFileSICollector() {
+ sid = new ScannerInfoData();
-// siChangedForFileList = new ArrayList();
+ // siChangedForFileList = new ArrayList();
siChangedForFileMap = new HashMap<IFile, Integer>();
siChangedForCommandIdList = new ArrayList<Integer>();
- freeCommandIdPool = new TreeSet<Integer>();
- }
+ freeCommandIdPool = new TreeSet<Integer>();
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject)
+ */
+ @Override
public void setProject(IProject project) {
- setInfoContext(new InfoContext(project));
- }
+ setInfoContext(new InfoContext(project));
+ }
- @Override
+ @Override
public void setInfoContext(InfoContext context) {
- this.project = context.getProject();
- this.context = context;
-
- try {
- // deserialize from SI store
- DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, sid);
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
+ this.project = context.getProject();
+ this.context = context;
+
+ try {
+ // deserialize from SI store
+ DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, sid);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
}
protected InfoContext getInfoContext() {
@@ -236,110 +233,102 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
- */
- @Override
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
+ */
+ @Override
public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) {
- // check the resource
- String errorMessage = null;
- if (resource == null) {
- errorMessage = "resource is null";//$NON-NLS-1$
- }
- else if (resource instanceof Integer) {
- synchronized (fLock) {
- @SuppressWarnings("unchecked")
- Map<ScannerInfoTypes, List<String>> scanInfo = scannerInfo;
- addScannerInfo(((Integer)resource), scanInfo);
- }
- return;
- }
- else if (!(resource instanceof IFile)) {
- errorMessage = "resource is not an IFile";//$NON-NLS-1$
- }
- else if (((IFile) resource).getProject() == null) {
- errorMessage = "project is null";//$NON-NLS-1$
- }
- else if (!((IFile) resource).getProject().equals(project)) {
- errorMessage = "wrong project";//$NON-NLS-1$
- }
- if (errorMessage != null) {
- TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
- return;
- }
-
- IFile file = (IFile) resource;
-
- synchronized (fLock) {
- @SuppressWarnings("unchecked")
- Map<ScannerInfoTypes, List<CCommandDSC>> scanInfo = scannerInfo;
- Set<ScannerInfoTypes> types = scanInfo.keySet();
- for (ScannerInfoTypes type : types) {
- if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
- List<CCommandDSC> commands = scanInfo.get(type);
- for (CCommandDSC cmd : commands) {
- addCompilerCommand(file, cmd);
- }
- }
- else {
- addScannerInfo(type, scanInfo.get(type));
- }
- }
- }
- }
-
- protected void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
+ // check the resource
+ String errorMessage = null;
+ if (resource == null) {
+ errorMessage = "resource is null";//$NON-NLS-1$
+ } else if (resource instanceof Integer) {
+ synchronized (fLock) {
+ @SuppressWarnings("unchecked")
+ Map<ScannerInfoTypes, List<String>> scanInfo = scannerInfo;
+ addScannerInfo(((Integer) resource), scanInfo);
+ }
+ return;
+ } else if (!(resource instanceof IFile)) {
+ errorMessage = "resource is not an IFile";//$NON-NLS-1$
+ } else if (((IFile) resource).getProject() == null) {
+ errorMessage = "project is null";//$NON-NLS-1$
+ } else if (!((IFile) resource).getProject().equals(project)) {
+ errorMessage = "wrong project";//$NON-NLS-1$
+ }
+ if (errorMessage != null) {
+ TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$
+ return;
+ }
+
+ IFile file = (IFile) resource;
+
+ synchronized (fLock) {
+ @SuppressWarnings("unchecked")
+ Map<ScannerInfoTypes, List<CCommandDSC>> scanInfo = scannerInfo;
+ Set<ScannerInfoTypes> types = scanInfo.keySet();
+ for (ScannerInfoTypes type : types) {
+ if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
+ List<CCommandDSC> commands = scanInfo.get(type);
+ for (CCommandDSC cmd : commands) {
+ addCompilerCommand(file, cmd);
+ }
+ } else {
+ addScannerInfo(type, scanInfo.get(type));
+ }
+ }
+ }
+ }
+
+ protected void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
assert Thread.holdsLock(fLock);
- CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
- if (cmd != null) {
- List<String> siItem = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
- cmd.setSymbols(siItem);
- siItem = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
- siItem = CygpathTranslator.translateIncludePaths(project, siItem);
- siItem = CCommandDSC.makeRelative(project, siItem);
- cmd.setIncludes(siItem);
- siItem = scannerInfo.get(ScannerInfoTypes.QUOTE_INCLUDE_PATHS);
- siItem = CygpathTranslator.translateIncludePaths(project, siItem);
- siItem = CCommandDSC.makeRelative(project, siItem);
- cmd.setQuoteIncludes(siItem);
-
- cmd.setDiscovered(true);
- }
- }
-
- protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
+ CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
+ if (cmd != null) {
+ List<String> siItem = scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+ cmd.setSymbols(siItem);
+ siItem = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
+ siItem = CygpathTranslator.translateIncludePaths(project, siItem);
+ siItem = CCommandDSC.makeRelative(project, siItem);
+ cmd.setIncludes(siItem);
+ siItem = scannerInfo.get(ScannerInfoTypes.QUOTE_INCLUDE_PATHS);
+ siItem = CygpathTranslator.translateIncludePaths(project, siItem);
+ siItem = CCommandDSC.makeRelative(project, siItem);
+ cmd.setQuoteIncludes(siItem);
+
+ cmd.setDiscovered(true);
+ }
+ }
+
+ protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
- List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values());
- int index = existingCommands.indexOf(cmd);
- if (index != -1) {
- cmd = existingCommands.get(index);
- }
- else {
- int commandId = -1;
- if (!freeCommandIdPool.isEmpty()) {
- Integer freeCommandId = freeCommandIdPool.first();
- freeCommandIdPool.remove(freeCommandId);
- commandId = freeCommandId.intValue();
- }
- else {
- commandId = ++commandIdCounter;
- }
- cmd.setCommandId(commandId);
- sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
- }
+ List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values());
+ int index = existingCommands.indexOf(cmd);
+ if (index != -1) {
+ cmd = existingCommands.get(index);
+ } else {
+ int commandId = -1;
+ if (!freeCommandIdPool.isEmpty()) {
+ Integer freeCommandId = freeCommandIdPool.first();
+ freeCommandIdPool.remove(freeCommandId);
+ commandId = freeCommandId.intValue();
+ } else {
+ commandId = ++commandIdCounter;
+ }
+ cmd.setCommandId(commandId);
+ sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd);
+ }
generateFileDelta(file, cmd);
- }
+ }
protected void generateFileDelta(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
- Integer commandId = cmd.getCommandIdAsInteger();
+ Integer commandId = cmd.getCommandIdAsInteger();
Integer oldCommandId = sid.fileToCommandIdMap.get(file);
if (oldCommandId != null && oldCommandId.equals(commandId)) {
// already exists; remove form delta
siChangedForFileMap.remove(file);
- }
- else {
+ } else {
// new (file, commandId) pair
siChangedForFileMap.put(file, commandId);
}
@@ -352,40 +341,39 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
Integer commandId = siChangedForFileMap.get(file);
if (commandId != null) {
- // update sid.commandIdToFilesMap
- Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId);
- if (fileSet == null) {
- fileSet = new HashSet<IFile>();
- sid.commandIdToFilesMap.put(commandId, fileSet);
- CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
- if (cmd != null) {
- cmd.resolveOptions(project);
- }
- }
- if (fileSet.add(file)) {
- // update fileToCommandIdsMap
- boolean change = true;
- Integer oldCommandId = sid.fileToCommandIdMap.get(file);
- if (oldCommandId != null) {
- if (oldCommandId.equals(commandId)) {
- change = false;
- }
- else {
- Set<IFile> oldFileSet = sid.commandIdToFilesMap.get(oldCommandId);
- if (oldFileSet != null) {
- oldFileSet.remove(file);
- }
- }
- }
- if (change) {
- sid.fileToCommandIdMap.put(file, commandId);
- // TODO generate change event for this resource
-// IPath path = file.getFullPath();
-// if (!siChangedForFileList.contains(path)) {
-// siChangedForFileList.add(path);
-// }
- }
- }
+ // update sid.commandIdToFilesMap
+ Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId);
+ if (fileSet == null) {
+ fileSet = new HashSet<IFile>();
+ sid.commandIdToFilesMap.put(commandId, fileSet);
+ CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
+ if (cmd != null) {
+ cmd.resolveOptions(project);
+ }
+ }
+ if (fileSet.add(file)) {
+ // update fileToCommandIdsMap
+ boolean change = true;
+ Integer oldCommandId = sid.fileToCommandIdMap.get(file);
+ if (oldCommandId != null) {
+ if (oldCommandId.equals(commandId)) {
+ change = false;
+ } else {
+ Set<IFile> oldFileSet = sid.commandIdToFilesMap.get(oldCommandId);
+ if (oldFileSet != null) {
+ oldFileSet.remove(file);
+ }
+ }
+ }
+ if (change) {
+ sid.fileToCommandIdMap.put(file, commandId);
+ // TODO generate change event for this resource
+ // IPath path = file.getFullPath();
+ // if (!siChangedForFileList.contains(path)) {
+ // siChangedForFileList.add(path);
+ // }
+ }
+ }
}
}
generateProjectScannerInfo();
@@ -403,373 +391,371 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected void removeUnusedCommands() {
assert Thread.holdsLock(fLock);
- Set<Entry<Integer, Set<IFile>>> entrySet = sid.commandIdToFilesMap.entrySet();
- for (Entry<Integer, Set<IFile>> entry : entrySet) {
- Integer cmdId = entry.getKey();
- Set<IFile> fileSet = entry.getValue();
- if (fileSet.isEmpty()) {
- // return cmdId to the free command id pool
- freeCommandIdPool.add(cmdId);
- }
- }
- for (Integer cmdId : freeCommandIdPool) {
- // the command does not have any files associated; remove
- sid.commandIdCommandMap.remove(cmdId);
- sid.commandIdToFilesMap.remove(cmdId);
- }
- while (!freeCommandIdPool.isEmpty()) {
- Integer last = freeCommandIdPool.last();
- if (last.intValue() == commandIdCounter) {
- freeCommandIdPool.remove(last);
- --commandIdCounter;
- }
- else break;
- }
- }
-
- protected void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
+ Set<Entry<Integer, Set<IFile>>> entrySet = sid.commandIdToFilesMap.entrySet();
+ for (Entry<Integer, Set<IFile>> entry : entrySet) {
+ Integer cmdId = entry.getKey();
+ Set<IFile> fileSet = entry.getValue();
+ if (fileSet.isEmpty()) {
+ // return cmdId to the free command id pool
+ freeCommandIdPool.add(cmdId);
+ }
+ }
+ for (Integer cmdId : freeCommandIdPool) {
+ // the command does not have any files associated; remove
+ sid.commandIdCommandMap.remove(cmdId);
+ sid.commandIdToFilesMap.remove(cmdId);
+ }
+ while (!freeCommandIdPool.isEmpty()) {
+ Integer last = freeCommandIdPool.last();
+ if (last.intValue() == commandIdCounter) {
+ freeCommandIdPool.remove(last);
+ --commandIdCounter;
+ } else
+ break;
+ }
+ }
+
+ protected void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
- ArrayList<IResource> changedResources = null;
- synchronized (fLock) {
- if (scannerInfoChanged()) {
- applyFileDeltas();
- removeUnusedCommands();
- changedResources = new ArrayList<IResource>(siChangedForFileMap.keySet());
- siChangedForFileMap.clear();
- }
- siChangedForCommandIdList.clear();
- }
- monitor.worked(50);
- if (changedResources != null) {
- // update outside monitor scope
- try {
- // update scanner configuration
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
- IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
- if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
- pathInfo = createPathInfoObject();
- }
- MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo, context.isDefaultContext(), changedResources);
- } catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
- monitor.worked(50);
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
+ ArrayList<IResource> changedResources = null;
+ synchronized (fLock) {
+ if (scannerInfoChanged()) {
+ applyFileDeltas();
+ removeUnusedCommands();
+ changedResources = new ArrayList<IResource>(siChangedForFileMap.keySet());
+ siChangedForFileMap.clear();
+ }
+ siChangedForCommandIdList.clear();
+ }
+ monitor.worked(50);
+ if (changedResources != null) {
+ // update outside monitor scope
+ try {
+ // update scanner configuration
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
+ IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager()
+ .getDiscoveredInfo(project, context);
+ if (!(pathInfo instanceof IPerFileDiscoveredPathInfo)) {
+ pathInfo = createPathInfoObject();
+ }
+ MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo,
+ context.isDefaultContext(), changedResources);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+ monitor.worked(50);
monitor.done();
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
+ */
+ @Override
public IDiscoveredPathInfo createPathInfoObject() {
- return new PerFileDiscoveredPathInfo();
- }
+ return new PerFileDiscoveredPathInfo();
+ }
protected boolean scannerInfoChanged() {
assert Thread.holdsLock(fLock);
-// return !siChangedForFileList.isEmpty();
+ // return !siChangedForFileList.isEmpty();
return !siChangedForFileMap.isEmpty();
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
+ */
+ @Override
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
- List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
- // check the resource
- String errorMessage = null;
- if (resource == null) {
- errorMessage = "resource is null";//$NON-NLS-1$
- }
- else if (!(resource instanceof IResource)) {
- errorMessage = "resource is not an IResource";//$NON-NLS-1$
- }
- else if (((IResource) resource).getProject() == null) {
- errorMessage = "project is null";//$NON-NLS-1$
- }
- else if (((IResource) resource).getProject() != project) {
- errorMessage = "wrong project";//$NON-NLS-1$
- }
-
- if (errorMessage != null) {
- TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
- return rv;
- }
- if (resource!=null && project.equals(((IResource)resource).getProject())) {
- if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
- synchronized (fLock) {
- Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
- for (Integer cmdId : cmdIds) {
- Set<IFile> fileSet = sid.commandIdToFilesMap.get(cmdId);
- if (fileSet != null && !fileSet.isEmpty()) {
- rv.add(sid.commandIdCommandMap.get(cmdId));
- }
- }
- }
- }
- else if (type.equals(ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND)) {
-// if (!siChangedForFileList.isEmpty()) {
- synchronized (fLock) {
- if (scannerInfoChanged()) {
- if (siChangedForCommandIdList.isEmpty()) {
- Set<IFile> files = siChangedForFileMap.keySet();
- for (IFile file : files) {
- Integer cmdId = siChangedForFileMap.get(file);
- if (cmdId != null) {
- if (!siChangedForCommandIdList.contains(cmdId)) {
- siChangedForCommandIdList.add(cmdId);
- }
- }
- }
- }
- Collections.sort(siChangedForCommandIdList);
- for (Integer cmdId : siChangedForCommandIdList) {
- CCommandDSC command = sid.commandIdCommandMap.get(cmdId);
- rv.add(command);
- }
- }
- }
- }
- }
- return rv;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
- */
- @Override
+ List<CCommandDSC> rv = new ArrayList<CCommandDSC>();
+ // check the resource
+ String errorMessage = null;
+ if (resource == null) {
+ errorMessage = "resource is null";//$NON-NLS-1$
+ } else if (!(resource instanceof IResource)) {
+ errorMessage = "resource is not an IResource";//$NON-NLS-1$
+ } else if (((IResource) resource).getProject() == null) {
+ errorMessage = "project is null";//$NON-NLS-1$
+ } else if (((IResource) resource).getProject() != project) {
+ errorMessage = "wrong project";//$NON-NLS-1$
+ }
+
+ if (errorMessage != null) {
+ TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
+ return rv;
+ }
+ if (resource != null && project.equals(((IResource) resource).getProject())) {
+ if (type.equals(ScannerInfoTypes.COMPILER_COMMAND)) {
+ synchronized (fLock) {
+ Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
+ for (Integer cmdId : cmdIds) {
+ Set<IFile> fileSet = sid.commandIdToFilesMap.get(cmdId);
+ if (fileSet != null && !fileSet.isEmpty()) {
+ rv.add(sid.commandIdCommandMap.get(cmdId));
+ }
+ }
+ }
+ } else if (type.equals(ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND)) {
+ // if (!siChangedForFileList.isEmpty()) {
+ synchronized (fLock) {
+ if (scannerInfoChanged()) {
+ if (siChangedForCommandIdList.isEmpty()) {
+ Set<IFile> files = siChangedForFileMap.keySet();
+ for (IFile file : files) {
+ Integer cmdId = siChangedForFileMap.get(file);
+ if (cmdId != null) {
+ if (!siChangedForCommandIdList.contains(cmdId)) {
+ siChangedForCommandIdList.add(cmdId);
+ }
+ }
+ }
+ }
+ Collections.sort(siChangedForCommandIdList);
+ for (Integer cmdId : siChangedForCommandIdList) {
+ CCommandDSC command = sid.commandIdCommandMap.get(cmdId);
+ rv.add(command);
+ }
+ }
+ }
+ }
+ }
+ return rv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAllPaths(IResource resource) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAllSymbols(IResource resource) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
public void deletePath(IResource resource, String path) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
public void deleteSymbol(IResource resource, String symbol) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAll(IResource resource) {
- if (resource.equals(project)) {
- synchronized (fLock) {
-// siChangedForFileList = new ArrayList();
- siChangedForFileMap.clear();
- Set<IFile> changedFiles = sid.fileToCommandIdMap.keySet();
- for (IFile file : changedFiles) {
-// IPath path = file.getFullPath();
-// siChangedForFileList.add(path);
- siChangedForFileMap.put(file, null);
- }
-
- sid = new ScannerInfoData();
- psi = null;
-
- commandIdCounter = 0;
+ if (resource.equals(project)) {
+ synchronized (fLock) {
+ // siChangedForFileList = new ArrayList();
+ siChangedForFileMap.clear();
+ Set<IFile> changedFiles = sid.fileToCommandIdMap.keySet();
+ for (IFile file : changedFiles) {
+ // IPath path = file.getFullPath();
+ // siChangedForFileList.add(path);
+ siChangedForFileMap.put(file, null);
+ }
+
+ sid = new ScannerInfoData();
+ psi = null;
+
+ commandIdCounter = 0;
freeCommandIdPool.clear();
- }
- }
- }
-
- /**
- * Per file DPI object
- *
- * @author vhirsl
- */
- protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
- */
- @Override
+ }
+ }
+ }
+
+ /**
+ * Per file DPI object
+ *
+ * @author vhirsl
+ */
+ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
+ */
+ @Override
public IProject getProject() {
- return project;
- }
+ return project;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths()
+ */
+ @Override
public IPath[] getIncludePaths() {
- final IPath[] includepaths;
- final IPath[] quotepaths;
- synchronized (PerFileSICollector.this.fLock) {
-// return new IPath[0];
- includepaths = getAllIncludePaths(INCLUDE_PATH);
- quotepaths = getAllIncludePaths(QUOTE_INCLUDE_PATH);
- }
- if (quotepaths == null || quotepaths.length == 0) {
- return includepaths;
- }
- if (includepaths == null || includepaths.length == 0) {
- return quotepaths;
- }
- ArrayList<IPath> result = new ArrayList<IPath>(includepaths.length + quotepaths.length);
- result.addAll(Arrays.asList(includepaths));
- result.addAll(Arrays.asList(quotepaths));
- return result.toArray(new IPath[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
- */
- @Override
+ final IPath[] includepaths;
+ final IPath[] quotepaths;
+ synchronized (PerFileSICollector.this.fLock) {
+ // return new IPath[0];
+ includepaths = getAllIncludePaths(INCLUDE_PATH);
+ quotepaths = getAllIncludePaths(QUOTE_INCLUDE_PATH);
+ }
+ if (quotepaths == null || quotepaths.length == 0) {
+ return includepaths;
+ }
+ if (includepaths == null || includepaths.length == 0) {
+ return quotepaths;
+ }
+ ArrayList<IPath> result = new ArrayList<IPath>(includepaths.length + quotepaths.length);
+ result.addAll(Arrays.asList(includepaths));
+ result.addAll(Arrays.asList(quotepaths));
+ return result.toArray(new IPath[result.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols()
+ */
+ @Override
public Map<String, String> getSymbols() {
-// return new HashMap();
- synchronized (PerFileSICollector.this.fLock) {
- return getAllSymbols();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
- */
- @Override
+ // return new HashMap();
+ synchronized (PerFileSICollector.this.fLock) {
+ return getAllSymbols();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
+ */
+ @Override
public IPath[] getIncludePaths(IPath path) {
- synchronized (PerFileSICollector.this.fLock) {
- // get the command
- CCommandDSC cmd = getCommand(path);
- if (cmd != null && cmd.isDiscovered()) {
- return stringListToPathArray(cmd.getIncludes());
- }
- // use project scope scanner info
- if (psi == null) {
- generateProjectScannerInfo();
- }
- return psi.includePaths;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null && cmd.isDiscovered()) {
+ return stringListToPathArray(cmd.getIncludes());
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ return psi.includePaths;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
+ */
+ @Override
public IPath[] getQuoteIncludePaths(IPath path) {
- synchronized (PerFileSICollector.this.fLock) {
- // get the command
- CCommandDSC cmd = getCommand(path);
- if (cmd != null && cmd.isDiscovered()) {
- return stringListToPathArray(cmd.getQuoteIncludes());
- }
- // use project scope scanner info
- if (psi == null) {
- generateProjectScannerInfo();
- }
- return psi.quoteIncludePaths;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null && cmd.isDiscovered()) {
+ return stringListToPathArray(cmd.getQuoteIncludes());
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ return psi.quoteIncludePaths;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
+ */
+ @Override
public Map<String, String> getSymbols(IPath path) {
- synchronized (PerFileSICollector.this.fLock) {
- // get the command
- CCommandDSC cmd = getCommand(path);
- if (cmd != null && cmd.isDiscovered()) {
- List<String> symbols = cmd.getSymbols();
- Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
- for (String symbol : symbols) {
- String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
- String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
- definedSymbols.put(key, value);
- }
- return definedSymbols;
- }
- // use project scope scanner info
- if (psi == null) {
- generateProjectScannerInfo();
- }
- return psi.definedSymbols;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null && cmd.isDiscovered()) {
+ List<String> symbols = cmd.getSymbols();
+ Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
+ for (String symbol : symbols) {
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
+ definedSymbols.put(key, value);
+ }
+ return definedSymbols;
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ return psi.definedSymbols;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
+ */
+ @Override
public IPath[] getIncludeFiles(IPath path) {
- synchronized (PerFileSICollector.this.fLock) {
- // get the command
- CCommandDSC cmd = getCommand(path);
- if (cmd != null) {
- return stringListToPathArray(cmd.getIncludeFile());
- }
- // use project scope scanner info
- if (psi == null) {
- generateProjectScannerInfo();
- }
- return psi.includeFiles;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ return stringListToPathArray(cmd.getIncludeFile());
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ return psi.includeFiles;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
+ */
+ @Override
public IPath[] getMacroFiles(IPath path) {
- synchronized (PerFileSICollector.this.fLock) {
- // get the command
- CCommandDSC cmd = getCommand(path);
- if (cmd != null) {
- return stringListToPathArray(cmd.getImacrosFile());
- }
- // use project scope scanner info
- if (psi == null) {
- generateProjectScannerInfo();
- }
- return psi.macrosFiles;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
- */
- @Override
+ synchronized (PerFileSICollector.this.fLock) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null) {
+ return stringListToPathArray(cmd.getImacrosFile());
+ }
+ // use project scope scanner info
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+ return psi.macrosFiles;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
+ */
+ @Override
public IDiscoveredScannerInfoSerializable getSerializable() {
- synchronized (PerFileSICollector.this.fLock) {
- return sid;
- }
- }
+ synchronized (PerFileSICollector.this.fLock) {
+ return sid;
+ }
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath)
@@ -780,12 +766,11 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
IResource resource = project.getWorkspace().getRoot().findMember(path);
if (resource != null) {
if (resource instanceof IFile) {
- rc = (getCommand((IFile)resource) == null);
- }
- else if (resource instanceof IProject) {
- synchronized (PerFileSICollector.this.fLock) {
- rc = (psi == null || psi.isEmpty());
- }
+ rc = (getCommand((IFile) resource) == null);
+ } else if (resource instanceof IProject) {
+ synchronized (PerFileSICollector.this.fLock) {
+ rc = (psi == null || psi.isEmpty());
+ }
}
}
return rc;
@@ -793,151 +778,151 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
@Override
public Map<IResource, PathInfo> getPathInfoMap() {
- synchronized (PerFileSICollector.this.fLock) {
+ synchronized (PerFileSICollector.this.fLock) {
//TODO: do we need to cache this?
return calculatePathInfoMap();
- }
+ }
}
- }
+ }
- protected Map<IResource, PathInfo> calculatePathInfoMap(){
+ protected Map<IResource, PathInfo> calculatePathInfoMap() {
assert Thread.holdsLock(fLock);
- Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
- Set<Entry<IFile, Integer>> entrySet = sid.fileToCommandIdMap.entrySet();
- for (Entry<IFile, Integer> entry : entrySet) {
- IFile file = entry.getKey();
- if(file != null){
- CCommandDSC cmd = sid.commandIdCommandMap.get(entry.getValue());
- if(cmd != null){
- PathInfo fpi = createFilePathInfo(cmd);
- map.put(file, fpi);
- }
- }
- }
-
- if(project != null){
- if(psi == null){
- generateProjectScannerInfo();
- }
-
- PathInfo fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles, psi.macrosFiles);
- map.put(project, fpi);
- }
-
- return map;
- }
-
- protected static PathInfo createFilePathInfo(CCommandDSC cmd){
- IPath[] includes = stringListToPathArray(cmd.getIncludes());
- IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
- IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
- IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile());
- List<String> symbols = cmd.getSymbols();
- Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
- for (String symbol : symbols) {
- String key = ScannerConfigUtil.getSymbolKey(symbol);
- String value = ScannerConfigUtil.getSymbolValue(symbol);
- definedSymbols.put(key, value);
- }
-
- return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
- }
-
- protected CCommandDSC getCommand(IPath path) {
- try {
- IFile file = project.getWorkspace().getRoot().getFile(path);
- return getCommand(file);
- }
- catch (Exception e) {
- return null;
- }
- }
-
- protected CCommandDSC getCommand(IFile file) {
- CCommandDSC cmd = null;
- if (file != null) {
- Integer cmdId = sid.fileToCommandIdMap.get(file);
- if (cmdId != null) {
- // get the command
- cmd = sid.commandIdCommandMap.get(cmdId);
- }
- }
- return cmd;
- }
-
- /**
- * @param type can be one of the following:
- * <li><code>INCLUDE_PATH</code>
- * <li><code>QUOTE_INCLUDE_PATH</code>
- * <li><code>INCLUDE_FILE</code>
- * <li><code>MACROS_FILE</code>
- *
- * @return list of IPath(s).
- */
- protected IPath[] getAllIncludePaths(int type) {
- List<String> allIncludes = new ArrayList<String>();
- Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
- for (Integer cmdId : cmdIds) {
- CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
- if (cmd.isDiscovered()) {
- List<String> discovered = null;
- switch (type) {
- case INCLUDE_PATH:
- discovered = cmd.getIncludes();
- break;
- case QUOTE_INCLUDE_PATH:
- discovered = cmd.getQuoteIncludes();
- break;
- case INCLUDE_FILE:
- discovered = cmd.getIncludeFile();
- break;
- case MACROS_FILE:
- discovered = cmd.getImacrosFile();
- break;
- default:
- discovered = new ArrayList<String>(0);
- }
- for (String include : discovered) {
- // the following line degrades perfomance
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=189127
- // it is not necessary for renaming projects anyway
- // include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString();
- if (!allIncludes.contains(include)) {
- allIncludes.add(include);
- }
- }
- }
- }
- return stringListToPathArray(allIncludes);
- }
+ Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
+ Set<Entry<IFile, Integer>> entrySet = sid.fileToCommandIdMap.entrySet();
+ for (Entry<IFile, Integer> entry : entrySet) {
+ IFile file = entry.getKey();
+ if (file != null) {
+ CCommandDSC cmd = sid.commandIdCommandMap.get(entry.getValue());
+ if (cmd != null) {
+ PathInfo fpi = createFilePathInfo(cmd);
+ map.put(file, fpi);
+ }
+ }
+ }
+
+ if (project != null) {
+ if (psi == null) {
+ generateProjectScannerInfo();
+ }
+
+ PathInfo fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles,
+ psi.macrosFiles);
+ map.put(project, fpi);
+ }
+
+ return map;
+ }
+
+ protected static PathInfo createFilePathInfo(CCommandDSC cmd) {
+ IPath[] includes = stringListToPathArray(cmd.getIncludes());
+ IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
+ IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
+ IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile());
+ List<String> symbols = cmd.getSymbols();
+ Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
+ for (String symbol : symbols) {
+ String key = ScannerConfigUtil.getSymbolKey(symbol);
+ String value = ScannerConfigUtil.getSymbolValue(symbol);
+ definedSymbols.put(key, value);
+ }
+
+ return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
+ }
+
+ protected CCommandDSC getCommand(IPath path) {
+ try {
+ IFile file = project.getWorkspace().getRoot().getFile(path);
+ return getCommand(file);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ protected CCommandDSC getCommand(IFile file) {
+ CCommandDSC cmd = null;
+ if (file != null) {
+ Integer cmdId = sid.fileToCommandIdMap.get(file);
+ if (cmdId != null) {
+ // get the command
+ cmd = sid.commandIdCommandMap.get(cmdId);
+ }
+ }
+ return cmd;
+ }
+
+ /**
+ * @param type can be one of the following:
+ * <li><code>INCLUDE_PATH</code>
+ * <li><code>QUOTE_INCLUDE_PATH</code>
+ * <li><code>INCLUDE_FILE</code>
+ * <li><code>MACROS_FILE</code>
+ *
+ * @return list of IPath(s).
+ */
+ protected IPath[] getAllIncludePaths(int type) {
+ List<String> allIncludes = new ArrayList<String>();
+ Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
+ for (Integer cmdId : cmdIds) {
+ CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
+ if (cmd.isDiscovered()) {
+ List<String> discovered = null;
+ switch (type) {
+ case INCLUDE_PATH:
+ discovered = cmd.getIncludes();
+ break;
+ case QUOTE_INCLUDE_PATH:
+ discovered = cmd.getQuoteIncludes();
+ break;
+ case INCLUDE_FILE:
+ discovered = cmd.getIncludeFile();
+ break;
+ case MACROS_FILE:
+ discovered = cmd.getImacrosFile();
+ break;
+ default:
+ discovered = new ArrayList<String>(0);
+ }
+ for (String include : discovered) {
+ // the following line degrades perfomance
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=189127
+ // it is not necessary for renaming projects anyway
+ // include = CCommandDSC.makeRelative(project, new Path(include)).toPortableString();
+ if (!allIncludes.contains(include)) {
+ allIncludes.add(include);
+ }
+ }
+ }
+ }
+ return stringListToPathArray(allIncludes);
+ }
protected static IPath[] stringListToPathArray(List<String> discovered) {
List<Path> allIncludes = new ArrayList<Path>(discovered.size());
for (String include : discovered) {
- if (!allIncludes.contains(include)) {
- allIncludes.add(new Path(include));
- }
+ if (!allIncludes.contains(include)) {
+ allIncludes.add(new Path(include));
+ }
}
return allIncludes.toArray(new IPath[allIncludes.size()]);
}
- protected Map<String, String> getAllSymbols() {
+ protected Map<String, String> getAllSymbols() {
assert Thread.holdsLock(fLock);
- Map<String, String> symbols = new HashMap<String, String>();
- Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
- for (Integer cmdId : cmdIds) {
- CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
- if (cmd.isDiscovered()) {
- List<String> discovered = cmd.getSymbols();
- for (String symbol : discovered) {
- String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
- String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
- symbols.put(key, value);
- }
- }
- }
- return symbols;
- }
+ Map<String, String> symbols = new HashMap<String, String>();
+ Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
+ for (Integer cmdId : cmdIds) {
+ CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
+ if (cmd.isDiscovered()) {
+ List<String> discovered = cmd.getSymbols();
+ for (String symbol : discovered) {
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
+ symbols.put(key, value);
+ }
+ }
+ }
+ return symbols;
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
index 016ab7dea63..63acee31c14 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
@@ -73,23 +73,23 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
protected IProject project;
protected InfoContext context;
- private boolean isBuiltinConfig= false;
+ private boolean isBuiltinConfig = false;
protected Map<ScannerInfoTypes, List<String>> discoveredSI;
-// private List discoveredIncludes;
-// private List discoveredSymbols;
-// private List discoveredTSO; // target specific options
+ // private List discoveredIncludes;
+ // private List discoveredSymbols;
+ // private List discoveredTSO; // target specific options
// cumulative values
protected List<String> sumDiscoveredIncludes;
private Map<String, SymbolEntry> sumDiscoveredSymbols;
- protected boolean scPersisted = false;
+ protected boolean scPersisted = false;
public PerProjectSICollector() {
- discoveredSI = new HashMap<ScannerInfoTypes, List<String>>();
-// discoveredIncludes = new ArrayList();
-// discoveredSymbols = new ArrayList();
-// discoveredTSO = new ArrayList();
-//
+ discoveredSI = new HashMap<ScannerInfoTypes, List<String>>();
+ // discoveredIncludes = new ArrayList();
+ // discoveredSymbols = new ArrayList();
+ // discoveredTSO = new ArrayList();
+ //
sumDiscoveredIncludes = new ArrayList<String>();
sumDiscoveredSymbols = new LinkedHashMap<String, SymbolEntry>();
}
@@ -103,13 +103,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
this.context = new InfoContext(project);
}
- public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo, boolean isBuiltinConfig) {
- this.isBuiltinConfig= isBuiltinConfig;
+ public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo,
+ boolean isBuiltinConfig) {
+ this.isBuiltinConfig = isBuiltinConfig;
try {
contributeToScannerConfig(resource, scannerInfo);
- }
- finally {
- this.isBuiltinConfig= false;
+ } finally {
+ this.isBuiltinConfig = false;
}
}
@@ -122,14 +122,11 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
String errorMessage = null;
if (resource == null) {
errorMessage = "resource is null";//$NON-NLS-1$
- }
- else if (!(resource instanceof IResource)) {
+ } else if (!(resource instanceof IResource)) {
errorMessage = "resource is not an IResource";//$NON-NLS-1$
- }
- else if (((IResource) resource).getProject() == null) {
+ } else if (((IResource) resource).getProject() == null) {
errorMessage = "project is null";//$NON-NLS-1$
- }
- else if (!((IResource) resource).getProject().equals(project)) {
+ } else if (!((IResource) resource).getProject().equals(project)) {
errorMessage = "wrong project";//$NON-NLS-1$
}
if (errorMessage != null) {
@@ -137,35 +134,32 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
return;
}
- if (scPersisted) {
- // delete discovered scanner config
- discoveredSI.clear();
- // new collection cycle
- scPersisted = false;
- }
+ if (scPersisted) {
+ // delete discovered scanner config
+ discoveredSI.clear();
+ // new collection cycle
+ scPersisted = false;
+ }
try {
if (/*project.hasNature(MakeProjectNature.NATURE_ID) && */// limits to StandardMake projects
- (project.hasNature(CProjectNature.C_NATURE_ID) ||
- project.hasNature(CCProjectNature.CC_NATURE_ID))) {
-
- for (Object name : scannerInfo.keySet()) {
- ScannerInfoTypes siType = (ScannerInfoTypes) name;
- @SuppressWarnings("unchecked")
- List<String> delta = (List<String>) scannerInfo.get(siType);
-
- List<String> discovered = discoveredSI.get(siType);
- if (discovered == null) {
- discovered = new ArrayList<String>(delta);
- discoveredSI.put(siType, discovered);
- }
- else {
- final boolean addSorted= !isBuiltinConfig && siType.equals(ScannerInfoTypes.INCLUDE_PATHS);
- contribute(discovered, delta, addSorted);
- }
- }
+ (project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID))) {
+
+ for (Object name : scannerInfo.keySet()) {
+ ScannerInfoTypes siType = (ScannerInfoTypes) name;
+ @SuppressWarnings("unchecked")
+ List<String> delta = (List<String>) scannerInfo.get(siType);
+
+ List<String> discovered = discoveredSI.get(siType);
+ if (discovered == null) {
+ discovered = new ArrayList<String>(delta);
+ discoveredSI.put(siType, discovered);
+ } else {
+ final boolean addSorted = !isBuiltinConfig && siType.equals(ScannerInfoTypes.INCLUDE_PATHS);
+ contribute(discovered, delta, addSorted);
+ }
+ }
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
MakeCorePlugin.log(e);
}
}
@@ -185,7 +179,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
/**
* Adds new items to the already accumulated ones preserving order
*
- * @param sumIncludes - previously accumulated items
+ * @param sumIncludes - previously accumulated items
* @param includes - items to be added
* @param ordered - to preserve order or append at the end
* @return boolean - true if added
@@ -195,12 +189,12 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
return false;
boolean addedIncludes = false;
- int insertionPoint= ordered ? 0 : sumIncludes.size();
+ int insertionPoint = ordered ? 0 : sumIncludes.size();
for (String item : includes) {
- int pos= sumIncludes.indexOf(item);
+ int pos = sumIncludes.indexOf(item);
if (pos >= 0) {
if (ordered) {
- insertionPoint= pos+1;
+ insertionPoint = pos + 1;
}
} else {
sumIncludes.add(insertionPoint++, item);
@@ -218,28 +212,30 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context);
- if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
- IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo;
-
- monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
- if (scannerConfigNeedsUpdate(projectPathInfo)) {
- monitor.worked(50);
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
- try {
- // update scanner configuration
+ IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project,
+ context);
+ if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
+ IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo;
+
+ monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
+ if (scannerConfigNeedsUpdate(projectPathInfo)) {
+ monitor.worked(50);
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
+ try {
+ // update scanner configuration
List<IResource> resourceDelta = new ArrayList<IResource>(1);
resourceDelta.add(project);
- MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo, context.isDefaultContext(), resourceDelta);
- monitor.worked(50);
- } catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- }
- monitor.done();
- scPersisted = true;
- }
+ MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo,
+ context.isDefaultContext(), resourceDelta);
+ monitor.worked(50);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+ monitor.done();
+ scPersisted = true;
+ }
}
/**
@@ -257,21 +253,21 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
*/
private boolean includePathsNeedUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
boolean addedIncludes = false;
- List<String> discoveredIncludes = discoveredSI.get(ScannerInfoTypes.INCLUDE_PATHS);
+ List<String> discoveredIncludes = discoveredSI.get(ScannerInfoTypes.INCLUDE_PATHS);
if (discoveredIncludes != null) {
// Step 1. Add discovered scanner config to the existing discovered scanner config
// add the includes from the latest discovery
-// if (sumDiscoveredIncludes == null) {
-// sumDiscoveredIncludes = new ArrayList(discoveredIncludes);
-// addedIncludes = true;
-// }
-// else {
-// addedIncludes = addItemsWithOrder(sumDiscoveredIncludes, discoveredIncludes, true);
-// }
-// instead
- addedIncludes = addItemsWithOrder(sumDiscoveredIncludes, discoveredIncludes, true);
-
- // try to translate cygpaths to absolute paths
+ // if (sumDiscoveredIncludes == null) {
+ // sumDiscoveredIncludes = new ArrayList(discoveredIncludes);
+ // addedIncludes = true;
+ // }
+ // else {
+ // addedIncludes = addItemsWithOrder(sumDiscoveredIncludes, discoveredIncludes, true);
+ // }
+ // instead
+ addedIncludes = addItemsWithOrder(sumDiscoveredIncludes, discoveredIncludes, true);
+
+ // try to translate cygpaths to absolute paths
List<String> finalSumIncludes = CygpathTranslator.translateIncludePaths(project, sumDiscoveredIncludes);
// Step 2. Get project's scanner config
@@ -288,20 +284,20 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
for (String include : persistedKeyList) {
if (persistedIncludes.containsKey(include)) {
newPersistedIncludes.put(include, persistedIncludes.get(include));
- }
- else {
+ } else {
// the paths may be on EFS resources, not local
Boolean includePathExists = true;
URI projectLocationURI = discPathInfo.getProject().getLocationURI();
// use the project's location... create a URI that uses the same provider but that points to the include path
- URI includeURI = EFSExtensionManager.getDefault().createNewURIFromPath(projectLocationURI, include);
+ URI includeURI = EFSExtensionManager.getDefault().createNewURIFromPath(projectLocationURI,
+ include);
// ask EFS if the path exists
try {
IFileStore fileStore = EFS.getStore(includeURI);
IFileInfo info = fileStore.fetchInfo();
- if(!info.exists()) {
+ if (!info.exists()) {
includePathExists = false;
}
} catch (CoreException e) {
@@ -313,8 +309,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
newPersistedIncludes.put(include, !includePathExists);
}
}
- }
- else {
+ } else {
newPersistedIncludes = persistedIncludes;
}
@@ -329,21 +324,24 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
*/
protected boolean definedSymbolsNeedUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
boolean addedSymbols = false;
- List<String> discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+ List<String> discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
if (discoveredSymbols != null) {
// Step 1. Add discovered scanner config to the existing discovered scanner config
// add the symbols from the latest discovery
-// if (sumDiscoveredSymbols == null) {
-// sumDiscoveredSymbols = new LinkedHashMap();
-// }
- addedSymbols = ScannerConfigUtil.scAddSymbolsList2SymbolEntryMap(sumDiscoveredSymbols, discoveredSymbols, true);
+ // if (sumDiscoveredSymbols == null) {
+ // sumDiscoveredSymbols = new LinkedHashMap();
+ // }
+ addedSymbols = ScannerConfigUtil.scAddSymbolsList2SymbolEntryMap(sumDiscoveredSymbols, discoveredSymbols,
+ true);
// Step 2. Get project's scanner config
LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap();
// Step 3. Merge scanner config from steps 1 and 2
- LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<String, SymbolEntry>(persistedSymbols);
- addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols, sumDiscoveredSymbols);
+ LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<String, SymbolEntry>(
+ persistedSymbols);
+ addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols,
+ sumDiscoveredSymbols);
// Step 4. Set resulting scanner config
discPathInfo.setSymbolMap(candidateSymbols);
@@ -351,133 +349,128 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
return addedSymbols;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes)
+ */
+ @Override
public List<String> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
- List<String> rv = null;
- // check the resource
- String errorMessage = null;
- if (resource == null) {
- errorMessage = "resource is null";//$NON-NLS-1$
- }
- else if (!(resource instanceof IResource)) {
- errorMessage = "resource is not an IResource";//$NON-NLS-1$
- }
- else if (((IResource) resource).getProject() == null) {
- errorMessage = "project is null";//$NON-NLS-1$
- }
- else if (((IResource) resource).getProject() != project) {
- errorMessage = "wrong project";//$NON-NLS-1$
- }
-
- if (errorMessage != null) {
- TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
- }
- else if (resource!=null && project.equals(((IResource)resource).getProject())) {
- rv = discoveredSI.get(type);
- }
- return rv;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#getDefinedSymbols()
- */
- public Map<String, String> getDefinedSymbols() {
- Map<String, String> definedSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(sumDiscoveredSymbols);
- return definedSymbols;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#getIncludePaths()
- */
- public List<String> getIncludePaths() {
- return sumDiscoveredIncludes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#serialize(org.w3c.dom.Element)
- */
- public void serialize(Element root) {
- // not supported in PerProject collector
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deserialize(org.w3c.dom.Element)
- */
- public void deserialize(Element root) {
- // not supported in PerProject collector
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
- */
- @Override
+ List<String> rv = null;
+ // check the resource
+ String errorMessage = null;
+ if (resource == null) {
+ errorMessage = "resource is null";//$NON-NLS-1$
+ } else if (!(resource instanceof IResource)) {
+ errorMessage = "resource is not an IResource";//$NON-NLS-1$
+ } else if (((IResource) resource).getProject() == null) {
+ errorMessage = "project is null";//$NON-NLS-1$
+ } else if (((IResource) resource).getProject() != project) {
+ errorMessage = "wrong project";//$NON-NLS-1$
+ }
+
+ if (errorMessage != null) {
+ TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$
+ } else if (resource != null && project.equals(((IResource) resource).getProject())) {
+ rv = discoveredSI.get(type);
+ }
+ return rv;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#getDefinedSymbols()
+ */
+ public Map<String, String> getDefinedSymbols() {
+ Map<String, String> definedSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(sumDiscoveredSymbols);
+ return definedSymbols;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#getIncludePaths()
+ */
+ public List<String> getIncludePaths() {
+ return sumDiscoveredIncludes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#serialize(org.w3c.dom.Element)
+ */
+ public void serialize(Element root) {
+ // not supported in PerProject collector
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deserialize(org.w3c.dom.Element)
+ */
+ public void deserialize(Element root) {
+ // not supported in PerProject collector
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAllPaths(IResource resource) {
- IProject project = resource.getProject();
- if (project != null && project.equals(this.project)) {
- sumDiscoveredIncludes.clear();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
- */
- @Override
+ IProject project = resource.getProject();
+ if (project != null && project.equals(this.project)) {
+ sumDiscoveredIncludes.clear();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAllSymbols(IResource resource) {
- IProject project = resource.getProject();
- if (project != null && project.equals(this.project)) {
- sumDiscoveredSymbols.clear();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
+ IProject project = resource.getProject();
+ if (project != null && project.equals(this.project)) {
+ sumDiscoveredSymbols.clear();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
public void deletePath(IResource resource, String path) {
- IProject project = resource.getProject();
- if (project != null && project.equals(this.project)) {
- sumDiscoveredIncludes.remove(path);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
- */
- @Override
+ IProject project = resource.getProject();
+ if (project != null && project.equals(this.project)) {
+ sumDiscoveredIncludes.remove(path);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
public void deleteSymbol(IResource resource, String symbol) {
- IProject project = resource.getProject();
- if (project != null && project.equals(this.project)) {
- // remove it from the Map of SymbolEntries
- ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
- */
- @Override
+ IProject project = resource.getProject();
+ if (project != null && project.equals(this.project)) {
+ // remove it from the Map of SymbolEntries
+ ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ @Override
public void deleteAll(IResource resource) {
- deleteAllPaths(resource);
- deleteAllSymbols(resource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
- */
- @Override
+ deleteAllPaths(resource);
+ deleteAllSymbols(resource);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
+ */
+ @Override
public IDiscoveredPathInfo createPathInfoObject() {
- DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
- try {
- DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, pathInfo);
- }
- catch (CoreException e) {
- MakeCorePlugin.log(e);
- }
- return pathInfo;
- }
+ DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
+ try {
+ DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, pathInfo);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+ return pathInfo;
+ }
/**
* Static method to return compiler built-in scanner info.
@@ -487,11 +480,10 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
public static void calculateCompilerBuiltins(final IProject project) throws CModelException {
createDiscoveredPathContainer(project, new NullProgressMonitor());
String scdProfileId = ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID;
- SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
- getSCProfileInstance(project, scdProfileId);
- final IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.
- createScannerConfigBuildInfo2(MakeCorePlugin.getDefault().getPluginPreferences(),
- scdProfileId, true);
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(project,
+ scdProfileId);
+ final IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager
+ .createScannerConfigBuildInfo2(MakeCorePlugin.getDefault().getPluginPreferences(), scdProfileId, true);
final IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
if (collector instanceof IScannerInfoCollectorCleaner) {
((IScannerInfoCollectorCleaner) collector).deleteAll(project);
@@ -521,20 +513,21 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
SafeRunner.run(runnable);
}
- private static void createDiscoveredPathContainer(IProject project, IProgressMonitor monitor) throws CModelException {
- IPathEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
- ICProject cProject = CoreModel.getDefault().create(project);
- if (cProject != null) {
- IPathEntry[] entries = cProject.getRawPathEntries();
- List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries));
- if (!newEntries.contains(container)) {
- newEntries.add(container);
- cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
- }
- }
- // create a new discovered scanner config store
- MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project);
- }
+ private static void createDiscoveredPathContainer(IProject project, IProgressMonitor monitor)
+ throws CModelException {
+ IPathEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID);
+ ICProject cProject = CoreModel.getDefault().create(project);
+ if (cProject != null) {
+ IPathEntry[] entries = cProject.getRawPathEntries();
+ List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries));
+ if (!newEntries.contains(container)) {
+ newEntries.add(container);
+ cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
+ }
+ }
+ // create a new discovered scanner config store
+ MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project);
+ }
@Override
public void setInfoContext(InfoContext context) {
@@ -542,7 +535,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
this.project = context.getProject();
}
- public InfoContext getContext(){
+ public InfoContext getContext() {
return this.context;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java
index b5ac55cbd33..642108dc019 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
@@ -29,134 +29,131 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-
/**
* A 'provider' that will generate a special makefile to generate scanner config
- *
+ *
* @author vhirsl
*/
public class SCDMakefileGenerator extends DefaultRunSIProvider {
- private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$
- private static final String DENDL = ENDL+ENDL;
- private String fMakeCommand = "-f ${project_name}_scd.mk "; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
- */
- @Override
+ private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$
+ private static final String DENDL = ENDL + ENDL;
+ private String fMakeCommand = "-f ${project_name}_scd.mk "; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
+ */
+ @Override
protected boolean initialize() {
- String args = buildInfo.getProviderRunArguments(providerId);
- if (null == args)
- args = " -E -P -v -dD "; //$NON-NLS-1$
- else {
- int nPos = args.indexOf('|');
- if(nPos > 0) {
- fMakeCommand = args.substring(0, nPos);
- args = args.substring(nPos + 1);
- }
- }
- fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
- args = substituteDynamicVariables(args);
- fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(args, "\"");//$NON-NLS-1$
- fWorkingDirectory = MakeCorePlugin.getWorkingDirectory();
- fMakeCommand = substituteDynamicVariables(fMakeCommand);
-
- return generateMakefile(resource.getProject().getName());
- }
+ String args = buildInfo.getProviderRunArguments(providerId);
+ if (null == args)
+ args = " -E -P -v -dD "; //$NON-NLS-1$
+ else {
+ int nPos = args.indexOf('|');
+ if (nPos > 0) {
+ fMakeCommand = args.substring(0, nPos);
+ args = args.substring(nPos + 1);
+ }
+ }
+ fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
+ args = substituteDynamicVariables(args);
+ fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(args, "\"");//$NON-NLS-1$
+ fWorkingDirectory = MakeCorePlugin.getWorkingDirectory();
+ fMakeCommand = substituteDynamicVariables(fMakeCommand);
+
+ return generateMakefile(resource.getProject().getName());
+ }
private boolean generateMakefile(String projectName) {
- boolean rc = false;
- if (collector instanceof IScannerInfoCollector2) {
- IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
- @SuppressWarnings("unchecked")
- List<CCommandDSC> commands = collector2.getCollectedScannerInfo(
- resource.getProject(), ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND);
- if (commands != null && commands.size() > 0) {
-
- StringBuilder buffer = new StringBuilder();
- buffer.append("# This is a generated file. Please do not edit."); //$NON-NLS-1$
- buffer.append(DENDL);
- buffer.append(".PHONY: all"); //$NON-NLS-1$
- buffer.append(DENDL);
- buffer.append("COMMANDS := "); //$NON-NLS-1$
- for (CCommandDSC cmd : commands) {
- buffer.append("\t\\"); //$NON-NLS-1$
- buffer.append(ENDL);
- buffer.append("\t scd_cmd_"); //$NON-NLS-1$
- buffer.append(cmd.getCommandId());
- }
- buffer.append(DENDL);
- buffer.append("all: $(COMMANDS)"); //$NON-NLS-1$
- buffer.append(DENDL);
- for (CCommandDSC cmd : commands) {
- buffer.append("scd_cmd_"); //$NON-NLS-1$
- buffer.append(cmd.getCommandId());
- buffer.append(':');
- buffer.append(ENDL);
- buffer.append("\t@echo begin generating scanner info for $@"); //$NON-NLS-1$
- buffer.append(ENDL);
- buffer.append('\t');
- buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines
- for (String arg : prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId))) {
- buffer.append(' ');
- buffer.append(arg);
- }
- buffer.append(' ');
- buffer.append(cmd.appliesToCPPFileType() ? "specs.cpp" : "specs.c"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append(ENDL);
- buffer.append("\t@echo end generating scanner info for $@"); //$NON-NLS-1$
- buffer.append(DENDL);
- }
-
- File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName));
- try {
- PrintStream ps = new PrintStream(new FileOutputStream(makefile));
- ps.println(buffer.toString());
- ps.close();
- rc = true;
- }
- catch (FileNotFoundException e) {
- MakeCorePlugin.log(e);
- }
- }
- }
-
- return rc;
- }
-
- private String getMakeFileName(String projectName) {
- String[] makeArgs = ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");//$NON-NLS-1$
- boolean found = false;
- for(String arg : makeArgs) {
- if(found)
- return arg;
- if(arg.equals("-f")) //$NON-NLS-1$
- found = true;
- }
- return projectName+"_scd.mk"; //$NON-NLS-1$
- }
-
+ boolean rc = false;
+ if (collector instanceof IScannerInfoCollector2) {
+ IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector;
+ @SuppressWarnings("unchecked")
+ List<CCommandDSC> commands = collector2.getCollectedScannerInfo(resource.getProject(),
+ ScannerInfoTypes.UNDISCOVERED_COMPILER_COMMAND);
+ if (commands != null && commands.size() > 0) {
- protected String substituteDynamicVariables(String in) {
- String string = in;
-// TODO: replace it with Eclipse Dynamic Variable Resolver
-// string = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(string, false);
- string = string.replaceAll("\\$\\{project_name\\}", //$NON-NLS-1$
- resource.getProject().getName());
- string = string.replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
- MakeCorePlugin.getWorkingDirectory().toString());
- string = string.replaceAll("\\$\\{specs_file\\}", //$NON-NLS-1$
- GCCScannerConfigUtil.C_SPECS_FILE );
- return string;
- }
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("# This is a generated file. Please do not edit."); //$NON-NLS-1$
+ buffer.append(DENDL);
+ buffer.append(".PHONY: all"); //$NON-NLS-1$
+ buffer.append(DENDL);
+ buffer.append("COMMANDS := "); //$NON-NLS-1$
+ for (CCommandDSC cmd : commands) {
+ buffer.append("\t\\"); //$NON-NLS-1$
+ buffer.append(ENDL);
+ buffer.append("\t scd_cmd_"); //$NON-NLS-1$
+ buffer.append(cmd.getCommandId());
+ }
+ buffer.append(DENDL);
+ buffer.append("all: $(COMMANDS)"); //$NON-NLS-1$
+ buffer.append(DENDL);
+ for (CCommandDSC cmd : commands) {
+ buffer.append("scd_cmd_"); //$NON-NLS-1$
+ buffer.append(cmd.getCommandId());
+ buffer.append(':');
+ buffer.append(ENDL);
+ buffer.append("\t@echo begin generating scanner info for $@"); //$NON-NLS-1$
+ buffer.append(ENDL);
+ buffer.append('\t');
+ buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines
+ for (String arg : prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId))) {
+ buffer.append(' ');
+ buffer.append(arg);
+ }
+ buffer.append(' ');
+ buffer.append(cmd.appliesToCPPFileType() ? "specs.cpp" : "specs.c"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append(ENDL);
+ buffer.append("\t@echo end generating scanner info for $@"); //$NON-NLS-1$
+ buffer.append(DENDL);
+ }
+
+ File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName));
+ try {
+ PrintStream ps = new PrintStream(new FileOutputStream(makefile));
+ ps.println(buffer.toString());
+ ps.close();
+ rc = true;
+ } catch (FileNotFoundException e) {
+ MakeCorePlugin.log(e);
+ }
+ }
+ }
+
+ return rc;
+ }
+
+ private String getMakeFileName(String projectName) {
+ String[] makeArgs = ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");//$NON-NLS-1$
+ boolean found = false;
+ for (String arg : makeArgs) {
+ if (found)
+ return arg;
+ if (arg.equals("-f")) //$NON-NLS-1$
+ found = true;
+ }
+ return projectName + "_scd.mk"; //$NON-NLS-1$
+ }
+
+ protected String substituteDynamicVariables(String in) {
+ String string = in;
+ // TODO: replace it with Eclipse Dynamic Variable Resolver
+ // string = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(string, false);
+ string = string.replaceAll("\\$\\{project_name\\}", //$NON-NLS-1$
+ resource.getProject().getName());
+ string = string.replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
+ MakeCorePlugin.getWorkingDirectory().toString());
+ string = string.replaceAll("\\$\\{specs_file\\}", //$NON-NLS-1$
+ GCCScannerConfigUtil.C_SPECS_FILE);
+ return string;
+ }
@Override
protected String[] getCommandLineOptions() {
- return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); //$NON-NLS-1$
+ return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); //$NON-NLS-1$
}
@Override
protected IPath getCommandToLaunch() {
- return new Path("make"); //$NON-NLS-1$
+ return new Path("make"); //$NON-NLS-1$
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
index 39403b4170f..a062dcd0cb7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
@@ -68,7 +68,8 @@ public class SCMarkerGenerator implements IMarkerGenerator {
protected IStatus run(IProgressMonitor monitor) {
IMarker marker;
try {
- IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
+ IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false,
+ IResource.DEPTH_ONE);
/*
* Try to find matching markers and don't put in duplicates
*/
@@ -77,13 +78,16 @@ public class SCMarkerGenerator implements IMarkerGenerator {
int line = ((Integer) cur[i].getAttribute(IMarker.LINE_NUMBER)).intValue();
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
- if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
+ if (line == problemMarkerInfo.lineNumber
+ && sev == mapMarkerSeverity(problemMarkerInfo.severity)
+ && mesg.equals(problemMarkerInfo.description)) {
return Status.OK_STATUS;
}
}
}
} catch (CoreException e) {
- return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
+ return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(),
+ Messages.SCMarkerGenerator_Error_Adding_Markers, e);
}
try {
@@ -99,7 +103,8 @@ public class SCMarkerGenerator implements IMarkerGenerator {
}
marker.setAttribute(IMarker.LOCATION, Messages.SCMarkerGenerator_Discovery_Options_Page);
} catch (CoreException e) {
- return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
+ return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(),
+ Messages.SCMarkerGenerator_Error_Adding_Markers, e);
}
return Status.OK_STATUS;
@@ -123,9 +128,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
int location = ((Integer) marker.getAttribute(IMarker.LINE_NUMBER)).intValue();
String error = (String) marker.getAttribute(IMarker.MESSAGE);
int sev = ((Integer) marker.getAttribute(IMarker.SEVERITY)).intValue();
- if (location == lineNumber &&
- errorDesc.equals(error) &&
- sev == severity) {
+ if (location == lineNumber && errorDesc.equals(error) && sev == severity) {
exactMarkers.add(marker);
}
}
@@ -134,21 +137,20 @@ public class SCMarkerGenerator implements IMarkerGenerator {
FixitManager.getInstance().deleteMarkers(exactMarkers.toArray(new IMarker[0]));
}
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
MakeCorePlugin.log(e.getStatus());
}
}
int mapMarkerSeverity(int severity) {
switch (severity) {
- case SEVERITY_ERROR_BUILD :
- case SEVERITY_ERROR_RESOURCE :
- return IMarker.SEVERITY_ERROR;
- case SEVERITY_INFO :
- return IMarker.SEVERITY_INFO;
- case SEVERITY_WARNING :
- return IMarker.SEVERITY_WARNING;
+ case SEVERITY_ERROR_BUILD:
+ case SEVERITY_ERROR_RESOURCE:
+ return IMarker.SEVERITY_ERROR;
+ case SEVERITY_INFO:
+ return IMarker.SEVERITY_INFO;
+ case SEVERITY_WARNING:
+ return IMarker.SEVERITY_WARNING;
}
return IMarker.SEVERITY_ERROR;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCProfileInstance.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCProfileInstance.java
index 1613d43f030..841e623dab3 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCProfileInstance.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCProfileInstance.java
@@ -30,7 +30,7 @@ import org.eclipse.core.resources.IProject;
/**
* Instantiated scanner config profile
- *
+ *
* @author vhirsl
*/
public class SCProfileInstance {
@@ -38,8 +38,9 @@ public class SCProfileInstance {
private ScannerConfigProfile profile;
private IScannerInfoCollector collector;
private InfoContext context;
+
/**
- *
+ *
*/
public SCProfileInstance(IProject project, ScannerConfigProfile profile) {
this(project, new InfoContext(project), profile);
@@ -52,46 +53,46 @@ public class SCProfileInstance {
}
/**
- *
+ *
*/
private void instantiateCollector() {
// create collector object
collector = createScannerInfoCollector();
- if (collector != null) {
- // call collector.setProject(project) if class supports it
- Class<? extends IScannerInfoCollector> clazz = collector.getClass();
- try {
-// Method setProjectMethod = clazz.getMethod("setProject", new Class[] {IProject.class});//$NON-NLS-1$
-// setProjectMethod.invoke(collector, new Object[] {project});
- Object[] args = null;
+ if (collector != null) {
+ // call collector.setProject(project) if class supports it
+ Class<? extends IScannerInfoCollector> clazz = collector.getClass();
+ try {
+ // Method setProjectMethod = clazz.getMethod("setProject", new Class[] {IProject.class});//$NON-NLS-1$
+ // setProjectMethod.invoke(collector, new Object[] {project});
+ Object[] args = null;
Method setMethod = null;
- if(context != null){
+ if (context != null) {
try {
- setMethod = clazz.getMethod("setInfoContext", new Class[] {InfoContext.class});//$NON-NLS-1$
- args = new Object[]{context};
- } catch(NoSuchMethodException e) {
+ setMethod = clazz.getMethod("setInfoContext", new Class[] { InfoContext.class });//$NON-NLS-1$
+ args = new Object[] { context };
+ } catch (NoSuchMethodException e) {
}
}
-
- if(setMethod == null){
+
+ if (setMethod == null) {
try {
- setMethod = clazz.getMethod("setProject", new Class[] {IProject.class});//$NON-NLS-1$
- args = new Object[]{project};
- } catch(NoSuchMethodException e) {
+ setMethod = clazz.getMethod("setProject", new Class[] { IProject.class });//$NON-NLS-1$
+ args = new Object[] { project };
+ } catch (NoSuchMethodException e) {
}
}
- if(setMethod != null)
+ if (setMethod != null)
setMethod.invoke(collector, args);
} catch (SecurityException e) {
MakeCorePlugin.log(e);
-// } catch (NoSuchMethodException e) {
+ // } catch (NoSuchMethodException e) {
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
MakeCorePlugin.log(e.getCause());
}
- }
+ }
// all other objects are created on request
}
@@ -108,7 +109,7 @@ public class SCProfileInstance {
}
return collector;
}
-
+
public IScannerInfoCollector createScannerInfoCollector() {
ScannerInfoCollector collector = profile.getScannerInfoCollectorElement();
if (collector != null) {
@@ -116,33 +117,35 @@ public class SCProfileInstance {
}
return null;
}
-
+
/**
* @return Creates new buildOutputProvider user object.
*/
public IExternalScannerInfoProvider createBuildOutputProvider() {
- BuildOutputProvider bop = profile.getBuildOutputProviderElement();
- if (bop != null) {
- Action action = bop.getAction();
- if (action != null) {
- return (IExternalScannerInfoProvider) action.createExternalScannerInfoProvider();
- }
- }
- return null;
+ BuildOutputProvider bop = profile.getBuildOutputProviderElement();
+ if (bop != null) {
+ Action action = bop.getAction();
+ if (action != null) {
+ return (IExternalScannerInfoProvider) action.createExternalScannerInfoProvider();
+ }
+ }
+ return null;
}
+
/**
* @return Creates new buildOutputParser user object.
*/
public IScannerInfoConsoleParser createBuildOutputParser() {
- BuildOutputProvider bop = profile.getBuildOutputProviderElement();
- if (bop != null) {
- ScannerInfoConsoleParser parserElement = bop.getScannerInfoConsoleParser();
- if (parserElement != null) {
- return (IScannerInfoConsoleParser) parserElement.createScannerInfoConsoleParser();
- }
- }
+ BuildOutputProvider bop = profile.getBuildOutputProviderElement();
+ if (bop != null) {
+ ScannerInfoConsoleParser parserElement = bop.getScannerInfoConsoleParser();
+ if (parserElement != null) {
+ return (IScannerInfoConsoleParser) parserElement.createScannerInfoConsoleParser();
+ }
+ }
return null;
}
+
/**
* @return Creates new externalSIProvider user object.
*/
@@ -153,6 +156,7 @@ public class SCProfileInstance {
}
return null;
}
+
/**
* @return Creates new esiProviderOutputParser user object.
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
index 5b848788dc5..dd5d36a1ab7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
@@ -68,11 +68,11 @@ public class ScannerConfigInfoFactory2 {
private static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
// preferences
private static final String DOT = ".";//$NON-NLS-1$
- private static final String SCD = "SCD.";//$NON-NLS-1$
+ private static final String SCD = "SCD.";//$NON-NLS-1$
private static final String SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX = "enabled";//$NON-NLS-1$
private static final String SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX = "selectedProfileId";//$NON-NLS-1$
- private static final String SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX = "problemReportingEnabled"; //$NON-NLS-1$
-// following require prefix: profileId
+ private static final String SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX = "problemReportingEnabled"; //$NON-NLS-1$
+ // following require prefix: profileId
private static final String BUILD_OUTPUT_OPEN_ACTION_ENABLED = ".BOP.open.enabled";//$NON-NLS-1$
private static final String BUILD_OUTPUT_OPEN_ACTION_FILE_PATH = ".BOP.open.path";//$NON-NLS-1$
private static final String BUILD_OUTPUT_PARSER_ENABLED = ".BOP.parser.enabled";//$NON-NLS-1$
@@ -85,14 +85,13 @@ public class ScannerConfigInfoFactory2 {
private static final String INFO_INSTANCE_IDS = SCD + "instanceIds";//$NON-NLS-1$
private static final String DELIMITER = ";";//$NON-NLS-1$
-
private static final String ELEMENT_CS_INFO = "scannerConfigBuildInfo";//$NON-NLS-1$
private static final String ATTRIBUTE_CS_INFO_INSTANCE_ID = "instanceId";//$NON-NLS-1$
private static class ScannerConfigInfoSet extends StoreSet {
private IProject fProject;
- ScannerConfigInfoSet(IProject project, String profileId){
+ ScannerConfigInfoSet(IProject project, String profileId) {
this.fProject = project;
load(profileId);
}
@@ -101,10 +100,13 @@ public class ScannerConfigInfoFactory2 {
ICDescriptor descriptor;
try {
descriptor = CCorePlugin.getDefault().getCProjectDescription(fProject, false);
- ICStorageElement rootEl = descriptor != null ? descriptor.getProjectStorageElement(SCANNER_CONFIG) : null;
+ ICStorageElement rootEl = descriptor != null ? descriptor.getProjectStorageElement(SCANNER_CONFIG)
+ : null;
InfoContext defaultContext = new InfoContext(fProject);
- if(rootEl == null || !rootEl.hasChildren()){
- BuildProperty prop = new BuildProperty(this, fProject, defaultContext, (Store)create(MakeCorePlugin.getDefault().getPluginPreferences(), profileId, false), profileId);
+ if (rootEl == null || !rootEl.hasChildren()) {
+ BuildProperty prop = new BuildProperty(this, fProject, defaultContext,
+ (Store) create(MakeCorePlugin.getDefault().getPluginPreferences(), profileId, false),
+ profileId);
fMap.put(defaultContext, prop);
prop.isDirty = true;
} else {
@@ -114,7 +116,7 @@ public class ScannerConfigInfoFactory2 {
for (ICStorageElement sc : rootEl.getChildren()) {
if (sc.getName().equals(ELEMENT_CS_INFO)) {
String instanceId = sc.getAttribute(ATTRIBUTE_CS_INFO_INSTANCE_ID);
- if(instanceId != null && instanceId.length() > 0){
+ if (instanceId != null && instanceId.length() > 0) {
InfoContext c = new InfoContext(fProject, instanceId);
BuildProperty p = new BuildProperty(this, fProject, c, profileId, sc);
fMap.put(c, p);
@@ -140,21 +142,21 @@ public class ScannerConfigInfoFactory2 {
// Clear all child settings
sc.clear();
- BuildProperty prop = (BuildProperty)fMap.get(new InfoContext(fProject));
+ BuildProperty prop = (BuildProperty) fMap.get(new InfoContext(fProject));
prop.store(sc);
for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : fMap.entrySet()) {
InfoContext context = entry.getKey();
- if(context.isDefaultContext())
+ if (context.isDefaultContext())
continue;
String instanceId = context.getInstanceId();
- if(instanceId.length() == 0)
+ if (instanceId.length() == 0)
continue;
- BuildProperty p = (BuildProperty)entry.getValue();
- if(p == prop)
+ BuildProperty p = (BuildProperty) entry.getValue();
+ if (p == prop)
continue;
ICStorageElement el = sc.createChild(ELEMENT_CS_INFO);
@@ -162,7 +164,7 @@ public class ScannerConfigInfoFactory2 {
p.store(el);
}
- if(serializeDescriptor)
+ if (serializeDescriptor)
descriptor.saveProjectData();
fIsDirty = false;
@@ -183,23 +185,24 @@ public class ScannerConfigInfoFactory2 {
private static class PreferenceSet extends StoreSet {
private Preferences prefs;
private boolean useDefaults;
- PreferenceSet(Preferences prefs, String profileId, boolean loadDefaults){
+
+ PreferenceSet(Preferences prefs, String profileId, boolean loadDefaults) {
this.prefs = prefs;
this.useDefaults = loadDefaults;
load(profileId);
}
- private void load(String profileId) {
+ private void load(String profileId) {
InfoContext defaultContext = new InfoContext(null);
String instancesStr = getString(INFO_INSTANCE_IDS);
String[] instanceIds = CDataUtil.stringToArray(instancesStr, DELIMITER);
Preference pref = new Preference(this, prefs, defaultContext, profileId, useDefaults);
fMap.put(defaultContext, pref);
- if(instanceIds != null && instanceIds.length != 0){
- for(int i = 0; i < instanceIds.length; i++) {
+ if (instanceIds != null && instanceIds.length != 0) {
+ for (int i = 0; i < instanceIds.length; i++) {
String id = instanceIds[i];
- if(id.length() == 0)
+ if (id.length() == 0)
continue;
InfoContext c = new InfoContext(null, id);
@@ -217,20 +220,20 @@ public class ScannerConfigInfoFactory2 {
Set<String> idSet = new HashSet<String>(fMap.size() - 1);
- Preference pref = (Preference)fMap.get(new InfoContext(null));
+ Preference pref = (Preference) fMap.get(new InfoContext(null));
pref.store();
for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : fMap.entrySet()) {
InfoContext context = entry.getKey();
- if(context.isDefaultContext())
+ if (context.isDefaultContext())
continue;
String instanceId = context.getInstanceId();
- if(instanceId.length() == 0)
+ if (instanceId.length() == 0)
continue;
- Preference p = (Preference)entry.getValue();
- if(p == pref)
+ Preference p = (Preference) entry.getValue();
+ if (p == pref)
continue;
p.store();
@@ -238,7 +241,7 @@ public class ScannerConfigInfoFactory2 {
idSet.add(instanceId);
}
- if(idSet.size() != 0){
+ if (idSet.size() != 0) {
String[] ids = idSet.toArray(new String[idSet.size()]);
String idsString = CDataUtil.arrayToString(ids, DELIMITER);
set(INFO_INSTANCE_IDS, idsString);
@@ -268,26 +271,24 @@ public class ScannerConfigInfoFactory2 {
private void set(String name, String value) {
if (useDefaults) {
prefs.setDefault(name, value);
- }
- else {
+ } else {
prefs.setValue(name, value);
}
}
}
-
private static abstract class StoreSet implements IScannerConfigBuilderInfo2Set {
protected HashMap<InfoContext, IScannerConfigBuilderInfo2> fMap = new HashMap<InfoContext, IScannerConfigBuilderInfo2>();
protected boolean fIsDirty;
- StoreSet(){
+ StoreSet() {
}
@Override
- public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
- IScannerConfigBuilderInfo2 base, String profileId){
+ public IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base,
+ String profileId) {
fIsDirty = true;
- Store store = doCreateStore(context, (Store)base, profileId);
+ Store store = doCreateStore(context, (Store) base, profileId);
fMap.put(context, store);
return store;
}
@@ -295,8 +296,7 @@ public class ScannerConfigInfoFactory2 {
protected abstract Store doCreateStore(InfoContext context, Store base, String profileId);
@Override
- public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
- IScannerConfigBuilderInfo2 base){
+ public IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base) {
fIsDirty = true;
return createInfo(context, base, ScannerConfigProfileManager.NULL_PROFILE_ID);
}
@@ -323,16 +323,17 @@ public class ScannerConfigInfoFactory2 {
return fMap.remove(context);
}
- private void checkRemoveInfo(InfoContext context) throws CoreException{
- if(context.isDefaultContext())
- throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeConfigurationDataProviderMessages.getString("ScannerConfigInfoFactory2.0"))); //$NON-NLS-1$
+ private void checkRemoveInfo(InfoContext context) throws CoreException {
+ if (context.isDefaultContext())
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID,
+ MakeConfigurationDataProviderMessages.getString("ScannerConfigInfoFactory2.0"))); //$NON-NLS-1$
}
- public boolean isDirty(){
- if(fIsDirty)
+ public boolean isDirty() {
+ if (fIsDirty)
return true;
for (IScannerConfigBuilderInfo2 prop : fMap.values()) {
- if(((Store)prop).isDirty)
+ if (((Store) prop).isDirty)
return true;
}
@@ -346,8 +347,7 @@ public class ScannerConfigInfoFactory2 {
}
@Override
- public IScannerConfigBuilderInfo2 createInfo(InfoContext context,
- String profileId) {
+ public IScannerConfigBuilderInfo2 createInfo(InfoContext context, String profileId) {
fIsDirty = true;
IScannerConfigBuilderInfo2 base = getInfo(new InfoContext(getProject()));
return createInfo(context, base, profileId);
@@ -356,54 +356,53 @@ public class ScannerConfigInfoFactory2 {
private static abstract class Store implements IScannerConfigBuilderInfo2 {
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
- protected boolean isDirty; // derived
+ protected boolean isDirty; // derived
protected boolean autoDiscoveryEnabled;
protected boolean problemReportingEnabled;
protected String selectedProfile = EMPTY_STRING;
/** Map from profile ID -> default ProfileOptions
* allows us to avoid storing options to .cproject when they are default .*/
- protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<String, ProfileOptions>();
+ protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<String, ProfileOptions>();
/** Map from profile ID -> ProfileOptions */
- protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<String, ProfileOptions>();
- static class ProfileOptions implements Cloneable {
- protected boolean buildOutputFileActionEnabled;
- protected String buildOutputFilePath = EMPTY_STRING;
- protected boolean buildOutputParserEnabled;
- /** Map from provider ID -> providerOptions */
- protected Map<String, ProviderOptions> providerOptionsMap;
- static class ProviderOptions implements Cloneable {
- protected String providerKind; // derived
- protected boolean providerOutputParserEnabled;
- protected boolean providerRunUseDefault;
- protected String providerRunCommand = EMPTY_STRING;
- protected String providerRunArguments = EMPTY_STRING;
- protected String providerOpenFilePath = EMPTY_STRING;
-
- ProviderOptions(){
- }
-
- ProviderOptions(ProviderOptions base){
- this.providerKind = base.providerKind;
- this.providerOutputParserEnabled = base.providerOutputParserEnabled;
- this.providerRunUseDefault = base.providerRunUseDefault;
- this.providerRunCommand = base.providerRunCommand;
- this.providerRunArguments = base.providerRunArguments;
- this.providerOpenFilePath = base.providerOpenFilePath;
- }
+ protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<String, ProfileOptions>();
+
+ static class ProfileOptions implements Cloneable {
+ protected boolean buildOutputFileActionEnabled;
+ protected String buildOutputFilePath = EMPTY_STRING;
+ protected boolean buildOutputParserEnabled;
+ /** Map from provider ID -> providerOptions */
+ protected Map<String, ProviderOptions> providerOptionsMap;
+
+ static class ProviderOptions implements Cloneable {
+ protected String providerKind; // derived
+ protected boolean providerOutputParserEnabled;
+ protected boolean providerRunUseDefault;
+ protected String providerRunCommand = EMPTY_STRING;
+ protected String providerRunArguments = EMPTY_STRING;
+ protected String providerOpenFilePath = EMPTY_STRING;
+
+ ProviderOptions() {
+ }
+
+ ProviderOptions(ProviderOptions base) {
+ this.providerKind = base.providerKind;
+ this.providerOutputParserEnabled = base.providerOutputParserEnabled;
+ this.providerRunUseDefault = base.providerRunUseDefault;
+ this.providerRunCommand = base.providerRunCommand;
+ this.providerRunArguments = base.providerRunArguments;
+ this.providerOpenFilePath = base.providerOpenFilePath;
+ }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((providerKind == null) ? 0 : providerKind.hashCode());
- result = prime * result
- + ((providerOpenFilePath == null) ? 0 : providerOpenFilePath.hashCode());
+ result = prime * result + ((providerOpenFilePath == null) ? 0 : providerOpenFilePath.hashCode());
result = prime * result + (providerOutputParserEnabled ? 1231 : 1237);
- result = prime * result
- + ((providerRunArguments == null) ? 0 : providerRunArguments.hashCode());
- result = prime * result
- + ((providerRunCommand == null) ? 0 : providerRunCommand.hashCode());
+ result = prime * result + ((providerRunArguments == null) ? 0 : providerRunArguments.hashCode());
+ result = prime * result + ((providerRunCommand == null) ? 0 : providerRunCommand.hashCode());
result = prime * result + (providerRunUseDefault ? 1231 : 1237);
return result;
}
@@ -446,32 +445,31 @@ public class ScannerConfigInfoFactory2 {
@Override
protected ProviderOptions clone() throws CloneNotSupportedException {
- return (ProviderOptions)super.clone();
+ return (ProviderOptions) super.clone();
}
- }
+ }
- ProfileOptions(){
- }
+ ProfileOptions() {
+ }
- ProfileOptions(ProfileOptions base){
- this.buildOutputFileActionEnabled = base.buildOutputFileActionEnabled;
- this.buildOutputFilePath = base.buildOutputFilePath;
- this.buildOutputParserEnabled = base.buildOutputParserEnabled;
- this.providerOptionsMap = new LinkedHashMap<String, ProviderOptions>(base.providerOptionsMap);
- for (Map.Entry<String, ProviderOptions> entry : providerOptionsMap.entrySet()) {
- ProviderOptions basePo = entry.getValue();
- entry.setValue(new ProviderOptions(basePo));
- }
- }
+ ProfileOptions(ProfileOptions base) {
+ this.buildOutputFileActionEnabled = base.buildOutputFileActionEnabled;
+ this.buildOutputFilePath = base.buildOutputFilePath;
+ this.buildOutputParserEnabled = base.buildOutputParserEnabled;
+ this.providerOptionsMap = new LinkedHashMap<String, ProviderOptions>(base.providerOptionsMap);
+ for (Map.Entry<String, ProviderOptions> entry : providerOptionsMap.entrySet()) {
+ ProviderOptions basePo = entry.getValue();
+ entry.setValue(new ProviderOptions(basePo));
+ }
+ }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (buildOutputFileActionEnabled ? 1231 : 1237);
- result = prime * result
- + ((buildOutputFilePath == null) ? 0 : buildOutputFilePath.hashCode());
+ result = prime * result + ((buildOutputFilePath == null) ? 0 : buildOutputFilePath.hashCode());
result = prime * result + (buildOutputParserEnabled ? 1231 : 1237);
result = prime * result + ((providerOptionsMap == null) ? 0 : providerOptionsMap.hashCode());
return result;
@@ -506,7 +504,7 @@ public class ScannerConfigInfoFactory2 {
@Override
public ProfileOptions clone() {
try {
- ProfileOptions newProfOpts = (ProfileOptions)super.clone();
+ ProfileOptions newProfOpts = (ProfileOptions) super.clone();
if (providerOptionsMap != null) {
newProfOpts.providerOptionsMap = new LinkedHashMap<String, ProviderOptions>();
for (Map.Entry<String, ProviderOptions> e : providerOptionsMap.entrySet())
@@ -517,21 +515,22 @@ public class ScannerConfigInfoFactory2 {
return null;
}
}
- }
+ }
protected Store() {
}
- protected Store(Store base, String profileId){
+ protected Store(Store base, String profileId) {
this.autoDiscoveryEnabled = base.autoDiscoveryEnabled;
this.problemReportingEnabled = base.problemReportingEnabled;
- this.selectedProfile = ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId) ? base.selectedProfile : profileId;
+ this.selectedProfile = ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId) ? base.selectedProfile
+ : profileId;
this.selectedProfile = SafeStringInterner.safeIntern(this.selectedProfile);
this.profileOptionsMap.putAll(base.profileOptionsMap);
for (Map.Entry<String, ProfileOptions> entry : profileOptionsMap.entrySet()) {
- ProfileOptions basePo = entry.getValue();
- entry.setValue(new ProfileOptions(basePo));
- }
+ ProfileOptions basePo = entry.getValue();
+ entry.setValue(new ProfileOptions(basePo));
+ }
isDirty = true;
}
@@ -549,7 +548,7 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setAutoDiscoveryEnabled(boolean enable) {
- autoDiscoveryEnabled = setDirty(autoDiscoveryEnabled, enable);
+ autoDiscoveryEnabled = setDirty(autoDiscoveryEnabled, enable);
}
/* (non-Javadoc)
@@ -559,13 +558,15 @@ public class ScannerConfigInfoFactory2 {
public boolean isProblemReportingEnabled() {
return problemReportingEnabled;
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSIProblemGenerationEnabled(boolean)
*/
@Override
public void setProblemReportingEnabled(boolean enable) {
- problemReportingEnabled = setDirty(problemReportingEnabled, enable);
+ problemReportingEnabled = setDirty(problemReportingEnabled, enable);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSelectedProfileId()
*/
@@ -579,33 +580,33 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setSelectedProfileId(String profileId) {
- selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId));
-// if (isDirty) {
-// try {
-// load();
-// isDirty = false;
-// } catch (CoreException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProfileIdList()
- */
- @Override
+ selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId));
+ // if (isDirty) {
+ // try {
+ // load();
+ // isDirty = false;
+ // } catch (CoreException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ // }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProfileIdList()
+ */
+ @Override
public List<String> getProfileIdList() {
- return new ArrayList<String>(profileOptionsMap.keySet());
- }
+ return new ArrayList<String>(profileOptionsMap.keySet());
+ }
- /* (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isBuildOutputFileActionEnabled()
*/
@Override
public boolean isBuildOutputFileActionEnabled() {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- return (po != null) ? po.buildOutputFileActionEnabled : false;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ return (po != null) ? po.buildOutputFileActionEnabled : false;
}
/* (non-Javadoc)
@@ -613,10 +614,10 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setBuildOutputFileActionEnabled(boolean enable) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- po.buildOutputFileActionEnabled = setDirty(po.buildOutputFileActionEnabled, enable);
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ po.buildOutputFileActionEnabled = setDirty(po.buildOutputFileActionEnabled, enable);
+ }
}
/* (non-Javadoc)
@@ -624,7 +625,7 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public String getBuildOutputFilePath() {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
return (po != null) ? po.buildOutputFilePath : EMPTY_STRING;
}
@@ -633,10 +634,10 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setBuildOutputFilePath(String path) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- po.buildOutputFilePath = setDirty(po.buildOutputFilePath, path);
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ po.buildOutputFilePath = setDirty(po.buildOutputFilePath, path);
+ }
}
/* (non-Javadoc)
@@ -644,7 +645,7 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public boolean isBuildOutputParserEnabled() {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
return (po != null) ? po.buildOutputParserEnabled : true;
}
@@ -653,10 +654,10 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setBuildOutputParserEnabled(boolean enable) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- po.buildOutputParserEnabled = setDirty(po.buildOutputParserEnabled, enable);
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ po.buildOutputParserEnabled = setDirty(po.buildOutputParserEnabled, enable);
+ }
}
/* (non-Javadoc)
@@ -664,35 +665,35 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public List<String> getProviderIdList() {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- return (po != null) ? new ArrayList<String>(po.providerOptionsMap.keySet()) : new ArrayList<String>(0);
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ return (po != null) ? new ArrayList<String>(po.providerOptionsMap.keySet()) : new ArrayList<String>(0);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#addSIProvider(java.lang.String)
*/
-// public void addSIProvider(String providerId) {
-// providerOptionsMap.put(providerId, new ProviderOptions());
-// }
+ // public void addSIProvider(String providerId) {
+ // providerOptionsMap.put(providerId, new ProviderOptions());
+ // }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#removeSIProvider(java.lang.String)
*/
-// public void removeSIProvider(String providerId) {
-// providerOptionsMap.put(providerId, null);
-// }
+ // public void removeSIProvider(String providerId) {
+ // providerOptionsMap.put(providerId, null);
+ // }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isSIProviderOutputParserEnabled(java.lang.String)
*/
@Override
public boolean isProviderOutputParserEnabled(String providerId) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- return (ppo == null) ? false : ppo.providerOutputParserEnabled;
- }
- return false;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ return (ppo == null) ? false : ppo.providerOutputParserEnabled;
+ }
+ return false;
}
/* (non-Javadoc)
@@ -700,13 +701,13 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setProviderOutputParserEnabled(String providerId, boolean enable) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- if (ppo != null) {
- ppo.providerOutputParserEnabled = setDirty(ppo.providerOutputParserEnabled, enable);
- }
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ if (ppo != null) {
+ ppo.providerOutputParserEnabled = setDirty(ppo.providerOutputParserEnabled, enable);
+ }
+ }
}
/* (non-Javadoc)
@@ -714,12 +715,12 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public boolean isUseDefaultProviderCommand(String providerId) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- return (ppo == null) ? false : ppo.providerRunUseDefault;
- }
- return false;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ return (ppo == null) ? false : ppo.providerRunUseDefault;
+ }
+ return false;
}
/* (non-Javadoc)
@@ -727,13 +728,13 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setUseDefaultProviderCommand(String providerId, boolean enable) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- if (ppo != null) {
- ppo.providerRunUseDefault = setDirty(ppo.providerRunUseDefault, enable);
- }
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ if (ppo != null) {
+ ppo.providerRunUseDefault = setDirty(ppo.providerRunUseDefault, enable);
+ }
+ }
}
/* (non-Javadoc)
@@ -741,12 +742,12 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public String getProviderRunCommand(String providerId) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- return (ppo == null) ? null : ppo.providerRunCommand;
- }
- return null;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ return (ppo == null) ? null : ppo.providerRunCommand;
+ }
+ return null;
}
/* (non-Javadoc)
@@ -754,13 +755,13 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setProviderRunCommand(String providerId, String command) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- if (ppo != null) {
- ppo.providerRunCommand = setDirty(ppo.providerRunCommand, command);
- }
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ if (ppo != null) {
+ ppo.providerRunCommand = setDirty(ppo.providerRunCommand, command);
+ }
+ }
}
/* (non-Javadoc)
@@ -768,12 +769,12 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public String getProviderRunArguments(String providerId) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- return (ppo == null) ? null : ppo.providerRunArguments;
- }
- return null;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ return (ppo == null) ? null : ppo.providerRunArguments;
+ }
+ return null;
}
/* (non-Javadoc)
@@ -781,13 +782,13 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setProviderRunArguments(String providerId, String arguments) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- if (ppo != null) {
- ppo.providerRunArguments = setDirty(ppo.providerRunArguments, arguments);
- }
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ if (ppo != null) {
+ ppo.providerRunArguments = setDirty(ppo.providerRunArguments, arguments);
+ }
+ }
}
/* (non-Javadoc)
@@ -795,12 +796,12 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public String getProviderOpenFilePath(String providerId) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- return (ppo == null) ? null : ppo.providerOpenFilePath;
- }
- return null;
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ return (ppo == null) ? null : ppo.providerOpenFilePath;
+ }
+ return null;
}
/* (non-Javadoc)
@@ -808,77 +809,78 @@ public class ScannerConfigInfoFactory2 {
*/
@Override
public void setProviderOpenFilePath(String providerId, String filePath) {
- ProfileOptions po = profileOptionsMap.get(selectedProfile);
- if (po != null) {
- ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
- if (ppo != null) {
- ppo.providerOpenFilePath = setDirty(ppo.providerOpenFilePath, filePath);
- }
- }
+ ProfileOptions po = profileOptionsMap.get(selectedProfile);
+ if (po != null) {
+ ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
+ if (ppo != null) {
+ ppo.providerOpenFilePath = setDirty(ppo.providerOpenFilePath, filePath);
+ }
+ }
}
private boolean setDirty(boolean l, boolean r) {
isDirty = isDirty || (l != r);
return r;
}
+
private String setDirty(String l, String r) {
isDirty = isDirty || !l.equals(r);
return r;
}
-// protected abstract void load();
-// public abstract void store();
-
- /**
- * Load defaults for the specified profileId.
- * Returns a clone() of the default profile matching the passed in profileId
- */
- protected static ProfileOptions getDefaultProfile(String profileId) {
- if (defaultProfiles.containsKey(profileId))
- return defaultProfiles.get(profileId).clone();
-
- ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId);
-
- ProfileOptions po = new ProfileOptions();
- po.buildOutputParserEnabled = false;
- po.buildOutputFileActionEnabled = false;
- po.buildOutputFilePath = EMPTY_STRING;
- if (configuredProfile.getBuildOutputProviderElement() != null) {
- po.buildOutputParserEnabled = true;
- if (configuredProfile.getBuildOutputProviderElement().getAction() != null) {
- po.buildOutputFileActionEnabled = true;
- String buildOutputFilePath = configuredProfile.getBuildOutputProviderElement().
- getAction().getAttribute("file");//$NON-NLS-1$
- po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING;
- }
- }
-
- po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>();
- for (String providerId : configuredProfile.getSIProviderIds()) {
- ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
- ScannerInfoProvider configuredProvider = configuredProfile.getScannerInfoProviderElement(providerId);
-
- ppo.providerOutputParserEnabled = true;
- ppo.providerKind = configuredProvider.getProviderKind();
- String attrValue;
- if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
- ppo.providerRunUseDefault = true;
- attrValue = configuredProvider.getAction().getAttribute(COMMAND);
- ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING;
- attrValue = configuredProvider.getAction().getAttribute(ARGUMENTS);
- ppo.providerRunArguments = (attrValue != null) ? attrValue : EMPTY_STRING;
- } else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
- attrValue = configuredProvider.getAction().getAttribute("file");//$NON-NLS-1$
- ppo.providerOpenFilePath = (attrValue != null) ? attrValue : EMPTY_STRING;
- }
-
- po.providerOptionsMap.put(providerId, ppo);
- }
-
- defaultProfiles.put(profileId, po);
- return po.clone();
- }
+ // protected abstract void load();
+ // public abstract void store();
+
+ /**
+ * Load defaults for the specified profileId.
+ * Returns a clone() of the default profile matching the passed in profileId
+ */
+ protected static ProfileOptions getDefaultProfile(String profileId) {
+ if (defaultProfiles.containsKey(profileId))
+ return defaultProfiles.get(profileId).clone();
+
+ ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId);
+
+ ProfileOptions po = new ProfileOptions();
+ po.buildOutputParserEnabled = false;
+ po.buildOutputFileActionEnabled = false;
+ po.buildOutputFilePath = EMPTY_STRING;
+ if (configuredProfile.getBuildOutputProviderElement() != null) {
+ po.buildOutputParserEnabled = true;
+ if (configuredProfile.getBuildOutputProviderElement().getAction() != null) {
+ po.buildOutputFileActionEnabled = true;
+ String buildOutputFilePath = configuredProfile.getBuildOutputProviderElement().getAction()
+ .getAttribute("file");//$NON-NLS-1$
+ po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING;
+ }
+ }
+
+ po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>();
+ for (String providerId : configuredProfile.getSIProviderIds()) {
+ ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
+ ScannerInfoProvider configuredProvider = configuredProfile.getScannerInfoProviderElement(providerId);
+
+ ppo.providerOutputParserEnabled = true;
+ ppo.providerKind = configuredProvider.getProviderKind();
+ String attrValue;
+ if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
+ ppo.providerRunUseDefault = true;
+ attrValue = configuredProvider.getAction().getAttribute(COMMAND);
+ ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING;
+ attrValue = configuredProvider.getAction().getAttribute(ARGUMENTS);
+ ppo.providerRunArguments = (attrValue != null) ? attrValue : EMPTY_STRING;
+ } else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
+ attrValue = configuredProvider.getAction().getAttribute("file");//$NON-NLS-1$
+ ppo.providerOpenFilePath = (attrValue != null) ? attrValue : EMPTY_STRING;
+ }
+
+ po.providerOptionsMap.put(providerId, ppo);
+ }
+
+ defaultProfiles.put(profileId, po);
+ return po.clone();
+ }
}
@@ -890,111 +892,111 @@ public class ScannerConfigInfoFactory2 {
private static class BuildProperty extends Store {
private IProject project;
private InfoContext context;
- private String profileId;
- private ScannerConfigInfoSet container;
+ private String profileId;
+ private ScannerConfigInfoSet container;
- BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, String profileId, ICStorageElement element) {
+ BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, String profileId,
+ ICStorageElement element) {
super();
this.project = project;
this.context = context;
- this.profileId = profileId;
- this.container = container;
+ this.profileId = profileId;
+ this.container = container;
load(element);
}
- BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, Store base, String profileId) {
+ BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, Store base,
+ String profileId) {
super(base, profileId);
this.project = project;
this.context = context;
this.container = container;
- if(!profileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID)){
+ if (!profileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID)) {
this.profileId = profileId;
- } else if(base instanceof BuildProperty){
- BuildProperty prop = (BuildProperty)base;
+ } else if (base instanceof BuildProperty) {
+ BuildProperty prop = (BuildProperty) base;
this.profileId = prop.profileId;
} else {
- Preference pref = (Preference)base;
+ Preference pref = (Preference) base;
this.profileId = pref.profileId;
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#load()
- */
- protected void load(ICStorageElement element) {
- List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
-
- // Load the default profiles
- for (String profileId : profileIds)
- profileOptionsMap.put(profileId, getDefaultProfile(profileId));
-
- boolean performMigration = true;
-
- // Now load the profiles from the .cproject
- for (ICStorageElement sc : element.getChildren()) {
- if (sc.getName().equals(SC_AUTODISCOVERY)) {
- autoDiscoveryEnabled = Boolean.valueOf(
- sc.getAttribute(ENABLED)).booleanValue();
- selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
- ? sc.getAttribute(SELECTED_PROFILE_ID)
- : profileId;
- selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
- problemReportingEnabled = Boolean.valueOf(
- sc.getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
- performMigration = false;
- } else if (sc.getName().equals(PROFILE)) {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#load()
+ */
+ protected void load(ICStorageElement element) {
+ List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
+
+ // Load the default profiles
+ for (String profileId : profileIds)
+ profileOptionsMap.put(profileId, getDefaultProfile(profileId));
+
+ boolean performMigration = true;
+
+ // Now load the profiles from the .cproject
+ for (ICStorageElement sc : element.getChildren()) {
+ if (sc.getName().equals(SC_AUTODISCOVERY)) {
+ autoDiscoveryEnabled = Boolean.valueOf(sc.getAttribute(ENABLED)).booleanValue();
+ selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
+ ? sc.getAttribute(SELECTED_PROFILE_ID)
+ : profileId;
+ selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
+ problemReportingEnabled = Boolean.valueOf(sc.getAttribute(PROBLEM_REPORTING_ENABLED))
+ .booleanValue();
+ performMigration = false;
+ } else if (sc.getName().equals(PROFILE)) {
if (profileIds.contains(sc.getAttribute(ID))) {
loadProfile(sc);
}
- performMigration = false;
+ performMigration = false;
}
}
if (performMigration) {
- // No ScannerConfigDiscovery entry, try old project location - .project
+ // No ScannerConfigDiscovery entry, try old project location - .project
if (!migrateScannerConfigBuildInfo(ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID)) {
- // disable autodiscovery
- autoDiscoveryEnabled = false;
- }
+ // disable autodiscovery
+ autoDiscoveryEnabled = false;
+ }
}
}
private boolean migrateScannerConfigBuildInfo(String profileId) {
boolean rc = true;
try {
- IScannerConfigBuilderInfo oldInfo = MakeCorePlugin.
- createScannerConfigBuildInfo(project, ScannerConfigBuilder.BUILDER_ID);
+ IScannerConfigBuilderInfo oldInfo = MakeCorePlugin.createScannerConfigBuildInfo(project,
+ ScannerConfigBuilder.BUILDER_ID);
autoDiscoveryEnabled = oldInfo.isAutoDiscoveryEnabled();
problemReportingEnabled = oldInfo.isSIProblemGenerationEnabled();
// effectively a PerProject profile
selectedProfile = SafeStringInterner.safeIntern(profileId);
- ProfileOptions po = new ProfileOptions();
+ ProfileOptions po = new ProfileOptions();
po.buildOutputFileActionEnabled = false;
po.buildOutputParserEnabled = oldInfo.isMakeBuilderConsoleParserEnabled();
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
- ppo.providerKind = ScannerConfigProfile.ScannerInfoProvider.RUN;
+ ppo.providerKind = ScannerConfigProfile.ScannerInfoProvider.RUN;
ppo.providerOutputParserEnabled = oldInfo.isESIProviderCommandEnabled();
ppo.providerRunUseDefault = oldInfo.isDefaultESIProviderCmd();
ppo.providerRunCommand = oldInfo.getESIProviderCommand().toString();
ppo.providerRunArguments = oldInfo.getESIProviderArguments();
- ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(selectedProfile);
+ ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(selectedProfile);
// get the one and only provider id
String providerId = configuredProfile.getSIProviderIds().get(0);
- po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(1);
+ po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(1);
po.providerOptionsMap.put(providerId, ppo);
- profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(1);
- profileOptionsMap.put(profileId, po);
+ profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(1);
+ profileOptionsMap.put(profileId, po);
- // store migrated data
- isDirty = true;
- save();
- }
- catch (CoreException e) {
+ // store migrated data
+ isDirty = true;
+ save();
+ } catch (CoreException e) {
MakeCorePlugin.log(e);
rc = false;
}
@@ -1002,65 +1004,61 @@ public class ScannerConfigInfoFactory2 {
}
private void loadProfile(ICStorageElement profile) {
- ProfileOptions po = new ProfileOptions();
- String profileId = profile.getAttribute(ID);
- profileOptionsMap.put(profileId, po);
- // get the list of providers from the profile configuration
- ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId);
- List<String> providerIds = configuredProfile.getSIProviderIds();
- int providerCounter = 0;
- po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(providerIds.size());
-
- for (ICStorageElement child : profile.getChildren()) {
- // buildOutputProvider element
- if (BUILD_OUTPUT_PROVIDER.equals(child.getName())) {
- for (ICStorageElement grandchild : child.getChildren()) {
- if (OPEN_ACTION.equals(grandchild.getName())) {
- po.buildOutputFileActionEnabled = Boolean.valueOf(
- grandchild.getAttribute(ENABLED)).booleanValue();
- po.buildOutputFilePath = grandchild.getAttribute(FILE_PATH);
- }
- else if (PARSER.equals(grandchild.getName())) {
- po.buildOutputParserEnabled = Boolean.valueOf(
- grandchild.getAttribute(ENABLED)).booleanValue();
- }
- }
- }
- else if (SCANNER_INFO_PROVIDER.equals(child.getName())) {
+ ProfileOptions po = new ProfileOptions();
+ String profileId = profile.getAttribute(ID);
+ profileOptionsMap.put(profileId, po);
+ // get the list of providers from the profile configuration
+ ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId);
+ List<String> providerIds = configuredProfile.getSIProviderIds();
+ int providerCounter = 0;
+ po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(providerIds.size());
+
+ for (ICStorageElement child : profile.getChildren()) {
+ // buildOutputProvider element
+ if (BUILD_OUTPUT_PROVIDER.equals(child.getName())) {
+ for (ICStorageElement grandchild : child.getChildren()) {
+ if (OPEN_ACTION.equals(grandchild.getName())) {
+ po.buildOutputFileActionEnabled = Boolean.valueOf(grandchild.getAttribute(ENABLED))
+ .booleanValue();
+ po.buildOutputFilePath = grandchild.getAttribute(FILE_PATH);
+ } else if (PARSER.equals(grandchild.getName())) {
+ po.buildOutputParserEnabled = Boolean.valueOf(grandchild.getAttribute(ENABLED))
+ .booleanValue();
+ }
+ }
+ } else if (SCANNER_INFO_PROVIDER.equals(child.getName())) {
String providerId = child.getAttribute(ID);
if (providerIds.get(providerCounter).equals(providerId)) {
// new provider
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
po.providerOptionsMap.put(providerId, ppo);
- ppo.providerKind = configuredProfile.getScannerInfoProviderElement(
- providerId).getProviderKind();
-
- for (ICStorageElement grandchild : child.getChildren()) {
- // action
- if (RUN_ACTION.equals(grandchild.getName())) {
- ppo.providerRunUseDefault = Boolean.valueOf(
- grandchild.getAttribute(USE_DEFAULT)).booleanValue();
- ppo.providerRunCommand = grandchild.getAttribute(COMMAND);
- ppo.providerRunArguments = grandchild.getAttribute(ARGUMENTS);
- }
- else if (OPEN_ACTION.equals(grandchild.getName())) {
- ppo.providerOpenFilePath = grandchild.getAttribute(FILE_PATH);
- }
- // parser
- else if (PARSER.equals(grandchild.getName())) {
- ppo.providerOutputParserEnabled = Boolean.valueOf(
- grandchild.getAttribute(ENABLED)).booleanValue();
- }
- }
- ++providerCounter;
+ ppo.providerKind = configuredProfile.getScannerInfoProviderElement(providerId)
+ .getProviderKind();
+
+ for (ICStorageElement grandchild : child.getChildren()) {
+ // action
+ if (RUN_ACTION.equals(grandchild.getName())) {
+ ppo.providerRunUseDefault = Boolean.valueOf(grandchild.getAttribute(USE_DEFAULT))
+ .booleanValue();
+ ppo.providerRunCommand = grandchild.getAttribute(COMMAND);
+ ppo.providerRunArguments = grandchild.getAttribute(ARGUMENTS);
+ } else if (OPEN_ACTION.equals(grandchild.getName())) {
+ ppo.providerOpenFilePath = grandchild.getAttribute(FILE_PATH);
+ }
+ // parser
+ else if (PARSER.equals(grandchild.getName())) {
+ ppo.providerOutputParserEnabled = Boolean.valueOf(grandchild.getAttribute(ENABLED))
+ .booleanValue();
+ }
+ }
+ ++providerCounter;
+ } else {
+ // mismatch - error
+ // TODO Vmir define error
}
- else {
- // mismatch - error
- // TODO Vmir define error
- }
- }
- }
+ }
+ }
}
/**
@@ -1068,11 +1066,11 @@ public class ScannerConfigInfoFactory2 {
* @param sc storage element in which to persist the settings.
*/
private void store(ICStorageElement sc) {
- // Clear children
- for (ICStorageElement child : sc.getChildren())
- sc.removeChild(child);
+ // Clear children
+ for (ICStorageElement child : sc.getChildren())
+ sc.removeChild(child);
- ICStorageElement autod = sc.createChild(SC_AUTODISCOVERY);
+ ICStorageElement autod = sc.createChild(SC_AUTODISCOVERY);
autod.setAttribute(ENABLED, Boolean.toString(autoDiscoveryEnabled));
autod.setAttribute(SELECTED_PROFILE_ID, selectedProfile);
autod.setAttribute(PROBLEM_REPORTING_ENABLED, Boolean.toString(problemReportingEnabled));
@@ -1081,10 +1079,10 @@ public class ScannerConfigInfoFactory2 {
// If this profile is identical to the default, then no need to store
if (entry.getValue().equals(defaultProfiles.get(entry.getKey())))
continue;
- ICStorageElement profile = sc.createChild(PROFILE);
+ ICStorageElement profile = sc.createChild(PROFILE);
profile.setAttribute(ID, entry.getKey());
store(profile, entry.getValue());
- }
+ }
isDirty = false;
}
@@ -1099,16 +1097,16 @@ public class ScannerConfigInfoFactory2 {
child = profile.createChild(BUILD_OUTPUT_PROVIDER);
grandchild = child.createChild(OPEN_ACTION);
grandchild.setAttribute(ENABLED, Boolean.toString(po.buildOutputFileActionEnabled));
- if(po.buildOutputFilePath != null)
+ if (po.buildOutputFilePath != null)
grandchild.setAttribute(FILE_PATH, po.buildOutputFilePath);
grandchild = child.createChild(PARSER);
grandchild.setAttribute(ENABLED, Boolean.toString(po.buildOutputParserEnabled));
// scannerInfoProvider elements
// get the list of providers from the profile configuration
-// ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
-// getSCProfileConfiguration(selectedProfile);
-// List providerIds = configuredProfile.getSIProviderIds();
- List<String> providerIds = new ArrayList<String>(po.providerOptionsMap.keySet());
+ // ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
+ // getSCProfileConfiguration(selectedProfile);
+ // List providerIds = configuredProfile.getSIProviderIds();
+ List<String> providerIds = new ArrayList<String>(po.providerOptionsMap.keySet());
for (int i = 0; i < providerIds.size(); ++i) {
String providerId = providerIds.get(i);
ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
@@ -1118,49 +1116,47 @@ public class ScannerConfigInfoFactory2 {
child.setAttribute(ID, providerId);
// action
-// String providerKind = configuredProfile.getScannerInfoProviderElement(
-// providerId).getProviderKind();
- String providerKind = ppo.providerKind;
+ // String providerKind = configuredProfile.getScannerInfoProviderElement(
+ // providerId).getProviderKind();
+ String providerKind = ppo.providerKind;
if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
grandchild = child.createChild(RUN_ACTION);
grandchild.setAttribute(USE_DEFAULT, Boolean.toString(ppo.providerRunUseDefault));
- if(ppo.providerRunCommand != null)
+ if (ppo.providerRunCommand != null)
grandchild.setAttribute(COMMAND, ppo.providerRunCommand);
- if(ppo.providerRunArguments != null)
+ if (ppo.providerRunArguments != null)
grandchild.setAttribute(ARGUMENTS, ppo.providerRunArguments);
- }
- else if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
+ } else if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
grandchild = child.createChild(OPEN_ACTION);
- if(ppo.providerOpenFilePath != null)
+ if (ppo.providerOpenFilePath != null)
grandchild.setAttribute(FILE_PATH, ppo.providerOpenFilePath);
}
// parser
grandchild = child.createChild(PARSER);
- grandchild.setAttribute(ENABLED, Boolean.toString(ppo.providerOutputParserEnabled));
- }
- else {
+ grandchild.setAttribute(ENABLED, Boolean.toString(ppo.providerOutputParserEnabled));
+ } else {
// missing provider options - error
// TODO Vmir define error
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
+ */
+ @Override
public synchronized void save() throws CoreException {
- if(isDirty){
- container.save(true);
- isDirty = false;
- }
- }
+ if (isDirty) {
+ container.save(true);
+ isDirty = false;
+ }
+ }
- @Override
- public InfoContext getContext(){
- return context;
- }
+ @Override
+ public InfoContext getContext() {
+ return context;
+ }
}
@@ -1176,7 +1172,8 @@ public class ScannerConfigInfoFactory2 {
private PreferenceSet prefsContainer;
private InfoContext context;
- public Preference(PreferenceSet container, Preferences prefs, InfoContext context, String profileId, boolean useDefaults) {
+ public Preference(PreferenceSet container, Preferences prefs, InfoContext context, String profileId,
+ boolean useDefaults) {
super();
this.prefs = prefs;
this.profileId = profileId;
@@ -1186,88 +1183,89 @@ public class ScannerConfigInfoFactory2 {
load();
}
- Preference(PreferenceSet container, Preferences prefs, InfoContext context, Store base, String profileId, boolean useDefaults) {
+ Preference(PreferenceSet container, Preferences prefs, InfoContext context, Store base, String profileId,
+ boolean useDefaults) {
super(base, profileId);
this.prefs = prefs;
this.prefsContainer = container;
this.useDefaults = useDefaults;
this.context = context;
- if(!profileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID)){
+ if (!profileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID)) {
this.profileId = profileId;
- } else if(base instanceof BuildProperty){
- BuildProperty prop = (BuildProperty)base;
+ } else if (base instanceof BuildProperty) {
+ BuildProperty prop = (BuildProperty) base;
this.profileId = prop.profileId;
} else {
- Preference pref = (Preference)base;
+ Preference pref = (Preference) base;
this.profileId = pref.profileId;
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#load()
- */
- protected void load() {
- String instanceId = context.getInstanceId();
- String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.Store#load()
+ */
+ protected void load() {
+ String instanceId = context.getInstanceId();
+ String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
autoDiscoveryEnabled = getBoolean(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX);
- selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ?
- getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) :
- profileId;
+ selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId))
+ ? getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX)
+ : profileId;
selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
problemReportingEnabled = getBoolean(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX);
- if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) {
- // get the default value
- selectedProfile = SafeStringInterner.safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX));
- }
- List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
- profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(profileIds.size());
- for (String profileId : profileIds) {
- ProfileOptions po = new ProfileOptions();
- profileOptionsMap.put(profileId, po);
-
- boolean profileStored = getBoolean(SCD + prefix + profileId + DOT + ENABLED);
- if (!profileStored && !useDefaults) {
- profileOptionsMap.put(profileId, getDefaultProfile(profileId));
- continue;
- }
-
- po.buildOutputFileActionEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED);
+ if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) {
+ // get the default value
+ selectedProfile = SafeStringInterner
+ .safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX));
+ }
+ List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
+ profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(profileIds.size());
+ for (String profileId : profileIds) {
+ ProfileOptions po = new ProfileOptions();
+ profileOptionsMap.put(profileId, po);
+
+ boolean profileStored = getBoolean(SCD + prefix + profileId + DOT + ENABLED);
+ if (!profileStored && !useDefaults) {
+ profileOptionsMap.put(profileId, getDefaultProfile(profileId));
+ continue;
+ }
+
+ po.buildOutputFileActionEnabled = getBoolean(
+ SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED);
po.buildOutputFilePath = getString(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH);
po.buildOutputParserEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED);
- ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId);
+ ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId);
List<String> providerIds = configuredProfile.getSIProviderIds();
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(providerIds.size());
for (String providerId : providerIds) {
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
po.providerOptionsMap.put(providerId, ppo);
- ppo.providerKind = configuredProfile.getScannerInfoProviderElement(
- providerId).getProviderKind();
+ ppo.providerKind = configuredProfile.getScannerInfoProviderElement(providerId).getProviderKind();
- ppo.providerOutputParserEnabled = getBoolean(SCD + prefix + profileId + DOT +
- providerId + SI_PROVIDER_PARSER_ENABLED);
+ ppo.providerOutputParserEnabled = getBoolean(
+ SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_PARSER_ENABLED);
if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
- ppo.providerRunUseDefault = getBoolean(SCD + prefix + profileId + DOT + providerId +
- SI_PROVIDER_RUN_ACTION_USE_DEFAULT);
- ppo.providerRunCommand = getString(SCD + prefix + profileId + DOT + providerId +
- SI_PROVIDER_RUN_ACTION_COMMAND);
- ppo.providerRunArguments = getString(SCD + prefix + profileId + DOT + providerId +
- SI_PROVIDER_RUN_ACTION_ARGUMENTS);
- }
- else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
- ppo.providerOpenFilePath = getString(SCD + prefix + profileId + DOT + providerId +
- SI_PROVIDER_OPEN_ACTION_FILE_PATH);
+ ppo.providerRunUseDefault = getBoolean(
+ SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_USE_DEFAULT);
+ ppo.providerRunCommand = getString(
+ SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND);
+ ppo.providerRunArguments = getString(
+ SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_ARGUMENTS);
+ } else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
+ ppo.providerOpenFilePath = getString(
+ SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_OPEN_ACTION_FILE_PATH);
}
}
- }
+ }
}
private void store() {
- String instanceId = context.getInstanceId();
- String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
+ String instanceId = context.getInstanceId();
+ String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$
if (isDirty) {
set(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX, autoDiscoveryEnabled);
set(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX, selectedProfile);
@@ -1276,21 +1274,21 @@ public class ScannerConfigInfoFactory2 {
for (String profileId : profileOptionsMap.keySet()) {
ProfileOptions po = profileOptionsMap.get(profileId);
- set(SCD + prefix + profileId + DOT + ENABLED, !useDefaults);
+ set(SCD + prefix + profileId + DOT + ENABLED, !useDefaults);
set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED, po.buildOutputFileActionEnabled);
set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH, po.buildOutputFilePath);
set(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED, po.buildOutputParserEnabled);
- ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(profileId);
+ ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
+ .getSCProfileConfiguration(profileId);
List<String> providerIds = configuredProfile.getSIProviderIds();
for (String providerId : providerIds) {
ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_PARSER_ENABLED,
ppo.providerOutputParserEnabled);
-// String providerKind = configuredProfile.getScannerInfoProviderElement(
-// providerId).getProviderKind();
+ // String providerKind = configuredProfile.getScannerInfoProviderElement(
+ // providerId).getProviderKind();
String providerKind = ppo.providerKind;
if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) {
@@ -1300,8 +1298,7 @@ public class ScannerConfigInfoFactory2 {
ppo.providerRunCommand);
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_ARGUMENTS,
ppo.providerRunArguments);
- }
- else if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
+ } else if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) {
set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_OPEN_ACTION_FILE_PATH,
ppo.providerOpenFilePath);
}
@@ -1318,11 +1315,11 @@ public class ScannerConfigInfoFactory2 {
}
return prefs.getBoolean(name);
}
+
private void set(String name, boolean value) {
if (useDefaults) {
prefs.setDefault(name, value);
- }
- else {
+ } else {
prefs.setValue(name, value);
}
}
@@ -1333,28 +1330,28 @@ public class ScannerConfigInfoFactory2 {
}
return prefs.getString(name);
}
+
private void set(String name, String value) {
if (useDefaults) {
prefs.setDefault(name, value);
- }
- else {
+ } else {
prefs.setValue(name, value);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save()
+ */
+ @Override
public void save() throws CoreException {
- if(isDirty)
- prefsContainer.save();
- }
-
- @Override
- public InfoContext getContext(){
- return context;
- }
+ if (isDirty)
+ prefsContainer.save();
+ }
+
+ @Override
+ public InfoContext getContext() {
+ return context;
+ }
}
public static IScannerConfigBuilderInfo2 create(IProject project, String profileId) throws CoreException {
@@ -1367,11 +1364,12 @@ public class ScannerConfigInfoFactory2 {
return container.getInfo(new InfoContext(null));
}
- public static IScannerConfigBuilderInfo2Set createInfoSet(Preferences prefs, String profileId, boolean useDefaults){
+ public static IScannerConfigBuilderInfo2Set createInfoSet(Preferences prefs, String profileId,
+ boolean useDefaults) {
return new ScannerConfigInfoFactory2.PreferenceSet(prefs, profileId, useDefaults);
}
- public static IScannerConfigBuilderInfo2Set createInfoSet(IProject project, String profileId){
+ public static IScannerConfigBuilderInfo2Set createInfoSet(IProject project, String profileId) {
return new ScannerConfigInfoFactory2.ScannerConfigInfoSet(project, profileId);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfile.java
index 04fe9f58101..015e369677f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfile.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM - Initial API and implementation
*******************************************************************************/
@@ -28,24 +28,24 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
-
/**
* SCD Profile extension point object model
- *
+ *
* @author vhirsl
*/
public class ScannerConfigProfile {
- /**
+ /**
* scannerInfoCollector element
- *
+ *
* @author vhirsl
*/
public class ScannerInfoCollector {
private IConfigurationElement configElem;
-
+
public ScannerInfoCollector(IConfigurationElement configElem) {
this.configElem = configElem;
}
+
public IScannerInfoCollector createScannerInfoCollector() {
try {
return (IScannerInfoCollector) configElem.createExecutableExtension("class"); //$NON-NLS-1$
@@ -54,21 +54,24 @@ public class ScannerConfigProfile {
return null;
}
}
- public String getScope() {
- return configElem.getAttribute("scope"); //$NON-NLS-1$
- }
+
+ public String getScope() {
+ return configElem.getAttribute("scope"); //$NON-NLS-1$
+ }
}
+
/**
* scannerInfoConsoleParser element
- *
+ *
* @author vhirsl
*/
public final class ScannerInfoConsoleParser {
private IConfigurationElement configElem;
-
+
public ScannerInfoConsoleParser(IConfigurationElement configElem) {
this.configElem = configElem;
}
+
public Object createScannerInfoConsoleParser() {
try {
return configElem.createExecutableExtension("class"); //$NON-NLS-1$
@@ -77,13 +80,15 @@ public class ScannerConfigProfile {
return null;
}
}
- public String getCompilerCommands() {
- return configElem.getAttribute("compilerCommands"); //$NON-NLS-1$
- }
+
+ public String getCompilerCommands() {
+ return configElem.getAttribute("compilerCommands"); //$NON-NLS-1$
+ }
}
+
/**
* tag interface, a placeholder for either run or open element
- *
+ *
* @author vhirsl
*/
protected abstract class Action {
@@ -92,7 +97,7 @@ public class ScannerConfigProfile {
protected Action(IConfigurationElement configElem) {
this.configElem = configElem;
}
-
+
public Object createExternalScannerInfoProvider() {
if (configElem.getAttribute("class") != null) { //$NON-NLS-1$
try {
@@ -103,20 +108,22 @@ public class ScannerConfigProfile {
}
return null;
}
-
- public String getAttribute(String name) {
- return configElem.getAttribute(name);
- }
+
+ public String getAttribute(String name) {
+ return configElem.getAttribute(name);
+ }
}
+
/**
* run element
- *
+ *
* @author vhirsl
*/
public final class Run extends Action {
public Run(IConfigurationElement run) {
super(run);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager.IAction#getNewExternalScannerInfoProvider()
*/
@@ -130,15 +137,17 @@ public class ScannerConfigProfile {
return provider;
}
}
+
/**
* open element
- *
+ *
* @author vhirsl
*/
public final class Open extends Action {
public Open(IConfigurationElement open) {
super(open);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager.IAction#getNewExternalScannerInfoProvider()
*/
@@ -152,15 +161,16 @@ public class ScannerConfigProfile {
return provider;
}
}
+
/**
* buildOutputProvider element
- *
+ *
* @author vhirsl
*/
public final class BuildOutputProvider {
private Open openFileAction;
private ScannerInfoConsoleParser scannerInfoConsoleParser;
-
+
public BuildOutputProvider(IConfigurationElement provider) {
IConfigurationElement[] actions = provider.getChildren("open"); //$NON-NLS-1$
// take the first one
@@ -171,79 +181,83 @@ public class ScannerConfigProfile {
// take the first one
this.scannerInfoConsoleParser = new ScannerConfigProfile.ScannerInfoConsoleParser(parsers[0]);
}
-
+
public Action getAction() {
return openFileAction;
}
+
public ScannerInfoConsoleParser getScannerInfoConsoleParser() {
return scannerInfoConsoleParser;
}
}
+
/**
* scannerInfoProvider element
- *
+ *
* @author vhirsl
*/
public final class ScannerInfoProvider {
public static final String RUN = "run";//$NON-NLS-1$
public static final String OPEN = "open";//$NON-NLS-1$
-
+
private String providerId;
private String providerKind; // derived attribute
private Action action;
private ScannerInfoConsoleParser scannerInfoConsoleParser;
-
+
public ScannerInfoProvider(IConfigurationElement provider) {
providerId = provider.getAttribute("providerId"); //$NON-NLS-1$
IConfigurationElement[] actions = provider.getChildren();
providerKind = actions[0].getName();
if (providerKind.equals(RUN)) {
this.action = new ScannerConfigProfile.Run(actions[0]);
- }
- else if (providerKind.equals(OPEN)) {
+ } else if (providerKind.equals(OPEN)) {
this.action = new ScannerConfigProfile.Open(actions[0]);
- }
- else {
+ } else {
// TODO Vmir generate an error
}
IConfigurationElement[] parsers = provider.getChildren("scannerInfoConsoleParser"); //$NON-NLS-1$
// take the first one
scannerInfoConsoleParser = new ScannerConfigProfile.ScannerInfoConsoleParser(parsers[0]);
}
-
+
public String getProviderId() {
return providerId;
}
+
public String getProviderKind() {
return providerKind;
}
+
public Action getAction() {
return action;
}
+
public ScannerInfoConsoleParser getScannerInfoConsoleParser() {
return scannerInfoConsoleParser;
}
}
-
+
// ScannerConfigProfile members
private final String id;
-
+
private ScannerInfoCollector scannerInfoCollector;
private BuildOutputProvider buildOutputProvider;
private Map<String, ScannerInfoProvider> scannerInfoProviders = new LinkedHashMap<String, ScannerInfoProvider>();
-
+
private Boolean supportsContext;
public ScannerConfigProfile(String profileId) {
id = profileId;
load();
}
+
/**
* loads the profile from the manifest file.
*/
private void load() {
- IExtensionPoint extension = Platform.getExtensionRegistry().
- getExtensionPoint(MakeCorePlugin.PLUGIN_ID, ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID,
+ ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; ++i) {
@@ -252,17 +266,14 @@ public class ScannerConfigProfile {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; ++j) {
String name = configElements[j].getName();
- if (scannerInfoCollector == null &&
- name.equals("scannerInfoCollector")) { //$NON-NLS-1$
+ if (scannerInfoCollector == null && name.equals("scannerInfoCollector")) { //$NON-NLS-1$
scannerInfoCollector = new ScannerConfigProfile.ScannerInfoCollector(configElements[j]);
- }
- else if (name.equals("buildOutputProvider")) { //$NON-NLS-1$
+ } else if (name.equals("buildOutputProvider")) { //$NON-NLS-1$
buildOutputProvider = new ScannerConfigProfile.BuildOutputProvider(configElements[j]);
- }
- else if (name.equals("scannerInfoProvider")) { //$NON-NLS-1$
+ } else if (name.equals("scannerInfoProvider")) { //$NON-NLS-1$
String providerId = configElements[j].getAttribute("providerId"); //$NON-NLS-1$
if (providerId != null && scannerInfoProviders.get(providerId) == null) {
- scannerInfoProviders.put(providerId,
+ scannerInfoProviders.put(providerId,
new ScannerConfigProfile.ScannerInfoProvider(configElements[j]));
}
}
@@ -272,13 +283,14 @@ public class ScannerConfigProfile {
}
}
}
+
/**
* @return Returns the id.
*/
public String getId() {
return id;
}
-
+
// access to model objects
/**
* @return Returns the list of providerIds
@@ -286,56 +298,57 @@ public class ScannerConfigProfile {
public List<String> getSIProviderIds() {
return new ArrayList<String>(scannerInfoProviders.keySet());
}
+
/**
* @return Returns the buildOutputProvider.
*/
public BuildOutputProvider getBuildOutputProviderElement() {
return buildOutputProvider;
}
+
/**
* @return Returns the scannerInfoCollector.
*/
public ScannerInfoCollector getScannerInfoCollectorElement() {
return scannerInfoCollector;
}
-
- public ScannerConfigScope getProfileScope() {
- ScannerConfigScope scope = null;
- if (scannerInfoCollector != null) {
- if (scannerInfoCollector.getScope().equals(ScannerConfigScope.PROJECT_SCOPE.toString())) {
- scope = ScannerConfigScope.PROJECT_SCOPE;
- }
- else if (scannerInfoCollector.getScope().equals(ScannerConfigScope.FILE_SCOPE.toString())) {
- scope = ScannerConfigScope.FILE_SCOPE;
- }
- }
- return scope;
- }
-
+
+ public ScannerConfigScope getProfileScope() {
+ ScannerConfigScope scope = null;
+ if (scannerInfoCollector != null) {
+ if (scannerInfoCollector.getScope().equals(ScannerConfigScope.PROJECT_SCOPE.toString())) {
+ scope = ScannerConfigScope.PROJECT_SCOPE;
+ } else if (scannerInfoCollector.getScope().equals(ScannerConfigScope.FILE_SCOPE.toString())) {
+ scope = ScannerConfigScope.FILE_SCOPE;
+ }
+ }
+ return scope;
+ }
+
/**
* @return Returns the scannerInfoProviders.
*/
public ScannerInfoProvider getScannerInfoProviderElement(String providerId) {
return scannerInfoProviders.get(providerId);
}
-
- public boolean supportsContext(){
- if(supportsContext == null){
+
+ public boolean supportsContext() {
+ if (supportsContext == null) {
ScannerInfoCollector cr = getScannerInfoCollectorElement();
- if(cr != null){
+ if (cr != null) {
IScannerInfoCollector collector = cr.createScannerInfoCollector();
- if(collector != null){
+ if (collector != null) {
Class<? extends IScannerInfoCollector> clazz = collector.getClass();
try {
- clazz.getMethod("setInfoContext", new Class[] {InfoContext.class}); //$NON-NLS-1$
+ clazz.getMethod("setInfoContext", new Class[] { InfoContext.class }); //$NON-NLS-1$
supportsContext = Boolean.TRUE;
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
}
}
}
-
- if(supportsContext == null)
+
+ if (supportsContext == null)
supportsContext = Boolean.FALSE;
}
return supportsContext.booleanValue();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
index 2a16b8b0905..a65cd3f5c79 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
@@ -33,15 +33,16 @@ import org.eclipse.core.runtime.Preferences;
/**
* Manages profiles per project
- *
+ *
* @author vhirsl
*/
public final class ScannerConfigProfileManager {
- public static final String SI_PROFILE_SIMPLE_ID = "ScannerConfigurationDiscoveryProfile"; //$NON-NLS-1$
- public static final String PER_PROJECT_PROFILE_ID = MakeCorePlugin.getUniqueIdentifier() + ".GCCStandardMakePerProjectProfile"; //$NON-NLS-1$
+ public static final String SI_PROFILE_SIMPLE_ID = "ScannerConfigurationDiscoveryProfile"; //$NON-NLS-1$
+ public static final String PER_PROJECT_PROFILE_ID = MakeCorePlugin.getUniqueIdentifier()
+ + ".GCCStandardMakePerProjectProfile"; //$NON-NLS-1$
public static final String NULL_PROFILE_ID = "";//$NON-NLS-1$
public static final String DEFAULT_SI_PROFILE_ID = NULL_PROFILE_ID;
-
+
private final Map<IProject, Map<InfoContext, Object>> projectToProfileInstanceMap;
private List<String> profileIds;
private List<String> contextAwareProfileIds;
@@ -53,6 +54,7 @@ public final class ScannerConfigProfileManager {
private ScannerConfigProfileManager() {
projectToProfileInstanceMap = new HashMap<IProject, Map<InfoContext, Object>>();
}
+
private static final ScannerConfigProfileManager instance = new ScannerConfigProfileManager();
public static ScannerConfigProfileManager getInstance() {
@@ -64,7 +66,7 @@ public final class ScannerConfigProfileManager {
try {
IScannerConfigBuilderInfo2Set container = createScannerConfigBuildInfo2Set(project);
IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context);
- if(buildInfo == null)
+ if (buildInfo == null)
buildInfo = container.getInfo(new InfoContext(project));
profileId = buildInfo.getSelectedProfileId();
} catch (CoreException e) {
@@ -85,24 +87,24 @@ public final class ScannerConfigProfileManager {
public void addProfile(IProject project, InfoContext context, ScannerConfigProfile profile) {
getProfileMap(project, true).put(context, profile);
}
-
- private Map<InfoContext, Object> getProfileMap(IProject project, boolean create){
+
+ private Map<InfoContext, Object> getProfileMap(IProject project, boolean create) {
synchronized (fLock) {
Map<InfoContext, Object> map = projectToProfileInstanceMap.get(project);
- if(map == null && create){
+ if (map == null && create) {
map = new HashMap<InfoContext, Object>();
projectToProfileInstanceMap.put(project, map);
}
return Collections.synchronizedMap(map);
}
}
-
- public void handleProjectRemoved(IProject project){
+
+ public void handleProjectRemoved(IProject project) {
synchronized (fLock) {
projectToProfileInstanceMap.remove(project);
}
}
-
+
/**
* @param profileId - if null, get the one associated with the project
* @return the scannerConfigProfile instance for a project.
@@ -114,30 +116,32 @@ public final class ScannerConfigProfileManager {
public SCProfileInstance getSCProfileInstance(IProject project, InfoContext context, String profileId) {
// if not specified read from .project file
- if (profileId == NULL_PROFILE_ID) {
- profileId = getProfileId(project, context);
- }
+ if (profileId == NULL_PROFILE_ID) {
+ profileId = getProfileId(project, context);
+ }
synchronized (fLock) {
- // is the project's profile already loaded?
- Map<InfoContext, Object> map = getProfileMap(project, true);
- SoftReference<SCProfileInstance> profileInstanceReference = (SoftReference<SCProfileInstance>) map.get(context);
- SCProfileInstance profileInstance = profileInstanceReference != null ? profileInstanceReference.get() : null;
-
- if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) {
- profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId));
- map.put(context, new SoftReference<SCProfileInstance>(profileInstance));
- }
- return profileInstance;
+ // is the project's profile already loaded?
+ Map<InfoContext, Object> map = getProfileMap(project, true);
+ SoftReference<SCProfileInstance> profileInstanceReference = (SoftReference<SCProfileInstance>) map
+ .get(context);
+ SCProfileInstance profileInstance = profileInstanceReference != null ? profileInstanceReference.get()
+ : null;
+
+ if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) {
+ profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId));
+ map.put(context, new SoftReference<SCProfileInstance>(profileInstance));
+ }
+ return profileInstance;
}
}
- public SCProfileInstance getSCProfileInstance(String profileId) {
- SCProfileInstance profileInstance = null;
- if (profileId != NULL_PROFILE_ID) {
- profileInstance = new SCProfileInstance(null, getSCProfileConfiguration(profileId));
- }
- return profileInstance;
- }
+ public SCProfileInstance getSCProfileInstance(String profileId) {
+ SCProfileInstance profileInstance = null;
+ if (profileId != NULL_PROFILE_ID) {
+ profileInstance = new SCProfileInstance(null, getSCProfileConfiguration(profileId));
+ }
+ return profileInstance;
+ }
/**
* @param profileId - if null, get the default one
@@ -155,8 +159,8 @@ public final class ScannerConfigProfileManager {
synchronized (fLock) {
if (profileIds == null) {
profileIds = new ArrayList<String>();
- IExtensionPoint extension = Platform.getExtensionRegistry().
- getExtensionPoint(MakeCorePlugin.PLUGIN_ID, ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID);
+ IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID,
+ ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; ++i) {
@@ -166,25 +170,25 @@ public final class ScannerConfigProfileManager {
}
}
}
- return Collections.unmodifiableList(profileIds);
+ return Collections.unmodifiableList(profileIds);
}
-
+
/**
* @return the list of profile IDs supported for this context
*/
- public List<String> getProfileIds(InfoContext context){
- if(context.isDefaultContext() || context.getProject() == null)
+ public List<String> getProfileIds(InfoContext context) {
+ if (context.isDefaultContext() || context.getProject() == null)
return getProfileIds();
-
+
synchronized (fLock) {
- if(contextAwareProfileIds == null){
+ if (contextAwareProfileIds == null) {
contextAwareProfileIds = new ArrayList<String>();
List<String> all = getProfileIds();
- for(int i = 0; i < all.size(); i++){
+ for (int i = 0; i < all.size(); i++) {
String id = all.get(i);
ScannerConfigProfile profile = getSCProfileConfiguration(id);
- if(profile.supportsContext())
+ if (profile.supportsContext())
contextAwareProfileIds.add(id);
}
}
@@ -198,49 +202,55 @@ public final class ScannerConfigProfileManager {
public static String getDefaultSIProfileId() {
return DEFAULT_SI_PROFILE_ID;
}
-
+
/**
- * Set selectedProfile to profileId
+ * Set selectedProfile to profileId
*/
- public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(IProject project, String profileId) throws CoreException {
+ public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(IProject project, String profileId)
+ throws CoreException {
return ScannerConfigInfoFactory2.create(project, profileId);
}
- /**
- * Use stored selectedProfile
- */
- public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(IProject project) throws CoreException {
- return ScannerConfigInfoFactory2.create(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
- }
-
- public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(IProject project) throws CoreException {
- return ScannerConfigInfoFactory2.createInfoSet(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
- }
+ /**
+ * Use stored selectedProfile
+ */
+ public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(IProject project) throws CoreException {
+ return ScannerConfigInfoFactory2.create(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
+ }
+
+ public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(IProject project)
+ throws CoreException {
+ return ScannerConfigInfoFactory2.createInfoSet(project, ScannerConfigProfileManager.NULL_PROFILE_ID);
+ }
- public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(IProject project, String profileId) throws CoreException {
- return ScannerConfigInfoFactory2.createInfoSet(project, profileId);
- }
+ public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(IProject project, String profileId)
+ throws CoreException {
+ return ScannerConfigInfoFactory2.createInfoSet(project, profileId);
+ }
- public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(Preferences prefs, boolean useDefaults) throws CoreException {
- return ScannerConfigInfoFactory2.createInfoSet(prefs, ScannerConfigProfileManager.NULL_PROFILE_ID, useDefaults);
- }
+ public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(Preferences prefs, boolean useDefaults)
+ throws CoreException {
+ return ScannerConfigInfoFactory2.createInfoSet(prefs, ScannerConfigProfileManager.NULL_PROFILE_ID, useDefaults);
+ }
- public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(Preferences prefs, String profileId, boolean useDefaults) throws CoreException {
- return ScannerConfigInfoFactory2.createInfoSet(prefs, profileId, useDefaults);
- }
+ public static IScannerConfigBuilderInfo2Set createScannerConfigBuildInfo2Set(Preferences prefs, String profileId,
+ boolean useDefaults) throws CoreException {
+ return ScannerConfigInfoFactory2.createInfoSet(prefs, profileId, useDefaults);
+ }
/**
- * Set selectedProfile to profileId
+ * Set selectedProfile to profileId
*/
- public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(Preferences prefs, String profileId, boolean useDefaults) {
+ public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(Preferences prefs, String profileId,
+ boolean useDefaults) {
return ScannerConfigInfoFactory2.create(prefs, profileId, useDefaults);
}
- /**
- * Use stored selectedProfile
- */
- public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(Preferences prefs, boolean useDefaults) {
- return ScannerConfigInfoFactory2.create(prefs, ScannerConfigProfileManager.NULL_PROFILE_ID, useDefaults);
- }
+ /**
+ * Use stored selectedProfile
+ */
+ public static IScannerConfigBuilderInfo2 createScannerConfigBuildInfo2(Preferences prefs, boolean useDefaults) {
+ return ScannerConfigInfoFactory2.create(prefs, ScannerConfigProfileManager.NULL_PROFILE_ID, useDefaults);
+ }
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/templateengine/AddMakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/templateengine/AddMakeTarget.java
index 13d9b24ca42..208d4326bbd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/templateengine/AddMakeTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/templateengine/AddMakeTarget.java
@@ -50,15 +50,16 @@ public class AddMakeTarget extends ProcessRunner {
private static final String PROJECTNAME_VARNAME = "projectName"; //$NON-NLS-1$
private static final String TARGETNAME_VARNAME = "targetName"; //$NON-NLS-1$
- private static final String MAKETARGET_VARNAME = "makeTarget"; //$NON-NLS-1$
- private static final String BUILDCOMMAND_VARNAME = "buildCommand"; //$NON-NLS-1$
- private static final String BUILDARGUMENTS_COMMAND_VARNAME = "buildArguments"; //$NON-NLS-1$
+ private static final String MAKETARGET_VARNAME = "makeTarget"; //$NON-NLS-1$
+ private static final String BUILDCOMMAND_VARNAME = "buildCommand"; //$NON-NLS-1$
+ private static final String BUILDARGUMENTS_COMMAND_VARNAME = "buildArguments"; //$NON-NLS-1$
- private static final String BUILDCOMMAND_DEFAULT = "make"; //$NON-NLS-1$
- private static final String BUILDARGUMENTS_DEFAULT = ""; //$NON-NLS-1$
+ private static final String BUILDCOMMAND_DEFAULT = "make"; //$NON-NLS-1$
+ private static final String BUILDARGUMENTS_DEFAULT = ""; //$NON-NLS-1$
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
IProject project = null;
String targetName = null;
String makeTarget = null;
@@ -75,7 +76,7 @@ public class AddMakeTarget extends ProcessRunner {
makeTarget = arg.getSimpleValue();
else if (BUILDCOMMAND_VARNAME.equals(argName))
buildCommand = arg.getSimpleValue();
- else if(BUILDARGUMENTS_COMMAND_VARNAME.equals(argName))
+ else if (BUILDARGUMENTS_COMMAND_VARNAME.equals(argName))
buildArguments = arg.getSimpleValue();
}
@@ -91,11 +92,13 @@ public class AddMakeTarget extends ProcessRunner {
target.setBuildAttribute(IMakeTarget.BUILD_TARGET, makeTarget == null ? targetName : makeTarget);
target.setUseDefaultBuildCmd(buildCommand == null);
- target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, buildCommand == null ? BUILDCOMMAND_DEFAULT : buildCommand);
- target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, buildArguments == null ? BUILDARGUMENTS_DEFAULT : buildArguments);
+ target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND,
+ buildCommand == null ? BUILDCOMMAND_DEFAULT : buildCommand);
+ target.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS,
+ buildArguments == null ? BUILDARGUMENTS_DEFAULT : buildArguments);
makeTargetManager.addTarget(target);
- } catch(CoreException e) {
+ } catch (CoreException e) {
throw new ProcessFailureException(e);
}
}

Back to the top