mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Bug 573722: Allow sub-class to output custom lines in header
Contributed by STMicroelectronics Change-Id: If7163f33c804dc40bc950da067d81396a26d8f74 Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
This commit is contained in:
parent
6187228a08
commit
fcbf0b6963
3 changed files with 73 additions and 5 deletions
|
@ -97,12 +97,21 @@ public class DefaultGCCDependencyCalculator3 implements IManagedDependencyGenera
|
||||||
makefile = root.getFile(makefilePath);
|
makefile = root.getFile(makefilePath);
|
||||||
IResourceInfo rcInfo = tool.getParentResourceInfo();
|
IResourceInfo rcInfo = tool.getParentResourceInfo();
|
||||||
if (rcInfo != null)
|
if (rcInfo != null)
|
||||||
return GnuMakefileGenerator.populateDummyTargets(rcInfo, makefile, false);
|
return createMakefileGenerator().generateDummyTargets(rcInfo, makefile, false);
|
||||||
return GnuMakefileGenerator.populateDummyTargets(buildContext, makefile, false);
|
return createMakefileGenerator().generateDummyTargets(buildContext, makefile, false);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a GnuMakefileGenerator instance to use during post processing of dependency files
|
||||||
|
* @return an GnuMakefileGenerator instance
|
||||||
|
* @since 9.3
|
||||||
|
*/
|
||||||
|
protected GnuMakefileGenerator createMakefileGenerator() {
|
||||||
|
return new GnuMakefileGenerator();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
/**
|
/**
|
||||||
* This is a specialized makefile generator that takes advantage of the
|
* This is a specialized makefile generator that takes advantage of the
|
||||||
* extensions present in Gnu Make.
|
* extensions present in Gnu Make.
|
||||||
|
* <p>
|
||||||
|
* If sub-classing and using {@link DefaultGCCDependencyCalculator3}, make sure to also override
|
||||||
|
* {@link DefaultGCCDependencyCalculator3#createMakefileGenerator()} to return the appropriate result.
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
|
@ -3482,6 +3485,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
||||||
return h.outputExtensionsSet;
|
return h.outputExtensionsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link GnuMakefileGenerator#generateDummyTargets(IConfiguration, IFile, boolean)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
static public boolean populateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
|
||||||
|
throws CoreException, IOException {
|
||||||
|
return new GnuMakefileGenerator().generateDummyTargets(cfg, makefile, force);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method postprocesses a .d file created by a build.
|
* This method postprocesses a .d file created by a build.
|
||||||
* It's main job is to add dummy targets for the header files dependencies.
|
* It's main job is to add dummy targets for the header files dependencies.
|
||||||
|
@ -3495,14 +3507,27 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
||||||
* checks for to determine if this dependency file has already been updated.
|
* checks for to determine if this dependency file has already been updated.
|
||||||
*
|
*
|
||||||
* @return a <code>true</code> if the dependency file is modified
|
* @return a <code>true</code> if the dependency file is modified
|
||||||
|
* @since 9.3
|
||||||
*/
|
*/
|
||||||
static public boolean populateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
|
public boolean generateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
|
||||||
throws CoreException, IOException {
|
throws CoreException, IOException {
|
||||||
return populateDummyTargets(cfg.getRootFolderInfo(), makefile, force);
|
return generateDummyTargets(cfg.getRootFolderInfo(), makefile, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link GnuMakefileGenerator#generateDummyTargets(IResourceInfo, IFile, boolean)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
static public boolean populateDummyTargets(IResourceInfo rcInfo, IFile makefile, boolean force)
|
static public boolean populateDummyTargets(IResourceInfo rcInfo, IFile makefile, boolean force)
|
||||||
throws CoreException, IOException {
|
throws CoreException, IOException {
|
||||||
|
return new GnuMakefileGenerator().generateDummyTargets(rcInfo, makefile, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.3
|
||||||
|
*/
|
||||||
|
public boolean generateDummyTargets(IResourceInfo rcInfo, IFile makefile, boolean force)
|
||||||
|
throws CoreException, IOException {
|
||||||
|
|
||||||
if (makefile == null || !makefile.exists())
|
if (makefile == null || !makefile.exists())
|
||||||
return false;
|
return false;
|
||||||
|
@ -3695,22 +3720,38 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
|
||||||
|
|
||||||
static public String ECHO_BLANK_LINE = ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE;
|
static public String ECHO_BLANK_LINE = ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link GnuMakefileGenerator#addGenericHeader()}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
static protected StringBuffer addDefaultHeader() {
|
||||||
|
return new GnuMakefileGenerator().addGenericHeader();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a comment formatted as follows:
|
* Outputs a comment formatted as follows:
|
||||||
* ##### ....... #####
|
* ##### ....... #####
|
||||||
* # <Comment message>
|
* # <Comment message>
|
||||||
* ##### ....... #####
|
* ##### ....... #####
|
||||||
|
* @since 9.3
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer addDefaultHeader() {
|
protected StringBuffer addGenericHeader() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
outputCommentLine(buffer);
|
outputCommentLine(buffer);
|
||||||
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(HEADER))
|
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(HEADER))
|
||||||
.append(NEWLINE);
|
.append(NEWLINE);
|
||||||
|
addCustomHeader(buffer);
|
||||||
outputCommentLine(buffer);
|
outputCommentLine(buffer);
|
||||||
buffer.append(NEWLINE);
|
buffer.append(NEWLINE);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.3
|
||||||
|
*/
|
||||||
|
protected void addCustomHeader(StringBuffer buffer) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put COLS_PER_LINE comment charaters in the argument.
|
* Put COLS_PER_LINE comment charaters in the argument.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
<li><a href="#gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</a></li>
|
<li><a href="#gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</a></li>
|
||||||
<li><a href="#ManagedCommandLineGenerator.toManagedCommandLineInfo">Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo</a></li>
|
<li><a href="#ManagedCommandLineGenerator.toManagedCommandLineInfo">Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo</a></li>
|
||||||
<li><a href="#GnuMakefileGenerator.addRuleForTool">Removed unneded boolean from function</a></li>
|
<li><a href="#GnuMakefileGenerator.addRuleForTool">Removed unneded boolean from function</a></li>
|
||||||
|
<li><a href="#GnuMakefileGenerator.addDefaultHeader">Changed methods from static to non-static</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -453,6 +454,23 @@
|
||||||
<p>
|
<p>
|
||||||
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573502" target="_blank">Bug 573502</a>.
|
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573502" target="_blank">Bug 573502</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h3>4. <a name="GnuMakefileGenerator.addDefaultHeader">Changed methods from static to non-static</a></h3>
|
||||||
|
<p>
|
||||||
|
The implementation for generating the header in the make resources was changed. The following
|
||||||
|
APIs will be removed, listed with their (non-static) replacement.
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.populateDummyTargets(IConfiguration, IFile, boolean), use
|
||||||
|
org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.generateDummyTargets(IConfiguration, IFile, boolean) instead.</li>
|
||||||
|
<li>org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.populateDummyTargets(IResourceInfo, IFile, boolean), use
|
||||||
|
org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.generateDummyTargets(IResourceInfo, IFile, boolean) instead.</li>
|
||||||
|
<li>org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.addDefaultHeader(), use
|
||||||
|
org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.addGenericHeader() instead.</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573722" target="_blank">Bug 573722</a>.
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue