Experimental combined linknpostlink.
<?xml version="1.0" encoding="UTF-8"?>
<!--
============================================================================
Name : password.ant.xml
Part of : Helium
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".
Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
Description:
============================================================================
-->
<project name="password" xmlns:hlm="http://www.nokia.com/helium">
<description>
Password retrieval targets
</description>
<!-- Retrieve the ATS password from the .netrc file and store it into ats.password property. -->
<target name="ats-password">
<hlm:netrcPasswordMacro output-prop="ats.password" result-prop="ats.password.available" type="ats"/>
</target>
<!-- Retrieve the ATS username from the .netrc file and store it into ats.username property. -->
<target name="ats-username">
<hlm:netrcUsernameMacro output-prop="ats.username" result-prop="ats.username.available" type="ats"/>
</target>
<!-- Retrieve the unix password from the .netrc file and store it into unix.password property. -->
<target name="unix-password">
<hlm:netrcPasswordMacro output-prop="unix.password" result-prop="unix.password.available" type="synergy"/>
</target>
<!-- Retrieve the unix username from the .netrc file and store it into unix.username property. -->
<target name="unix-username">
<hlm:netrcUsernameMacro output-prop="unix.username" result-prop="unix.username.available" type="synergy"/>
</target>
<!-- Ask for unix login using UI. -->
<target name="get-unix-password" depends="unix-username,unix-password">
<hlm:filterRecordStartMacro/>
<if>
<not>
<equals arg1="${unix.password.available}" arg2="0"/>
</not>
<then>
<property name="unix.username" value="${env.USERNAME}"/>
<antform title="User login information">
<textProperty label="UNIX login:" property="unix.username"/>
<textProperty label="UNIX password:" property="unix.password" password="true"/>
</antform>
<property name="unix.password.available" value="1"/>
</then>
</if>
<hlm:filterRecordStopMacro pattern="${unix.password}"/>
</target>
<!-- Retrieve the GRACE password from the .netrc file and store it into release.grace.password property. -->
<target name="grace-password" if="release.grace">
<hlm:netrcPasswordMacro output-prop="release.grace.password" result-prop="grace.password.available" type="grace"/>
</target>
<!-- Retrieve the NOE password from the .netrc file and store it into noe.password property. -->
<target name="noe-password">
<hlm:netrcPasswordMacro output-prop="noe.password" result-prop="noe.password.available" type="noe"/>
<if>
<not>
<isset property="noe.password"/>
</not>
<then>
<antform title="NOE login information">
<label>Unable to read NOE password from h:\.netrc file.</label>
<textProperty label="NOE password:" property="noe.password" password="true"/>
</antform>
</then>
</if>
</target>
<!-- Retrieve the notes password from the .netrc file and store it into notes.password property. -->
<target name="notes-password">
<hlm:netrcPasswordMacro output-prop="release.notes.password" result-prop="notes.password.available" type="notes"/>
</target>
<!-- Retrieve the ccm password from the .netrc file and store it into ccm.password property.
Requires ccm.enabled tobe set to 'true' to work.-->
<target name="ccm-password">
<if>
<isset property="run.ccm"/>
<then>
<hlm:netrcPasswordMacro output-prop="ccm.password.rc" result-prop="ccm.password.available" type="synergy"/>
</then>
</if>
</target>
<!-- Retrieve the ccm username from the .netrc file and store it into ccm.username property.
Requires ccm.enabled tobe set to 'true' to work. -->
<target name="ccm-username">
<if>
<isset property="run.ccm"/>
<then>
<hlm:netrcUsernameMacro output-prop="ccm.login.rc" result-prop="ccm.username.available" type="synergy"/>
</then>
</if>
</target>
<!--
This target retreive user's login and password and tries to
open a synergy session. if it fails it leaves ant
it sets the following properties:
- ccm.user.login
- ccm.user.password
it requires ccm.database to be set to the wanted database and ccm.enabled to set to 'true'.
-->
<target name="get-ccm-password" depends="ccm-password,ccm-username" unless="ccm.user.password">
<if>
<isset property="run.ccm"/>
<then>
<hlm:filterRecordStartMacro/>
<if>
<not>
<and>
<isset property="ccm.login.rc"/>
<isset property="ccm.password.rc"/>
</and>
</not>
<then>
<if>
<isset property="ccm.login.popup.disable"/>
<then>
<echo>Error: Unable to read synergy username and password from .netrc file.</echo>
<property name="skip.password.validation" value="true"/>
</then>
<else>
<property name="ccm.user.login" value="${env.USERNAME}"/>
<antform title="Synergy login information">
<label>Unable to read synergy username and password from h:\.netrc file.</label>
<textProperty label="ccm login:" property="ccm.user.login"/>
<textProperty label="ccm password:" property="ccm.user.password" password="true"/>
</antform>
<property name="ccm.password.available" value="1"/>
<property name="unix.username" value="${env.USERNAME}"/>
<property name="unix.password" value="${ccm.user.password}"/>
<property name="unix.password.available" value="1"/>
</else>
</if>
</then>
<else>
<property name="ccm.user.login" value="${ccm.login.rc}"/>
<property name="ccm.user.password" value="${ccm.password.rc}"/>
</else>
</if>
<antcall target="ccm-check"/>
<hlm:filterRecordStopMacro pattern="${ccm.user.password}"/>
</then>
<!--echo> ccm not enabled so not get password</echo-->
</if>
</target>
<!-- check synergy is available needs ccm.enabled to be set to 'true' as well.-->
<target name="ccm-check" unless="skip.password.validation">
<if>
<isset property="run.ccm"/>
<then>
<hlm:ccmAvailableMacro resultproperty="ccm.session.created"/>
<echo>ccm.session.created = ${ccm.session.created}</echo>
<if>
<equals arg1="${ccm.session.created}" arg2="-1"/>
<then>
<fail message="Unable to create CCM session."/>
</then>
</if>
<if>
<equals arg1="${ccm.session.created}" arg2="-2"/>
<then>
<fail message="Access Denied for user."/>
</then>
</if>
</then>
</if>
</target>
</project>