VIVO-262 Add languages to VIVO at build time.

Move the language-specific files out of the default build area. Add a build property that will cause the selected language(s) to be copied into the build area.
This commit is contained in:
j2blake 2013-09-09 12:23:54 -04:00
parent 8e0bf8c229
commit f129f727a7
4 changed files with 47 additions and 1 deletions

View file

@ -147,6 +147,32 @@
- - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - - - -->
<target name="prepare"> <target name="prepare">
<mkdir dir="${build.dir}" /> <mkdir dir="${build.dir}" />
<!-- Get ready to copy language files.
Use JavaScript functions to add "includes" to this PatternSet,
depending on which languages are selected. -->
<patternset id="language_files" />
<script language="javascript"> <![CDATA[
function echo(e, message) {
e.setMessage(message);
e.perform();
}
prop = project.getProperty("languages.addToBuild");
ps = project.getReference("language_files");
e = project.createTask("echo");
if (prop != null) {
languages = prop.trim().split(",");
for (var i=0; i < languages.length; i++) {
ps.setIncludes([languages[i] + "/**/*"])
echo(e, "Adding language: " + languages[i])
}
} else {
ps.appendExcludes(["**/*"])
}
]]> </script>
</target> </target>
<!-- - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - -
@ -196,6 +222,16 @@
<copy todir="${main.compiled.dir}"> <copy todir="${main.compiled.dir}">
<fileset dir="${appbase.dir}/src" includes="**/*.xml" /> <fileset dir="${appbase.dir}/src" includes="**/*.xml" />
</copy> </copy>
<!-- Copy any requested language files to the webapp directory. -->
<!-- Use a mapper to remove the language directory name when copying. -->
<copy todir="${main.webapp.dir}/">
<fileset dir="${appbase.dir}/languages" >
<patternset refid="language_files" />
<filename regex="/i18n/|/templates/|/themes/" />
</fileset>
<regexpmapper from="^[^/]+/(.*)$$" to="\1" />
</copy>
</target> </target>
<!-- - - - - - - - - - - - - - - - - - <!-- - - - - - - - - - - - - - - - - -
@ -210,7 +246,17 @@
<include name="rdf/**/*" /> <include name="rdf/**/*" />
</fileset> </fileset>
</copy> </copy>
</target>
<!-- Copy any requested language files to the webapp directory. -->
<!-- Use a mapper to remove the language directory name when copying. -->
<copy todir="${vitrohome.image.dir}" >
<fileset dir="${appbase.dir}/languages" >
<patternset refid="language_files" />
<filename name="*/rdf/**/*" />
</fileset>
<regexpmapper from="^[^/]+/(.*)$$" to="\1" />
</copy>
</target>
<!-- ================================= <!-- =================================