-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathbuild.gradle
77 lines (65 loc) · 3.29 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
plugins {
id 'java' // java plugin must be explicitly applied for shadow plugin
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.apache.poi:poi-ooxml:5.4.0'
implementation 'org.apache.poi:poi-scratchpad:5.4.0'
implementation 'com.fasterxml:aalto-xml:1.3.0'
implementation 'stax:stax-api:1.0.1'
// See https://github.com/apache/logging-log4j2/issues/2129 for an issue in 2.22.x
// we may need to report issues again in the future if changes break on Android
implementation 'org.apache.logging.log4j:log4j-api:2.24.3'
}
shadowJar {
// Apache POI uses service-files for Extractors, Renderers, ...
mergeServiceFiles {
// merging relocates some files, so exclude these as we want to keep them in place
exclude 'META-INF/services/javax.xml.stream.*'
}
exclude 'repackage/**'
exclude 'LICENSE.txt'
exclude 'NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/**'
// these would cause warnings because the referenced classes are not available on Android
// because of this the System.setProperty() is needed as a workaround
exclude 'META-INF/services/javax.xml.stream.XMLEventFactory'
exclude 'META-INF/services/javax.xml.stream.XMLInputFactory'
exclude 'META-INF/services/javax.xml.stream.XMLOutputFactory'
// these are only needed when handling Visio files, remove it if you would like to use Visio support
dependencies {
exclude(dependency('com.github.virtuald:curvesapi'))
exclude(dependency('commons-codec:commons-codec'))
exclude(dependency('org.apache.commons:commons-lang3'))
}
// Relocate javax dependencies so Android does not choke
relocate 'javax.xml.namespace', 'org.apache.poi.javax.xml.namespace'
relocate 'javax.xml.stream', 'org.apache.poi.javax.xml.stream'
relocate 'javax.xml.XMLConstants', 'org.apache.poi.javax.xml.XMLConstants'
// java.awt is not available, but class Color is used in APIs in POI, therefore
// relocate this class to another one where we can include a rewrite
relocate 'java.awt.font.FontRenderContext', 'org.apache.poi.java.awt.font.FontRenderContext'
relocate 'java.awt.font.TextLayout', 'org.apache.poi.java.awt.font.TextLayout'
relocate 'java.awt.geom.AffineTransform', 'org.apache.poi.java.awt.geom.AffineTransform'
relocate 'java.awt.geom.Dimension2D', 'org.apache.poi.java.awt.geom.Dimension2D'
relocate 'java.awt.image.BufferedImage', 'org.apache.poi.java.awt.image.BufferedImage'
relocate 'java.awt.Color', 'org.apache.poi.java.awt.Color'
relocate 'java.awt.Dimension', 'org.apache.poi.java.awt.Dimension'
relocate 'javax.imageio.ImageIO', 'org.apache.poi.javax.imageio.ImageIO'
relocate 'javax.imageio.ImageReader', 'org.apache.poi.javax.imageio.ImageReader'
relocate 'javax.imageio.stream.ImageInputStream', 'org.apache.poi.javax.imageio.stream.ImageInputStream'
relocate 'javax.imageio.metadata.IIOMetadata', 'org.apache.poi.javax.imageio.metadata.IIOMetadata'
}
jar.dependsOn shadowJar
test.dependsOn shadowJar