blob: 3dba9a3678e8063cb040c19c186f4d91c0e90edb [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-dotnet</artifactId>
<version>3.5.6</version>
</parent>
<artifactId>gremlin-dotnet-source</artifactId>
<name>Apache TinkerPop :: Gremlin.Net - Source</name>
<packaging>${packaging.type}</packaging>
<properties>
<nugetVersion>4.9.2</nugetVersion>
<nugetExe>nuget-${nugetVersion}.exe</nugetExe>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<executions>
<execution>
<id>update-version</id>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scripts>
<script>
def mavenVersion = "${project.version}"
def platformAgnosticBaseDirPath = project.basedir.getAbsolutePath().replace("\\", "/")
def file = new File(platformAgnosticBaseDirPath + "/Gremlin.Net/Gremlin.Net.csproj")
file.write(file.getText("UTF-8").replaceFirst(/&lt;Version&gt;(.*)&lt;\/Version&gt;/, "&lt;Version&gt;" + mavenVersion + "&lt;/Version&gt;"))
file = new File(platformAgnosticBaseDirPath + "/Gremlin.Net.Template/Gremlin.Net.Template.csproj")
file.write(file.getText("UTF-8").replaceFirst(/Gremlin\.Net\" Version="(.*)"/, "Gremlin.Net\" Version=\"" + mavenVersion + "\""))
file = new File(platformAgnosticBaseDirPath + "/Gremlin.Net.Template/Gremlin.Net.Template.nuspec")
file.write(file.getText("UTF-8").replaceFirst(/&lt;version&gt;(.*)&lt;\/version&gt;/, "&lt;version&gt;" + mavenVersion + "&lt;/version&gt;"))
</script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>
<!--
there is no point to building/deploying the jvm stuff - there is no java source really - just poms
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>gremlin-dotnet-standard</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<packaging.type>pom</packaging.type>
</properties>
</profile>
<!-- activates the building of .NET components and requires that the .NET SDK be installed on the system -->
<profile>
<id>gremlin-dotnet</id>
<activation>
<activeByDefault>false</activeByDefault>
<file>
<exists>.glv</exists>
</file>
</activation>
<properties>
<packaging.type>dotnet-library</packaging.type>
</properties>
<build>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.eobjects.build</groupId>
<artifactId>dotnet-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<packEnabled>true</packEnabled>
<nugetPushEnabled>false</nugetPushEnabled>
<nugetAddEnabled>false</nugetAddEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>docfx</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<if>
<!-- docfx sadly requires mono and nuget at this time:
1. https://github.com/dotnet/docfx/issues/3389 (nuget required for a dll not in mono
2. https://github.com/dotnet/docfx/issues/718#issuecomment-256700598 (mono workaround) -->
<and>
<available file="mono" filepath="${env.PATH}"/>
<available file="${nugetExe}"/>
</and>
<then>
<if>
<available file="docfx/docfx.exe"/>
<then>
<echo>docfx already downloaded.</echo>
</then>
<else>
<exec executable="wget" failonerror="true">
<arg line="https://github.com/dotnet/docfx/releases/download/v2.58/docfx.zip"/>
</exec>
<mkdir dir="docfx"/>
<exec executable="unzip" failonerror="true">
<arg line="docfx.zip -d docfx"/>
</exec>
<delete file="docfx.zip"/>
<exec executable="mono" failonerror="true">
<arg line="${nugetExe} install -OutputDirectory docfx SQLitePCLRaw.core -ExcludeVersion"/>
</exec>
</else>
</if>
<exec executable="mono" failonerror="true">
<arg line="docfx/docfx.exe"/>
</exec>
</then>
<else>
<echo>Skipping docfx generation as mono and nuget are required.</echo>
<echo>nuget must be installed as it would if doing a .NET deployment - see the glv-dotnet-deploy Maven profile for more information.</echo>
</else>
</if>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<!--
Provides a way to deploy the Gremlin.Net GLV to nuget. This cannot be part of the standard maven execution
because nuget does not have a staging environment like sonatype for releases. As soon as the release is
published it is public. In our release workflow, deploy occurs prior to vote on the release and we can't
make this stuff public until the vote is over.
-->
<profile>
<id>glv-dotnet-deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>nuget</name>
</property>
</activation>
<properties>
<packaging.type>dotnet-library</packaging.type>
</properties>
<build>
<plugins>
<!--
not seeing much point to making this OS agnostic really. as far as it is known, no one who does
deployments will do so from a windows machine. this part of the build requires mono. note that
the "correct" version of nuget is downloaded as part of the process.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>pack-dotnet-template</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<if>
<available file="mono" filepath="${env.PATH}"/>
<then>
<if>
<available file="${nugetExe}"/>
<then>
<echo>nuget.exe already downloaded.</echo>
</then>
<else>
<exec executable="wget" failonerror="true">
<arg line="https://dist.nuget.org/win-x86-commandline/v${nugetVersion}/nuget.exe -O ${nugetExe}"/>
</exec>
</else>
</if>
<exec executable="mono" failonerror="true">
<arg line="${nugetExe} pack Gremlin.Net.Template/Gremlin.Net.Template.nuspec"/>
</exec>
</then>
<else>
<echo>Skipping packaging of Gremlin.Net.Template as mono is not available</echo>
</else>
</if>
</target>
</configuration>
</execution>
<execution>
<id>deploy-nuget</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<if>
<available file="${nugetExe}"/>
<then>
<echo>nuget.exe already downloaded.</echo>
</then>
<else>
<exec executable="wget" failonerror="true">
<arg line="https://dist.nuget.org/win-x86-commandline/v${nugetVersion}/nuget.exe -O ${nugetExe}"/>
</exec>
</else>
</if>
<!--
until https://github.com/NuGet/Home/issues/4095 we have to have to specify
the "ConfigFile" option to nuget.
-->
<exec executable="mono" failonerror="true">
<arg line="${nugetExe} push Gremlin.Net/bin/Gremlin.Net.${project.version}.nupkg -Source https://api.nuget.org/v3/index.json -ConfigFile ${user.home}/.config/NuGet/NuGet.Config"/>
</exec>
<exec executable="mono" failonerror="true">
<arg line="${nugetExe} push Gremlin.Net.Template.${project.version}.nupkg -Source https://api.nuget.org/v3/index.json -ConfigFile ${user.home}/.config/NuGet/NuGet.Config"/>
</exec>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-dsl</id>
<phase>deploy</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scripts>
<script><![CDATA[
// prevent SNAPSHOT deployment for .NET
def versionToUse = '${project.version}'
if (versionToUse.endsWith("-SNAPSHOT"))
throw new RuntimeException("Current version is a SNAPSHOT which can not be deployed to nuget")
]]>
</script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>