Kaydet (Commit) a835b0af authored tarafından Liu Zhe's avatar Liu Zhe

#120510# - Move ant scripts from testgui to test module root

üst 3473dbf6
......@@ -96,9 +96,8 @@
</target>
<target name="testuno.compile" depends="testuno.init, prepare.junit">
<property name="uno.jar.dir" location="${openoffice.home}/../" />
<path id="uno.classpath">
<fileset dir="${uno.jar.dir}" erroronmissingdir="false">
<fileset dir="${openoffice.home}" erroronmissingdir="false">
<include name="**/juh.jar" />
<include name="**/unoil.jar" />
<include name="**/ridl.jar" />
......@@ -161,7 +160,12 @@
</or>
</condition>
<condition property="install.build.skip">
<isset property="openoffice.home" />
<or>
<isset property="openoffice.home" />
<not>
<isset property="openoffice.archive.dir" />
</not>
</or>
</condition>
</target>
......@@ -208,7 +212,8 @@
<fileset dir="${openoffice.installation.dir}" includes="**/*/soffice.bin" followsymlinks="false" />
</path>
</pathconvert>
<dirname property="openoffice.home" file="${openoffice.bin}" />
<dirname property="openoffice.bin.parent" file="${openoffice.bin}" />
<property name="openoffice.home" location="${openoffice.bin.parent}/../" />
<fail unless="openoffice.home" />
<echo>Openoffice is installed to ${openoffice.home}</echo>
</target>
......@@ -222,8 +227,6 @@
<mkdir dir="${test.result}" />
<mkdir dir="${test.report}" />
<mkdir dir="${test.output}/temp" />
<property file="${openoffice.home}/versionrc" prefix="version" />
<property file="${openoffice.home}/version.ini" />
<junit fork="yes" forkmode="once" tempdir="${test.output}/temp" printsummary="yes" showoutput="false" errorProperty="test.failed" failureProperty="test.failed" dir=".">
<sysproperty key="openoffice.home" value="${openoffice.home}" />
......
......@@ -23,6 +23,7 @@ package org.openoffice.test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Properties;
import java.util.UUID;
......@@ -40,6 +41,17 @@ public class OpenOffice {
private static Logger LOG = Logger.getLogger(OpenOffice.class.getName());
private static final String[] DEFAULT_HOME = new String[] {
"C:/Program Files/OpenOffice.org 3",
"C:/Program Files (x86)/OpenOffice.org 3",
"/Applications/OpenOffice.org.app/Contents",
"/opt/openoffice.org3",
};
private static final String USERHOME = System.getProperty("user.home");
private static final String BIN = SystemUtil.isWindows() ? "program/soffice.exe" : SystemUtil.isMac() ? "MacOS/soffice.bin": "program/soffice.bin";
private static final String SYSUSERCONFIG = SystemUtil.isWindows()? System.getenv("APPDATA") : SystemUtil.isMac() ? USERHOME + "/Library/Application Support" : USERHOME;
private static OpenOffice defaultInstance = null;
private File userInstallation = null;
......@@ -48,6 +60,8 @@ public class OpenOffice {
private File home = null;
private File bin = null;
private ArrayList<String> args = new ArrayList<String>();
private ArrayList<String> registryModifications = new ArrayList<String>();
......@@ -62,13 +76,13 @@ public class OpenOffice {
private String id = "-"+UUID.randomUUID().toString().replace("-", "");
public OpenOffice() {
this(null);
}
/**
* Construct Process with the home path of OpenOffice. The home is the
* directory which contains soffice.bin.
* Construct Process with the home path of OpenOffice.
*
* @param appHome
*/
......@@ -78,47 +92,40 @@ public class OpenOffice {
if (appHome == null)
appHome = System.getenv("OPENOFFICE_HOME");
if (appHome == null) {
if (SystemUtil.isWindows()) {
appHome = "C:/Program Files/OpenOffice.org 3/program";
if (!new File(appHome).exists())
appHome = "C:/Program Files (x86)/OpenOffice.org 3/program";
} else if (SystemUtil.isMac()) {
appHome = "/Applications/OpenOffice.org.app/Contents/MacOS";
} else {
appHome = "/opt/openoffice.org3/program";
// Search in the classpath
try {
URL url = getClass().getClassLoader().getResource(BIN);
File file = new File(url.toURI());
if (file.exists())
appHome = file.getParentFile().getParentFile().getAbsolutePath();
} catch (Exception e) {
// ignore
}
}
home = new File(appHome);
if (appHome == null) {
for (int i = 0; i < DEFAULT_HOME.length; i++)
if (new File(DEFAULT_HOME[i]).exists())
appHome = DEFAULT_HOME[i];
}
File bootstrapFile = new File(home, "bootstraprc");
home = new File(appHome);
bin = new File(appHome, BIN);
File binParent = bin.getParentFile();
File bootstrapFile = new File(binParent, "bootstraprc");
if (!bootstrapFile.exists())
bootstrapFile = new File(home, "bootstrap.ini");
bootstrapFile = new File(binParent, "bootstrap.ini");
if (!bootstrapFile.exists())
throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed. " +
"Use system property openoffice.home to specify the correct location of OpenOffice.");
Properties props = FileUtil.loadProperties(bootstrapFile);
String defaultUserInstallationPath = props.getProperty("UserInstallation");
String sysUserConfig = null;
if (SystemUtil.isWindows()) {
sysUserConfig = System.getenv("APPDATA");
} else if (SystemUtil.isMac()) {
sysUserConfig = System.getProperty("user.home") + "/Library/Application Support";
} else {
sysUserConfig = System.getProperty("user.home");
}
defaultUserInstallationPath = defaultUserInstallationPath.replace("$ORIGIN", home.getAbsolutePath()).replace("$SYSUSERCONFIG", sysUserConfig);
String defaultUserInstallationPath = props.getProperty("UserInstallation").replace("$ORIGIN", binParent.getAbsolutePath()).replace("$SYSUSERCONFIG", SYSUSERCONFIG);
defaultUserInstallation = new File(defaultUserInstallationPath);
File versionFile = new File(home, "versionrc");
if (!versionFile.exists())
versionFile = new File(home, "version.ini");
File versionFile = new File(binParent, "versionrc");
if (!versionFile.exists())
throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed. " +
"Use system property openoffice.home to specify the correct location of OpenOffice.");
versionFile = new File(binParent, "version.ini");
versionProps = FileUtil.loadProperties(versionFile);
addArgs(id);
}
......@@ -258,9 +265,8 @@ public class OpenOffice {
return;
}
String bin = home.getAbsolutePath() + File.separatorChar + (SystemUtil.isWindows() ? "soffice.exe" : "soffice.bin");
ArrayList<String> cmds = new ArrayList<String>();
cmds.add(bin);
cmds.add(bin.getAbsolutePath());
if (automationPort > 0) {
cmds.add("-automationport=" + automationPort);
cmds.add("-enableautomation");
......
......@@ -5,5 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="var" path="openoffice.home"/>
<classpathentry kind="var" path="JRE_LIB"/>
<classpathentry kind="output" path="bin"/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=warning
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="var" path="openoffice.home"/>
<classpathentry kind="var" path="openoffice.home/basis-link/program/classes/unoil.jar"/>
<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/jurt.jar"/>
<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/juh.jar"/>
<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/ridl.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -4,5 +4,10 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="var" path="openoffice.home"/>
<classpathentry kind="var" path="openoffice.home/Basis/program/classes/unoil.jar"/>
<classpathentry kind="var" path="openoffice.home/URE/java/jurt.jar"/>
<classpathentry kind="var" path="openoffice.home/URE/java/juh.jar"/>
<classpathentry kind="var" path="openoffice.home/URE/java/ridl.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
<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="testuno"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/testuno/builder.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
......@@ -5,6 +5,20 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/Classpath Builder.launch</value>
</dictionary>
<dictionary>
<key>incclean</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
......
<?xml version="1.0"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
***********************************************************-->
<project basedir="." default="config.classpath">
<target name="config.classpath">
<condition property="classpath.file" value=".classpath_win" else=".classpath_linux">
<os family="windows"/>
</condition>
<copy file="${classpath.file}" tofile=".classpath"/>
</target>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment