Skip to content

Commit f54f0b1

Browse files
author
per
committed
add source and javadoc, published as ver 0.2.1
2 parents 9500d12 + d32c0c9 commit f54f0b1

File tree

9 files changed

+187
-63
lines changed

9 files changed

+187
-63
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
^Meta$
1212
^CRAN-RELEASE$
1313
^\.RDataFiles$
14+
^build$

build/javadocs.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<assembly
2+
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
5+
<id>javadoc</id>
6+
<baseDirectory>.</baseDirectory>
7+
<formats>
8+
<format>jar</format>
9+
</formats>
10+
<fileSets>
11+
<fileSet>
12+
<directory>${basedir}</directory>
13+
<includes>
14+
<include>*.md</include>
15+
</includes>
16+
</fileSet>
17+
<fileSet>
18+
<directory>${basedir}/doc</directory>
19+
<outputDirectory>.</outputDirectory>
20+
</fileSet>
21+
</fileSets>
22+
</assembly>

build/sources.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<assembly
2+
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd ">
5+
<id>sources</id>
6+
<formats>
7+
<format>jar</format>
8+
</formats>
9+
<fileSets>
10+
<fileSet>
11+
<directory>${basedir}/R</directory>
12+
</fileSet>
13+
</fileSets>
14+
</assembly>

man/xmlr.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 91 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>se.alipsa</groupId>
99
<artifactId>xmlr</artifactId>
10-
<version>0.2.0-SNAPHOT</version>
10+
<version>0.2.1</version>
1111
<packaging>jar</packaging>
1212

1313
<!-- general information about your package -->
@@ -90,6 +90,33 @@
9090
</pluginRepositories>
9191
<build>
9292
<plugins>
93+
<plugin>
94+
<groupId>org.apache.maven.plugins</groupId>
95+
<artifactId>maven-enforcer-plugin</artifactId>
96+
<version>3.0.0-M3</version>
97+
<executions>
98+
<execution>
99+
<id>enforce-releases-maven-java</id>
100+
<goals>
101+
<goal>enforce</goal>
102+
</goals>
103+
<configuration>
104+
<rules>
105+
<requireMavenVersion>
106+
<version>[3.5.2,)</version>
107+
<level>ERROR</level>
108+
<message>Please use maven version 3.5.2 or higher</message>
109+
</requireMavenVersion>
110+
<requireJavaVersion>
111+
<version>1.8.0</version>
112+
<level>WARN</level>
113+
<message>Please use Java 8</message>
114+
</requireJavaVersion>
115+
</rules>
116+
</configuration>
117+
</execution>
118+
</executions>
119+
</plugin>
93120
<plugin>
94121
<groupId>org.renjin</groupId>
95122
<artifactId>renjin-maven-plugin</artifactId>
@@ -136,6 +163,12 @@
136163
<version>1.3.6</version>
137164
<configuration>
138165
<runSourceScriptsBeforeTests>false</runSourceScriptsBeforeTests>
166+
<replaceStringsWhenCopy>
167+
<property>
168+
<name>library(xmlr)</name>
169+
<value>library('se.alipsa:xmlr')</value>
170+
</property>
171+
</replaceStringsWhenCopy>
139172
</configuration>
140173
<executions>
141174
<!-- Expect_error does not quite work in Renjin. Instead of capturing the stop message it captures
@@ -177,39 +210,69 @@
177210
</dependency>
178211
</dependencies>
179212
</plugin>
213+
<plugin>
214+
<artifactId>maven-assembly-plugin</artifactId>
215+
<version>3.3.0</version>
216+
<executions>
217+
<execution>
218+
<id>create-sources</id>
219+
<phase>package</phase>
220+
<goals>
221+
<goal>single</goal>
222+
</goals>
223+
<configuration>
224+
<descriptors>
225+
<descriptor>build/sources.xml</descriptor>
226+
</descriptors>
227+
</configuration>
228+
</execution>
229+
<execution>
230+
<id>create-javadocs</id>
231+
<phase>package</phase>
232+
<goals>
233+
<goal>single</goal>
234+
</goals>
235+
<configuration>
236+
<descriptors>
237+
<descriptor>build/javadocs.xml</descriptor>
238+
</descriptors>
239+
</configuration>
240+
</execution>
241+
</executions>
242+
</plugin>
243+
<plugin>
244+
<groupId>org.apache.maven.plugins</groupId>
245+
<artifactId>maven-site-plugin</artifactId>
246+
<version>3.9.1</version>
247+
<configuration>
248+
<generateReports>false</generateReports>
249+
</configuration>
250+
<executions>
251+
<execution>
252+
<phase>test</phase>
253+
<goals>
254+
<goal>site</goal>
255+
</goals>
256+
</execution>
257+
</executions>
258+
</plugin>
180259
</plugins>
181260
</build>
261+
<distributionManagement>
262+
<snapshotRepository>
263+
<id>ossrh</id>
264+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
265+
</snapshotRepository>
266+
<repository>
267+
<id>ossrh</id>
268+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
269+
</repository>
270+
</distributionManagement>
182271
<profiles>
183272
<profile>
184273
<id>release</id>
185274
<build>
186275
<plugins>
187-
<plugin>
188-
<groupId>org.apache.maven.plugins</groupId>
189-
<artifactId>maven-javadoc-plugin</artifactId>
190-
<version>3.1.0</version>
191-
<executions>
192-
<execution>
193-
<id>attach-javadocs</id>
194-
<goals>
195-
<goal>jar</goal>
196-
</goals>
197-
</execution>
198-
</executions>
199-
</plugin>
200-
<plugin>
201-
<groupId>org.apache.maven.plugins</groupId>
202-
<artifactId>maven-source-plugin</artifactId>
203-
<version>3.0.1</version>
204-
<executions>
205-
<execution>
206-
<id>attach-sources</id>
207-
<goals>
208-
<goal>jar</goal>
209-
</goals>
210-
</execution>
211-
</executions>
212-
</plugin>
213276
<plugin>
214277
<groupId>org.apache.maven.plugins</groupId>
215278
<artifactId>maven-gpg-plugin</artifactId>
@@ -239,4 +302,4 @@
239302
</build>
240303
</profile>
241304
</profiles>
242-
</project>
305+
</project>

tests/testthat.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
library(testthat)
22
library(xmlr)
33

4+
isRenjin <- function() {
5+
grepl("Renjin", R.Version()$version.string, fixed = TRUE)
6+
}
7+
48
test_check("xmlr")

tests/testthat/test_Element.R

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,27 @@ test_that("Elements can be removed", {
8787
"</foo>")
8888
)
8989
# As we have just removed baz, removing it again should result in an error
90-
expect_error(foo$removeContent(baz), "There is no such content belonging to this Element")
90+
if (isRenjin()) {
91+
expect_error(foo$removeContent(baz), "Exception calling rlang_eval : null")
92+
} else {
93+
expect_error(foo$removeContent(baz), "There is no such content belonging to this Element")
94+
}
9195
})
9296

9397
test_that("Conversions works and wrong input does not work", {
9498
e <- Element$new("test")
9599
attributelist <- c("foo", "bar")
96-
expect_error(e$setAttributes(attributelist), "Argument to setAttributes must be a list")
100+
if (isRenjin()) {
101+
expect_error(e$setAttributes(attributelist), "Exception calling rlang_eval : null")
102+
} else {
103+
expect_error(e$setAttributes(attributelist), "Argument to setAttributes must be a list")
104+
}
97105
attributelist <- as.list(attributelist)
98-
expect_error(e$setAttributes(attributelist), "All attribute values in the list must be named")
106+
if (isRenjin()) {
107+
expect_error(e$setAttributes(attributelist), "Exception calling rlang_eval : null")
108+
} else {
109+
expect_error(e$setAttributes(attributelist), "All attribute values in the list must be named")
110+
}
99111
# now we name it an all should work
100112
names(attributelist) <- c("first", "second")
101113
e$setAttributes(attributelist)

tests/testthat/test_chained_creation.R

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ test_that("Chained creation and traversion works", {
2929
document <- createDom()
3030
rootName <- document$getRootElement()$getName()
3131
expect_equal(info="Root element from document", rootName, "class")
32-
expect_equal(capture_output(print(paste("Root element :", rootName))), "[1] \"Root element : class\"");
32+
if (!isRenjin()) {
33+
expect_equal(capture_output(print(paste("Root element :", rootName))), "[1] \"Root element : class\"");
34+
}
3335
classElement <- document$getRootElement();
3436
studentList <- classElement$getChildren();
3537
#str(studentList)
@@ -40,33 +42,35 @@ test_that("Chained creation and traversion works", {
4042
print(paste(...))
4143
}
4244

43-
output <- capture.output({
44-
for (student in studentList) {
45-
print("-------------------------")
46-
printp("Current Element :", student$getName())
47-
printp("Student roll no : ", student$getAttribute("rollno") )
48-
printp("First Name : ", student$getChild("firstname")$getText())
49-
printp("Last Name : ", student$getChild("lastname")$getText())
50-
printp("Nick Name : ", student$getChild("nickname")$getText())
51-
printp("Marks : ", student$getChild("marks")$getText())
52-
}
53-
})
45+
if (!isRenjin()) {
46+
output <- capture.output({
47+
for (student in studentList) {
48+
print("-------------------------")
49+
printp("Current Element :", student$getName())
50+
printp("Student roll no : ", student$getAttribute("rollno") )
51+
printp("First Name : ", student$getChild("firstname")$getText())
52+
printp("Last Name : ", student$getChild("lastname")$getText())
53+
printp("Nick Name : ", student$getChild("nickname")$getText())
54+
printp("Marks : ", student$getChild("marks")$getText())
55+
}
56+
})
5457

55-
expect <- c(
56-
'[1] "-------------------------"',
57-
'[1] "Current Element : student"',
58-
'[1] "Student roll no : 393"',
59-
'[1] "First Name : Dinkar"',
60-
'[1] "Last Name : Kad"',
61-
'[1] "Nick Name : dinkar"',
62-
'[1] "Marks : 85"',
63-
'[1] "-------------------------"',
64-
'[1] "Current Element : student"',
65-
'[1] "Student roll no : 493"',
66-
'[1] "First Name : Vaneet"',
67-
'[1] "Last Name : Gupta"',
68-
'[1] "Nick Name : vinni"',
69-
'[1] "Marks : 95"'
70-
)
71-
expect_equal(output, expect)
58+
expect <- c(
59+
'[1] "-------------------------"',
60+
'[1] "Current Element : student"',
61+
'[1] "Student roll no : 393"',
62+
'[1] "First Name : Dinkar"',
63+
'[1] "Last Name : Kad"',
64+
'[1] "Nick Name : dinkar"',
65+
'[1] "Marks : 85"',
66+
'[1] "-------------------------"',
67+
'[1] "Current Element : student"',
68+
'[1] "Student roll no : 493"',
69+
'[1] "First Name : Vaneet"',
70+
'[1] "Last Name : Gupta"',
71+
'[1] "Nick Name : vinni"',
72+
'[1] "Marks : 95"'
73+
)
74+
expect_equal(output, expect)
75+
}
7276
})

tests/testthat/test_simple.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ test_that("Element can have Namespace and attribute", {
2929
})
3030

3131
test_that("Abstract classes cannot be instantiated", {
32-
expect_error(AbstractClass$new(), "AbstractClass is an abstract class that can't be initialized.")
32+
if (isRenjin()) {
33+
expect_error(AbstractClass$new(), "Exception calling rlang_eval : null")
34+
} else {
35+
expect_error(AbstractClass$new(), "AbstractClass is an abstract class that can't be initialized.")
36+
}
3337
})

0 commit comments

Comments
 (0)