Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-24 18:08:23 +0000
committerEike Stepper2012-07-24 18:08:23 +0000
commit3bbc1c413a97d4484834a551851ab33134659eb2 (patch)
tree974f017e9153c3d45f144fced6269a8f12289208 /plugins
parent4d693826360651df2460a93aa5adcc6401a6f56e (diff)
downloadcdo-3bbc1c413a97d4484834a551851ab33134659eb2.tar.gz
cdo-3bbc1c413a97d4484834a551851ab33134659eb2.tar.xz
cdo-3bbc1c413a97d4484834a551851ab33134659eb2.zip
Optimize tracing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionBuilder.java23
2 files changed, 56 insertions, 30 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
index 2da43ae1fb..91ae209039 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
@@ -148,14 +148,6 @@ public class DigestValidator extends VersionValidator
}
}
- public void beforeValidation(DigestValidatorState validatorState, IModel componentModel) throws Exception
- {
- }
-
- public void afterValidation(DigestValidatorState validatorState) throws Exception
- {
- }
-
@Override
public void updateBuildState(BuildState buildState, String releasePath, Release release, IProject project,
IResourceDelta delta, IModel componentModel, IProgressMonitor monitor) throws Exception
@@ -164,13 +156,21 @@ public class DigestValidator extends VersionValidator
beforeValidation(validatorState, componentModel);
if (validatorState == null || delta == null)
{
- VersionBuilder.trace("Digest: Full validation...");
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("Digest: Full validation...");
+ }
+
buildState.setValidatorState(null);
validatorState = validateFull(project, null, componentModel, monitor);
}
else
{
- VersionBuilder.trace("Digest: Delta validation...");
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("Digest: Delta validation...");
+ }
+
validatorState = validateDelta(delta, validatorState, componentModel, monitor);
}
@@ -181,12 +181,19 @@ public class DigestValidator extends VersionValidator
}
byte[] validatorDigest = validatorState.getDigest();
- VersionBuilder.trace("DIGEST = " + formatDigest(validatorDigest));
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("DIGEST = " + formatDigest(validatorDigest));
+ }
byte[] releaseDigest = getReleaseDigest(releasePath, release, project.getName(), monitor);
- VersionBuilder.trace("RELEASE = " + formatDigest(releaseDigest));
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("RELEASE = " + formatDigest(releaseDigest));
+ }
- buildState.setChangedSinceRelease(!MessageDigest.isEqual(validatorDigest, releaseDigest));
+ boolean changedSinceRelease = !MessageDigest.isEqual(validatorDigest, releaseDigest);
+ buildState.setChangedSinceRelease(changedSinceRelease);
buildState.setValidatorState(validatorState);
}
@@ -198,7 +205,11 @@ public class DigestValidator extends VersionValidator
return null;
}
- VersionBuilder.trace("Digest: " + resource.getFullPath());
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("Digest: " + resource.getFullPath());
+ }
+
DigestValidatorState result = new DigestValidatorState();
result.setName(resource.getName());
result.setParent(parentState);
@@ -217,7 +228,11 @@ public class DigestValidator extends VersionValidator
}
byte[] digest = getFolderDigest(memberStates);
- VersionBuilder.trace("Considered: " + container.getFullPath() + " --> " + formatDigest(digest));
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("Considered: " + container.getFullPath() + " --> " + formatDigest(digest));
+ }
+
result.setDigest(digest);
result.setChildren(memberStates.toArray(new DigestValidatorState[memberStates.size()]));
}
@@ -225,7 +240,11 @@ public class DigestValidator extends VersionValidator
{
IFile file = (IFile)resource;
byte[] digest = getFileDigest(file);
- VersionBuilder.trace("Considered: " + file.getFullPath() + " --> " + formatDigest(digest));
+ if (VersionBuilder.DEBUG)
+ {
+ System.out.println("Considered: " + file.getFullPath() + " --> " + formatDigest(digest));
+ }
+
result.setDigest(digest);
}
@@ -310,6 +329,14 @@ public class DigestValidator extends VersionValidator
return !resource.isDerived();
}
+ protected void beforeValidation(DigestValidatorState validatorState, IModel componentModel) throws Exception
+ {
+ }
+
+ protected void afterValidation(DigestValidatorState validatorState) throws Exception
+ {
+ }
+
private byte[] getReleaseDigest(String releasePath, Release release, String name, IProgressMonitor monitor)
throws IOException, CoreException, ClassNotFoundException
{
@@ -538,7 +565,7 @@ public class DigestValidator extends VersionValidator
}
@Override
- public void beforeValidation(DigestValidatorState validatorState, IModel componentModel) throws Exception
+ protected void beforeValidation(DigestValidatorState validatorState, IModel componentModel) throws Exception
{
considered.clear();
considered.add("");
@@ -566,7 +593,7 @@ public class DigestValidator extends VersionValidator
}
@Override
- public void afterValidation(DigestValidatorState validatorState) throws Exception
+ protected void afterValidation(DigestValidatorState validatorState) throws Exception
{
considered.clear();
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionBuilder.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionBuilder.java
index c907846234..f1bb5612bf 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionBuilder.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionBuilder.java
@@ -58,6 +58,8 @@ public class VersionBuilder extends IncrementalProjectBuilder implements Element
public static final String IGNORE_CONTENT_CHANGES_ARGUMENT = "ignore.feature.content.changes";
+ public static final boolean DEBUG = false;
+
private static final Path MANIFEST_PATH = new Path("META-INF/MANIFEST.MF");
private static final Path FEATURE_PATH = new Path("feature.xml");
@@ -74,8 +76,6 @@ public class VersionBuilder extends IncrementalProjectBuilder implements Element
private static final int MAJOR_CHANGE = 3;
- private static final boolean DEBUG = false;
-
private Release release;
private Map<Element, Element> elementCache = new HashMap<Element, Element>();
@@ -205,7 +205,11 @@ public class VersionBuilder extends IncrementalProjectBuilder implements Element
Element releaseElement = release.getElements().get(element);
if (releaseElement == null)
{
- trace("Project has not been released: " + project.getName());
+ if (DEBUG)
+ {
+ System.out.println("Project has not been released: " + project.getName());
+ }
+
return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
}
@@ -306,7 +310,10 @@ public class VersionBuilder extends IncrementalProjectBuilder implements Element
return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
}
- trace(validator.getClass().getName() + ": " + project.getName());
+ if (DEBUG)
+ {
+ System.out.println(validator.getClass().getName() + ": " + project.getName());
+ }
/*
* Do the validation
@@ -816,14 +823,6 @@ public class VersionBuilder extends IncrementalProjectBuilder implements Element
Markers.addMarker(file, msg, IMarker.SEVERITY_WARNING, regex);
}
- public static void trace(String msg)
- {
- if (DEBUG)
- {
- System.out.println(msg);
- }
- }
-
public static IModel getComponentModel(IProject project)
{
IModel componentModel = PluginRegistry.findModel(project);

Back to the top