diff options
author | Nitin Dahyabhai | 2019-07-23 17:29:13 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2019-07-23 17:29:13 +0000 |
commit | 2d1afd56c332ceb2542dcf6ca4f4179ff6e4ff47 (patch) | |
tree | 72ea659bfa611a158772b088715327c9c6602f19 | |
parent | 769bd817297f4cc9d1a39cf1436b60229d81c74f (diff) | |
parent | ca2ffc1c1b0205897bada310289f1bc1bb8809e4 (diff) | |
download | webtools.sourceediting-2d1afd56c332ceb2542dcf6ca4f4179ff6e4ff47.tar.gz webtools.sourceediting-2d1afd56c332ceb2542dcf6ca4f4179ff6e4ff47.tar.xz webtools.sourceediting-2d1afd56c332ceb2542dcf6ca4f4179ff6e4ff47.zip |
Merge "Bug 287909 - [xinclude] XInclude task needs to work standalone"
12 files changed, 76 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore index 03299a6ef7..b7cada1b7b 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 757debf743..182aeaf8ca 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 0000000000..6b882a5ac0 --- /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 72c2525e3a..2e2847fe1f 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><project>/.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 0000000000..97587eb0d7 --- /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 2c3b42df89..3c870810fa 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 0000000000..519a92c47c --- /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 Binary files differdeleted file mode 100644 index fc3203a3b3..0000000000 --- a/xsl/bundles/org.eclipse.wst.xsl.core/lib/xinclude.jar +++ /dev/null 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 0735724d39..8fd47d4c0a 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 5c5c2bca5a..854e642c04 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 69bb8282ba..51bf51a68f 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 4a6abd359e..4a6abd359e 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 |