<?xml version="1.0" encoding="UTF-8"?>

<!--
    Copyright (c) 2009, 2014 IBM Corporation and others.

    This program and the accompanying materials
    are made available under the terms of the Eclipse Public License 2.0
    which accompanies this distribution, and is available at
    https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0

    Contributors:
        IBM Corporation - initial API and implementation
 -->

<!--
	Build file used only by internal SWT build that generates the libraries & tags.
 -->

<project name="swtinternalbuild" basedir=".">
	<import file="buildSWT.xml"/>
	<property name="file_src_pom" value="bundles/org.eclipse.swt/pom.xml"/>
	<property name="file_bin_parent_pom" value="bundles/binaries-parent/pom.xml"/>
	<property name="lib.dir" value="/var/lib/hudson/antlib"/>
	
	<!-- When there are build changes, generates the time-stamp qualifiers and updates the pom files in source and binaries repo -->
	<target name="generate_qualifier" depends="check_build_changed" if="build_changed">
		<tstamp><format property="build.qualifier" pattern="yyyyMMdd-HHmm"/></tstamp>
		<echo>${build.qualifier}</echo>
	</target>
	
	<!--
		Update forceContextQualifier property in <SWT source repo>/bundles/org.eclipse.swt/pom.xml and 
		<SWT binaries repo>/bundles/binaries-parent/pom.xml
		
		We match existing forceContextQualifier in the format vyyyyMMdd-HHmm and replace this with v${build.qualifier}
		
		See https://bugs.eclipse.org/bugs/show_bug.cgi?id=577391 
	-->
	
	<target name="write_qualifier" depends="generate_qualifier" if="build.qualifier" description="writes the generated qualifier in pom.xml in src and binaries repo">
		<replaceregexp file="${repo.src}/${file_src_pom}"
			match="v\d+-\d+"
			replace="v${build.qualifier}"/>
		<replaceregexp file="${repo.bin}/${file_bin_parent_pom}"
			match="v\d+-\d+"
			replace="v${build.qualifier}"/>
	</target>
</project>
