Skip to content

Commit

Permalink
Add template for client package (Azure#2587)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeharder authored Nov 14, 2018
1 parent 4a9dfb4 commit b4e30b6
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .azure-pipelines/client.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
parameters:
name: ''
vmImage: ''

jobs:
- job: ${{ format('Test_{0}', parameters.name) }}

pool:
vmImage: ${{ parameters.vmImage }}

steps:
- task: Maven@3
displayName: 'Run tests'
inputs:
mavenPomFile: 'pom.client.build.xml'
options: '--batch-mode' #hides dependencies download progress from CI output
mavenOptions: '-Xmx3072m -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
goals: 'test'
51 changes: 51 additions & 0 deletions .azure-pipelines/client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
trigger:
- master

jobs:
- template: client.test.yml
parameters:
name: Linux
vmImage: 'ubuntu-16.04'

- template: client.test.yml
parameters:
name: macOS
vmImage: 'macOS-10.13'

- template: client.test.yml
parameters:
name: Windows
vmImage: 'vs2017-win2016'

- job: 'Publish'

dependsOn:
- 'Test_Linux'
- 'Test_macOS'
- 'Test_Windows'

pool:
vmImage: 'ubuntu-16.04'

steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.client.build.xml'
options: '--batch-mode' #hides dependencies download progress from CI output
mavenOptions: '-Xmx3072m -Dmaven.test.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'package'
displayName: 'Package'

- task: CopyFiles@2
inputs:
contents: '**/*.jar'
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
displayName: 'Copy'

- task: PublishBuildArtifacts@1
displayName: 'Publish'
22 changes: 22 additions & 0 deletions pom.client.build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sdk-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>./pom.client.xml</relativePath>
</parent>

<artifactId>azure-sdk-parent-build</artifactId>
<version>${parent.version}</version>
<packaging>pom</packaging>

<name>Microsoft Azure SDK Build</name>
<description>This package bundles all the SDKs in a multi-module for build/CI purposes.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<modules>
<module>./template/client</module>
</modules>
</project>
41 changes: 41 additions & 0 deletions pom.client.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sdk-parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>

<name>Microsoft Azure SDK Parent</name>
<description>This package contains the parent module of Microsoft Azure SDK.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

</project>
3 changes: 3 additions & 0 deletions template/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Azure Template

This project provides a starter template for a Java client package.
25 changes: 25 additions & 0 deletions template/client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sdk-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.client.xml</relativePath>
</parent>

<artifactId>azure-sdk-template</artifactId>
<packaging>jar</packaging>

<name>Microsoft Azure SDK for Template</name>
<description>This package contains Microsoft Azure SDK for Template.</description>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.template;

public class Hello {
public String getMessage() {
return "hello";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.template;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloTest {
@Test
public void testMessage() {
assertEquals("hello", (new Hello()).getMessage());
}
}

0 comments on commit b4e30b6

Please sign in to comment.