Commit 5d68b6163ccf9d961dfcb288a71ca52bbaebaed9
1 parent
231fcc84
- porządniejsze rzucanie wyjątków w Javie
- next() i peek() w klasie ResultsIterator rzuca std::out_of_bounds gdy nie ma elementów (zamiast MorfeuszException) - dodanie testu w junicie dla wrappera javowego git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/trunk@250 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
Showing
25 changed files
with
1857 additions
and
149 deletions
morfeusz/Environment.cpp
... | ... | @@ -40,7 +40,6 @@ Environment::Environment( |
40 | 40 | : currentCharsetConverter(getCharsetConverter(charset)), |
41 | 41 | caseConverter(), |
42 | 42 | tagset(fsaFileStartPtr, currentCharsetConverter), |
43 | -//qualifiers(fsaFileStartPtr), | |
44 | 43 | fsaFileStartPtr(fsaFileStartPtr), |
45 | 44 | fsa(FSAType::getFSA(fsaFileStartPtr, initializeDeserializer(processorType))), |
46 | 45 | separatorsList(getSeparatorsList(fsaFileStartPtr)), |
... | ... | @@ -116,7 +115,6 @@ void Environment::setDictionaryFile(const std::string& filename) { |
116 | 115 | this->currSegrulesFSA = getDefaultSegrulesFSA(this->segrulesFSAsMap, this->fsaFileStartPtr); |
117 | 116 | this->isFromFile = true; |
118 | 117 | this->tagset = IdResolverImpl(fsaFileStartPtr, currentCharsetConverter); |
119 | -// this->qualifiers = Qualifiers(fsaFileStartPtr); | |
120 | 118 | } |
121 | 119 | |
122 | 120 | const SegrulesFSA& Environment::getCurrentSegrulesFSA() const { |
... | ... | @@ -156,10 +154,6 @@ const CasePatternHelper& Environment::getCasePatternHelper() const { |
156 | 154 | return *this->casePatternHelper; |
157 | 155 | } |
158 | 156 | |
159 | -//const Qualifiers& Environment::getQualifiersHelper() const { | |
160 | -// return this->qualifiers; | |
161 | -//} | |
162 | - | |
163 | 157 | bool Environment::isSeparator(uint32_t codepoint) const { |
164 | 158 | return binary_search( |
165 | 159 | this->separatorsList.begin(), |
... | ... |
morfeusz/Environment.hpp
... | ... | @@ -18,7 +18,6 @@ |
18 | 18 | #include "IdResolverImpl.hpp" |
19 | 19 | #include "InterpsGroup.hpp" |
20 | 20 | #include "case/CasePatternHelper.hpp" |
21 | -#include "Qualifiers.hpp" | |
22 | 21 | #include "deserialization/InterpsGroupsReader.hpp" |
23 | 22 | |
24 | 23 | namespace morfeusz { |
... | ... | @@ -140,12 +139,6 @@ public: |
140 | 139 | const CasePatternHelper& getCasePatternHelper() const; |
141 | 140 | |
142 | 141 | /** |
143 | - * Return current qualifiers helper. | |
144 | - * @return | |
145 | - */ | |
146 | -// const Qualifiers& getQualifiersHelper() const; | |
147 | - | |
148 | - /** | |
149 | 142 | * Returns true iff given codepoint denotes a separator char for ign handling. |
150 | 143 | * @param codepoint |
151 | 144 | * @return |
... | ... | @@ -157,7 +150,6 @@ private: |
157 | 150 | const CharsetConverter* currentCharsetConverter; |
158 | 151 | const CaseConverter caseConverter; |
159 | 152 | IdResolverImpl tagset; |
160 | -// Qualifiers qualifiers; | |
161 | 153 | |
162 | 154 | const unsigned char* fsaFileStartPtr; |
163 | 155 | const FSAType* fsa; |
... | ... |
morfeusz/Qualifiers.cpp deleted
1 | -/* | |
2 | - * File: Qualifiers.cpp | |
3 | - * Author: lennyn | |
4 | - * | |
5 | - * Created on April 4, 2014, 6:19 PM | |
6 | - */ | |
7 | - | |
8 | -#include <iostream> | |
9 | -#include "Qualifiers.hpp" | |
10 | -#include "deserialization/deserializationUtils.hpp" | |
11 | -#include "fsa/const.hpp" | |
12 | - | |
13 | -using namespace std; | |
14 | - | |
15 | -namespace morfeusz { | |
16 | - | |
17 | -Qualifiers::Qualifiers(const unsigned char* ptr): | |
18 | -qualifiers() { | |
19 | - uint32_t fsaSize = readInt32Const(ptr + FSA_DATA_SIZE_OFFSET); | |
20 | - const unsigned char* currPtr = ptr + FSA_DATA_OFFSET + fsaSize + 4; | |
21 | - vector<string> _dupa; | |
22 | - readTags(currPtr, _dupa); | |
23 | - _dupa.clear(); | |
24 | - readTags(currPtr, _dupa); | |
25 | - uint16_t allCombinationsSize = readInt16(currPtr); | |
26 | - this->qualifiers.reserve(allCombinationsSize); | |
27 | - for (unsigned int i = 0; i < allCombinationsSize; i++) { | |
28 | - unsigned char qualsNum = readInt8(currPtr); | |
29 | - vector<string> quals; | |
30 | - for (unsigned int j = 0; j < qualsNum; j++) { | |
31 | - string qual = readString(currPtr); | |
32 | - quals.push_back(qual); | |
33 | - } | |
34 | - this->qualifiers.push_back(quals); | |
35 | - } | |
36 | -} | |
37 | - | |
38 | -const vector<string>& Qualifiers::getQualifiers(int n) const { | |
39 | - return this->qualifiers.at(n); | |
40 | -} | |
41 | - | |
42 | -Qualifiers::~Qualifiers() { | |
43 | -} | |
44 | - | |
45 | -} |
morfeusz/Qualifiers.hpp deleted
1 | -/* | |
2 | - * File: Qualifiers.hpp | |
3 | - * Author: lennyn | |
4 | - * | |
5 | - * Created on April 4, 2014, 6:19 PM | |
6 | - */ | |
7 | - | |
8 | -#ifndef QUALIFIERS_HPP | |
9 | -#define QUALIFIERS_HPP | |
10 | - | |
11 | -#include <vector> | |
12 | -#include <string> | |
13 | -#include <stdint.h> | |
14 | - | |
15 | -namespace morfeusz { | |
16 | - | |
17 | -/** | |
18 | - * Helper class used for decoding qualifiers set number into a vector of strings. | |
19 | - * | |
20 | - * @param ptr | |
21 | - */ | |
22 | -class Qualifiers { | |
23 | -public: | |
24 | - explicit Qualifiers(const unsigned char* ptr); | |
25 | - | |
26 | - /** | |
27 | - * Returns vector of qualifiers represented as strings. | |
28 | - * @param n - the index in qualifiers tab. | |
29 | - * @return - vector of qualifiers represented as strings. | |
30 | - */ | |
31 | - const std::vector<std::string>& getQualifiers(int n) const; | |
32 | - virtual ~Qualifiers(); | |
33 | -private: | |
34 | - std::vector< std::vector<std::string> > qualifiers; | |
35 | -}; | |
36 | - | |
37 | -} | |
38 | - | |
39 | -#endif /* QUALIFIERS_HPP */ | |
40 | - |
morfeusz/ResultsIteratorImpl.cpp
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | #include "ResultsIteratorImpl.hpp" |
9 | 9 | |
10 | 10 | #include <cstring> |
11 | +#include <stdexcept> | |
11 | 12 | |
12 | 13 | namespace morfeusz { |
13 | 14 | |
... | ... | @@ -43,7 +44,7 @@ namespace morfeusz { |
43 | 44 | |
44 | 45 | void ResultsIteratorImpl::ensureHasNext() { |
45 | 46 | if (!hasNext()) { |
46 | - throw MorfeuszException("No more interpretations available to ResultsIterator"); | |
47 | + throw std::out_of_range("No more interpretations available to ResultsIterator"); | |
47 | 48 | } |
48 | 49 | } |
49 | 50 | |
... | ... |
morfeusz/tests/TestMorfeusz.cpp
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | #include <cstdio> |
11 | 11 | #include <vector> |
12 | 12 | #include <fstream> |
13 | +#include <stdexcept> | |
13 | 14 | |
14 | 15 | CPPUNIT_TEST_SUITE_REGISTRATION(TestMorfeusz); |
15 | 16 | |
... | ... | @@ -37,8 +38,8 @@ void TestMorfeusz::testAnalyzeIterate1() { |
37 | 38 | CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), it->peek().orth); |
38 | 39 | CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), it->next().orth); |
39 | 40 | CPPUNIT_ASSERT(!it->hasNext()); |
40 | - CPPUNIT_ASSERT_THROW(it->peek(), MorfeuszException); | |
41 | - CPPUNIT_ASSERT_THROW(it->next(), MorfeuszException); | |
41 | + CPPUNIT_ASSERT_THROW(it->peek(), std::out_of_range); | |
42 | + CPPUNIT_ASSERT_THROW(it->next(), std::out_of_range); | |
42 | 43 | delete it; |
43 | 44 | } |
44 | 45 | |
... | ... | @@ -66,8 +67,8 @@ void TestMorfeusz::testAnalyzeIterateWithWhitespaceHandlingKEEP() { |
66 | 67 | CPPUNIT_ASSERT_EQUAL(string("\t"), it->next().orth); |
67 | 68 | |
68 | 69 | CPPUNIT_ASSERT(!it->hasNext()); |
69 | - CPPUNIT_ASSERT_THROW(it->peek(), MorfeuszException); | |
70 | - CPPUNIT_ASSERT_THROW(it->next(), MorfeuszException); | |
70 | + CPPUNIT_ASSERT_THROW(it->peek(), std::out_of_range); | |
71 | + CPPUNIT_ASSERT_THROW(it->next(), std::out_of_range); | |
71 | 72 | delete it; |
72 | 73 | } |
73 | 74 | |
... | ... | @@ -86,8 +87,8 @@ void TestMorfeusz::testAnalyzeIterateWithWhitespaceHandlingAPPEND() { |
86 | 87 | CPPUNIT_ASSERT_EQUAL(string(".\t"), it->next().orth); |
87 | 88 | |
88 | 89 | CPPUNIT_ASSERT(!it->hasNext()); |
89 | - CPPUNIT_ASSERT_THROW(it->peek(), MorfeuszException); | |
90 | - CPPUNIT_ASSERT_THROW(it->next(), MorfeuszException); | |
90 | + CPPUNIT_ASSERT_THROW(it->peek(), std::out_of_range); | |
91 | + CPPUNIT_ASSERT_THROW(it->next(), std::out_of_range); | |
91 | 92 | delete it; |
92 | 93 | } |
93 | 94 | |
... | ... |
morfeusz/wrappers/java/CMakeLists.txt
... | ... | @@ -10,6 +10,7 @@ include_directories (${CMAKE_SOURCE_DIR}/morfeusz) |
10 | 10 | |
11 | 11 | set (SWIG_JAVA_OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/swigJAVA.cpp") |
12 | 12 | file (COPY pl DESTINATION .) |
13 | +file (COPY JMorfeuszTest DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") | |
13 | 14 | set (JAVA_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/pl/waw/ipipan/morfeusz") |
14 | 15 | add_custom_command ( |
15 | 16 | OUTPUT ${SWIG_JAVA_OUTFILE} |
... | ... | @@ -50,7 +51,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
50 | 51 | endif () |
51 | 52 | |
52 | 53 | # build jmorfeusz |
53 | -file(GLOB_RECURSE JAVA_SOURCES ${JAVA_SRC_DIR} "*.java") | |
54 | +file(GLOB_RECURSE JAVA_SOURCES "${JAVA_SRC_DIR}" "${JAVA_SRC_DIR}/*.java") | |
55 | +message("SOURCES: ${JAVA_SOURCES}") | |
54 | 56 | add_jar (jmorfeusz |
55 | 57 | SOURCES "${JAVA_SOURCES}" |
56 | 58 | ENTRY_POINT pl/waw/ipipan/morfeusz/app/App |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/build.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- You may freely edit this file. See commented blocks below for --> | |
3 | +<!-- some examples of how to customize the build. --> | |
4 | +<!-- (If you delete it and reopen the project it will be recreated.) --> | |
5 | +<!-- By default, only the Clean and Build commands use this build script. --> | |
6 | +<!-- Commands such as Run, Debug, and Test only use this build script if --> | |
7 | +<!-- the Compile on Save feature is turned off for the project. --> | |
8 | +<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | |
9 | +<!-- in the project's Project Properties dialog box.--> | |
10 | +<project name="JMorfeuszTest" default="default" basedir="."> | |
11 | + <description>Builds, tests, and runs the project JMorfeuszTest.</description> | |
12 | + <import file="nbproject/build-impl.xml"/> | |
13 | + <!-- | |
14 | + | |
15 | + There exist several targets which are by default empty and which can be | |
16 | + used for execution of your tasks. These targets are usually executed | |
17 | + before and after some main targets. They are: | |
18 | + | |
19 | + -pre-init: called before initialization of project properties | |
20 | + -post-init: called after initialization of project properties | |
21 | + -pre-compile: called before javac compilation | |
22 | + -post-compile: called after javac compilation | |
23 | + -pre-compile-single: called before javac compilation of single file | |
24 | + -post-compile-single: called after javac compilation of single file | |
25 | + -pre-compile-test: called before javac compilation of JUnit tests | |
26 | + -post-compile-test: called after javac compilation of JUnit tests | |
27 | + -pre-compile-test-single: called before javac compilation of single JUnit test | |
28 | + -post-compile-test-single: called after javac compilation of single JUunit test | |
29 | + -pre-jar: called before JAR building | |
30 | + -post-jar: called after JAR building | |
31 | + -post-clean: called after cleaning build products | |
32 | + | |
33 | + (Targets beginning with '-' are not intended to be called on their own.) | |
34 | + | |
35 | + Example of inserting an obfuscator after compilation could look like this: | |
36 | + | |
37 | + <target name="-post-compile"> | |
38 | + <obfuscate> | |
39 | + <fileset dir="${build.classes.dir}"/> | |
40 | + </obfuscate> | |
41 | + </target> | |
42 | + | |
43 | + For list of available properties check the imported | |
44 | + nbproject/build-impl.xml file. | |
45 | + | |
46 | + | |
47 | + Another way to customize the build is by overriding existing main targets. | |
48 | + The targets of interest are: | |
49 | + | |
50 | + -init-macrodef-javac: defines macro for javac compilation | |
51 | + -init-macrodef-junit: defines macro for junit execution | |
52 | + -init-macrodef-debug: defines macro for class debugging | |
53 | + -init-macrodef-java: defines macro for class execution | |
54 | + -do-jar: JAR building | |
55 | + run: execution of project | |
56 | + -javadoc-build: Javadoc generation | |
57 | + test-report: JUnit report generation | |
58 | + | |
59 | + An example of overriding the target for project execution could look like this: | |
60 | + | |
61 | + <target name="run" depends="JMorfeuszTest-impl.jar"> | |
62 | + <exec dir="bin" executable="launcher.exe"> | |
63 | + <arg file="${dist.jar}"/> | |
64 | + </exec> | |
65 | + </target> | |
66 | + | |
67 | + Notice that the overridden target depends on the jar target and not only on | |
68 | + the compile target as the regular run target does. Again, for a list of available | |
69 | + properties which you can use, check the target you are overriding in the | |
70 | + nbproject/build-impl.xml file. | |
71 | + | |
72 | + --> | |
73 | +</project> | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
0 → 100644
No preview for this file type
morfeusz/wrappers/java/JMorfeuszTest/lib/jmorfeusz.jar
0 → 100644
No preview for this file type
morfeusz/wrappers/java/JMorfeuszTest/lib/junit_4/junit-4.10-javadoc.jar
0 → 100644
No preview for this file type
morfeusz/wrappers/java/JMorfeuszTest/lib/junit_4/junit-4.10-sources.jar
0 → 100644
No preview for this file type
morfeusz/wrappers/java/JMorfeuszTest/lib/junit_4/junit-4.10.jar
0 → 100644
No preview for this file type
morfeusz/wrappers/java/JMorfeuszTest/lib/nblibraries.properties
0 → 100644
1 | +libs.CopyLibs.classpath=\ | |
2 | + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar | |
3 | +libs.CopyLibs.displayName=CopyLibs Task | |
4 | +libs.CopyLibs.prop-version=2.0 | |
5 | +libs.junit_4.classpath=\ | |
6 | + ${base}/junit_4/junit-4.10.jar | |
7 | +libs.junit_4.displayName=JUnit 4.10 | |
8 | +libs.junit_4.javadoc=\ | |
9 | + ${base}/junit_4/junit-4.10-javadoc.jar | |
10 | +libs.junit_4.prop-maven-dependencies=junit:junit:4.10:jar | |
11 | +libs.junit_4.src=\ | |
12 | + ${base}/junit_4/junit-4.10-sources.jar | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/nbproject/build-impl.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
4 | +*** EDIT ../build.xml INSTEAD *** | |
5 | + | |
6 | +For the purpose of easier reading the script | |
7 | +is divided into following sections: | |
8 | + | |
9 | + - initialization | |
10 | + - compilation | |
11 | + - jar | |
12 | + - execution | |
13 | + - debugging | |
14 | + - javadoc | |
15 | + - test compilation | |
16 | + - test execution | |
17 | + - test debugging | |
18 | + - applet | |
19 | + - cleanup | |
20 | + | |
21 | + --> | |
22 | +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JMorfeuszTest-impl"> | |
23 | + <fail message="Please build using Ant 1.8.0 or higher."> | |
24 | + <condition> | |
25 | + <not> | |
26 | + <antversion atleast="1.8.0"/> | |
27 | + </not> | |
28 | + </condition> | |
29 | + </fail> | |
30 | + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> | |
31 | + <!-- | |
32 | + ====================== | |
33 | + INITIALIZATION SECTION | |
34 | + ====================== | |
35 | + --> | |
36 | + <target name="-pre-init"> | |
37 | + <!-- Empty placeholder for easier customization. --> | |
38 | + <!-- You can override this target in the ../build.xml file. --> | |
39 | + </target> | |
40 | + <target depends="-pre-init" name="-init-private"> | |
41 | + <property file="nbproject/private/config.properties"/> | |
42 | + <property file="nbproject/private/configs/${config}.properties"/> | |
43 | + <property file="nbproject/private/private.properties"/> | |
44 | + </target> | |
45 | + <target name="-pre-init-libraries"> | |
46 | + <property location="./lib/nblibraries.properties" name="libraries.path"/> | |
47 | + <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/> | |
48 | + <pathconvert dirsep="/" property="libraries.dir"> | |
49 | + <path path="${libraries.dir.nativedirsep}"/> | |
50 | + </pathconvert> | |
51 | + <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/> | |
52 | + <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/> | |
53 | + </target> | |
54 | + <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries"> | |
55 | + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties"> | |
56 | + <filterchain> | |
57 | + <replacestring from="$${base}" to="${libraries.dir}"/> | |
58 | + <escapeunicode/> | |
59 | + </filterchain> | |
60 | + </loadproperties> | |
61 | + </target> | |
62 | + <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries"> | |
63 | + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}"> | |
64 | + <filterchain> | |
65 | + <replacestring from="$${base}" to="${libraries.dir}"/> | |
66 | + <escapeunicode/> | |
67 | + </filterchain> | |
68 | + </loadproperties> | |
69 | + </target> | |
70 | + <target depends="-pre-init,-init-private,-init-libraries" name="-init-user"> | |
71 | + <property file="${user.properties.file}"/> | |
72 | + <!-- The two properties below are usually overridden --> | |
73 | + <!-- by the active platform. Just a fallback. --> | |
74 | + <property name="default.javac.source" value="1.4"/> | |
75 | + <property name="default.javac.target" value="1.4"/> | |
76 | + </target> | |
77 | + <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project"> | |
78 | + <property file="nbproject/configs/${config}.properties"/> | |
79 | + <property file="nbproject/project.properties"/> | |
80 | + </target> | |
81 | + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> | |
82 | + <property name="platform.java" value="${java.home}/bin/java"/> | |
83 | + <available file="${manifest.file}" property="manifest.available"/> | |
84 | + <condition property="splashscreen.available"> | |
85 | + <and> | |
86 | + <not> | |
87 | + <equals arg1="${application.splash}" arg2="" trim="true"/> | |
88 | + </not> | |
89 | + <available file="${application.splash}"/> | |
90 | + </and> | |
91 | + </condition> | |
92 | + <condition property="main.class.available"> | |
93 | + <and> | |
94 | + <isset property="main.class"/> | |
95 | + <not> | |
96 | + <equals arg1="${main.class}" arg2="" trim="true"/> | |
97 | + </not> | |
98 | + </and> | |
99 | + </condition> | |
100 | + <condition property="profile.available"> | |
101 | + <and> | |
102 | + <isset property="javac.profile"/> | |
103 | + <length length="0" string="${javac.profile}" when="greater"/> | |
104 | + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> | |
105 | + </and> | |
106 | + </condition> | |
107 | + <condition property="do.archive"> | |
108 | + <or> | |
109 | + <not> | |
110 | + <istrue value="${jar.archive.disabled}"/> | |
111 | + </not> | |
112 | + <istrue value="${not.archive.disabled}"/> | |
113 | + </or> | |
114 | + </condition> | |
115 | + <condition property="do.mkdist"> | |
116 | + <and> | |
117 | + <isset property="do.archive"/> | |
118 | + <isset property="libs.CopyLibs.classpath"/> | |
119 | + <not> | |
120 | + <istrue value="${mkdist.disabled}"/> | |
121 | + </not> | |
122 | + </and> | |
123 | + </condition> | |
124 | + <condition property="do.archive+manifest.available"> | |
125 | + <and> | |
126 | + <isset property="manifest.available"/> | |
127 | + <istrue value="${do.archive}"/> | |
128 | + </and> | |
129 | + </condition> | |
130 | + <condition property="do.archive+main.class.available"> | |
131 | + <and> | |
132 | + <isset property="main.class.available"/> | |
133 | + <istrue value="${do.archive}"/> | |
134 | + </and> | |
135 | + </condition> | |
136 | + <condition property="do.archive+splashscreen.available"> | |
137 | + <and> | |
138 | + <isset property="splashscreen.available"/> | |
139 | + <istrue value="${do.archive}"/> | |
140 | + </and> | |
141 | + </condition> | |
142 | + <condition property="do.archive+profile.available"> | |
143 | + <and> | |
144 | + <isset property="profile.available"/> | |
145 | + <istrue value="${do.archive}"/> | |
146 | + </and> | |
147 | + </condition> | |
148 | + <condition property="have.tests"> | |
149 | + <or> | |
150 | + <available file="${test.src.dir}"/> | |
151 | + </or> | |
152 | + </condition> | |
153 | + <condition property="have.sources"> | |
154 | + <or> | |
155 | + <available file="${src.dir}"/> | |
156 | + </or> | |
157 | + </condition> | |
158 | + <condition property="netbeans.home+have.tests"> | |
159 | + <and> | |
160 | + <isset property="netbeans.home"/> | |
161 | + <isset property="have.tests"/> | |
162 | + </and> | |
163 | + </condition> | |
164 | + <condition property="no.javadoc.preview"> | |
165 | + <and> | |
166 | + <isset property="javadoc.preview"/> | |
167 | + <isfalse value="${javadoc.preview}"/> | |
168 | + </and> | |
169 | + </condition> | |
170 | + <property name="run.jvmargs" value=""/> | |
171 | + <property name="run.jvmargs.ide" value=""/> | |
172 | + <property name="javac.compilerargs" value=""/> | |
173 | + <property name="work.dir" value="${basedir}"/> | |
174 | + <condition property="no.deps"> | |
175 | + <and> | |
176 | + <istrue value="${no.dependencies}"/> | |
177 | + </and> | |
178 | + </condition> | |
179 | + <property name="javac.debug" value="true"/> | |
180 | + <property name="javadoc.preview" value="true"/> | |
181 | + <property name="application.args" value=""/> | |
182 | + <property name="source.encoding" value="${file.encoding}"/> | |
183 | + <property name="runtime.encoding" value="${source.encoding}"/> | |
184 | + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> | |
185 | + <and> | |
186 | + <isset property="javadoc.encoding"/> | |
187 | + <not> | |
188 | + <equals arg1="${javadoc.encoding}" arg2=""/> | |
189 | + </not> | |
190 | + </and> | |
191 | + </condition> | |
192 | + <property name="javadoc.encoding.used" value="${source.encoding}"/> | |
193 | + <property name="includes" value="**"/> | |
194 | + <property name="excludes" value=""/> | |
195 | + <property name="do.depend" value="false"/> | |
196 | + <condition property="do.depend.true"> | |
197 | + <istrue value="${do.depend}"/> | |
198 | + </condition> | |
199 | + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> | |
200 | + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> | |
201 | + <and> | |
202 | + <isset property="endorsed.classpath"/> | |
203 | + <not> | |
204 | + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> | |
205 | + </not> | |
206 | + </and> | |
207 | + </condition> | |
208 | + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> | |
209 | + <isset property="profile.available"/> | |
210 | + </condition> | |
211 | + <condition else="false" property="jdkBug6558476"> | |
212 | + <and> | |
213 | + <matches pattern="1\.[56]" string="${java.specification.version}"/> | |
214 | + <not> | |
215 | + <os family="unix"/> | |
216 | + </not> | |
217 | + </and> | |
218 | + </condition> | |
219 | + <property name="javac.fork" value="${jdkBug6558476}"/> | |
220 | + <property name="jar.index" value="false"/> | |
221 | + <property name="jar.index.metainf" value="${jar.index}"/> | |
222 | + <property name="copylibs.rebase" value="true"/> | |
223 | + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> | |
224 | + <condition property="junit.available"> | |
225 | + <or> | |
226 | + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> | |
227 | + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> | |
228 | + </or> | |
229 | + </condition> | |
230 | + <condition property="testng.available"> | |
231 | + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> | |
232 | + </condition> | |
233 | + <condition property="junit+testng.available"> | |
234 | + <and> | |
235 | + <istrue value="${junit.available}"/> | |
236 | + <istrue value="${testng.available}"/> | |
237 | + </and> | |
238 | + </condition> | |
239 | + <condition else="testng" property="testng.mode" value="mixed"> | |
240 | + <istrue value="${junit+testng.available}"/> | |
241 | + </condition> | |
242 | + <condition else="" property="testng.debug.mode" value="-mixed"> | |
243 | + <istrue value="${junit+testng.available}"/> | |
244 | + </condition> | |
245 | + </target> | |
246 | + <target name="-post-init"> | |
247 | + <!-- Empty placeholder for easier customization. --> | |
248 | + <!-- You can override this target in the ../build.xml file. --> | |
249 | + </target> | |
250 | + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check"> | |
251 | + <fail unless="src.dir">Must set src.dir</fail> | |
252 | + <fail unless="test.src.dir">Must set test.src.dir</fail> | |
253 | + <fail unless="build.dir">Must set build.dir</fail> | |
254 | + <fail unless="dist.dir">Must set dist.dir</fail> | |
255 | + <fail unless="build.classes.dir">Must set build.classes.dir</fail> | |
256 | + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> | |
257 | + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> | |
258 | + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> | |
259 | + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> | |
260 | + <fail unless="dist.jar">Must set dist.jar</fail> | |
261 | + </target> | |
262 | + <target name="-init-macrodef-property"> | |
263 | + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
264 | + <attribute name="name"/> | |
265 | + <attribute name="value"/> | |
266 | + <sequential> | |
267 | + <property name="@{name}" value="${@{value}}"/> | |
268 | + </sequential> | |
269 | + </macrodef> | |
270 | + </target> | |
271 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> | |
272 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
273 | + <attribute default="${src.dir}" name="srcdir"/> | |
274 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
275 | + <attribute default="${javac.classpath}" name="classpath"/> | |
276 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
277 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
278 | + <attribute default="${includes}" name="includes"/> | |
279 | + <attribute default="${excludes}" name="excludes"/> | |
280 | + <attribute default="${javac.debug}" name="debug"/> | |
281 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
282 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
283 | + <element name="customize" optional="true"/> | |
284 | + <sequential> | |
285 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
286 | + <mkdir dir="${empty.dir}"/> | |
287 | + <mkdir dir="@{apgeneratedsrcdir}"/> | |
288 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
289 | + <src> | |
290 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
291 | + <include name="*"/> | |
292 | + </dirset> | |
293 | + </src> | |
294 | + <classpath> | |
295 | + <path path="@{classpath}"/> | |
296 | + </classpath> | |
297 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
298 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
299 | + <compilerarg line="${javac.compilerargs}"/> | |
300 | + <compilerarg value="-processorpath"/> | |
301 | + <compilerarg path="@{processorpath}:${empty.dir}"/> | |
302 | + <compilerarg line="${ap.processors.internal}"/> | |
303 | + <compilerarg line="${annotation.processing.processor.options}"/> | |
304 | + <compilerarg value="-s"/> | |
305 | + <compilerarg path="@{apgeneratedsrcdir}"/> | |
306 | + <compilerarg line="${ap.proc.none.internal}"/> | |
307 | + <customize/> | |
308 | + </javac> | |
309 | + </sequential> | |
310 | + </macrodef> | |
311 | + </target> | |
312 | + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> | |
313 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
314 | + <attribute default="${src.dir}" name="srcdir"/> | |
315 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
316 | + <attribute default="${javac.classpath}" name="classpath"/> | |
317 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
318 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
319 | + <attribute default="${includes}" name="includes"/> | |
320 | + <attribute default="${excludes}" name="excludes"/> | |
321 | + <attribute default="${javac.debug}" name="debug"/> | |
322 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
323 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
324 | + <element name="customize" optional="true"/> | |
325 | + <sequential> | |
326 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
327 | + <mkdir dir="${empty.dir}"/> | |
328 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
329 | + <src> | |
330 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
331 | + <include name="*"/> | |
332 | + </dirset> | |
333 | + </src> | |
334 | + <classpath> | |
335 | + <path path="@{classpath}"/> | |
336 | + </classpath> | |
337 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
338 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
339 | + <compilerarg line="${javac.compilerargs}"/> | |
340 | + <customize/> | |
341 | + </javac> | |
342 | + </sequential> | |
343 | + </macrodef> | |
344 | + </target> | |
345 | + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> | |
346 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
347 | + <attribute default="${src.dir}" name="srcdir"/> | |
348 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
349 | + <attribute default="${javac.classpath}" name="classpath"/> | |
350 | + <sequential> | |
351 | + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> | |
352 | + <classpath> | |
353 | + <path path="@{classpath}"/> | |
354 | + </classpath> | |
355 | + </depend> | |
356 | + </sequential> | |
357 | + </macrodef> | |
358 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
359 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
360 | + <sequential> | |
361 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
362 | + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> | |
363 | + <path> | |
364 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
365 | + </path> | |
366 | + <globmapper from="*.java" to="*.class"/> | |
367 | + </pathconvert> | |
368 | + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> | |
369 | + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> | |
370 | + <delete> | |
371 | + <files includesfile="${javac.includesfile.binary}"/> | |
372 | + </delete> | |
373 | + <delete> | |
374 | + <fileset file="${javac.includesfile.binary}"/> | |
375 | + </delete> | |
376 | + </sequential> | |
377 | + </macrodef> | |
378 | + </target> | |
379 | + <target if="${junit.available}" name="-init-macrodef-junit-init"> | |
380 | + <condition else="false" property="nb.junit.batch" value="true"> | |
381 | + <and> | |
382 | + <istrue value="${junit.available}"/> | |
383 | + <not> | |
384 | + <isset property="test.method"/> | |
385 | + </not> | |
386 | + </and> | |
387 | + </condition> | |
388 | + <condition else="false" property="nb.junit.single" value="true"> | |
389 | + <and> | |
390 | + <istrue value="${junit.available}"/> | |
391 | + <isset property="test.method"/> | |
392 | + </and> | |
393 | + </condition> | |
394 | + </target> | |
395 | + <target name="-init-test-properties"> | |
396 | + <property name="test.binaryincludes" value="<nothing>"/> | |
397 | + <property name="test.binarytestincludes" value=""/> | |
398 | + <property name="test.binaryexcludes" value=""/> | |
399 | + </target> | |
400 | + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> | |
401 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
402 | + <attribute default="${includes}" name="includes"/> | |
403 | + <attribute default="${excludes}" name="excludes"/> | |
404 | + <attribute default="**" name="testincludes"/> | |
405 | + <attribute default="" name="testmethods"/> | |
406 | + <element name="customize" optional="true"/> | |
407 | + <sequential> | |
408 | + <property name="junit.forkmode" value="perTest"/> | |
409 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
410 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
411 | + <syspropertyset> | |
412 | + <propertyref prefix="test-sys-prop."/> | |
413 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
414 | + </syspropertyset> | |
415 | + <formatter type="brief" usefile="false"/> | |
416 | + <formatter type="xml"/> | |
417 | + <jvmarg value="-ea"/> | |
418 | + <customize/> | |
419 | + </junit> | |
420 | + </sequential> | |
421 | + </macrodef> | |
422 | + </target> | |
423 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> | |
424 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
425 | + <attribute default="${includes}" name="includes"/> | |
426 | + <attribute default="${excludes}" name="excludes"/> | |
427 | + <attribute default="**" name="testincludes"/> | |
428 | + <attribute default="" name="testmethods"/> | |
429 | + <element name="customize" optional="true"/> | |
430 | + <sequential> | |
431 | + <property name="junit.forkmode" value="perTest"/> | |
432 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
433 | + <batchtest todir="${build.test.results.dir}"> | |
434 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
435 | + <filename name="@{testincludes}"/> | |
436 | + </fileset> | |
437 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
438 | + <filename name="${test.binarytestincludes}"/> | |
439 | + </fileset> | |
440 | + </batchtest> | |
441 | + <syspropertyset> | |
442 | + <propertyref prefix="test-sys-prop."/> | |
443 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
444 | + </syspropertyset> | |
445 | + <formatter type="brief" usefile="false"/> | |
446 | + <formatter type="xml"/> | |
447 | + <jvmarg value="-ea"/> | |
448 | + <customize/> | |
449 | + </junit> | |
450 | + </sequential> | |
451 | + </macrodef> | |
452 | + </target> | |
453 | + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> | |
454 | + <target if="${testng.available}" name="-init-macrodef-testng"> | |
455 | + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
456 | + <attribute default="${includes}" name="includes"/> | |
457 | + <attribute default="${excludes}" name="excludes"/> | |
458 | + <attribute default="**" name="testincludes"/> | |
459 | + <attribute default="" name="testmethods"/> | |
460 | + <element name="customize" optional="true"/> | |
461 | + <sequential> | |
462 | + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> | |
463 | + <isset property="test.method"/> | |
464 | + </condition> | |
465 | + <union id="test.set"> | |
466 | + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> | |
467 | + <filename name="@{testincludes}"/> | |
468 | + </fileset> | |
469 | + </union> | |
470 | + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> | |
471 | + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="JMorfeuszTest" testname="TestNG tests" workingDir="${work.dir}"> | |
472 | + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> | |
473 | + <propertyset> | |
474 | + <propertyref prefix="test-sys-prop."/> | |
475 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
476 | + </propertyset> | |
477 | + <customize/> | |
478 | + </testng> | |
479 | + </sequential> | |
480 | + </macrodef> | |
481 | + </target> | |
482 | + <target name="-init-macrodef-test-impl"> | |
483 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
484 | + <attribute default="${includes}" name="includes"/> | |
485 | + <attribute default="${excludes}" name="excludes"/> | |
486 | + <attribute default="**" name="testincludes"/> | |
487 | + <attribute default="" name="testmethods"/> | |
488 | + <element implicit="true" name="customize" optional="true"/> | |
489 | + <sequential> | |
490 | + <echo>No tests executed.</echo> | |
491 | + </sequential> | |
492 | + </macrodef> | |
493 | + </target> | |
494 | + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> | |
495 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
496 | + <attribute default="${includes}" name="includes"/> | |
497 | + <attribute default="${excludes}" name="excludes"/> | |
498 | + <attribute default="**" name="testincludes"/> | |
499 | + <attribute default="" name="testmethods"/> | |
500 | + <element implicit="true" name="customize" optional="true"/> | |
501 | + <sequential> | |
502 | + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
503 | + <customize/> | |
504 | + </j2seproject3:junit> | |
505 | + </sequential> | |
506 | + </macrodef> | |
507 | + </target> | |
508 | + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> | |
509 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
510 | + <attribute default="${includes}" name="includes"/> | |
511 | + <attribute default="${excludes}" name="excludes"/> | |
512 | + <attribute default="**" name="testincludes"/> | |
513 | + <attribute default="" name="testmethods"/> | |
514 | + <element implicit="true" name="customize" optional="true"/> | |
515 | + <sequential> | |
516 | + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
517 | + <customize/> | |
518 | + </j2seproject3:testng> | |
519 | + </sequential> | |
520 | + </macrodef> | |
521 | + </target> | |
522 | + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> | |
523 | + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
524 | + <attribute default="${includes}" name="includes"/> | |
525 | + <attribute default="${excludes}" name="excludes"/> | |
526 | + <attribute default="**" name="testincludes"/> | |
527 | + <attribute default="" name="testmethods"/> | |
528 | + <sequential> | |
529 | + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
530 | + <customize> | |
531 | + <classpath> | |
532 | + <path path="${run.test.classpath}"/> | |
533 | + </classpath> | |
534 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
535 | + <jvmarg line="${run.jvmargs}"/> | |
536 | + <jvmarg line="${run.jvmargs.ide}"/> | |
537 | + </customize> | |
538 | + </j2seproject3:test-impl> | |
539 | + </sequential> | |
540 | + </macrodef> | |
541 | + </target> | |
542 | + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> | |
543 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
544 | + <attribute default="${includes}" name="includes"/> | |
545 | + <attribute default="${excludes}" name="excludes"/> | |
546 | + <attribute default="**" name="testincludes"/> | |
547 | + <attribute default="" name="testmethods"/> | |
548 | + <element name="customize" optional="true"/> | |
549 | + <sequential> | |
550 | + <property name="junit.forkmode" value="perTest"/> | |
551 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
552 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
553 | + <syspropertyset> | |
554 | + <propertyref prefix="test-sys-prop."/> | |
555 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
556 | + </syspropertyset> | |
557 | + <formatter type="brief" usefile="false"/> | |
558 | + <formatter type="xml"/> | |
559 | + <jvmarg value="-ea"/> | |
560 | + <jvmarg line="${debug-args-line}"/> | |
561 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
562 | + <customize/> | |
563 | + </junit> | |
564 | + </sequential> | |
565 | + </macrodef> | |
566 | + </target> | |
567 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> | |
568 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
569 | + <attribute default="${includes}" name="includes"/> | |
570 | + <attribute default="${excludes}" name="excludes"/> | |
571 | + <attribute default="**" name="testincludes"/> | |
572 | + <attribute default="" name="testmethods"/> | |
573 | + <element name="customize" optional="true"/> | |
574 | + <sequential> | |
575 | + <property name="junit.forkmode" value="perTest"/> | |
576 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
577 | + <batchtest todir="${build.test.results.dir}"> | |
578 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
579 | + <filename name="@{testincludes}"/> | |
580 | + </fileset> | |
581 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
582 | + <filename name="${test.binarytestincludes}"/> | |
583 | + </fileset> | |
584 | + </batchtest> | |
585 | + <syspropertyset> | |
586 | + <propertyref prefix="test-sys-prop."/> | |
587 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
588 | + </syspropertyset> | |
589 | + <formatter type="brief" usefile="false"/> | |
590 | + <formatter type="xml"/> | |
591 | + <jvmarg value="-ea"/> | |
592 | + <jvmarg line="${debug-args-line}"/> | |
593 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
594 | + <customize/> | |
595 | + </junit> | |
596 | + </sequential> | |
597 | + </macrodef> | |
598 | + </target> | |
599 | + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> | |
600 | + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
601 | + <attribute default="${includes}" name="includes"/> | |
602 | + <attribute default="${excludes}" name="excludes"/> | |
603 | + <attribute default="**" name="testincludes"/> | |
604 | + <attribute default="" name="testmethods"/> | |
605 | + <element implicit="true" name="customize" optional="true"/> | |
606 | + <sequential> | |
607 | + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
608 | + <customize/> | |
609 | + </j2seproject3:junit-debug> | |
610 | + </sequential> | |
611 | + </macrodef> | |
612 | + </target> | |
613 | + <target if="${testng.available}" name="-init-macrodef-testng-debug"> | |
614 | + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
615 | + <attribute default="${main.class}" name="testClass"/> | |
616 | + <attribute default="" name="testMethod"/> | |
617 | + <element name="customize2" optional="true"/> | |
618 | + <sequential> | |
619 | + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> | |
620 | + <isset property="test.method"/> | |
621 | + </condition> | |
622 | + <condition else="-suitename JMorfeuszTest -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> | |
623 | + <matches pattern=".*\.xml" string="@{testClass}"/> | |
624 | + </condition> | |
625 | + <delete dir="${build.test.results.dir}" quiet="true"/> | |
626 | + <mkdir dir="${build.test.results.dir}"/> | |
627 | + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> | |
628 | + <customize> | |
629 | + <customize2/> | |
630 | + <jvmarg value="-ea"/> | |
631 | + <arg line="${testng.debug.mode}"/> | |
632 | + <arg line="-d ${build.test.results.dir}"/> | |
633 | + <arg line="-listener org.testng.reporters.VerboseReporter"/> | |
634 | + <arg line="${testng.cmd.args}"/> | |
635 | + </customize> | |
636 | + </j2seproject3:debug> | |
637 | + </sequential> | |
638 | + </macrodef> | |
639 | + </target> | |
640 | + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> | |
641 | + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
642 | + <attribute default="${main.class}" name="testClass"/> | |
643 | + <attribute default="" name="testMethod"/> | |
644 | + <element implicit="true" name="customize2" optional="true"/> | |
645 | + <sequential> | |
646 | + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> | |
647 | + <customize2/> | |
648 | + </j2seproject3:testng-debug> | |
649 | + </sequential> | |
650 | + </macrodef> | |
651 | + </target> | |
652 | + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> | |
653 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
654 | + <attribute default="${includes}" name="includes"/> | |
655 | + <attribute default="${excludes}" name="excludes"/> | |
656 | + <attribute default="**" name="testincludes"/> | |
657 | + <attribute default="" name="testmethods"/> | |
658 | + <attribute default="${main.class}" name="testClass"/> | |
659 | + <attribute default="" name="testMethod"/> | |
660 | + <sequential> | |
661 | + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
662 | + <customize> | |
663 | + <classpath> | |
664 | + <path path="${run.test.classpath}"/> | |
665 | + </classpath> | |
666 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
667 | + <jvmarg line="${run.jvmargs}"/> | |
668 | + <jvmarg line="${run.jvmargs.ide}"/> | |
669 | + </customize> | |
670 | + </j2seproject3:test-debug-impl> | |
671 | + </sequential> | |
672 | + </macrodef> | |
673 | + </target> | |
674 | + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> | |
675 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
676 | + <attribute default="${includes}" name="includes"/> | |
677 | + <attribute default="${excludes}" name="excludes"/> | |
678 | + <attribute default="**" name="testincludes"/> | |
679 | + <attribute default="" name="testmethods"/> | |
680 | + <attribute default="${main.class}" name="testClass"/> | |
681 | + <attribute default="" name="testMethod"/> | |
682 | + <sequential> | |
683 | + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> | |
684 | + <customize2> | |
685 | + <syspropertyset> | |
686 | + <propertyref prefix="test-sys-prop."/> | |
687 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
688 | + </syspropertyset> | |
689 | + </customize2> | |
690 | + </j2seproject3:testng-debug-impl> | |
691 | + </sequential> | |
692 | + </macrodef> | |
693 | + </target> | |
694 | + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> | |
695 | + <!-- | |
696 | + pre NB7.2 profiling section; consider it deprecated | |
697 | + --> | |
698 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> | |
699 | + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> | |
700 | + <!-- Empty placeholder for easier customization. --> | |
701 | + <!-- You can override this target in the ../build.xml file. --> | |
702 | + </target> | |
703 | + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> | |
704 | + <!-- Empty placeholder for easier customization. --> | |
705 | + <!-- You can override this target in the ../build.xml file. --> | |
706 | + </target> | |
707 | + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> | |
708 | + <macrodef name="resolve"> | |
709 | + <attribute name="name"/> | |
710 | + <attribute name="value"/> | |
711 | + <sequential> | |
712 | + <property name="@{name}" value="${env.@{value}}"/> | |
713 | + </sequential> | |
714 | + </macrodef> | |
715 | + <macrodef name="profile"> | |
716 | + <attribute default="${main.class}" name="classname"/> | |
717 | + <element name="customize" optional="true"/> | |
718 | + <sequential> | |
719 | + <property environment="env"/> | |
720 | + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> | |
721 | + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> | |
722 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
723 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
724 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
725 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
726 | + <arg line="${application.args}"/> | |
727 | + <classpath> | |
728 | + <path path="${run.classpath}"/> | |
729 | + </classpath> | |
730 | + <syspropertyset> | |
731 | + <propertyref prefix="run-sys-prop."/> | |
732 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
733 | + </syspropertyset> | |
734 | + <customize/> | |
735 | + </java> | |
736 | + </sequential> | |
737 | + </macrodef> | |
738 | + </target> | |
739 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> | |
740 | + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> | |
741 | + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> | |
742 | + </target> | |
743 | + <!-- | |
744 | + end of pre NB7.2 profiling section | |
745 | + --> | |
746 | + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> | |
747 | + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
748 | + <attribute default="${main.class}" name="name"/> | |
749 | + <attribute default="${debug.classpath}" name="classpath"/> | |
750 | + <attribute default="" name="stopclassname"/> | |
751 | + <sequential> | |
752 | + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> | |
753 | + <classpath> | |
754 | + <path path="@{classpath}"/> | |
755 | + </classpath> | |
756 | + </nbjpdastart> | |
757 | + </sequential> | |
758 | + </macrodef> | |
759 | + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
760 | + <attribute default="${build.classes.dir}" name="dir"/> | |
761 | + <sequential> | |
762 | + <nbjpdareload> | |
763 | + <fileset dir="@{dir}" includes="${fix.classes}"> | |
764 | + <include name="${fix.includes}*.class"/> | |
765 | + </fileset> | |
766 | + </nbjpdareload> | |
767 | + </sequential> | |
768 | + </macrodef> | |
769 | + </target> | |
770 | + <target name="-init-debug-args"> | |
771 | + <property name="version-output" value="java version "${ant.java.version}"/> | |
772 | + <condition property="have-jdk-older-than-1.4"> | |
773 | + <or> | |
774 | + <contains string="${version-output}" substring="java version "1.0"/> | |
775 | + <contains string="${version-output}" substring="java version "1.1"/> | |
776 | + <contains string="${version-output}" substring="java version "1.2"/> | |
777 | + <contains string="${version-output}" substring="java version "1.3"/> | |
778 | + </or> | |
779 | + </condition> | |
780 | + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> | |
781 | + <istrue value="${have-jdk-older-than-1.4}"/> | |
782 | + </condition> | |
783 | + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> | |
784 | + <os family="windows"/> | |
785 | + </condition> | |
786 | + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> | |
787 | + <isset property="debug.transport"/> | |
788 | + </condition> | |
789 | + </target> | |
790 | + <target depends="-init-debug-args" name="-init-macrodef-debug"> | |
791 | + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
792 | + <attribute default="${main.class}" name="classname"/> | |
793 | + <attribute default="${debug.classpath}" name="classpath"/> | |
794 | + <element name="customize" optional="true"/> | |
795 | + <sequential> | |
796 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
797 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
798 | + <jvmarg line="${debug-args-line}"/> | |
799 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
800 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
801 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
802 | + <jvmarg line="${run.jvmargs}"/> | |
803 | + <jvmarg line="${run.jvmargs.ide}"/> | |
804 | + <classpath> | |
805 | + <path path="@{classpath}"/> | |
806 | + </classpath> | |
807 | + <syspropertyset> | |
808 | + <propertyref prefix="run-sys-prop."/> | |
809 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
810 | + </syspropertyset> | |
811 | + <customize/> | |
812 | + </java> | |
813 | + </sequential> | |
814 | + </macrodef> | |
815 | + </target> | |
816 | + <target name="-init-macrodef-java"> | |
817 | + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
818 | + <attribute default="${main.class}" name="classname"/> | |
819 | + <attribute default="${run.classpath}" name="classpath"/> | |
820 | + <attribute default="jvm" name="jvm"/> | |
821 | + <element name="customize" optional="true"/> | |
822 | + <sequential> | |
823 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
824 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
825 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
826 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
827 | + <jvmarg line="${run.jvmargs}"/> | |
828 | + <jvmarg line="${run.jvmargs.ide}"/> | |
829 | + <classpath> | |
830 | + <path path="@{classpath}"/> | |
831 | + </classpath> | |
832 | + <syspropertyset> | |
833 | + <propertyref prefix="run-sys-prop."/> | |
834 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
835 | + </syspropertyset> | |
836 | + <customize/> | |
837 | + </java> | |
838 | + </sequential> | |
839 | + </macrodef> | |
840 | + </target> | |
841 | + <target name="-init-macrodef-copylibs"> | |
842 | + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
843 | + <attribute default="${manifest.file}" name="manifest"/> | |
844 | + <element name="customize" optional="true"/> | |
845 | + <sequential> | |
846 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
847 | + <pathconvert property="run.classpath.without.build.classes.dir"> | |
848 | + <path path="${run.classpath}"/> | |
849 | + <map from="${build.classes.dir.resolved}" to=""/> | |
850 | + </pathconvert> | |
851 | + <pathconvert pathsep=" " property="jar.classpath"> | |
852 | + <path path="${run.classpath.without.build.classes.dir}"/> | |
853 | + <chainedmapper> | |
854 | + <flattenmapper/> | |
855 | + <filtermapper> | |
856 | + <replacestring from=" " to="%20"/> | |
857 | + </filtermapper> | |
858 | + <globmapper from="*" to="lib/*"/> | |
859 | + </chainedmapper> | |
860 | + </pathconvert> | |
861 | + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> | |
862 | + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> | |
863 | + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
864 | + <manifest> | |
865 | + <attribute name="Class-Path" value="${jar.classpath}"/> | |
866 | + <customize/> | |
867 | + </manifest> | |
868 | + </copylibs> | |
869 | + </sequential> | |
870 | + </macrodef> | |
871 | + </target> | |
872 | + <target name="-init-presetdef-jar"> | |
873 | + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
874 | + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> | |
875 | + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
876 | + </jar> | |
877 | + </presetdef> | |
878 | + </target> | |
879 | + <target name="-init-ap-cmdline-properties"> | |
880 | + <property name="annotation.processing.enabled" value="true"/> | |
881 | + <property name="annotation.processing.processors.list" value=""/> | |
882 | + <property name="annotation.processing.processor.options" value=""/> | |
883 | + <property name="annotation.processing.run.all.processors" value="true"/> | |
884 | + <property name="javac.processorpath" value="${javac.classpath}"/> | |
885 | + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> | |
886 | + <condition property="ap.supported.internal" value="true"> | |
887 | + <not> | |
888 | + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> | |
889 | + </not> | |
890 | + </condition> | |
891 | + </target> | |
892 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> | |
893 | + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> | |
894 | + <isfalse value="${annotation.processing.run.all.processors}"/> | |
895 | + </condition> | |
896 | + <condition else="" property="ap.proc.none.internal" value="-proc:none"> | |
897 | + <isfalse value="${annotation.processing.enabled}"/> | |
898 | + </condition> | |
899 | + </target> | |
900 | + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> | |
901 | + <property name="ap.cmd.line.internal" value=""/> | |
902 | + </target> | |
903 | + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> | |
904 | + <!-- | |
905 | + =================== | |
906 | + COMPILATION SECTION | |
907 | + =================== | |
908 | + --> | |
909 | + <target name="-deps-jar-init" unless="built-jar.properties"> | |
910 | + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> | |
911 | + <delete file="${built-jar.properties}" quiet="true"/> | |
912 | + </target> | |
913 | + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> | |
914 | + <echo level="warn" message="Cycle detected: JMorfeuszTest was already built"/> | |
915 | + </target> | |
916 | + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> | |
917 | + <mkdir dir="${build.dir}"/> | |
918 | + <touch file="${built-jar.properties}" verbose="false"/> | |
919 | + <property file="${built-jar.properties}" prefix="already.built.jar."/> | |
920 | + <antcall target="-warn-already-built-jar"/> | |
921 | + <propertyfile file="${built-jar.properties}"> | |
922 | + <entry key="${basedir}" value=""/> | |
923 | + </propertyfile> | |
924 | + </target> | |
925 | + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> | |
926 | + <target depends="init" name="-check-automatic-build"> | |
927 | + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> | |
928 | + </target> | |
929 | + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> | |
930 | + <antcall target="clean"/> | |
931 | + </target> | |
932 | + <target depends="init,deps-jar" name="-pre-pre-compile"> | |
933 | + <mkdir dir="${build.classes.dir}"/> | |
934 | + </target> | |
935 | + <target name="-pre-compile"> | |
936 | + <!-- Empty placeholder for easier customization. --> | |
937 | + <!-- You can override this target in the ../build.xml file. --> | |
938 | + </target> | |
939 | + <target if="do.depend.true" name="-compile-depend"> | |
940 | + <pathconvert property="build.generated.subdirs"> | |
941 | + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
942 | + <include name="*"/> | |
943 | + </dirset> | |
944 | + </pathconvert> | |
945 | + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> | |
946 | + </target> | |
947 | + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> | |
948 | + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> | |
949 | + <copy todir="${build.classes.dir}"> | |
950 | + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
951 | + </copy> | |
952 | + </target> | |
953 | + <target if="has.persistence.xml" name="-copy-persistence-xml"> | |
954 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
955 | + <copy todir="${build.classes.dir}/META-INF"> | |
956 | + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> | |
957 | + </copy> | |
958 | + </target> | |
959 | + <target name="-post-compile"> | |
960 | + <!-- Empty placeholder for easier customization. --> | |
961 | + <!-- You can override this target in the ../build.xml file. --> | |
962 | + </target> | |
963 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> | |
964 | + <target name="-pre-compile-single"> | |
965 | + <!-- Empty placeholder for easier customization. --> | |
966 | + <!-- You can override this target in the ../build.xml file. --> | |
967 | + </target> | |
968 | + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> | |
969 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
970 | + <j2seproject3:force-recompile/> | |
971 | + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> | |
972 | + </target> | |
973 | + <target name="-post-compile-single"> | |
974 | + <!-- Empty placeholder for easier customization. --> | |
975 | + <!-- You can override this target in the ../build.xml file. --> | |
976 | + </target> | |
977 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> | |
978 | + <!-- | |
979 | + ==================== | |
980 | + JAR BUILDING SECTION | |
981 | + ==================== | |
982 | + --> | |
983 | + <target depends="init" name="-pre-pre-jar"> | |
984 | + <dirname file="${dist.jar}" property="dist.jar.dir"/> | |
985 | + <mkdir dir="${dist.jar.dir}"/> | |
986 | + </target> | |
987 | + <target name="-pre-jar"> | |
988 | + <!-- Empty placeholder for easier customization. --> | |
989 | + <!-- You can override this target in the ../build.xml file. --> | |
990 | + </target> | |
991 | + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> | |
992 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
993 | + <touch file="${tmp.manifest.file}" verbose="false"/> | |
994 | + </target> | |
995 | + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> | |
996 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
997 | + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> | |
998 | + </target> | |
999 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> | |
1000 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
1001 | + <attribute name="Main-Class" value="${main.class}"/> | |
1002 | + </manifest> | |
1003 | + </target> | |
1004 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> | |
1005 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
1006 | + <attribute name="Profile" value="${javac.profile}"/> | |
1007 | + </manifest> | |
1008 | + </target> | |
1009 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> | |
1010 | + <basename file="${application.splash}" property="splashscreen.basename"/> | |
1011 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
1012 | + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> | |
1013 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
1014 | + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> | |
1015 | + </manifest> | |
1016 | + </target> | |
1017 | + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> | |
1018 | + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> | |
1019 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
1020 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
1021 | + <echo level="info">java -jar "${dist.jar.resolved}"</echo> | |
1022 | + </target> | |
1023 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> | |
1024 | + <j2seproject1:jar manifest="${tmp.manifest.file}"/> | |
1025 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
1026 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
1027 | + <pathconvert property="run.classpath.with.dist.jar"> | |
1028 | + <path path="${run.classpath}"/> | |
1029 | + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> | |
1030 | + </pathconvert> | |
1031 | + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> | |
1032 | + <isset property="main.class.available"/> | |
1033 | + </condition> | |
1034 | + <condition else="debug" property="jar.usage.level" value="info"> | |
1035 | + <isset property="main.class.available"/> | |
1036 | + </condition> | |
1037 | + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> | |
1038 | + </target> | |
1039 | + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> | |
1040 | + <delete> | |
1041 | + <fileset file="${tmp.manifest.file}"/> | |
1042 | + </delete> | |
1043 | + </target> | |
1044 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> | |
1045 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> | |
1046 | + <target name="-post-jar"> | |
1047 | + <!-- Empty placeholder for easier customization. --> | |
1048 | + <!-- You can override this target in the ../build.xml file. --> | |
1049 | + </target> | |
1050 | + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> | |
1051 | + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> | |
1052 | + <!-- | |
1053 | + ================= | |
1054 | + EXECUTION SECTION | |
1055 | + ================= | |
1056 | + --> | |
1057 | + <target depends="init,compile" description="Run a main class." name="run"> | |
1058 | + <j2seproject1:java> | |
1059 | + <customize> | |
1060 | + <arg line="${application.args}"/> | |
1061 | + </customize> | |
1062 | + </j2seproject1:java> | |
1063 | + </target> | |
1064 | + <target name="-do-not-recompile"> | |
1065 | + <property name="javac.includes.binary" value=""/> | |
1066 | + </target> | |
1067 | + <target depends="init,compile-single" name="run-single"> | |
1068 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1069 | + <j2seproject1:java classname="${run.class}"/> | |
1070 | + </target> | |
1071 | + <target depends="init,compile-test-single" name="run-test-with-main"> | |
1072 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1073 | + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> | |
1074 | + </target> | |
1075 | + <!-- | |
1076 | + ================= | |
1077 | + DEBUGGING SECTION | |
1078 | + ================= | |
1079 | + --> | |
1080 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> | |
1081 | + <j2seproject1:nbjpdastart name="${debug.class}"/> | |
1082 | + </target> | |
1083 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> | |
1084 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> | |
1085 | + </target> | |
1086 | + <target depends="init,compile" name="-debug-start-debuggee"> | |
1087 | + <j2seproject3:debug> | |
1088 | + <customize> | |
1089 | + <arg line="${application.args}"/> | |
1090 | + </customize> | |
1091 | + </j2seproject3:debug> | |
1092 | + </target> | |
1093 | + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> | |
1094 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> | |
1095 | + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> | |
1096 | + </target> | |
1097 | + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> | |
1098 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> | |
1099 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
1100 | + <j2seproject3:debug classname="${debug.class}"/> | |
1101 | + </target> | |
1102 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> | |
1103 | + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> | |
1104 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
1105 | + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> | |
1106 | + </target> | |
1107 | + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> | |
1108 | + <target depends="init" name="-pre-debug-fix"> | |
1109 | + <fail unless="fix.includes">Must set fix.includes</fail> | |
1110 | + <property name="javac.includes" value="${fix.includes}.java"/> | |
1111 | + </target> | |
1112 | + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> | |
1113 | + <j2seproject1:nbjpdareload/> | |
1114 | + </target> | |
1115 | + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> | |
1116 | + <!-- | |
1117 | + ================= | |
1118 | + PROFILING SECTION | |
1119 | + ================= | |
1120 | + --> | |
1121 | + <!-- | |
1122 | + pre NB7.2 profiler integration | |
1123 | + --> | |
1124 | + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> | |
1125 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1126 | + <nbprofiledirect> | |
1127 | + <classpath> | |
1128 | + <path path="${run.classpath}"/> | |
1129 | + </classpath> | |
1130 | + </nbprofiledirect> | |
1131 | + <profile/> | |
1132 | + </target> | |
1133 | + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> | |
1134 | + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> | |
1135 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1136 | + <nbprofiledirect> | |
1137 | + <classpath> | |
1138 | + <path path="${run.classpath}"/> | |
1139 | + </classpath> | |
1140 | + </nbprofiledirect> | |
1141 | + <profile classname="${profile.class}"/> | |
1142 | + </target> | |
1143 | + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> | |
1144 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1145 | + <nbprofiledirect> | |
1146 | + <classpath> | |
1147 | + <path path="${run.classpath}"/> | |
1148 | + </classpath> | |
1149 | + </nbprofiledirect> | |
1150 | + <profile classname="sun.applet.AppletViewer"> | |
1151 | + <customize> | |
1152 | + <arg value="${applet.url}"/> | |
1153 | + </customize> | |
1154 | + </profile> | |
1155 | + </target> | |
1156 | + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> | |
1157 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1158 | + <nbprofiledirect> | |
1159 | + <classpath> | |
1160 | + <path path="${run.test.classpath}"/> | |
1161 | + </classpath> | |
1162 | + </nbprofiledirect> | |
1163 | + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> | |
1164 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
1165 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
1166 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
1167 | + <test name="${profile.class}"/> | |
1168 | + <classpath> | |
1169 | + <path path="${run.test.classpath}"/> | |
1170 | + </classpath> | |
1171 | + <syspropertyset> | |
1172 | + <propertyref prefix="test-sys-prop."/> | |
1173 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
1174 | + </syspropertyset> | |
1175 | + <formatter type="brief" usefile="false"/> | |
1176 | + <formatter type="xml"/> | |
1177 | + </junit> | |
1178 | + </target> | |
1179 | + <!-- | |
1180 | + end of pre NB72 profiling section | |
1181 | + --> | |
1182 | + <target if="netbeans.home" name="-profile-check"> | |
1183 | + <condition property="profiler.configured"> | |
1184 | + <or> | |
1185 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> | |
1186 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> | |
1187 | + </or> | |
1188 | + </condition> | |
1189 | + </target> | |
1190 | + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> | |
1191 | + <startprofiler/> | |
1192 | + <antcall target="run"/> | |
1193 | + </target> | |
1194 | + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> | |
1195 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1196 | + <startprofiler/> | |
1197 | + <antcall target="run-single"/> | |
1198 | + </target> | |
1199 | + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> | |
1200 | + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> | |
1201 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
1202 | + <startprofiler/> | |
1203 | + <antcall target="test-single"/> | |
1204 | + </target> | |
1205 | + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> | |
1206 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1207 | + <startprofiler/> | |
1208 | + <antcal target="run-test-with-main"/> | |
1209 | + </target> | |
1210 | + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> | |
1211 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1212 | + <startprofiler/> | |
1213 | + <antcall target="run-applet"/> | |
1214 | + </target> | |
1215 | + <!-- | |
1216 | + =============== | |
1217 | + JAVADOC SECTION | |
1218 | + =============== | |
1219 | + --> | |
1220 | + <target depends="init" if="have.sources" name="-javadoc-build"> | |
1221 | + <mkdir dir="${dist.javadoc.dir}"/> | |
1222 | + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> | |
1223 | + <and> | |
1224 | + <isset property="endorsed.classpath.cmd.line.arg"/> | |
1225 | + <not> | |
1226 | + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> | |
1227 | + </not> | |
1228 | + </and> | |
1229 | + </condition> | |
1230 | + <condition else="" property="bug5101868workaround" value="*.java"> | |
1231 | + <matches pattern="1\.[56](\..*)?" string="${java.version}"/> | |
1232 | + </condition> | |
1233 | + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> | |
1234 | + <classpath> | |
1235 | + <path path="${javac.classpath}"/> | |
1236 | + </classpath> | |
1237 | + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> | |
1238 | + <filename name="**/*.java"/> | |
1239 | + </fileset> | |
1240 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
1241 | + <include name="**/*.java"/> | |
1242 | + <exclude name="*.java"/> | |
1243 | + </fileset> | |
1244 | + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> | |
1245 | + </javadoc> | |
1246 | + <copy todir="${dist.javadoc.dir}"> | |
1247 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
1248 | + <filename name="**/doc-files/**"/> | |
1249 | + </fileset> | |
1250 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
1251 | + <include name="**/doc-files/**"/> | |
1252 | + </fileset> | |
1253 | + </copy> | |
1254 | + </target> | |
1255 | + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> | |
1256 | + <nbbrowse file="${dist.javadoc.dir}/index.html"/> | |
1257 | + </target> | |
1258 | + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> | |
1259 | + <!-- | |
1260 | + ========================= | |
1261 | + TEST COMPILATION SECTION | |
1262 | + ========================= | |
1263 | + --> | |
1264 | + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> | |
1265 | + <mkdir dir="${build.test.classes.dir}"/> | |
1266 | + </target> | |
1267 | + <target name="-pre-compile-test"> | |
1268 | + <!-- Empty placeholder for easier customization. --> | |
1269 | + <!-- You can override this target in the ../build.xml file. --> | |
1270 | + </target> | |
1271 | + <target if="do.depend.true" name="-compile-test-depend"> | |
1272 | + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> | |
1273 | + </target> | |
1274 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> | |
1275 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> | |
1276 | + <copy todir="${build.test.classes.dir}"> | |
1277 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
1278 | + </copy> | |
1279 | + </target> | |
1280 | + <target name="-post-compile-test"> | |
1281 | + <!-- Empty placeholder for easier customization. --> | |
1282 | + <!-- You can override this target in the ../build.xml file. --> | |
1283 | + </target> | |
1284 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> | |
1285 | + <target name="-pre-compile-test-single"> | |
1286 | + <!-- Empty placeholder for easier customization. --> | |
1287 | + <!-- You can override this target in the ../build.xml file. --> | |
1288 | + </target> | |
1289 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> | |
1290 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
1291 | + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> | |
1292 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> | |
1293 | + <copy todir="${build.test.classes.dir}"> | |
1294 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
1295 | + </copy> | |
1296 | + </target> | |
1297 | + <target name="-post-compile-test-single"> | |
1298 | + <!-- Empty placeholder for easier customization. --> | |
1299 | + <!-- You can override this target in the ../build.xml file. --> | |
1300 | + </target> | |
1301 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> | |
1302 | + <!-- | |
1303 | + ======================= | |
1304 | + TEST EXECUTION SECTION | |
1305 | + ======================= | |
1306 | + --> | |
1307 | + <target depends="init" if="have.tests" name="-pre-test-run"> | |
1308 | + <mkdir dir="${build.test.results.dir}"/> | |
1309 | + </target> | |
1310 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> | |
1311 | + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> | |
1312 | + </target> | |
1313 | + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> | |
1314 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1315 | + </target> | |
1316 | + <target depends="init" if="have.tests" name="test-report"/> | |
1317 | + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> | |
1318 | + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> | |
1319 | + <target depends="init" if="have.tests" name="-pre-test-run-single"> | |
1320 | + <mkdir dir="${build.test.results.dir}"/> | |
1321 | + </target> | |
1322 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> | |
1323 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
1324 | + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> | |
1325 | + </target> | |
1326 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> | |
1327 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1328 | + </target> | |
1329 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> | |
1330 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> | |
1331 | + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> | |
1332 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
1333 | + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> | |
1334 | + </target> | |
1335 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> | |
1336 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1337 | + </target> | |
1338 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> | |
1339 | + <!-- | |
1340 | + ======================= | |
1341 | + TEST DEBUGGING SECTION | |
1342 | + ======================= | |
1343 | + --> | |
1344 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> | |
1345 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
1346 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> | |
1347 | + </target> | |
1348 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> | |
1349 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
1350 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
1351 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> | |
1352 | + </target> | |
1353 | + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> | |
1354 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> | |
1355 | + </target> | |
1356 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> | |
1357 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> | |
1358 | + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> | |
1359 | + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> | |
1360 | + </target> | |
1361 | + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> | |
1362 | + <!-- | |
1363 | + ========================= | |
1364 | + APPLET EXECUTION SECTION | |
1365 | + ========================= | |
1366 | + --> | |
1367 | + <target depends="init,compile-single" name="run-applet"> | |
1368 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1369 | + <j2seproject1:java classname="sun.applet.AppletViewer"> | |
1370 | + <customize> | |
1371 | + <arg value="${applet.url}"/> | |
1372 | + </customize> | |
1373 | + </j2seproject1:java> | |
1374 | + </target> | |
1375 | + <!-- | |
1376 | + ========================= | |
1377 | + APPLET DEBUGGING SECTION | |
1378 | + ========================= | |
1379 | + --> | |
1380 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> | |
1381 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1382 | + <j2seproject3:debug classname="sun.applet.AppletViewer"> | |
1383 | + <customize> | |
1384 | + <arg value="${applet.url}"/> | |
1385 | + </customize> | |
1386 | + </j2seproject3:debug> | |
1387 | + </target> | |
1388 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> | |
1389 | + <!-- | |
1390 | + =============== | |
1391 | + CLEANUP SECTION | |
1392 | + =============== | |
1393 | + --> | |
1394 | + <target name="-deps-clean-init" unless="built-clean.properties"> | |
1395 | + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> | |
1396 | + <delete file="${built-clean.properties}" quiet="true"/> | |
1397 | + </target> | |
1398 | + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> | |
1399 | + <echo level="warn" message="Cycle detected: JMorfeuszTest was already built"/> | |
1400 | + </target> | |
1401 | + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> | |
1402 | + <mkdir dir="${build.dir}"/> | |
1403 | + <touch file="${built-clean.properties}" verbose="false"/> | |
1404 | + <property file="${built-clean.properties}" prefix="already.built.clean."/> | |
1405 | + <antcall target="-warn-already-built-clean"/> | |
1406 | + <propertyfile file="${built-clean.properties}"> | |
1407 | + <entry key="${basedir}" value=""/> | |
1408 | + </propertyfile> | |
1409 | + </target> | |
1410 | + <target depends="init" name="-do-clean"> | |
1411 | + <delete dir="${build.dir}"/> | |
1412 | + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> | |
1413 | + </target> | |
1414 | + <target name="-post-clean"> | |
1415 | + <!-- Empty placeholder for easier customization. --> | |
1416 | + <!-- You can override this target in the ../build.xml file. --> | |
1417 | + </target> | |
1418 | + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> | |
1419 | + <target name="-check-call-dep"> | |
1420 | + <property file="${call.built.properties}" prefix="already.built."/> | |
1421 | + <condition property="should.call.dep"> | |
1422 | + <and> | |
1423 | + <not> | |
1424 | + <isset property="already.built.${call.subproject}"/> | |
1425 | + </not> | |
1426 | + <available file="${call.script}"/> | |
1427 | + </and> | |
1428 | + </condition> | |
1429 | + </target> | |
1430 | + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> | |
1431 | + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> | |
1432 | + <propertyset> | |
1433 | + <propertyref prefix="transfer."/> | |
1434 | + <mapper from="transfer.*" to="*" type="glob"/> | |
1435 | + </propertyset> | |
1436 | + </ant> | |
1437 | + </target> | |
1438 | +</project> | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/nbproject/genfiles.properties
0 → 100644
1 | +build.xml.data.CRC32=77e3e582 | |
2 | +build.xml.script.CRC32=6c6ff090 | |
3 | +build.xml.stylesheet.CRC32=8064a381@1.74.2.48 | |
4 | +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | |
5 | +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | |
6 | +nbproject/build-impl.xml.data.CRC32=77e3e582 | |
7 | +nbproject/build-impl.xml.script.CRC32=d290501b | |
8 | +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.2.48 | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/nbproject/project.properties
0 → 100644
1 | +annotation.processing.enabled=true | |
2 | +annotation.processing.enabled.in.editor=false | |
3 | +annotation.processing.processors.list= | |
4 | +annotation.processing.run.all.processors=true | |
5 | +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output | |
6 | +application.title=JMorfeuszTest | |
7 | +application.vendor=mlenart | |
8 | +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml | |
9 | +build.classes.dir=${build.dir}/classes | |
10 | +build.classes.excludes=**/*.java,**/*.form | |
11 | +# This directory is removed when the project is cleaned: | |
12 | +build.dir=build | |
13 | +build.generated.dir=${build.dir}/generated | |
14 | +build.generated.sources.dir=${build.dir}/generated-sources | |
15 | +# Only compile against the classpath explicitly listed here: | |
16 | +build.sysclasspath=ignore | |
17 | +build.test.classes.dir=${build.dir}/test/classes | |
18 | +build.test.results.dir=${build.dir}/test/results | |
19 | +# Uncomment to specify the preferred debugger connection transport: | |
20 | +#debug.transport=dt_socket | |
21 | +debug.classpath=\ | |
22 | + ${run.classpath} | |
23 | +debug.test.classpath=\ | |
24 | + ${run.test.classpath} | |
25 | +# Files in build.classes.dir which should be excluded from distribution jar | |
26 | +dist.archive.excludes= | |
27 | +# This directory is removed when the project is cleaned: | |
28 | +dist.dir=dist | |
29 | +dist.jar=${dist.dir}/JMorfeuszTest.jar | |
30 | +dist.javadoc.dir=${dist.dir}/javadoc | |
31 | +endorsed.classpath= | |
32 | +excludes= | |
33 | +file.reference.jmorfeusz.jar=lib/jmorfeusz.jar | |
34 | +includes=** | |
35 | +jar.archive.disabled=${jnlp.enabled} | |
36 | +jar.compress=false | |
37 | +jar.index=${jnlp.enabled} | |
38 | +javac.classpath=\ | |
39 | + ${file.reference.jmorfeusz.jar} | |
40 | +# Space-separated list of extra javac options | |
41 | +javac.compilerargs= | |
42 | +javac.deprecation=false | |
43 | +javac.processorpath=\ | |
44 | + ${javac.classpath} | |
45 | +javac.source=1.7 | |
46 | +javac.target=1.7 | |
47 | +javac.test.classpath=\ | |
48 | + ${libs.junit_4.classpath}:\ | |
49 | + ${javac.classpath}:\ | |
50 | + ${build.classes.dir} | |
51 | +javac.test.processorpath=\ | |
52 | + ${javac.test.classpath} | |
53 | +javadoc.additionalparam= | |
54 | +javadoc.author=false | |
55 | +javadoc.encoding=${source.encoding} | |
56 | +javadoc.noindex=false | |
57 | +javadoc.nonavbar=false | |
58 | +javadoc.notree=false | |
59 | +javadoc.private=false | |
60 | +javadoc.splitindex=true | |
61 | +javadoc.use=true | |
62 | +javadoc.version=false | |
63 | +javadoc.windowtitle= | |
64 | +jnlp.codebase.type=no.codebase | |
65 | +jnlp.descriptor=application | |
66 | +jnlp.enabled=false | |
67 | +jnlp.mixed.code=default | |
68 | +jnlp.offline-allowed=false | |
69 | +jnlp.signed=false | |
70 | +jnlp.signing= | |
71 | +jnlp.signing.alias= | |
72 | +jnlp.signing.keystore= | |
73 | +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed | |
74 | +manifest.custom.codebase= | |
75 | +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) | |
76 | +manifest.custom.permissions= | |
77 | +meta.inf.dir=${src.dir}/META-INF | |
78 | +mkdist.disabled=true | |
79 | +platform.active=default_platform | |
80 | +run.classpath=\ | |
81 | + ${javac.classpath}:\ | |
82 | + ${build.classes.dir} | |
83 | +# Space-separated list of JVM arguments used when running the project. | |
84 | +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. | |
85 | +# To set system properties for unit tests define test-sys-prop.name=value: | |
86 | +run.jvmargs= | |
87 | +run.test.classpath=\ | |
88 | + ${javac.test.classpath}:\ | |
89 | + ${build.test.classes.dir}:\ | |
90 | + ${libs.junit_4.classpath} | |
91 | +source.encoding=UTF-8 | |
92 | +src.dir=src | |
93 | +test.src.dir=test | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/nbproject/project.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project xmlns="http://www.netbeans.org/ns/project/1"> | |
3 | + <type>org.netbeans.modules.java.j2seproject</type> | |
4 | + <configuration> | |
5 | + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | |
6 | + <name>JMorfeuszTest</name> | |
7 | + <source-roots> | |
8 | + <root id="src.dir"/> | |
9 | + </source-roots> | |
10 | + <test-roots> | |
11 | + <root id="test.src.dir"/> | |
12 | + </test-roots> | |
13 | + </data> | |
14 | + <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1"> | |
15 | + <definitions>./lib/nblibraries.properties</definitions> | |
16 | + </libraries> | |
17 | + </configuration> | |
18 | +</project> | |
... | ... |
morfeusz/wrappers/java/JMorfeuszTest/test/pl/sgjp/morfeusz/JMorfeuszTest.java
0 → 100644
1 | +package pl.sgjp.morfeusz; | |
2 | + | |
3 | +import java.io.File; | |
4 | +import java.io.IOException; | |
5 | +import java.util.List; | |
6 | +import java.util.NoSuchElementException; | |
7 | +import org.junit.After; | |
8 | +import org.junit.AfterClass; | |
9 | +import static org.junit.Assert.*; | |
10 | +import org.junit.Before; | |
11 | +import org.junit.BeforeClass; | |
12 | +import org.junit.Test; | |
13 | +import pl.waw.ipipan.morfeusz.Morfeusz; | |
14 | +import pl.waw.ipipan.morfeusz.MorfeuszException; | |
15 | +import pl.waw.ipipan.morfeusz.MorphInterpretation; | |
16 | +import pl.waw.ipipan.morfeusz.ResultsIterator; | |
17 | + | |
18 | +/** | |
19 | + * | |
20 | + * @author mlenart | |
21 | + */ | |
22 | +public class JMorfeuszTest { | |
23 | + | |
24 | + private Morfeusz morfeusz; | |
25 | + | |
26 | + public JMorfeuszTest() { | |
27 | + } | |
28 | + | |
29 | + @BeforeClass | |
30 | + public static void setUpClass() { | |
31 | + } | |
32 | + | |
33 | + @AfterClass | |
34 | + public static void tearDownClass() { | |
35 | + } | |
36 | + | |
37 | + @Before | |
38 | + public void setUp() { | |
39 | + morfeusz = Morfeusz.createInstance(); | |
40 | + } | |
41 | + | |
42 | + @After | |
43 | + public void tearDown() { | |
44 | + } | |
45 | + | |
46 | + @Test | |
47 | + public void testAnalyzeAsList() { | |
48 | + List<MorphInterpretation> res = morfeusz.analyseAsList("Aaaa żżżż"); | |
49 | + assertEquals(2, res.size()); | |
50 | + assertEquals("Aaaa", res.get(0).getOrth()); | |
51 | + assertEquals("żżżż", res.get(1).getOrth()); | |
52 | + try { | |
53 | + res.get(2); | |
54 | + fail(); | |
55 | + } | |
56 | + catch (IndexOutOfBoundsException ex) { | |
57 | + | |
58 | + } | |
59 | + } | |
60 | + | |
61 | + @Test | |
62 | + public void testAnalyzeAsIterator() { | |
63 | + ResultsIterator it = morfeusz.analyseAsIterator("Aaaa żżżż"); | |
64 | + assertTrue(it.hasNext()); | |
65 | + assertEquals("Aaaa", it.next().getOrth()); | |
66 | + assertTrue(it.hasNext()); | |
67 | + assertEquals("żżżż", it.next().getOrth()); | |
68 | + try { | |
69 | + it.next(); | |
70 | + fail(); | |
71 | + } | |
72 | + catch (NoSuchElementException ex) { | |
73 | + | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + @Test(expected = MorfeuszException.class) | |
78 | + public void testInvalidAgglOption() { | |
79 | + morfeusz.setAggl("XXXXYYYYZZZZ"); | |
80 | + } | |
81 | + | |
82 | + @Test(expected = MorfeuszException.class) | |
83 | + public void testInvalidPraetOption() { | |
84 | + morfeusz.setPraet("XXXXYYYYZZZZ"); | |
85 | + } | |
86 | + | |
87 | + @Test(expected = MorfeuszException.class) | |
88 | + public void testInvalidGenerate() { | |
89 | + morfeusz.generate("AAAA BBBB"); | |
90 | + } | |
91 | + | |
92 | + @Test(expected = NullPointerException.class) | |
93 | + public void testNullCaseHandling() { | |
94 | + morfeusz.setCaseHandling(null); | |
95 | + } | |
96 | + | |
97 | + @Test(expected = IOException.class) | |
98 | + public void testNonExistingDictionaryFile() throws IOException { | |
99 | + morfeusz.setGeneratorDictionary("/asfda/asfa"); | |
100 | + } | |
101 | + | |
102 | + @Test(expected = IOException.class) | |
103 | + public void testInvalidDictionaryFile() throws IOException { | |
104 | + File tmpFile = File.createTempFile("morfeusz_invalid_dict", ".test"); | |
105 | + morfeusz.setGeneratorDictionary(tmpFile.getAbsolutePath()); | |
106 | + } | |
107 | +} | |
... | ... |
morfeusz/wrappers/morfeusz.i
morfeusz/wrappers/morfeusz_common.i
1 | 1 | |
2 | -%exception { | |
3 | - try{ | |
4 | - $action | |
5 | - } | |
6 | - catch(const morfeusz::FileFormatException& e) { | |
7 | - SWIG_exception(SWIG_IOError, const_cast<char*>(e.what())); | |
8 | - } | |
9 | - catch(const std::exception& e) { | |
10 | - SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what())); | |
11 | - } | |
12 | - catch(...) { | |
13 | - SWIG_exception(SWIG_RuntimeError, "Unknown exception"); | |
14 | - } | |
15 | -} | |
2 | +//%exception { | |
3 | +// try{ | |
4 | +// $action | |
5 | +// } | |
6 | +// catch(const morfeusz::FileFormatException& e) { | |
7 | +// SWIG_exception(SWIG_IOError, const_cast<char*>(e.what())); | |
8 | +// } | |
9 | +// catch(const std::exception& e) { | |
10 | +// SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what())); | |
11 | +// } | |
12 | +// catch(...) { | |
13 | +// SWIG_exception(SWIG_RuntimeError, "Unknown exception"); | |
14 | +// } | |
15 | +//} | |
16 | 16 | |
17 | 17 | namespace morfeusz { |
18 | - | |
19 | -// %ignore MorphInterpretation::createIgn(int startNode, int endNode, const std::string& orth, const std::string& lemma); | |
20 | -// %ignore MorphInterpretation::createWhitespace(int startNode, int endNode, const std::string& orth); | |
18 | + | |
21 | 19 | %ignore Morfeusz::analyse(const char*) const; |
22 | 20 | %ignore Morfeusz::analyse(const std::string&) const; |
23 | 21 | %ignore Morfeusz::setCharset(Charset); |
24 | -// %rename(_doGetNext) ResultsIterator::next(); | |
25 | -// %ignore Morfeusz::analyse(const std::string&, std::vector<MorphInterpretation>&) const; | |
26 | -// %ignore Morfeusz::generate(const std::string&, std::vector<MorphInterpretation>&) const; | |
27 | -// %ignore Morfeusz::generate(const std::string&, int, std::vector<MorphInterpretation>&) const; | |
28 | 22 | %ignore Morfeusz::setDebug(bool); |
23 | + %ignore Charset; | |
29 | 24 | |
30 | 25 | %newobject Morfeusz::createInstance(); |
31 | 26 | %newobject Morfeusz::analyseAsIterator(const char*) const; |
... | ... |
morfeusz/wrappers/morfeusz_java.i
... | ... | @@ -136,8 +136,9 @@ import java.util.ArrayList; |
136 | 136 | |
137 | 137 | %rename(_dictionarySearchPaths) morfeusz::Morfeusz::dictionarySearchPaths; |
138 | 138 | %rename(_getLabels) morfeusz::IdResolver::getLabels; |
139 | +%ignore morfeusz::FileFormatException; | |
139 | 140 | |
140 | -%javaexception("IOException") morfeusz::Morfeusz::setAnalyzerDictionary { | |
141 | +%javaexception("java.io.IOException") morfeusz::Morfeusz::setAnalyzerDictionary { | |
141 | 142 | try { |
142 | 143 | $action |
143 | 144 | } |
... | ... | @@ -146,9 +147,14 @@ import java.util.ArrayList; |
146 | 147 | jenv->ThrowNew(clazz, "Invalid file format"); |
147 | 148 | return $null; |
148 | 149 | } |
150 | + catch(std::ios_base::failure & e) { | |
151 | + jclass clazz = jenv->FindClass("java/io/IOException"); | |
152 | + jenv->ThrowNew(clazz, e.what()); | |
153 | + return $null; | |
154 | + } | |
149 | 155 | } |
150 | 156 | |
151 | -%javaexception("IOException") morfeusz::Morfeusz::setGeneratorDictionary { | |
157 | +%javaexception("java.io.IOException") morfeusz::Morfeusz::setGeneratorDictionary { | |
152 | 158 | try { |
153 | 159 | $action |
154 | 160 | } |
... | ... | @@ -157,6 +163,48 @@ import java.util.ArrayList; |
157 | 163 | jenv->ThrowNew(clazz, "Invalid file format"); |
158 | 164 | return $null; |
159 | 165 | } |
166 | + catch(std::ios_base::failure & e) { | |
167 | + jclass clazz = jenv->FindClass("java/io/IOException"); | |
168 | + jenv->ThrowNew(clazz, e.what()); | |
169 | + return $null; | |
170 | + } | |
171 | +} | |
172 | + | |
173 | +%javaexception("java.util.NoSuchElementException") morfeusz::ResultsIterator::next { | |
174 | + try { | |
175 | + $action | |
176 | + } | |
177 | + catch(std::out_of_range & e) { | |
178 | + jclass clazz = jenv->FindClass("java/util/NoSuchElementException"); | |
179 | + jenv->ThrowNew(clazz, e.what()); | |
180 | + return $null; | |
181 | + } | |
182 | +} | |
183 | + | |
184 | +%exception { | |
185 | + try{ | |
186 | + $action | |
187 | + } | |
188 | + catch(const morfeusz::MorfeuszException& e) { | |
189 | + jclass clazz = jenv->FindClass("pl/waw/ipipan/morfeusz/MorfeuszException"); | |
190 | + jenv->ThrowNew(clazz, e.what()); | |
191 | + return $null; | |
192 | + } | |
193 | + catch(const std::exception& e) { | |
194 | + jclass clazz = jenv->FindClass("java/lang/RuntimeException"); | |
195 | + jenv->ThrowNew(clazz, e.what()); | |
196 | + return $null; | |
197 | + } | |
198 | + catch(const std::string& e) { | |
199 | + jclass clazz = jenv->FindClass("java/lang/RuntimeException"); | |
200 | + jenv->ThrowNew(clazz, e.c_str()); | |
201 | + return $null; | |
202 | + } | |
203 | + catch(...) { | |
204 | + jclass clazz = jenv->FindClass("java/lang/RuntimeException"); | |
205 | + jenv->ThrowNew(clazz, "Unknown exception"); | |
206 | + return $null; | |
207 | + } | |
160 | 208 | } |
161 | 209 | |
162 | 210 | %typemap(javainterfaces) morfeusz::ResultsIterator "java.util.Iterator<MorphInterpretation>" |
... | ... | @@ -254,12 +302,18 @@ import java.util.ArrayList; |
254 | 302 | %javamethodmodifiers morfeusz::IdResolver::getLabels "private"; |
255 | 303 | |
256 | 304 | %typemap(javaclassmodifiers) std::vector "class" |
305 | +%typemap(javaclassmodifiers) std::list "class" | |
306 | +%typemap(javaclassmodifiers) std::set "class" | |
257 | 307 | |
258 | 308 | %include "enums.swg" |
259 | 309 | |
260 | 310 | /* Force the generated Java code to use the C enum values rather than making a JNI call */ |
261 | 311 | %javaconst(1); |
262 | 312 | |
313 | +%pragma(java) jniclassclassmodifiers="class" | |
314 | + | |
315 | +%pragma(java) moduleclassmodifiers="class" | |
316 | + | |
263 | 317 | %pragma(java) jniclasscode=%{ |
264 | 318 | static { |
265 | 319 | System.loadLibrary("jmorfeusz"); |
... | ... |
morfeusz/wrappers/morfeusz_python.i
... | ... | @@ -26,13 +26,20 @@ def next(self): |
26 | 26 | raise StopIteration |
27 | 27 | %} |
28 | 28 | |
29 | -%feature("shadow") morfeusz::Morfeusz::analyseAsIterator(const char*) %{ | |
29 | +%feature("shadow") morfeusz::Morfeusz::analyseAsIterator %{ | |
30 | + | |
30 | 31 | def analyse_iter(self, text): |
32 | + """ | |
33 | + Analyse given text and return an iterator over MorphInterpretation as a result. | |
34 | + """ | |
31 | 35 | return $action(self, text) |
32 | 36 | %} |
33 | 37 | |
34 | 38 | %feature("shadow") morfeusz::Morfeusz::analyse %{ |
35 | 39 | def analyse(self, text): |
40 | + """ | |
41 | + Analyse given text and return a list of MorphInterpretation objects. | |
42 | + """ | |
36 | 43 | res = InterpsList() |
37 | 44 | $action(self, text, res) |
38 | 45 | return res |
... | ... | @@ -47,6 +54,9 @@ def _generateByTagId(self, lemma, tagId): |
47 | 54 | |
48 | 55 | %feature("shadow") morfeusz::Morfeusz::generate %{ |
49 | 56 | def generate(self, lemma, tagId=None): |
57 | + """ | |
58 | + Perform morphological synthesis on given text and return a list of MorphInterpretation objects. | |
59 | + """ | |
50 | 60 | if tagId is not None: |
51 | 61 | return self._generateByTagId(lemma, tagId) |
52 | 62 | else: |
... | ... |
nbproject/configurations.xml
... | ... | @@ -64,13 +64,17 @@ |
64 | 64 | <in>TestMorfeusz.cpp</in> |
65 | 65 | <in>test_c_api.cpp</in> |
66 | 66 | </df> |
67 | + <df name="wrappers"> | |
68 | + <df name="java"> | |
69 | + <in>JMorfeuszTest.java</in> | |
70 | + </df> | |
71 | + </df> | |
67 | 72 | <in>Environment.cpp</in> |
68 | 73 | <in>IdResolverImpl.cpp</in> |
69 | 74 | <in>InflexionGraph.cpp</in> |
70 | 75 | <in>Morfeusz.cpp</in> |
71 | 76 | <in>MorfeuszImpl.cpp</in> |
72 | 77 | <in>MorphInterpretation.cpp</in> |
73 | - <in>Qualifiers.cpp</in> | |
74 | 78 | <in>ResultsIteratorImpl.cpp</in> |
75 | 79 | <in>const.cpp</in> |
76 | 80 | <in>morfeusz2_c.cpp</in> |
... | ... | @@ -327,8 +331,6 @@ |
327 | 331 | ex="false" |
328 | 332 | tool="1" |
329 | 333 | flavor2="4"> |
330 | - <ccTool flags="1"> | |
331 | - </ccTool> | |
332 | 334 | </item> |
333 | 335 | <item path="build/morfeusz/wrappers/morfeuszPERL_wrap.cxx" |
334 | 336 | ex="false" |
... | ... | @@ -773,19 +775,6 @@ |
773 | 775 | </preprocessorList> |
774 | 776 | </ccTool> |
775 | 777 | </item> |
776 | - <item path="morfeusz/Qualifiers.cpp" ex="false" tool="1" flavor2="4"> | |
777 | - <ccTool flags="1"> | |
778 | - <incDir> | |
779 | - <pElem>morfeusz</pElem> | |
780 | - <pElem>build/morfeusz</pElem> | |
781 | - </incDir> | |
782 | - <preprocessorList> | |
783 | - <Elem>MORFEUSZ2_VERSION="2.0.0"</Elem> | |
784 | - <Elem>NDEBUG</Elem> | |
785 | - <Elem>libmorfeusz_EXPORTS</Elem> | |
786 | - </preprocessorList> | |
787 | - </ccTool> | |
788 | - </item> | |
789 | 778 | <item path="morfeusz/ResultsIteratorImpl.cpp" ex="false" tool="1" flavor2="4"> |
790 | 779 | <ccTool flags="1"> |
791 | 780 | <incDir> |
... | ... | @@ -960,6 +949,11 @@ |
960 | 949 | </incDir> |
961 | 950 | </ccTool> |
962 | 951 | </item> |
952 | + <item path="morfeusz/wrappers/java/JMorfeuszTest.java" | |
953 | + ex="false" | |
954 | + tool="3" | |
955 | + flavor2="0"> | |
956 | + </item> | |
963 | 957 | </conf> |
964 | 958 | </confs> |
965 | 959 | </configurationDescriptor> |
... | ... |
testJavaWrapper.sh
1 | 1 | #!/bin/bash |
2 | 2 | echo "testing java wrapper" |
3 | 3 | PROJECT_BINARY_DIR=$1 |
4 | -LD_LIBRARY_PATH="$PROJECT_BINARY_DIR/morfeusz:$PROJECT_BINARY_DIR/morfeusz/wrappers/java" java -jar "$PROJECT_BINARY_DIR/morfeusz/wrappers/java/jmorfeusz.jar" | |
4 | +cd morfeusz/wrappers/java/JMorfeuszTest | |
5 | +LD_LIBRARY_PATH="$PROJECT_BINARY_DIR/morfeusz:$PROJECT_BINARY_DIR/morfeusz/wrappers/java" ant -lib "$PROJECT_BINARY_DIR/morfeusz/wrappers/java" test | |
... | ... |