Commit 4b08d8db authored by Florian Hölzl's avatar Florian Hölzl
Browse files

YELLOW

refs 862
parent 8c7ec2ed
......@@ -20,10 +20,12 @@ package org.fortiss.af3.tools.gcc;
import static org.conqat.lib.commons.filesystem.FileSystemUtils.readFile;
import static org.eclipse.core.runtime.Assert.isNotNull;
import static org.eclipse.core.runtime.Assert.isTrue;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.io.File;
import java.io.IOException;
import org.fortiss.af3.tools.ToolsActivator;
import org.fortiss.af3.tools.base.SimpleToolRunnerBase;
/**
......@@ -32,7 +34,7 @@ import org.fortiss.af3.tools.base.SimpleToolRunnerBase;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: F58DDBC26B4ACF4ACF67047916E13713
* @ConQAT.Rating YELLOW Hash: 15ECED26A3B5D47571DDF794EA753986
*/
public class BuiltProgramRunner extends SimpleToolRunnerBase {
......@@ -77,10 +79,7 @@ public class BuiltProgramRunner extends SimpleToolRunnerBase {
try {
return readFile(physicalFile);
} catch(IOException e) {
// TODO(AW) review: may it be useful to provide an error-log entry about
// this incident here? Please ignore this comment, if this exception is just here
// for completeness.
e.printStackTrace();
error(ToolsActivator.getDefault(), e.getMessage(), e);
}
return null;
}
......
......@@ -20,10 +20,12 @@ package org.fortiss.af3.tools.gcc;
import static org.conqat.lib.commons.filesystem.FileSystemUtils.readFile;
import static org.eclipse.core.runtime.Assert.isNotNull;
import static org.eclipse.core.runtime.Assert.isTrue;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.io.File;
import java.io.IOException;
import org.fortiss.af3.tools.ToolsActivator;
import org.fortiss.af3.tools.base.SimpleToolRunnerBase;
/**
......@@ -32,7 +34,7 @@ import org.fortiss.af3.tools.base.SimpleToolRunnerBase;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: B908F969DDF4B1CFEF7B93B66C2D3854
* @ConQAT.Rating YELLOW Hash: 3DA3550CA54ACF6C105D89AACFC13D2A
*/
public class ConfigureRunner extends SimpleToolRunnerBase {
......@@ -72,10 +74,7 @@ public class ConfigureRunner extends SimpleToolRunnerBase {
try {
return readFile(physicalFile);
} catch(IOException e) {
// TODO(AW) review: may it be useful to provide an error-log entry about
// this incident here? Please ignore this comment, if this exception is just here
// for completeness.
e.printStackTrace();
error(ToolsActivator.getDefault(), e.getMessage(), e);
}
return null;
}
......
......@@ -25,7 +25,7 @@ import java.io.File;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: 80CD5F1A5E715F57A5D8F4EB63CD9744
* @ConQAT.Rating YELLOW Hash: 9F5165FF4CFAD0DB3F553121792A89F2
*/
public class GCCRunner extends GCCToolChainRunnerBase {
......@@ -53,10 +53,8 @@ public class GCCRunner extends GCCToolChainRunnerBase {
/** {@inheritDoc} */
@Override
protected String getVersionInfo(String helpMessage) {
// TODO(AW) review: please see 'ShellRunner'.
int startOfVersioningInfo = helpMessage.indexOf("gcc version ");
return helpMessage.substring(startOfVersioningInfo + 12, startOfVersioningInfo + 17);
protected String getVersionKeyString() {
return "gcc version ";
}
/** {@inheritDoc} */
......
......@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.af3.tools.gcc;
import static java.lang.Character.isDigit;
import java.io.File;
import org.conqat.lib.commons.collections.Pair;
......@@ -28,7 +30,7 @@ import org.fortiss.af3.tools.base.SimpleToolRunnerBase;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 863C0D40D824B26F915B1DEA3F30C7B1
* @ConQAT.Rating YELLOW Hash: 7A93100403B451D362C6F2F82626ABF4
*/
public abstract class GCCToolChainRunnerBase extends SimpleToolRunnerBase {
......@@ -67,6 +69,28 @@ public abstract class GCCToolChainRunnerBase extends SimpleToolRunnerBase {
return "-v";
}
/** Returns the version info contained in the given help message. */
protected abstract String getVersionInfo(String helpMessage);
/**
* Returns the version info contained in the given help message. The implementation looks for
* the key string returned by {@link #getVersionKeyString()} and outputs all the following
* character, which are digits or dots. Sub-classes may override this behavior.
*/
protected String getVersionInfo(String helpMessage) {
String key = getVersionKeyString();
int vInfo = helpMessage.indexOf(key) + key.length();
StringBuffer buf = new StringBuffer();
while(vInfo < helpMessage.length() &&
(isDigit(helpMessage.charAt(vInfo)) || helpMessage.charAt(vInfo) == '.')) {
buf.append(helpMessage.charAt(vInfo));
vInfo++;
}
return buf.toString();
}
/**
* Returns the key string to be searched in the tools help message to find the version info. The
* default is {@code version} followed by a space.
*/
protected String getVersionKeyString() {
return "version ";
}
}
......@@ -27,7 +27,7 @@ import java.io.File;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: AA2EBC818460EE1D5A931C87800D13CB
* @ConQAT.Rating YELLOW Hash: 707448717B8C069078B22075B52E9BFE
*/
public class MakeRunner extends GCCToolChainRunnerBase {
......@@ -56,9 +56,7 @@ public class MakeRunner extends GCCToolChainRunnerBase {
/** {@inheritDoc} */
@Override
protected String getVersionInfo(String helpMessage) {
// TODO(AW) review: please see 'ShellRunner'.
int startOfVersioningInfo = helpMessage.indexOf("GNU Make ") + 9;
return helpMessage.substring(startOfVersioningInfo, startOfVersioningInfo + 4);
protected String getVersionKeyString() {
return "GNU Make ";
}
}
......@@ -26,7 +26,7 @@ import java.io.File;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: AC236F369217514A802B5FFF69CBC120
* @ConQAT.Rating YELLOW Hash: 63E058B554AE8984C6283A3816492730
*/
public class ShellRunner extends GCCToolChainRunnerBase {
......@@ -57,16 +57,4 @@ public class ShellRunner extends GCCToolChainRunnerBase {
protected String getVersionOption() {
return "-version";
}
/** {@inheritDoc} */
@Override
protected String getVersionInfo(String helpMessage) {
int startOfVersioningInfo = helpMessage.indexOf("version ") + 8;
// TODO(AW) review: this type of parsing can be dangerous, if the version string is
// extended in the future. So it may be possible that "1.42.9", for example, increments to
// "1.42.10" which would produce an error here. The magic version string length of "6"
// seems a bit arbitrary to me ;) ... maybe there is currently no better solution, then
// please ignore this comment.
return helpMessage.substring(startOfVersioningInfo, startOfVersioningInfo + 6);
}
}
<!--
$Id$
@version $Rev$
@ConQAT.Rating RED Hash: E522E0A83F619710EDF84EEDFB309EC4
@ConQAT.Rating YELLOW Hash: 0230B4FE18CB2A690B211C6A9057CE29
-->
<body>
review: this file was missing.
Package for running external tools related to the GCC compiler, i.e., gcc, make, configure, and shell.
</body>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment