Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some refactoring

  • Loading branch information...
commit f4b59dd2585c6f4cfbcdc68f92e6882ba50f5504 1 parent ee01cf5
John J. Camilleri authored
View
22 ....grammaticalframework.eclipse/src/org/grammaticalframework/eclipse/builder/GFBuilder.java
@@ -80,6 +80,11 @@
private String gfPath;
private String gfLibPath;
private Boolean buildDependents;
+
+// /**
+// * For avoiding duplicate work
+// */
+// private Long buildStartTime;
/**
* Logger
@@ -100,6 +105,9 @@
gfLibPath = GFPreferences.getLibraryPath();
buildDependents = GFPreferences.getBuildDependents();
+// // Record start time
+// buildStartTime = new Date().getTime();
+
try {
switch (kind) {
case IncrementalProjectBuilder.FULL_BUILD:
@@ -149,7 +157,7 @@ public boolean visit(IResourceDelta delta) {
}
// Do we want to bother further?
- if (!shouldBuild(delta.getResource())) {
+ if (!isBuildable(delta.getResource())) {
return true;
}
IFile file = (IFile)delta.getResource();
@@ -187,7 +195,7 @@ public boolean visit(IResource resource) {
throw new OperationCanceledException();
}
// Build
- if (shouldBuild(resource)) {
+ if (isBuildable(resource)) {
IFile file = (IFile) resource;
Set<String> imports = GFBuilderHelper.getFileImports(file);
if (imports == null) {
@@ -223,7 +231,7 @@ public boolean visit(IResource resource) {
throw new OperationCanceledException();
}
// Build
- if (shouldBuild(resource)) {
+ if (isBuildable(resource)) {
buildFile((IFile) resource);
}
// Visit children too
@@ -251,7 +259,7 @@ public boolean visit(IResource resource) {
}
// If it's a buildable file, then clear its 'imports' data!
- if (shouldBuild(resource)) {
+ if (isBuildable(resource)) {
GFBuilderHelper.clearFileImports(resource);
return true;
}
@@ -319,7 +327,7 @@ private void cleanFile(IFile file) {
* @param resource the resource
* @return true, if this is a source fiel which should be built
*/
- private boolean shouldBuild(IResource resource) {
+ private boolean isBuildable(IResource resource) {
try {
boolean isFile = resource.getType() == IResource.FILE;
boolean isGF = resource.getFileExtension().equals("gf");
@@ -332,7 +340,7 @@ private boolean shouldBuild(IResource resource) {
}
/**
- * Call the respective build method depending on the type of build
+ * Build an individual file, including pre & post tasks
* @param file
* @return
*/
@@ -350,7 +358,7 @@ private void buildFile(IFile file) {
buildFileTags(file);
// Process tags file and save imports
- Set<String> imports = GFBuilderHelper.readTagsFile(file);
+ Set<String> imports = GFBuilderHelper.getImportsFromTagsFile(file);
GFBuilderHelper.saveFileImports(file, imports);
}
View
26 ...aticalframework.eclipse/src/org/grammaticalframework/eclipse/builder/GFBuilderHelper.java
@@ -60,7 +60,7 @@ public static URI getTagsFileURIRelative(String sourceFileName) {
/**
* Gets the tags file path as a raw location.
* Only pieces the name together; does not do any checking!
- * @param sourceFileName
+ * @param file
* @return
*/
public static String getTagsFileFullPath(IFile file) {
@@ -69,7 +69,27 @@ public static String getTagsFileFullPath(IFile file) {
+ getTagsFileNameRelative(file.getName());
}
- public static Set<String> readTagsFile(IFile file) {
+// /**
+// * Gets the modification time of the file's tags file, or 0 if not found
+// * @param file
+// * @return
+// */
+// public static Long getTagsFileMTime(IFile file) {
+// String tagsFileName = getTagsFileNameRelative(file.getName());
+// try {
+// IFile tagsFile = (IFile)file.getParent().findMember(tagsFileName);
+// return tagsFile.getLocalTimeStamp();
+// } catch (Exception e) {
+// return (long) IResource.NULL_STAMP;
+// }
+// }
+
+ /**
+ * Read tags file for a source module and return a list of the modules it imports/opens
+ * @param file
+ * @return
+ */
+ public static Set<String> getImportsFromTagsFile(IFile file) {
boolean includeSelf = false;
String tagsFileName = getTagsFileNameRelative(file.getName());
try {
@@ -106,7 +126,7 @@ public static String getTagsFileFullPath(IFile file) {
} catch (CoreException e) {
log.warn("Error reading tags file "+tagsFileName, e);
}
- return null;
+ return null;
}
/**
View
5 ...rk.eclipse/src/org/grammaticalframework/eclipse/launch/GFLaunchConfigurationDelegate.java
@@ -125,6 +125,11 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
if (!opt_Options.isEmpty()) {
command.addAll( Arrays.asList(opt_Options.split("\\s")) );
}
+
+ // TODO: Do we want to add the --run command to suppress annoying output?
+ // command.add("--run");
+
+ // Add filenames
command.addAll( Arrays.asList(opt_Files.split("\\s")) );
try {
Please sign in to comment.
Something went wrong with that request. Please try again.