Skip to content

Conversation

@eerohele
Copy link
Contributor

Signed-off-by: Eero Helenius eero.helenius@kapsi.fi

@infotexture
Copy link
Member

👍 I compared the output generated by the dist target in this build file with that produced by the Ant build and found it to be identical, with one exception.

💥 The new build not only generates the platform filter file, but also applies it to each target, so no content with @platform="windows" is included when building on macOS or Linux.

This was certainly the original intent, but it appears the Ant build never actually applied the generated filter file (presumably to ensure distribution builds include all content, regardless of the platform on which they are run).

So the new build is working as intended, but exposes errors in the logic elsewhere.

For example on macOS, an empty table is produced for http://www.dita-ot.org/dev/user-guide/increasing-the-jvm.html. That table uses <chrow platform="unix">, which according to the subject scheme is either osx or linux.

<subjectdef keys="unix">
  <subjectdef keys="osx"/>
  <subjectdef keys="linux"/>
</subjectdef>

But the filtering routine seems to ignore this definition and exclude the row, since the current platform is not literally unix.

If the source file is changed to <chrow platform="linux osx"> the content is included as expected.

@jelovirt: Should the filtering process be respecting the subjectScheme? If this is a bug, I'll file a separate issue in the core repo, but I'm not sure if it's an error in the docs source files.

Disable filters in distribution builds

I think the solution here is to simply remove the filter lines from the pdf and html tasks in build.gradle to ensure CI builds include all content.

I'd be inclined to leave the filter active in the htmlhelp task, since it doesn't make much sense to include info on UNIX in a Windows-only help format.

@infotexture infotexture requested a review from jelovirt October 26, 2017 06:45
@infotexture
Copy link
Member

infotexture commented Oct 26, 2017

@jelovirt Merging this will require changes to the distribution build task in the core repo, so we may want to coordinate the timing of the merge to minimize errors.

@eerohele
Copy link
Contributor Author

I can remove the filters for the PDF and HTML builds. I'll do it when I get the chance.

I also need to modify publish.sh to use build.gradle instead of site.gradle.

@infotexture
Copy link
Member

@eerohele:

I can remove the filters for the PDF and HTML builds. I'll do it when I get the chance.

Sure, feel free to update the branch if you have time. If not, I can do that right after we merge this.

I also need to modify publish.sh to use build.gradle instead of site.gradle.

Good point, hadn't thought of that yet.

@infotexture
Copy link
Member

Also confirmed this new build file works with Markdown input. 👍

@eerohele
Copy link
Contributor Author

Should we just remove the generatePlatformFilter task (which auto-generates the DITAVAL file based on the platform)? Would it be better to just have a static windows.ditaval file for the HTML Help output?

@eerohele
Copy link
Contributor Author

Also, in publish.sh, there's this:

-PditaHomeSrc=$DITA_OT_DEV

And in the current site.gradle version, there's this:

def ditaHomeSrc = project.hasProperty("ditaHomeSrc") ? file("${ditaHomeSrc}") : file("${ditaHome}")
def configDir = "$ditaHomeSrc/config"

But my PR (inadvertently) removes the ditaHomeSrc variable.

I don't quite understand its purpose. Could you enlighten me on that so that I can put it back (in some form or another)?

@infotexture
Copy link
Member

Should we just remove the generatePlatformFilter task?

I'd be inclined to keep it, as this approach may serve as a useful example to others with similar requirements. I'd just remove the filters for the PDF and HTML builds.

As for the purpose of the ditaHomeSrc variable, we use the stable (last released) version of the toolkit to run the conversion, but also download the latest development version of the toolkit to get the plugin configuration for generated topics from there.

So we use a stable toolkit to run the build, but generate topics from the bleeding edge source files.

@eerohele
Copy link
Contributor Author

I'd be inclined to keep it, as this approach may serve as a useful example to others with similar requirements. I'd just remove the filters for the PDF and HTML builds.

Sure thing. One thing to note, though, is that if you generate HTML Help output on a non-Windows platform, the resulting output will have non-Windows content, too.

As for the purpose of the ditaHomeSrc variable, we use the stable (last released) version of the toolkit to run the conversion, but also download the latest development version of the toolkit to get the plugin configuration for generated topics from there.

So we use a stable toolkit to run the build, but generate topics from the bleeding edge source files.

OK, I see — thanks for the explanation. I'll modify build.gradle accordingly.

@infotexture
Copy link
Member

if you generate HTML Help output on a non-Windows platform, the resulting output will have non-Windows content

Theoretically yes, but the risk is low, since the HTML Help Workshop required to compile the CHM is Windows-only software. (Not sure how many would generate output on Linux/macOS for subsequent compilation on Windows, but the result would be extra content rather than data loss, so little danger.)

@eerohele eerohele force-pushed the feature/gradle-build branch from c146e96 to e04ddc6 Compare October 27, 2017 10:49
@eerohele
Copy link
Contributor Author

I pushed the changes and cleaned up a few things. If you have the time, please give it another go. If you can, you could also test using ditaHomeSrcto make sure that bit still works OK. I gave it a quick try and it seems to work fine, as far as I can tell.

The CI build seems to be passing, now, too.

Note that when you invoke Gradle after these changes, you have to use gradle -PditaHome=... instead of gradle -Ddita.home=.... Since Ant is no longer involved, there's no reason to use Java system properties — we can use Gradle command-line parameters instead.

@infotexture
Copy link
Member

I get a new message that I haven't seen before, but the build seems to complete successfully:

[ant:loadproperties] Unable to find resource application.properties

There are issues with missing conrefs in the PDF output (empty bullets on page 12, for example), but this is apparently related to upstream changes in the conref processing, as the same issues appear when building with Ant using dita-ot/dita-ot@19abe1998.

The content appears as expected when building with the master branch of the dita-ot repo, so I'll file a separate issue there for this.

@jelovirt Can you update the distribution builds to use this new Gradle build for docs instead of Ant?

@eerohele
Copy link
Contributor Author

[ant:loadproperties] Unable to find resource application.properties

DITA-OT itself tries to load that property file, so I think it must be unrelated to this change.

Not sure why that popped up for you all of a sudden, though. Also not sure why that file is missing.

@infotexture
Copy link
Member

infotexture commented Oct 28, 2017

👍 This has the added benefit of significantly faster distribution builds for docs (~42s).

We plan to merge this in for 3.0.1.

@eerohele eerohele force-pushed the feature/gradle-build branch from e04ddc6 to ba2bb37 Compare October 29, 2017 06:38
@eerohele
Copy link
Contributor Author

I pushed one last change that updates the DITA-OT Gradle Plugin to version 0.4.3. That should fix the problems with --continuous.

@infotexture infotexture changed the base branch from release/3.0 to develop October 29, 2017 08:24
@infotexture infotexture reopened this Oct 29, 2017
@infotexture
Copy link
Member

Pull request inadvertently closed when the release/3.0 branch was deleted.

Reopened and based on develop for 3.0.1

build.gradle Outdated

task messages(type: SaxonXsltTask) {
input "${configDir}/messages.xml"
output 'user-guide/DITA-messages.xml'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and others assume the current repository is the docs repo or docsrc inside DITA-OT. This should be configurable with a paragraph, so that we can run Gradle from any random directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you mean that you should be able to do something like gradle -b ~/Git/docs/build.gradle -PditaHome=$DITA_HOME site, too, which you currently can't?

If so, I agree, and I pushed the changes.

@eerohele eerohele force-pushed the feature/gradle-build branch from ba2bb37 to a6da39d Compare October 29, 2017 18:29
@infotexture
Copy link
Member

Tested a6da39d, verified the following:

  • --continuous builds now work as expected: only actual changes re-trigger builds. 👍
  • runs from any folder if paths to the build file, ditaHome, outputDir are passed as parameters 👍

✅ This should be suitable for use in DITA-OT distribution builds.

build.gradle Outdated
doLast {
antBuilder.execute {
ant(antfile: 'build.xml', target: 'pdf')
String ditaHome = getPropertyOrDefault('ditaHome', '../')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be something like

String ditaHome = getPropertyOrDefault('ditaHome', buildscript.sourceFile.getParentFile().getParentFile().getAbsolutePath())

This way the default we would not need to define the ditaHome property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Signed-off-by: Eero Helenius <eero.helenius@kapsi.fi>
@eerohele eerohele force-pushed the feature/gradle-build branch from a6da39d to 55466c2 Compare October 30, 2017 10:58
@infotexture infotexture merged commit ac79e97 into dita-ot:develop Oct 30, 2017
infotexture added a commit that referenced this pull request Oct 30, 2017
Per #178

Signed-off-by: Roger Sheen <roger@infotexture.net>
@eerohele eerohele deleted the feature/gradle-build branch October 30, 2017 13:40
@infotexture infotexture added build Ant/Gradle build scripts & CI/CD issues refactoring Changes to organization of docs source and removed ready for merge labels Nov 1, 2017
@infotexture infotexture modified the milestones: 3.0.1, 3.1 Nov 28, 2017
infotexture added a commit that referenced this pull request May 22, 2018
Replaced with a Gradle build for 3.1 in #178.

Signed-off-by: Roger Sheen <roger@infotexture.net>
infotexture added a commit that referenced this pull request Oct 21, 2018
When the docs Ant build was replaced with the new Gradle build for #178, the `generate-properties-file` target created for 2.3 with #60 was inadvertently left behind.

Since the distribution build for the core repo was updated to use the docs Gradle build for 3.1 per dita-ot/dita-ot#2972, this file is no longer generated when the docs build runs.

This commit ports the missing target from the old Ant build to the current Gradle build file to ensure that the template is once again available in the `docsrc/samples/properties/` directory of distribution builds.

Signed-off-by: Roger Sheen <roger@infotexture.net>
infotexture added a commit that referenced this pull request Oct 24, 2018
When the docs Ant build was replaced with the new Gradle build for #178, the `generate-properties-file` target created for 2.3 with #60 was inadvertently left behind.

Since the distribution build for the core repo was updated to use the docs Gradle build for 3.1 per dita-ot/dita-ot#2972, this file is no longer generated when the docs build runs.

This commit ports the missing target from the old Ant build to the current Gradle build file to ensure that the template is once again available in the `docsrc/samples/properties/` directory of distribution builds.

Signed-off-by: Roger Sheen <roger@infotexture.net>
infotexture added a commit that referenced this pull request Jan 10, 2021
The properties files were originally created in 9cceb75 to allow the same properties to be used in both Ant and Gradle builds. The legacy Ant build was removed ac79e97 for #178, so there's no longer any need to maintain properties files that are separate from the build script.

Since ffd660f, properties that require absolute paths are set in the Gradle build to anchor these paths to the Gradle project directory, which corresponds to the `docsrc/` folder of the DITA-OT distribution package, or the root folder of the docs repository when cloned to a standalone location.

This supports location-independent builds in a more reliable fashion than the previous mechanism that relied on the Ant `${basedir}` property, which is interpreted differently in recent Gradle and JDK versions.

Signed-off-by: Roger Sheen <roger@infotexture.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Ant/Gradle build scripts & CI/CD issues refactoring Changes to organization of docs source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants