summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaeyoung Son <taeyoung2.son@samsung.com>2014-05-23 16:28:25 +0900
committerTaeyoung Son <taeyoung2.son@samsung.com>2014-06-09 16:17:51 +0900
commita5bce57edfda917ac9740542b3ea07b479d62a8f (patch)
tree0e3f77a43b1f960099198da4d7d2180fe557e5b3
parent2f7fe5f2e9d2879a7429369bb3d535419e0ae2ca (diff)
downloadcommon-eplugin-a5bce57edfda917ac9740542b3ea07b479d62a8f.tar.gz
common-eplugin-a5bce57edfda917ac9740542b3ea07b479d62a8f.tar.bz2
common-eplugin-a5bce57edfda917ac9740542b3ea07b479d62a8f.zip
BUILD: Fixed bug in TemplateEngineBuilder
Fixed bug in TemplateEngineBuilder Change-Id: I54dbf3e6c0462302ffb2dacf2540476deb4a3dad Signed-off-by: Taeyoung Son <taeyoung2.son@samsung.com>
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/BuildDependencyListener.java2
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/BuildProcess.java23
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/IBuildProcessListener.java25
-rwxr-xr-xorg.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java5
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/core/TemplateEngineBuilder.java2
-rw-r--r--org.tizen.common.builder/src/org/tizen/common/builder/exception/Location.java25
-rw-r--r--org.tizen.common.builder/test/src/org/tizen/common/builder/MockBuilder.java2
7 files changed, 78 insertions, 6 deletions
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/BuildDependencyListener.java b/org.tizen.common.builder/src/org/tizen/common/builder/BuildDependencyListener.java
index 4e090dd3a..0629c992f 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/BuildDependencyListener.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/BuildDependencyListener.java
@@ -1,5 +1,5 @@
/*
- * BuildListener.java
+ * common
*
* Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
*
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/BuildProcess.java b/org.tizen.common.builder/src/org/tizen/common/builder/BuildProcess.java
index 8986c9427..f140a147d 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/BuildProcess.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/BuildProcess.java
@@ -1,5 +1,5 @@
/*
- * AbstractBuildProcess.java
+ * BuildProcess.java
*
* Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
*
@@ -218,4 +218,25 @@ public class BuildProcess implements IBuildProcess {
public void removeListener(IBuildListener listener) {
listeners.remove(listener);
}
+
+ public IBuilder getLastBuilder() {
+ if (builders == null
+ || builders.isEmpty()) {
+ return null;
+ }
+ return builders.get(builders.size()-1);
+ }
+
+ public IBuilder getBuilder(Class<? extends IBuilder> clazz) {
+ if (builders == null
+ || builders.isEmpty()) {
+ return null;
+ }
+ for (IBuilder builder : builders) {
+ if (builder.getClass().equals(clazz)) {
+ return builder;
+ }
+ }
+ return null;
+ }
}
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/IBuildProcessListener.java b/org.tizen.common.builder/src/org/tizen/common/builder/IBuildProcessListener.java
index ab703f744..485f3fbc8 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/IBuildProcessListener.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/IBuildProcessListener.java
@@ -1,3 +1,28 @@
+/*
+ * IBuildProcessListener.java
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Taeyoung Son <taeyoung2.son@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
package org.tizen.common.builder;
public interface IBuildProcessListener extends IBuildListener {
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java b/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
index 67c3c87d1..b3c419633 100755
--- a/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/core/AbstractBuilder.java
@@ -149,12 +149,13 @@ implements IBuilder
* @param byteArray
* @throws IOException
*/
- public void addOutputResource(BuildResult result, IResource resource, byte[] byteArray) throws IOException {
- IResource outResource = new Resource(getOutputFileHandler(), resource.getPath());
+ public IResource addOutputResource(BuildResult result, IResource resource, String outputPath, byte[] byteArray) throws IOException {
+ IResource outResource = new Resource(getOutputFileHandler(), outputPath);
outResource.setContents(byteArray);
result.addDependency(resource, outResource);
result.setResult(Status.SUCCESS);
+ return outResource;
}
abstract protected BuildResult doBuild(IResource resource) throws BuildException;
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/core/TemplateEngineBuilder.java b/org.tizen.common.builder/src/org/tizen/common/builder/core/TemplateEngineBuilder.java
index def18fb7b..d04685958 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/core/TemplateEngineBuilder.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/core/TemplateEngineBuilder.java
@@ -89,7 +89,7 @@ public abstract class TemplateEngineBuilder extends AbstractBuilder {
templateEngine.generate( templateKey, getModelProvider(), baos ); //$NON-NLS-1$
final BuildResult ret = new BuildResult(Status.SUCCESS);
- addOutputResource(ret, resource, baos.toByteArray());
+ addOutputResource(ret, resource, resource.getPath(), baos.toByteArray());
return ret;
} catch (Exception e) {
throw new BuildException( e );
diff --git a/org.tizen.common.builder/src/org/tizen/common/builder/exception/Location.java b/org.tizen.common.builder/src/org/tizen/common/builder/exception/Location.java
index 5a901e7ee..1182365cb 100644
--- a/org.tizen.common.builder/src/org/tizen/common/builder/exception/Location.java
+++ b/org.tizen.common.builder/src/org/tizen/common/builder/exception/Location.java
@@ -1,3 +1,28 @@
+/*
+ * Location.java
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Taeyoung Son <taeyoung2.son@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
package org.tizen.common.builder.exception;
public class Location {
diff --git a/org.tizen.common.builder/test/src/org/tizen/common/builder/MockBuilder.java b/org.tizen.common.builder/test/src/org/tizen/common/builder/MockBuilder.java
index 50ae293bb..246de6c12 100644
--- a/org.tizen.common.builder/test/src/org/tizen/common/builder/MockBuilder.java
+++ b/org.tizen.common.builder/test/src/org/tizen/common/builder/MockBuilder.java
@@ -25,7 +25,7 @@ public class MockBuilder extends AbstractBuilder {
protected BuildResult doBuild(IResource resource) throws BuildException {
BuildResult result = new BuildResult(Status.UNKNOWN);
try {
- addOutputResource(result, resource, IOUtil.getBytes(resource.getContents()));
+ addOutputResource(result, resource, resource.getPath(), IOUtil.getBytes(resource.getContents()));
} catch (IOException e) {
e.printStackTrace();
}