Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 262824
Collapse All | Expand All

(-)src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java (+4 lines)
Lines 177-182 Link Here
177
     */
177
     */
178
    private void initializeProfilePageMap() {
178
    private void initializeProfilePageMap() {
179
        fProfilePageMap = new HashMap(5);
179
        fProfilePageMap = new HashMap(5);
180
        if(!isInitialized()) {
181
        	return;
182
        }
183
        
180
        
184
        
181
        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(MakeUIPlugin.getPluginId(), "DiscoveryProfilePage"); //$NON-NLS-1$
185
        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(MakeUIPlugin.getPluginId(), "DiscoveryProfilePage"); //$NON-NLS-1$
182
        IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
186
        IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
(-)src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java (-7 / +20 lines)
Lines 11-16 Link Here
11
package org.eclipse.cdt.make.ui.dialogs;
11
package org.eclipse.cdt.make.ui.dialogs;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.List;
14
15
15
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
16
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
16
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
17
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
Lines 43-49 Link Here
43
 * @author vhirsl
44
 * @author vhirsl
44
 */
45
 */
45
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
46
public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
46
    private static final String providerId = "specsFile";  //$NON-NLS-1$
47
    
47
    
48
    private static Object lock = GCCPerProjectSCDProfilePage.class;
48
    private static Object lock = GCCPerProjectSCDProfilePage.class;
49
    private Shell shell;
49
    private Shell shell;
Lines 251-260 Link Here
251
    }
251
    }
252
    
252
    
253
    private void initializeValues() {
253
    private void initializeValues() {
254
        bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled());
254
    	IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo();
255
        setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath());
255
    	String providerId = getProviderIDForSelectedProfile(); 
256
        sipEnabledButton.setSelection(getContainer().getBuildInfo().isProviderOutputParserEnabled(providerId));
256
    	
257
        sipRunCommandText.setText(getContainer().getBuildInfo().getProviderRunCommand(providerId));
257
    	bopEnabledButton.setSelection(builderInfo.isBuildOutputParserEnabled());
258
        setBopOpenFileText(builderInfo.getBuildOutputFilePath());
259
        sipEnabledButton.setSelection(builderInfo.isProviderOutputParserEnabled(providerId));
260
        sipRunCommandText.setText(builderInfo.getProviderRunCommand(providerId));
261
    }
262
    
263
    private String getProviderIDForSelectedProfile() {
264
    	IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo();
265
    	// Provider IDs for selected profile
266
    	List providerIDs = builderInfo.getProviderIdList(); 
267
    	if(providerIDs.size() == 0)
268
    		return "";
269
    	return (String)providerIDs.iterator().next(); 
258
    }
270
    }
259
271
260
    private void handleBOPLoadFileButtonSelected() {
272
    private void handleBOPLoadFileButtonSelected() {
Lines 318-324 Link Here
318
            buildInfo.setBuildOutputFileActionEnabled(true);
330
            buildInfo.setBuildOutputFileActionEnabled(true);
319
            buildInfo.setBuildOutputFilePath(getBopOpenFileText());
331
            buildInfo.setBuildOutputFilePath(getBopOpenFileText());
320
            buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
332
            buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
321
            
333
            String providerId = getProviderIDForSelectedProfile();
322
            buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
334
            buildInfo.setProviderOutputParserEnabled(providerId, sipEnabledButton.getSelection());
323
            buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
335
            buildInfo.setProviderRunCommand(providerId, sipRunCommandText.getText().trim());
324
        }
336
        }
Lines 331-337 Link Here
331
        if (buildInfo != null) {
343
        if (buildInfo != null) {
332
            setBopOpenFileText(buildInfo.getBuildOutputFilePath());
344
            setBopOpenFileText(buildInfo.getBuildOutputFilePath());
333
            bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
345
            bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
334
            
346
347
            String providerId = getProviderIDForSelectedProfile();
335
            sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
348
            sipEnabledButton.setSelection(buildInfo.isProviderOutputParserEnabled(providerId));
336
            sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
349
            sipRunCommandText.setText(buildInfo.getProviderRunCommand(providerId));
337
        }
350
        }
(-)src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java (-1 / +11 lines)
Lines 11-16 Link Here
11
package org.eclipse.cdt.make.ui.dialogs;
11
package org.eclipse.cdt.make.ui.dialogs;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.List;
14
15
15
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
16
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
16
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
17
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.BuildOutputReaderJob;
Lines 260-266 Link Here
260
            buildInfo.setBuildOutputFileActionEnabled(true);
261
            buildInfo.setBuildOutputFileActionEnabled(true);
261
            buildInfo.setBuildOutputFilePath(getBopOpenFileText());
262
            buildInfo.setBuildOutputFilePath(getBopOpenFileText());
262
            buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
263
            buildInfo.setBuildOutputParserEnabled(bopEnabledButton.getSelection());
263
            buildInfo.setProviderOutputParserEnabled(providerId, bopEnabledButton.getSelection());
264
            buildInfo.setProviderOutputParserEnabled(getProviderIDForSelectedProfile(), bopEnabledButton.getSelection());
264
        }
265
        }
265
    }
266
    }
266
267
Lines 273-277 Link Here
273
            bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
274
            bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled());
274
        }
275
        }
275
    }
276
    }
277
    
278
    private String getProviderIDForSelectedProfile() {
279
    	IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo();
280
    	// Provider IDs for selected profile
281
    	List providerIDs = builderInfo.getProviderIdList(); 
282
    	if(providerIDs.size() == 0)
283
    		return "";
284
    	return (String)providerIDs.iterator().next(); 
285
    }
276
286
277
}
287
}
(-).settings/org.eclipse.jdt.core.prefs (+12 lines)
Added Link Here
1
#Wed Jan 28 15:21:05 EST 2009
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
(-)src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java (-5 / +69 lines)
Lines 33-38 Link Here
33
import org.eclipse.cdt.managedbuilder.core.IInputType;
33
import org.eclipse.cdt.managedbuilder.core.IInputType;
34
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
34
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
35
import org.eclipse.cdt.managedbuilder.core.ITool;
35
import org.eclipse.cdt.managedbuilder.core.ITool;
36
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
37
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
36
import org.eclipse.cdt.ui.CUIPlugin;
38
import org.eclipse.cdt.ui.CUIPlugin;
37
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
39
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
38
import org.eclipse.cdt.ui.newui.UIMessages;
40
import org.eclipse.cdt.ui.newui.UIMessages;
Lines 54-59 Link Here
54
import org.eclipse.swt.widgets.Combo;
56
import org.eclipse.swt.widgets.Combo;
55
import org.eclipse.swt.widgets.Composite;
57
import org.eclipse.swt.widgets.Composite;
56
import org.eclipse.swt.widgets.Group;
58
import org.eclipse.swt.widgets.Group;
59
import org.eclipse.swt.widgets.Label;
57
import org.eclipse.swt.widgets.Table;
60
import org.eclipse.swt.widgets.Table;
58
import org.eclipse.swt.widgets.TableItem;
61
import org.eclipse.swt.widgets.TableItem;
59
62
Lines 71-76 Link Here
71
    private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
74
    private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
72
    private static final int DEFAULT_HEIGHT = 110;
75
    private static final int DEFAULT_HEIGHT = 110;
73
	private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 20 };
76
	private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 20 };
77
	private Label fTableDefinition;
74
    private Table resTable;
78
    private Table resTable;
75
    private Button scEnabledButton;
79
    private Button scEnabledButton;
76
    private Button scProblemReportingEnabledButton;
80
    private Button scProblemReportingEnabledButton;
Lines 118-125 Link Here
118
		sashForm = new SashForm(usercomp, SWT.NONE);
122
		sashForm = new SashForm(usercomp, SWT.NONE);
119
		sashForm.setOrientation(SWT.HORIZONTAL);
123
		sashForm.setOrientation(SWT.HORIZONTAL);
120
		sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
124
		sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
121
    	
125
		
122
		resTable = new Table(sashForm, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
126
		Composite comp = new Composite(sashForm, SWT.NONE);
127
		comp.setLayout(new GridLayout(1, true));
128
		comp.setLayoutData(new GridData());
129
		
130
		fTableDefinition = new Label(comp, SWT.LEFT);
131
		fTableDefinition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
132
		
133
		resTable = new Table(comp, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
123
		GridData gd = new GridData(GridData.FILL_VERTICAL);
134
		GridData gd = new GridData(GridData.FILL_VERTICAL);
124
		gd.widthHint = 150;
135
		gd.widthHint = 150;
125
		resTable.setLayoutData(gd);
136
		resTable.setLayoutData(gd);
Lines 205-212 Link Here
205
 	}
216
 	}
206
 	
217
 	
207
 	private void updateData() {
218
 	private void updateData() {
208
 		if (scopeComboBox != null) 
219
 		int selScope = 0;
209
 			scopeComboBox.select(cbi.isPerRcTypeDiscovery() ? 0 : 1);
220
 		String lblText = "Tools:";
221
 		if(!cbi.isPerRcTypeDiscovery()) {
222
 			selScope = 1;
223
 			lblText = "Configuration:";
224
 		} 
225
		if (scopeComboBox != null) 
226
			scopeComboBox.select(selScope);
227
		fTableDefinition.setText(lblText);
228
 		
210
 		
229
 		
211
 		Map<CfgInfoContext, IScannerConfigBuilderInfo2> m = cbi.getInfoMap();
230
 		Map<CfgInfoContext, IScannerConfigBuilderInfo2> m = cbi.getInfoMap();
212
 		int pos = resTable.getSelectionIndex();
231
 		int pos = resTable.getSelectionIndex();
Lines 291-297 Link Here
291
        int counter = 0;
310
        int counter = 0;
292
        int pos = 0;
311
        int pos = 0;
293
        String savedId = buildInfo.getSelectedProfileId();
312
        String savedId = buildInfo.getSelectedProfileId();
313
        ITool[] tools = null;
314
		Tool tool = (Tool)iContext.getTool();
315
		if(null == tool) {
316
			IConfiguration conf = iContext.getConfiguration();
317
			if(null != conf) {
318
				tools = conf.getToolChain().getTools();
319
			}
320
			if(null == tools)
321
				return;
322
		}
323
		else
324
			tools = new ITool[] { tool };
325
        
294
        for (String profileId : profilesList) {
326
        for (String profileId : profilesList) {
327
    		boolean ok = false;
328
        	for(int i = 0; i < tools.length; ++i) {
329
        		IInputType[] inputTypes = ((Tool)tools[i]).getAllInputTypes();
330
	        	if(null != inputTypes) {
331
		        	for(IInputType it : inputTypes) {
332
		        		String[] requiedProfiles = getDiscoveryProfileIds(tools[i], it);
333
		        		if(null != requiedProfiles) {
334
		        			for(String requiredProfile : requiedProfiles) {
335
				        		if(profileId.equals(requiredProfile)) {
336
				        			ok = true;
337
				        			break;
338
				        		}
339
		        			}
340
		        		}
341
		        	}
342
	        	}
343
	        	if(ok)
344
	        		break;
345
        	}
346
        	if(!ok)
347
        		continue;
295
            if (!cbi.isProfileSupported(iContext, profileId)) 
348
            if (!cbi.isProfileSupported(iContext, profileId)) 
296
 				continue; 
349
 				continue; 
297
 			visibleProfilesList.add(profileId);
350
 			visibleProfilesList.add(profileId);
Lines 325-331 Link Here
325
        handleDiscoveryProfileChanged();
378
        handleDiscoveryProfileChanged();
326
 	}
379
 	}
327
 	
380
 	
328
 	private String[] normalize(String[] labels, String[] ids, int counter) {
381
 	private String[] getDiscoveryProfileIds(ITool iTool, IInputType it) {
382
		String attribute = ((InputType)it).getDiscoveryProfileIdAttribute();
383
		if(null == attribute)
384
			return new String[0];
385
		// FIXME: temporary; we should add new method to IInputType instead of that
386
		String[] profileIds = attribute.split("\\|");
387
		for(int i = 0; i < profileIds.length; ++i)
388
			profileIds[i] = profileIds[i].trim();
389
		return profileIds;
390
	}
391
392
	private String[] normalize(String[] labels, String[] ids, int counter) {
329
 		int mode = CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES);
393
 		int mode = CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES);
330
		String[] tmp = new String[counter];
394
		String[] tmp = new String[counter];
331
 		// Always show either Name + ID, or ID only
395
 		// Always show either Name + ID, or ID only
(-)src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java (+8 lines)
Lines 1818-1823 Link Here
1818
		if(id == null){
1818
		if(id == null){
1819
			id = ((Tool)tool).getDiscoveryProfileId();
1819
			id = ((Tool)tool).getDiscoveryProfileId();
1820
		}
1820
		}
1821
		// if there is more than one ('|'-separated), return the first one
1822
		// TODO: expand interface with String[] getDiscoveryProfileIds(ITool tool)
1823
		if(null != id) {
1824
		int nPos = id.indexOf('|');
1825
		if(nPos <= 0)
1826
			nPos = id.length();
1827
			id = id.substring(0, nPos);
1828
		}
1821
		return id;
1829
		return id;
1822
	}
1830
	}
1823
	
1831
	
(-)src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java (-1 / +1 lines)
Lines 304-310 Link Here
304
			if(!isPerRcTypeDiscovery())
304
			if(!isPerRcTypeDiscovery())
305
				return true;
305
				return true;
306
306
307
			return !CfgScannerConfigProfileManager.isPerFileProfile(profileId);
307
			return CfgScannerConfigProfileManager.isPerFileProfile(profileId);
308
		}
308
		}
309
	}
309
	}
310
310
(-)src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java (-1 / +5 lines)
Lines 60-66 Link Here
60
 * 
60
 * 
61
 * @author vhirsl
61
 * @author vhirsl
62
 */
62
 */
63
public final class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
63
public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
64
	private static final int INCLUDE_PATH 		= 1;
64
	private static final int INCLUDE_PATH 		= 1;
65
	private static final int QUOTE_INCLUDE_PATH = 2;
65
	private static final int QUOTE_INCLUDE_PATH = 2;
66
	private static final int INCLUDE_FILE		= 3;
66
	private static final int INCLUDE_FILE		= 3;
Lines 225-230 Link Here
225
        }
225
        }
226
	}
226
	}
227
227
228
	protected InfoContext getInfoContext() {
229
		return context;
230
	}
231
228
	/* (non-Javadoc)
232
	/* (non-Javadoc)
229
     * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
233
     * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map)
230
     */
234
     */
(-)src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java (-9 / +14 lines)
Lines 105-119 Link Here
105
            // Print the command for visual interaction.
105
            // Print the command for visual interaction.
106
            launcher.showCommand(true);
106
            launcher.showCommand(true);
107
107
108
            // add additional arguments
108
            String[] comandLineOptions = getCommandLineOptions();
109
            // subclass can change default behavior
109
            String ca = coligate(comandLineOptions);
110
            String[] compileArguments = prepareArguments( 
111
                    buildInfo.isUseDefaultProviderCommand(providerId));
112
113
            String ca = coligate(compileArguments);
114
110
115
            monitor.subTask(MakeMessages.getString("ExternalScannerInfoProvider.Invoking_Command")  //$NON-NLS-1$
111
            monitor.subTask(MakeMessages.getString("ExternalScannerInfoProvider.Invoking_Command")  //$NON-NLS-1$
116
                    + fCompileCommand.toString() + ca);
112
                    + getCommandToLaunch() + ca);
117
            cos = new StreamMonitor(new SubProgressMonitor(monitor, 70), cos, 100);
113
            cos = new StreamMonitor(new SubProgressMonitor(monitor, 70), cos, 100);
118
            
114
            
119
            ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer(
115
            ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer(
Lines 121-127 Link Here
121
            OutputStream consoleOut = (sniffer == null ? cos : sniffer.getOutputStream());
117
            OutputStream consoleOut = (sniffer == null ? cos : sniffer.getOutputStream());
122
            OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream());
118
            OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream());
123
            TraceUtil.outputTrace("Default provider is executing command:", fCompileCommand.toString() + ca, ""); //$NON-NLS-1$ //$NON-NLS-2$
119
            TraceUtil.outputTrace("Default provider is executing command:", fCompileCommand.toString() + ca, ""); //$NON-NLS-1$ //$NON-NLS-2$
124
            Process p = launcher.execute(fCompileCommand, compileArguments, setEnvironment(launcher, env), fWorkingDirectory);
120
            Process p = launcher.execute(getCommandToLaunch(), comandLineOptions, setEnvironment(launcher, env), fWorkingDirectory);
125
            if (p != null) {
121
            if (p != null) {
126
                try {
122
                try {
127
                    // Close the input of the Process explicitely.
123
                    // Close the input of the Process explicitely.
Lines 158-164 Link Here
158
        return true;
154
        return true;
159
    }
155
    }
160
    
156
    
161
157
    protected IPath getCommandToLaunch() {
158
    	return fCompileCommand;
159
    }
160
    
161
    protected String[] getCommandLineOptions() {
162
        // add additional arguments
163
        // subclass can change default behavior
164
        return prepareArguments( 
165
                buildInfo.isUseDefaultProviderCommand(providerId));
166
    }
162
    
167
    
163
    /**
168
    /**
164
     * Initialization of protected fields. 
169
     * Initialization of protected fields. 
(-)src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCDMakefileGenerator.java (-15 / +64 lines)
Lines 21-27 Link Here
21
import org.eclipse.cdt.make.core.MakeCorePlugin;
21
import org.eclipse.cdt.make.core.MakeCorePlugin;
22
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
22
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
23
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
23
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
24
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
25
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
24
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
26
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
27
import org.eclipse.core.runtime.IPath;
28
import org.eclipse.core.runtime.Path;
25
29
26
30
27
/**
31
/**
Lines 32-55 Link Here
32
public class SCDMakefileGenerator extends DefaultRunSIProvider {
36
public class SCDMakefileGenerator extends DefaultRunSIProvider {
33
    private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$
37
    private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$
34
    private static final String DENDL = ENDL+ENDL;
38
    private static final String DENDL = ENDL+ENDL;
35
39
    private String fMakeCommand = "-f ${project_name}_scd.mk ";
40
    
36
    /* (non-Javadoc)
41
    /* (non-Javadoc)
37
     * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
42
     * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
38
     */
43
     */
39
    protected boolean initialize() {
44
    protected boolean initialize() {
40
        boolean rc = super.initialize();
45
    	String args = buildInfo.getProviderRunArguments(providerId);
46
    	if(null == args)
47
    		args = " -E -P -v -dD ";
48
    	else {
49
	        int nPos = args.indexOf('|');
50
	        if(nPos > 0) {
51
	        	fMakeCommand = args.substring(0, nPos);
52
	        	args = args.substring(nPos + 1);
53
	        }
54
    	}
55
        fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
56
        	
57
//		args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args, false);
58
    	args = substituteDynamicVariables(args);
59
        fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(args, "\"");//$NON-NLS-1$
60
        fWorkingDirectory = MakeCorePlugin.getWorkingDirectory();
61
        fMakeCommand = substituteDynamicVariables(fMakeCommand); 
62
//      fMakeCommand = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fMakeCommand, false);
41
        
63
        
42
        if (rc) {
64
        return generateMakefile(resource.getProject().getName());
43
            fWorkingDirectory = MakeCorePlugin.getWorkingDirectory();
44
            // replace string variables in compile arguments
45
            // TODO Vmir - use string variable replacement
46
            for (int i = 0; i < fCompileArguments.length; ++i) {
47
                fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{project_name\\}",    //$NON-NLS-1$ 
48
                        resource.getProject().getName());
49
            }
50
            rc = generateMakefile(resource.getProject().getName());
51
        }
52
        return rc;
53
    }
65
    }
54
66
55
    /**
67
    /**
Lines 86-99 Link Here
86
                    buffer.append(ENDL);
98
                    buffer.append(ENDL);
87
                    buffer.append("\t@echo begin generating scanner info for $@"+ENDL+"\t"); //$NON-NLS-1$ //$NON-NLS-2$
99
                    buffer.append("\t@echo begin generating scanner info for $@"+ENDL+"\t"); //$NON-NLS-1$ //$NON-NLS-2$
88
                    buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines
100
                    buffer.append(cmd.getSCDRunnableCommand(true, true)); // quote includes and defines
89
                    buffer.append(" -E -P -v -dD "); //$NON-NLS-1$
101
                    for (String arg : prepareArguments(buildInfo.isUseDefaultProviderCommand(providerId))) { 
102
                    	buffer.append(' ');
103
                    	buffer.append(arg);
104
                    }
105
                    buffer.append(' ');
90
                    buffer.append(cmd.appliesToCPPFileType() ? "specs.cpp" : "specs.c"); //$NON-NLS-1$ //$NON-NLS-2$
106
                    buffer.append(cmd.appliesToCPPFileType() ? "specs.cpp" : "specs.c"); //$NON-NLS-1$ //$NON-NLS-2$
91
                    buffer.append(ENDL);
107
                    buffer.append(ENDL);
92
                    buffer.append("\t@echo end generating scanner info for $@"); //$NON-NLS-1$
108
                    buffer.append("\t@echo end generating scanner info for $@"); //$NON-NLS-1$
93
                    buffer.append(DENDL);
109
                    buffer.append(DENDL);
94
                }
110
                }
95
                
111
                
96
                File makefile = new File(fWorkingDirectory.toFile(), projectName+"_scd.mk"); //$NON-NLS-1$
112
                File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName)); //$NON-NLS-1$
97
                try {
113
                try {
98
                    PrintStream ps = new PrintStream(new FileOutputStream(makefile));
114
                    PrintStream ps = new PrintStream(new FileOutputStream(makefile));
99
                    ps.println(buffer.toString());
115
                    ps.println(buffer.toString());
Lines 108-111 Link Here
108
        
124
        
109
        return rc;
125
        return rc;
110
    }
126
    }
127
    
128
    private String getMakeFileName(String projectName) {
129
        String[] makeArgs = ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");//$NON-NLS-1$
130
        boolean found = false;
131
        for(String arg : makeArgs) { 
132
        	if(found)
133
        		return arg;
134
        	if(arg.equals("-f"))
135
        		found = true;
136
        }
137
        return projectName+"_scd.mk";
138
    }
139
    
140
    // TODO: replace it with Eclipse Dynamic Variable Resolver
141
    private String substituteDynamicVariables(String string) {
142
        string = string.replaceAll("\\$\\{project_name\\}",    //$NON-NLS-1$ 
143
                resource.getProject().getName());
144
        string = string.replaceAll("\\$\\{plugin_state_location\\}",    //$NON-NLS-1$ 
145
                MakeCorePlugin.getWorkingDirectory().toString());
146
        string = string.replaceAll("\\$\\{specs_file\\}", 
147
        		GCCScannerConfigUtil.C_SPECS_FILE );  //$NON-NLS-1$
148
        return string;
149
    }
150
151
	@Override
152
	protected String[] getCommandLineOptions() {
153
		return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");		
154
	}
155
156
	@Override
157
	protected IPath getCommandToLaunch() {
158
		return new Path("make");	
159
	}
111
}
160
}

Return to bug 262824