<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<name>wcomponents-theme-parent</name>
	<artifactId>wcomponents-theme-parent</artifactId>

	<parent>
		<groupId>com.github.bordertech.wcomponents</groupId>
		<artifactId>wcomponents-parent</artifactId>
		<version>1.3.2</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<packaging>pom</packaging>

	<properties>
		<!--
			We externalize download URLs so that in-house builds can override them to on-prem mirrors.
		-->
		<mvn.repo.url>http://repo.maven.apache.org/maven2</mvn.repo.url>
		<npm.registry.url>https://registry.npmjs.org/</npm.registry.url>
		<node.download.root>http://nodejs.org/dist/</node.download.root>
		<npm.download.root>http://registry.npmjs.org/npm/-/</npm.download.root>
		<!--<node.sass.download.root>https://github.com/sass/node-sass/releases/download</node.sass.download.root>-->
		<phantomjs.download.root>https://repo1.maven.org/maven2/com/github/klieber/phantomjs/2.0.0</phantomjs.download.root>
		<theme.dir>${basedir}</theme.dir>
		<theme.default.name>wcomponents-theme</theme.default.name>
		<theme.unpacked.name>theme_unpacked</theme.unpacked.name>
		<theme.target.dir>${project.build.directory}</theme.target.dir>
		<theme.tmp.dir>${java.io.tmpdir}${file.separator}wcomponents-theme-tmp</theme.tmp.dir>
		<theme.impl.dir>${theme.tmp.dir}/fakeImplRoot</theme.impl.dir>
		<theme.impl.name />
		<theme.unpack.dir>${project.build.directory}${file.separator}${theme.unpacked.name}</theme.unpack.dir>
		<i18n.unpack.dir>${project.build.directory}${file.separator}i18n-unpacked</i18n.unpack.dir>
		<nodejs.dist.dir>${project.build.directory}/nodejsdist</nodejs.dist.dir><!-- The nodejs binaries get unpacked to here -->
		<nodejs.dir>${basedir}/node</nodejs.dir><!-- Where we expect to find Node installed -->
		<npmjs.dir>${nodejs.dir}/node_modules/npm/bin</npmjs.dir><!-- Where we expect to find NPM installed -->
		<theme.skip.antrun>true</theme.skip.antrun><!-- All child projects that want to build a theme should set this to false -->
		<theme.skip.unpack>true</theme.skip.unpack><!-- child projects outside of wcomponents will set this to false -->
		<theme.core.dir>${theme.dir}</theme.core.dir><!-- In child projects this would probably be ${theme.unpack.dir}${file.separator}${theme.default.name} -->
		<wc.project.version>${project.version}</wc.project.version><!-- Child projects should override this to the version of WComponents they use -->
		<xsltjson.download.url>https://github.com/bramstein/xsltjson/archive/master.zip</xsltjson.download.url>
		<xsltjson.dir>${project.build.directory}/xsltjson</xsltjson.dir><!-- Convert XML to JSON at build time -->
		<timezonedata.download.url>http://www.iana.org/time-zones/repository/tzdata-latest.tar.gz</timezonedata.download.url>
		<timezone.dir>${project.build.directory}/timezone</timezone.dir><!-- Fetch Timezone Database -->
	</properties>

	<build>
		<plugins>
<!--			<plugin>
				<groupId>com.github.klieber</groupId>
				<artifactId>phantomjs-maven-plugin</artifactId>
				<version>0.7</version>
				<executions>
					<execution>
						<goals>
							<goal>install</goal>
						</goals>
						<phase>generate-test-sources</phase>
					</execution>
				</executions>
				<configuration>
					<version>2.0.0</version>
					<source>URL</source>
					<baseUrl>${phantomjs.download.root}</baseUrl>
					<phase>test</phase>
				</configuration>
			</plugin>-->
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<ignoreMissingDescriptor>true</ignoreMissingDescriptor>
					<descriptors>
						<descriptor>sources.xml</descriptor>
					</descriptors>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.8</version>
				<executions>
					<execution>
						<id>unpack-core</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<skip>${theme.skip.unpack}</skip>
							<outputDirectory>${theme.unpack.dir}</outputDirectory>
							<!--				<stripVersion>true</stripVersion>-->
							<!--				<excludes>theme_build_tools/**, theme*parent/**</excludes>-->
							<excludes>**/pom.xml</excludes>
							<includes>${theme.default.name}/**</includes>
							<artifactItems>
								<artifactItem>
									<groupId>com.github.bordertech.wcomponents</groupId>
									<artifactId>${theme.default.name}</artifactId>
									<version>${wc.project.version}</version>
									<classifier>sources</classifier>
									<overWrite>true</overWrite>
									<type>zip</type>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
					<execution>
						<id>unpack-i18n</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<outputDirectory>${i18n.unpack.dir}</outputDirectory>
							<artifactItems>
								<artifactItem>
									<groupId>com.github.bordertech.wcomponents</groupId>
									<artifactId>wcomponents-i18n</artifactId>
									<version>${wc.project.version}</version>
									<overWrite>true</overWrite>
									<type>jar</type>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-site-plugin</artifactId>
				<version>3.4</version>
				<configuration>
					<reportPlugins combine.children="override">
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-project-info-reports-plugin</artifactId>
							<version>2.7</version>
						</plugin>
					</reportPlugins>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.googlecode.maven-download-plugin</groupId>
				<artifactId>download-maven-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<id>unpack-xsltjson</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<url>${xsltjson.download.url}</url>
							<unpack>false</unpack>
							<outputDirectory>${xsltjson.dir}</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>fetch-timezonedb</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<url>${timezonedata.download.url}</url>
							<unpack>true</unpack>
							<outputDirectory>${timezone.dir}</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>compile</id>
						<phase>compile</phase>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<target>
								<echo>Attempting to start ANT build at ${theme.core.dir}</echo>
								<echo>basedir = ${basedir}</echo>
								<property name="basedir" location="${basedir}" />
								<property name="target.dir" location="${project.build.directory}" />
								<property name="component.rootdir" location="${theme.core.dir}" />
								<property name="build.number" value="${project.version}" />
								<property name="build.rootdir" location="${theme.target.dir}" />
								<property name="theme.skip.tests" value="true" />
								<property name="maven.plugin.classpath" refid="maven.plugin.classpath" />
								<ant antfile="${theme.core.dir}/build.xml">
									<target name="build" />
								</ant>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
					<execution>
						<id>test</id>
						<phase>test</phase>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<target>
								<echo>Attempting to start ANT test at ${theme.core.dir}</echo>
								<echo>basedir = ${basedir}</echo>
								<property name="basedir" location="${basedir}" />
								<property name="phantomjs.binary" value="${phantomjs.binary}" />
								<property name="target.dir" location="${project.build.directory}" />
								<property name="component.rootdir" location="${theme.core.dir}" />
								<property name="build.number" value="${project.version}" />
								<property name="build.rootdir" location="${theme.target.dir}" />
								<property name="theme.skip.tests" value="${skipOptionalTests}" />
								<property name="maven.plugin.classpath" refid="maven.plugin.classpath" />
								<!--<property name="theme.skip.tests" value="${skipOptionalTests}" />-->
								<ant antfile="${theme.core.dir}/build.xml">
									<target name="test" />
								</ant>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
					<execution>
						<id>doco</id>
						<phase>site</phase>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<target>
								<echo>Attempting to start ANT documentation build at ${theme.core.dir}</echo>
								<echo>basedir = ${basedir}</echo>
								<property name="basedir" location="${basedir}" />
								<property name="target.dir" location="${project.build.directory}" />
								<property name="component.rootdir" location="${theme.core.dir}" />
								<property name="build.number" value="${project.version}" />
								<property name="build.rootdir" location="${theme.target.dir}" />
								<property name="theme.skip.tests" value="true" />
								<property name="maven.plugin.classpath" refid="maven.plugin.classpath" />
								<ant antfile="${theme.core.dir}/build.xml">
									<target name="document" />
								</ant>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.fedorahosted.tennera</groupId>
						<artifactId>ant-gettext</artifactId>
						<version>0.9</version>
					</dependency>
					<dependency>
						<groupId>com.github.bordertech.wcomponents</groupId>
						<artifactId>wcomponents-sass-compiler</artifactId>
						<version>1.0.0</version>
					</dependency>
					<dependency>
						<groupId>commons-io</groupId>
						<artifactId>commons-io</artifactId>
						<version>1.4</version>
					</dependency>
					<dependency>
						<groupId>commons-codec</groupId>
						<artifactId>commons-codec</artifactId>
						<version>1.4</version>
					</dependency>
<!--					<dependency>
						<groupId>rhino</groupId>
						<artifactId>js</artifactId>
						<version>1.7R2</version>
					</dependency>-->
					<dependency>
						<groupId>net.sf.saxon</groupId>
						<artifactId>Saxon-HE</artifactId>
						<version>9.6.0-7</version>
					</dependency>
<!--					<dependency>
						<groupId>com.google.javascript</groupId>
						<artifactId>closure-compiler</artifactId>
						<version>v20130603</version>
					</dependency>-->
<!--					<dependency>
						<groupId>com.googlecode.jgenhtml</groupId>
						<artifactId>jgenhtml</artifactId>
						<version>1.5</version>
					</dependency>-->
					<dependency>
						<groupId>com.github.ricksbrown</groupId>
						<artifactId>xslmin</artifactId>
						<version>2.3.0</version>
					</dependency>
				</dependencies>
			</plugin>
			<plugin>
				<groupId>com.github.eirslett</groupId>
				<artifactId>frontend-maven-plugin</artifactId>
				<version>0.0.26</version>
				<configuration>
					<workingDirectory>${basedir}</workingDirectory>
				</configuration>
				<executions>
					<execution>
						<id>install node and npm</id>
						<goals>
							<goal>install-node-and-npm</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<skip>${theme.skip.antrun}</skip>
							<nodeVersion>v4.2.1</nodeVersion>
							<npmVersion>2.14.7</npmVersion>
							<!--
								This will only work if the nodejs binaries are unpacked first (see the execution with ID "unpack-nodejs").
							-->
							<nodeDownloadRoot>${node.download.root}</nodeDownloadRoot>
							<npmDownloadRoot>${npm.download.root}</npmDownloadRoot>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>${jetty.version}</version>
				<configuration>
					<stopPort>9966</stopPort>
					<stopKey>stopit</stopKey>
					<webAppSourceDirectory>${basedir}</webAppSourceDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<modules>
		<module>../wcomponents-theme</module>
	</modules>
</project>
