Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMat Booth2019-06-26 10:42:41 -0400
committerMat Booth2019-06-26 12:05:27 -0400
commitca2ffc1c1b0205897bada310289f1bc1bb8809e4 (patch)
tree7f1d07b13a5853c921c165e9d8585fde70d6877e
parent12232675002034e762f9182b4e5f6852b344004a (diff)
downloadwebtools.sourceediting-ca2ffc1c1b0205897bada310289f1bc1bb8809e4.tar.gz
webtools.sourceediting-ca2ffc1c1b0205897bada310289f1bc1bb8809e4.tar.xz
webtools.sourceediting-ca2ffc1c1b0205897bada310289f1bc1bb8809e4.zip
Bug 287909 - [xinclude] XInclude task needs to work standalone
* Remove the dependency on OSGi NLS from the ant task. Ant tasks don't really know about internationalisation, so plain strings are used instead. * Fix the ant task's handling of relative paths, where the task would stop abrubtly if the given input or output files did not have parent path segments. * Move source for the ant task into a separate source folder so that the build of the embedded xinclude jar can be hooked into Tycho and PDE. * Added an external tool builder and little ant script so that PDE will rebuild the embedded xinclude jar whenever source changes in the IDE. * Added configuration to build.properties so that Tycho will always rebuild the embedded xinclude jar from source during CI Change-Id: I25975dc8babe7c1dab6dc3a74667979b0579eee9 Signed-off-by: Mat Booth <mat.booth@redhat.com>
-rw-r--r--.gitignore1
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/.classpath1
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/.externalToolBuilders/Build Lib - xinclude.jar.launch14
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/.project9
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/build-xinclude.xml27
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/build.properties9
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/lib/.gitignore1
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/lib/xinclude.jarbin4665 -> 0 bytes
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/Messages.java50
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/messages.properties13
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java (renamed from xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java)33
-rw-r--r--xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java (renamed from xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java)0
12 files changed, 76 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index 03299a6ef..b7cada1b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/*/*/bin/
*/*/bin/
bin/
+bin_*/
build.xml
bundles/org.eclipse.wst.xml.xpath2.processor/JavaCUP-dump.txt
bundles/org.eclipse.wst.xml.xpath2.processor/lib/javacup10.jar
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/.classpath b/xsl/bundles/org.eclipse.wst.xsl.core/.classpath
index 757debf74..182aeaf8c 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/.classpath
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/.classpath
@@ -17,6 +17,7 @@
</accessrules>
</classpathentry>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="bin_xinclude" path="src_xinclude"/>
<classpathentry kind="src" path="src_sse"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/.externalToolBuilders/Build Lib - xinclude.jar.launch b/xsl/bundles/org.eclipse.wst.xsl.core/.externalToolBuilders/Build Lib - xinclude.jar.launch
new file mode 100644
index 000000000..6b882a5ac
--- /dev/null
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/.externalToolBuilders/Build Lib - xinclude.jar.launch
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.wst.xsl.core"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.wst.xsl.core/build-xinclude.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/.project b/xsl/bundles/org.eclipse.wst.xsl.core/.project
index 72c2525e3..2e2847fe1 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/.project
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/.project
@@ -30,6 +30,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/Build Lib - xinclude.jar.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/build-xinclude.xml b/xsl/bundles/org.eclipse.wst.xsl.core/build-xinclude.xml
new file mode 100644
index 000000000..97587eb0d
--- /dev/null
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/build-xinclude.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2019 Red Hat and others.
+
+ This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License 2.0
+ which accompanies this distribution, and is available at
+ https://www.eclipse.org/legal/epl-2.0/
+
+ SPDX-License-Identifier: EPL-2.0
+
+ Contributors:
+ Red Hat - initial API and implementation
+ -->
+
+<project name="Build xinclude.jar" default="build" basedir=".">
+ <target name="build" description="Cleans, builds and refreshes the impacted resources" depends="clean, lib/xinclude.jar"/>
+
+ <target name="lib/xinclude.jar" description="Creates the lib/xinclude.jar">
+ <mkdir dir="${basedir}/lib"/>
+ <jar destfile="${basedir}/lib/xinclude.jar" basedir="${basedir}/bin_xinclude"/>
+ </target>
+
+ <target name="clean">
+ <delete file="${basedir}/lib/xinclude.jar"/>
+ </target>
+</project> \ No newline at end of file
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/build.properties b/xsl/bundles/org.eclipse.wst.xsl.core/build.properties
index 2c3b42df8..3c870810f 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/build.properties
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/build.properties
@@ -6,7 +6,10 @@ bin.includes = META-INF/,\
plugin.xml,\
plugin.properties,\
xslt-schemas/,\
- lib/,\
- bin/,\
about.html,\
- about_files/
+ about_files/,\
+ lib/xinclude.jar
+jars.compile.order = .,\
+ lib/xinclude.jar
+source.lib/xinclude.jar = src_xinclude/
+output.lib/xinclude.jar = bin_xinclude/
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/lib/.gitignore b/xsl/bundles/org.eclipse.wst.xsl.core/lib/.gitignore
new file mode 100644
index 000000000..519a92c47
--- /dev/null
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/lib/.gitignore
@@ -0,0 +1 @@
+xinclude.jar
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/lib/xinclude.jar b/xsl/bundles/org.eclipse.wst.xsl.core/lib/xinclude.jar
deleted file mode 100644
index fc3203a3b..000000000
--- a/xsl/bundles/org.eclipse.wst.xsl.core/lib/xinclude.jar
+++ /dev/null
Binary files differ
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/Messages.java b/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/Messages.java
index 0735724d3..8fd47d4c0 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/Messages.java
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/Messages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2005, 2019 IBM Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License 2.0 which accompanies this distribution, and is
* available at https://www.eclipse.org/legal/epl-2.0/
@@ -41,54 +41,6 @@ public class Messages extends NLS {
*/
public static String XSLCorePlugin_coreError;
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_0;
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_1;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_2;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_3;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_4;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_5;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_6;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_7;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_8;
-
- /**
- * TODO: Add JavaDoc
- */
- public static String XIncludeTask_9;
public static String XSLValidator_1;
/**
* Stylesheet importing itself
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/messages.properties b/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/messages.properties
index 5c5c2bca5..854e642c0 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/messages.properties
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2005, 2009 IBM Corporation and others.
+# Copyright (c) 2000, 2005, 2019 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
@@ -16,17 +16,6 @@
XSLCorePlugin_badInitializationData = Invalid initialization data for "{0}".
XSLCorePlugin_parserConfiguration = XSL parser configuration error during content description.
XSLCorePlugin_coreError=Error logged from XSL core plug-in\:
-# XInclude
-XIncludeTask_0=Setting the output File to:
-XIncludeTask_1=Setting the output File to:
-XIncludeTask_2=Executing the XIncludeTask
-XIncludeTask_3=Specified Inputfile does not exists
-XIncludeTask_4=Creating the output directory
-XIncludeTask_5=Could not create outputfile
-XIncludeTask_6=Changes detected. Creating a new output file
-XIncludeTask_7=Problems with accessing the files.
-XIncludeTask_8=Please specify inputfile
-XIncludeTask_9=Please specify outputfile
# Validation
XSLValidator_1=Xpath is invalid
XSLValidator_10=A stylesheet must not import itself
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java b/xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java
index 69bb8282b..51bf51a68 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/ant/XIncludeTask.java
@@ -1,5 +1,5 @@
/******************************************************************************
-* Copyright (c) 2008, 2009 Lars Vogel
+* Copyright (c) 2008, 2019 Lars Vogel 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
@@ -18,7 +18,6 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
-import org.eclipse.wst.xsl.core.internal.Messages;
import org.eclipse.wst.xsl.core.internal.xinclude.XIncluder;
/**
@@ -37,7 +36,7 @@ public class XIncludeTask extends Task {
* @param inFile
*/
public void setIn(String inFile) {
- log(Messages.XIncludeTask_0 + inFile, Project.MSG_VERBOSE);
+ log("Setting the input file to: " + inFile, Project.MSG_VERBOSE); //$NON-NLS-1$
this.inFile = inFile;
}
@@ -46,51 +45,49 @@ public class XIncludeTask extends Task {
* @param outFile
*/
public void setOut(String outFile) {
- log(Messages.XIncludeTask_1 + outFile, Project.MSG_VERBOSE);
+ log("Setting the output file to: " + outFile, Project.MSG_VERBOSE); //$NON-NLS-1$
this.outFile = outFile;
}
@Override
public void execute() {
validate();
- log(Messages.XIncludeTask_2, Project.MSG_VERBOSE);
- File file = new File(inFile);
+ log("Executing the XIncludeTask", Project.MSG_VERBOSE); //$NON-NLS-1$
+ File file = new File(inFile).getAbsoluteFile();
if (!file.exists()) {
- throw new BuildException(Messages.XIncludeTask_3
+ throw new BuildException("Specified input file does not exist: " //$NON-NLS-1$
+ inFile);
}
// We will check if the file exists, if not we will try to create the
// output file and or the output directory
- File fileout = new File(outFile);
+ File fileout = new File(outFile).getAbsoluteFile();
File dir = new File(fileout.getParent());
if (!dir.exists()) {
- log(Messages.XIncludeTask_4 + dir.getAbsolutePath());
+ log("Creating the output directory: " + dir.getAbsolutePath()); //$NON-NLS-1$
Boolean success = (new File(dir.getAbsolutePath())).mkdirs();
if (!success) {
- throw new BuildException(Messages.XIncludeTask_5
+ throw new BuildException("Could not create output file: " //$NON-NLS-1$
+ outFile);
}
}
// check if the included files are modified after the last run
// Assumption that all the included files are part of the input file
// directory
- if (checkmodified(inFile, outFile)) {
- log(Messages.XIncludeTask_6,
+ if (checkmodified(file, fileout)) {
+ log("Changes detected, creating a new output file", //$NON-NLS-1$
Project.MSG_INFO);
XIncluder la = new XIncluder();
try {
la.extractXMLFile(inFile, outFile);
} catch (Exception e) {
- throw new BuildException(Messages.XIncludeTask_7
+ throw new BuildException("An error occurred during processing: " //$NON-NLS-1$
+ e.getMessage());
}
}
}
- private boolean checkmodified(String inFile, String outFile) {
- File in = new File(inFile);
- File out = new File(outFile);
+ private boolean checkmodified(File in, File out) {
File dir = new File(in.getParent());
Collection<File> allFiles = listFiles(dir, true);
@@ -133,10 +130,10 @@ public class XIncludeTask extends Task {
private void validate() {
if (inFile == null) {
- throw new BuildException(Messages.XIncludeTask_8);
+ throw new BuildException("Please specify input file"); //$NON-NLS-1$
}
if (outFile == null) {
- throw new BuildException(Messages.XIncludeTask_9);
+ throw new BuildException("Please specify output file"); //$NON-NLS-1$
}
}
}
diff --git a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java b/xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java
index 4a6abd359..4a6abd359 100644
--- a/xsl/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java
+++ b/xsl/bundles/org.eclipse.wst.xsl.core/src_xinclude/org/eclipse/wst/xsl/core/internal/xinclude/XIncluder.java

Back to the top