aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2020-12-05 21:30:19 +0000
committerAndreas Beeker <kiwiwings@apache.org>2020-12-05 21:30:19 +0000
commite43a1d220f046d46a133a6827c75292f2c3f8862 (patch)
treef6d853119390bf342118247ab9ffffb2005335b4
parent6d1a5e0db92e0c354791fd960e99e0b7a1c7e82b (diff)
downloadpoi-e43a1d220f046d46a133a6827c75292f2c3f8862.tar.gz
poi-e43a1d220f046d46a133a6827c75292f2c3f8862.zip
optimize size of poi-ooxml-schemas by 40% by only including necessary *.xsb files
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884139 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--build.xml35
1 files changed, 27 insertions, 8 deletions
diff --git a/build.xml b/build.xml
index 04240ba109..5ced1e8ddd 100644
--- a/build.xml
+++ b/build.xml
@@ -1685,25 +1685,44 @@ under the License.
</modulepath>
</javac>
- <local name="lite.classes"/>
- <loadresource property="lite.classes">
- <file file="${ooxml.lite.report}"/>
+ <copy file="${ooxml.lite.report}" tofile="build/ooxml-lite-classes.txt" overwrite="true">
<filterchain>
<tokenfilter>
- <replaceregex pattern="(.*)" replace="\1.class \1$*.class "/>
+ <replaceregex pattern="(.*)" replace="\1.class${line.separator}\1$*.class "/>
</tokenfilter>
- <striplinebreaks/>
+ </filterchain>
+ </copy>
+
+ <local name="ooxml.lite.xsbs"/>
+ <loadresource property="ooxml.lite.xsbs">
+ <file file="${ooxml.lite.report}"/>
+ <filterchain>
+ <linecontains negate="true" matchany="true">
+ <contains value="$"/>
+ <contains value="TypeSystemHolder"/>
+ </linecontains>
+ <suffixlines suffix=".java"/>
</filterchain>
</loadresource>
+ <concat dest="build/ooxml-lite-classes.txt" append="true">
+ <filelist dir="build/xmlbean-sources" files="${ooxml.lite.xsbs}"/>
+ <filterchain>
+ <linecontains>
+ <contains value="resolveHandle"/>
+ </linecontains>
+ <replaceregex pattern='.*"([^"]+)".*' replace="org/apache/poi/schemas/ooxml/system/ooxml/\1.xsb"/>
+ </filterchain>
+ </concat>
+
<mkdir dir="build/dist/maven/poi-ooxml-schemas"/>
<jar destfile="${ooxml.lite.jar}" duplicate="preserve">
<zipfileset dir="${basedir}/src/multimodule/ooxml-lite/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<zipfileset src="${ooxml.xsds.jar}">
- <patternset includes="${lite.classes}">
- <include name="org/apache/poi/schemas/*/system/**/*.xsb"/>
- <include name="org/apache/poi/schemas/*/element/**/*.xsb"/>
+ <patternset includesfile="build/ooxml-lite-classes.txt">
+ <include name="org/apache/poi/schemas/ooxml/element/**/*.xsb"/>
+ <include name="org/apache/poi/schemas/ooxml/system/ooxml/index.xsb"/>
</patternset>
</zipfileset>
<zipfileset dir="src/multimodule/ooxml-schemas/java9" prefix="META-INF/versions/9" excludes="*.java"/>