summaryrefslogtreecommitdiffstats
path: root/publish.xml
blob: 3c14e86774eefdef88ddfd9eaa99c43abc1318d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?xml version="1.0" encoding="UTF-8"?>
<project name="publish" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
    <include file="common.xml" as="common" />
    <include file="build.xml" as="vaadin" />

    <!-- Dummy value as ivysettings-publish require a value -->
    <property name="publish.sftp.keyfile" value="/dummy" />
    <property name="publish.sftp.ivy.pattern" value="dummy" />

    <ivy:settings file="ivysettings.xml" />
    <ivy:settings file="ivysettings-publish.xml" id="publish.settings" />
    <property file="publish.properties" />

    <target name="nightly.publish" depends="nightly.download.publish, nightly.maven.publish">

    </target>

    <!-- Copies the nightly build artifacts to the download server. -->
    <target name="nightly.tests.publish" if="nightly.tests.publish">
        <property name="file.war" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${version}.war" />
        <property name="target" value="${nightly.tests.publish}/${vaadin.version.major}.${vaadin.version.minor}-${build.tag}.war" />

        <fail unless="ant-jsch.present" message="Please install ant-jsch.jar into ANT_HOME/lib" />
        <fail unless="jsch.present" message="Please install jsch.jar into ANT_HOME/lib" />

        <echo>Installing ${src} to ${target}</echo>

        <scp todir="${nightly.tests.publish}" file="${file.war}">
        </scp>
    </target>

    <target name="nightly.download.publish">
        <antcontrib:foreach list="${modules.to.publish.to.download}" target="publish.module.to.download.site" param="module" />
    </target>

    <target name="nightly.maven.publish">
        <antcontrib:foreach list="${modules.to.publish.to.maven}" target="publish.module.to.maven" param="module" />
    </target>

	<target name="publish.module.to.download.site">
        <fail unless="module" message="No module to publish defined" />
        <ivy:resolve log="download-only" file="${module}/ivy.xml" />
        <ivy:publish publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sftp-publish">
            <artifacts pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision](-[classifier]).[ext]" />
        </ivy:publish>
    </target>

    <target name="publish.module.to.maven">
        <fail unless="module" message="No module to publish defined" />
        <property file="${gpg.passphrase.file}" />

        <!-- Ivy should be able to handle this but this does not work at 
            the moment <ivy:resolve log="download-only" file="${module}/ivy.xml" /> <ivy:publish pubrevision="7.0-SNAPSHOT" 
            publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sonatype"> 
            <artifacts pattern="${ivy.settings.dir}/result/artifacts/${vaadin.version}/[module]/[artifact]-${vaadin.version}(-[classifier]).[ext]" 
            /> </ivy:publish> -->
        <property name="jar.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" />
        <property name="pom.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" />

        <antcontrib:if>
        	<available file="${jar.file}"/>
            <then>
                <artifact:mvn failonerror="true">
                    <arg value="gpg:sign-and-deploy-file" />
                    <sysproperty key="file" value="${jar.file}" />
                    <sysproperty key="pomFile" value="${pom.file}" />
                    <sysproperty key="repositoryId" value="${maven.snapshot.repository.id}" />
                    <sysproperty key="url" value="${maven.snapshot.repository.url}" />
                    <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
                    <sysproperty key="retryFailedDeploymentCount" value="10" />
                </artifact:mvn>
            </then>
            <else>
                <artifact:mvn failonerror="true">
                    <arg value="gpg:sign-and-deploy-file" />
                    <sysproperty key="file" value="${pom.file}" />
                    <sysproperty key="pomFile" value="${pom.file}" />
                    <sysproperty key="generatePom" value="false" />
                    <sysproperty key="packaging" value="pom" />
                    <sysproperty key="repositoryId" value="${maven.snapshot.repository.id}" />
                    <sysproperty key="url" value="${maven.snapshot.repository.url}" />
                    <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
                    <sysproperty key="retryFailedDeploymentCount" value="10" />
                </artifact:mvn>
            </else>
        </antcontrib:if>
    </target>

	<!-- Use this to publish to local Maven repo                              -->
	<!-- If you have compiled a snapshot build with:                          -->
	<!--    ant -Dvaadin.version=7.x.x.zzz package                            -->
	<!-- Publish with:                                                        -->
	<!--    ant -f publish.xml -Dvaadin.version=7.x.x.zzz local.maven.publish -->
	<!-- Note that if the build is a snapshot build, it will be installed as  -->
	<!-- 7.x-SNAPSHOT.                                                        -->
    <target name="local.maven.publish">
        <antcontrib:foreach list="${modules.to.publish.to.maven}" target="publish.module.to.local.maven" param="module" />
    </target>

    <target name="publish.module.to.local.maven">
        <fail unless="module" message="No module to publish defined" />

        <property name="jar.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" />
        <property name="javadoc.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}-javadoc.jar" />
        <property name="sources.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}-sources.jar" />
        <property name="pom.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" />

        <antcontrib:if>
        	<available file="${jar.file}"/>
            <then>
                <artifact:mvn failonerror="true">
                    <arg value="install:install-file" />
                    <sysproperty key="file" value="${jar.file}" />
                    <sysproperty key="pomFile" value="${pom.file}" />
                    <sysproperty key="javadoc" value="${javadoc.file}" />
                    <sysproperty key="sources" value="${sources.file}" />
                </artifact:mvn>
            </then>
            <else>
                <artifact:mvn failonerror="true">
                    <arg value="install:install-file" />
                    <sysproperty key="file" value="${pom.file}" />
                    <sysproperty key="pomFile" value="${pom.file}" />
                    <sysproperty key="generatePom" value="false" />
                    <sysproperty key="packaging" value="pom" />
                </artifact:mvn>
            </else>
        </antcontrib:if>
    </target>
</project>