Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-29 08:51:25 +0000
committerEike Stepper2012-07-29 08:51:25 +0000
commitf741a4ab3118ccc90c34b114026079bee41fb2bd (patch)
tree03fe32b382911959c5be338ae15b3137cb7e7e66 /plugins
parentb4a81b0b53a216e513103c09adb9850b23146f53 (diff)
downloadcdo-f741a4ab3118ccc90c34b114026079bee41fb2bd.tar.gz
cdo-f741a4ab3118ccc90c34b114026079bee41fb2bd.tar.xz
cdo-f741a4ab3118ccc90c34b114026079bee41fb2bd.zip
Create builder framework
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/BuildContext.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/Builder.java75
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyDelta.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyProvider.java35
4 files changed, 182 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/BuildContext.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/BuildContext.java
new file mode 100644
index 0000000000..67fb796730
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/BuildContext.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.internal.version.proto;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuildContext
+{
+ private Builder<?> builder;
+
+ private boolean fullBuild;
+
+ public BuildContext(Builder<?> builder, int kind, Map<String, String> args)
+ {
+ this.builder = builder;
+ fullBuild = kind == IncrementalProjectBuilder.FULL_BUILD || kind == IncrementalProjectBuilder.CLEAN_BUILD;
+ }
+
+ public IProject getProject()
+ {
+ return builder.getProject();
+ }
+
+ public IResourceDelta getDelta()
+ {
+ return builder.getDelta(getProject());
+ }
+
+ public boolean isFullBuild()
+ {
+ return fullBuild;
+ }
+
+ public void setFullBuild()
+ {
+ fullBuild = true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/Builder.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/Builder.java
new file mode 100644
index 0000000000..f8300c6012
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/Builder.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.internal.version.proto;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class Builder<DEPENDENCY> extends IncrementalProjectBuilder
+{
+ private List<DependencyProvider> dependencyProviders = new ArrayList<DependencyProvider>();
+
+ public Builder()
+ {
+ }
+
+ @Override
+ protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException
+ {
+ BuildContext buildContext = new BuildContext(this, kind, args);
+
+ initDependencyProviders(buildContext);
+ boolean dependenciesMayHaveChanged = dependenciesMayHaveChanged();
+
+ List<DEPENDENCY> dependencies;
+ List<DependencyDelta> dependencyDeltas;
+ if (dependenciesMayHaveChanged)
+ {
+ for (DependencyProvider dependencyProvider : dependencyProviders)
+ {
+ // List<DEPENDENCY> dependencies;
+ // dependencyProvider.getDependencies();
+ }
+ }
+
+ return null;
+ }
+
+ private void initDependencyProviders(BuildContext buildContext)
+ {
+ for (DependencyProvider dependencyProvider : dependencyProviders)
+ {
+ dependencyProvider.setBuildContext(buildContext);
+ }
+ }
+
+ private boolean dependenciesMayHaveChanged()
+ {
+ for (DependencyProvider dependencyProvider : dependencyProviders)
+ {
+ if (dependencyProvider.dependenciesMayHaveChanged())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyDelta.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyDelta.java
new file mode 100644
index 0000000000..0bdff6c6a8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyDelta.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.internal.version.proto;
+
+/**
+ * @author Eike Stepper
+ */
+public class DependencyDelta
+{
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyProvider.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyProvider.java
new file mode 100644
index 0000000000..5501bfb45d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/proto/DependencyProvider.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.releng.internal.version.proto;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class DependencyProvider
+{
+ private BuildContext buildContext;
+
+ public DependencyProvider()
+ {
+ }
+
+ public BuildContext getBuildContext()
+ {
+ return buildContext;
+ }
+
+ public void setBuildContext(BuildContext buildContext)
+ {
+ this.buildContext = buildContext;
+ }
+
+ public abstract boolean dependenciesMayHaveChanged();
+}

Back to the top