-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Gradle based build #1981
Add Gradle based build #1981
Conversation
Replaces Ant+Ivy with Gradle based build environment.
@eerohele any possibility to get a review? |
I suspect you'll need to add and commit the |
@eerohele yes, forgot about that. |
I'm creating dummy Java files for RenderX classes used by PDF2, that way you can build without first copying XEP installation into PDF2 lib. Those empty dummy Java classes are then left out from the |
Yeah, the I also wonder whether it might make sense to have a target like this for easily running unit tests:
My Gradle is a bit rusty, so I'm not sure whether that's the cleanest way of doing it. |
Ah, sorry, they actually don't fail if I run the |
@eerohele, the Note that this PR is still somewhat work in progress, but I wanted to get more eyes on it while development was still active. |
I just executed a [stefan@vaio jelovirt]$ cd dita-ot/
[stefan@vaio dita-ot]$ git checkout feature/gradle
Branch feature/gradle konfiguriert zum Folgen von Remote-Branch feature/gradle von origin.
Zu neuem Branch 'feature/gradle' gewechselt
[stefan@vaio dita-ot]$ clear
[stefan@vaio dita-ot]$ gradle build
:compileJava
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/25/commons-parent-25.pom
Download https://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/32/commons-parent-32.pom
Download https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom
Download https://repo1.maven.org/maven2/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.pom
Download https://repo1.maven.org/maven2/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.pom
Download https://repo1.maven.org/maven2/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.pom
Download https://repo1.maven.org/maven2/org/apache/apache/3/apache-3.pom
Download https://repo1.maven.org/maven2/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8.pom
Download https://repo1.maven.org/maven2/com/ibm/icu/icu4j/54.1/icu4j-54.1.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant-parent/1.9.4/ant-parent-1.9.4.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.pom
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
Download https://repo1.maven.org/maven2/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar
Download https://repo1.maven.org/maven2/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar
Download https://repo1.maven.org/maven2/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
Download https://repo1.maven.org/maven2/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8-dom.jar
Download https://repo1.maven.org/maven2/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8.jar
Download https://repo1.maven.org/maven2/com/ibm/icu/icu4j/54.1/icu4j-54.1.jar
Download https://repo1.maven.org/maven2/org/apache/ant/ant/1.9.4/ant-1.9.4.jar
Download https://repo1.maven.org/maven2/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.jar
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:processResources
:classes
:jar
:assemble
:compileTestJava
Download https://repo1.maven.org/maven2/nu/validator/htmlparser/htmlparser/1.4/htmlparser-1.4.pom
Download https://repo1.maven.org/maven2/junit/junit/4.11/junit-4.11.pom
Download https://repo1.maven.org/maven2/xmlunit/xmlunit/1.6/xmlunit-1.6.pom
Download https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom
Download https://repo1.maven.org/maven2/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom
Download https://repo1.maven.org/maven2/nu/validator/htmlparser/htmlparser/1.4/htmlparser-1.4.jar
Download https://repo1.maven.org/maven2/junit/junit/4.11/junit-4.11.jar
Download https://repo1.maven.org/maven2/xmlunit/xmlunit/1.6/xmlunit-1.6.jar
Download https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:processTestResources
:testClasses
:test
Download https://repo1.maven.org/maven2/org/apache/ant/ant-apache-resolver/1.9.4/ant-apache-resolver-1.9.4.pom
Download https://repo1.maven.org/maven2/org/apache/ant/ant-apache-resolver/1.9.4/ant-apache-resolver-1.9.4.jar
org.dita.dost.writer.KeyrefPaserTest > classMethod FAILED
net.sf.saxon.trans.XPathException at KeyrefPaserTest.java:59
Caused by: java.io.FileNotFoundException at KeyrefPaserTest.java:59
org.dita.dost.reader.TestGenListModuleReader > testParse FAILED
java.io.FileNotFoundException at TestGenListModuleReader.java:75
org.dita.dost.reader.MapMetaReaderTest > classMethod FAILED
net.sf.saxon.trans.XPathException at MapMetaReaderTest.java:50
Caused by: java.io.FileNotFoundException at MapMetaReaderTest.java:50
org.dita.dost.reader.KeydefFilterTest > testParse FAILED
java.io.FileNotFoundException at KeydefFilterTest.java:56
org.dita.dost.module.TestGenMapAndTopicListModule > classMethod FAILED
org.dita.dost.exception.DITAOTException at TestGenMapAndTopicListModule.java:104
Caused by: java.io.FileNotFoundException at TestGenMapAndTopicListModule.java:104
org.dita.dost.module.DebugAndFilterModuleTest > testGeneratedFiles FAILED
java.lang.AssertionError at DebugAndFilterModuleTest.java:98
282 tests completed, 6 failed, 7 skipped
:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///home/stefan/workspace/jelovirt/dita-ot/build/reports/tests/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 47.264 secs Failed tests:
|
The problem @xephon2 also encountered occurs because when Gradle runs the Something like this should do the trick: diff --git a/build.gradle b/build.gradle
index 3443465..8377643 100644
--- a/build.gradle
+++ b/build.gradle
@@ -74,11 +74,15 @@ task copyInstall(type: Copy, dependsOn: initInstall) {
from (configurations.runtime)
destinationDir = file("src/main/lib")
}
-task buildLocal(dependsOn: [copyInstall, ":fo:copyInstall"]) << {
- description "Build archives and install all plugins with dependencies"
+
+task integrate(dependsOn: initInstall) << {
ant.ant([antfile: "integrator.xml", dir: file("src/main")])
}
+task buildLocal(dependsOn: [copyInstall, ":fo:copyInstall", integrate]) << {
+ description "Build archives and install all plugins with dependencies"
+}
+
// Distribution
def distTempDir = file("${buildDir}/tmp/dist")
@@ -194,4 +198,8 @@ task distTarGz(type: Tar, dependsOn: [jar, generateDocs]) {
}
task dist(dependsOn: [distZip, distTarGz]) << {
// NOOP
+}
+
+test {
+ dependsOn integrate
}
\ No newline at end of file |
|
# Conflicts: # README.markdown
Ah, I see — guess I haven't worked with the unit tests enough to have been aware that they don't use So is the answer updating the paths to the DTDs in the unit test DITA files? |
Unit tests should work now without needing to run integration. |
Works great for me now. |
Reverted back to FOP 1.1 for compiling |
I still had issues with FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':fo:compile'.
> Could not find org.apache.avalon.framework:avalon-framework-api:4.2.0.
Searched in the following locations:
https://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.pom
https://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.jar
Required by:
org.dita-ot.pdf:fo:unspecified > org.apache.xmlgraphics:fop:1.1
> Could not find org.apache.avalon.framework:avalon-framework-impl:4.2.0.
Searched in the following locations:
https://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.pom
https://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.jar
Required by:
org.dita-ot.pdf:fo:unspecified > org.apache.xmlgraphics:fop:1.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.384 secs I added the following line to the dependencies in build.gradle, now the build is successful:
|
@xephon2 pull the latest changes, that's not an issue any more. |
Oh, I was too slow. You're right. The build is passing. |
Local code must be integrated before dist is ran to set up configuration correctly.
Replaces Ant+Ivy with a more modern Gradle based build environment. Basic build will remain a similar single command operation, but distribution builds will no longer require separate steps and manual
CLASSPATH
management, and will too be a single command operation.This PR retains the original Ant and Ivy files, but in the future Gradle build should completely take over the build infrastructure.
Remaining tasks:
fo.jar
generation.