-
Notifications
You must be signed in to change notification settings - Fork 195
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
Separate workspace for files generated from plugins #3152
base: develop
Are you sure you want to change the base?
Conversation
Ping @raducoravu @eerohele, you might be interested in this feature. |
@jelovirt that's great, I will try to compile a DITA OT from your branch and work with it. |
66c4ba3
to
259db8b
Compare
@raducoravu This is still just a POC and doesn't work yet. I wanted to work in public to get comments in early, so that this doesn't end up being something that's not really needed or wanted. |
2fca1e7
to
cb00a21
Compare
@@ -611,6 +639,8 @@ public void addConfiguredDitaFileset(final FileInfoFilterElem fileInfoFilter) { | |||
|
|||
private String name; | |||
private String value; | |||
// XXX This should be List<ResourceCollection> | |||
private List<FileSet> filesets = new ArrayList<>();; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double semicolon.
@@ -15,6 +15,7 @@ plugindirs = plugins;demo | |||
plugin.ignores = | |||
plugin.order = org.dita.base org.oasis-open.dita.v1_3 org.oasis-open.dita.v1_2 | |||
registry = http://plugins.dita-ot.org/ | |||
workspace = . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refresh my memory: can configuration.properties
live outside the DITA-OT directory? If not, you'd still have to "mutate" the installation to change the workspace, I think. Still, just mutating one file is much better than mutating a whole lot.
Would it be possible for DITA-OT to look for something like ~/.dita-ot.properties
and merge the properties in that file with the contents of src/main/config/configuration.properties
or something along those lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configuration.properties
needs to be in the classpath, so the exact location is not important. See discussion on main comments.
@@ -88,7 +108,7 @@ public void generate(final File fileName) { | |||
} catch (final RuntimeException e) { | |||
throw e; | |||
} catch (final Exception e) { | |||
logger.error("Failed to transform " + fileName + ": " + e.getMessage(), e); | |||
throw new IOException("Failed to transform " + fileName + ": " + e.getMessage(), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why an exception instead of logging the error…?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If generating a file from a template fails, it's likely that the actual DITA-OT process will not work. So it's safer to fail to notify that this doesn't work, instead of logging and continuing.
Left a couple of minor comments, but 👍 👍 & 🥇 for putting generated files outside the installation directory. |
@eerohele OT has for a long time had support for
where the first declaration is effective. That would give us
|
@jelovirt that sounds good to me. Alternatively (or additionally), you could maybe pass a property file as a command-line argument to I guess even with the way things currently stand, you could deliver a One concern is that all of those property files have different names, but it's probably something we just have to live with because it's not worth breaking backwards compatibility. |
Thinking about this aloud, we need to keep In order to make the distribution directory read-only, maybe start build file should be just a proxy that imports or includes the generated build file that contains all the plugin imports. So right now the root <import file="plugins/org.dita.base/build_init.xml"/>
<import file="plugins/org.dita.base/preproess.xml"/>
... What if the root <import file="plugins/org.dita.base/start.xml"/> and <import file="plugins/org.dita.base/build_init.xml"/>
<import file="plugins/org.dita.base/preproess.xml"/>
... This way |
👍 for the idea of adding support for something like It would be good if the DITA-OT Java code would also read this file, so that it can be used to set things like custom registry entries that cannot currently be overridden with the |
Maybe running something like “dita install ws=some\path” could copy all the resources in the current dita ot to the workspace folder and then run the integrator there. So the separate workspace would end up having an entire dita ot installation there. Is this already the idea or do you plan the custom workspace to contain a minimal set of resources, no jar libraries for example? |
Without thinking on the implementation details my wish for this would be to have a separate plugins folder somewhere in the users home and running the integrator would not modify the existing dita ot folder resources. But publishing would be able to use the plugins. |
@raducoravu, this would be nice and would make it possible to provide Linux repositories. It would be probably very difficult to implement, especially if the machine is used in a multi-user environment and users use different plugins. |
35adc27
to
609cbbd
Compare
66efc69
to
401d275
Compare
3bc40a7
to
f10af43
Compare
Not really a comment on the code but |
This feature proves to be challenging to implement. Modules can be made to work nicely with external workspace, but Ant imports are a challenge. |
110f1d6
to
9b13a65
Compare
9b13a65
to
4641872
Compare
4641872
to
09328ad
Compare
Worked around the Ant import issue by using |
fe557bc
to
a127c28
Compare
81fca3b
to
02dcbf8
Compare
Signed-off-by: Jarno Elovirta <[email protected]>
02dcbf8
to
589b20b
Compare
Add support for a workspace directory outside the DITA-OT installation that contains the files generated during the plugin integration.
The goal is to allow DITA-OT installation to be read-only, and all generated files can be written to and read from e.g.
~/Library/Application Support/DITA-OT
on OS X or%APPDATA%\DITA-OT
on Windows. In order to support a distribution package that doesn't require a installation step, the code should fall back to files located in the DITA-OT installation directory.The old generated file would be that inside DITA-OT installation we'd have
~/dita-ot/plugins/foo/build_template.xml
~/dita-ot/plugins/foo/build.xml
with the separate workspace, we'd have
~/dita-ot/plugins/foo/build_template.xml
~/Library/Application Support/DITA-OT/plugins/foo/build.xml
The workspace directory should be overridable with
workspace
key in the configuration properties to support multiple DITA-OT installations; valueworkspace = .
will use the DITA-OT installation directory as the workspace.The default distribution package should use DITA-OT installation as the workspace directory. DITA-OT installed with e.g. Brew could use macOS's
~/Library/Application Support/DITA-OT
as the workspace with an integration step as part of the installation process.