From d7a446ce6c6cef2a43186e0917682aee768a7bd8 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 9 Nov 2018 13:45:59 -0800 Subject: [PATCH 1/4] Add template for client package --- azure-pipelines.client.yml | 51 +++++++++++++++++++ pom.client.xml | 44 ++++++++++++++++ template/client/README.md | 3 ++ template/client/pom.xml | 25 +++++++++ .../com/microsoft/azure/template/Hello.java | 12 +++++ .../microsoft/azure/template/HelloTest.java | 17 +++++++ test.client.yml | 23 +++++++++ 7 files changed, 175 insertions(+) create mode 100644 azure-pipelines.client.yml create mode 100644 pom.client.xml create mode 100644 template/client/README.md create mode 100644 template/client/pom.xml create mode 100644 template/client/src/main/java/com/microsoft/azure/template/Hello.java create mode 100644 template/client/src/test/java/com/microsoft/azure/template/HelloTest.java create mode 100644 test.client.yml diff --git a/azure-pipelines.client.yml b/azure-pipelines.client.yml new file mode 100644 index 000000000000..93c74ab5f6b1 --- /dev/null +++ b/azure-pipelines.client.yml @@ -0,0 +1,51 @@ +trigger: +- master + +jobs: +- template: test.client.yml + parameters: + name: Linux + vmImage: 'ubuntu-16.04' + +- template: test.client.yml + parameters: + name: macOS + vmImage: 'macOS-10.13' + +- template: test.client.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.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' diff --git a/pom.client.xml b/pom.client.xml new file mode 100644 index 000000000000..d7d3eab86ba5 --- /dev/null +++ b/pom.client.xml @@ -0,0 +1,44 @@ + + 4.0.0 + com.microsoft.azure + azure-sdk-parent + pom + 1.0-SNAPSHOT + + Microsoft Azure SDK Parent + This package contains the parent module of Microsoft Azure SDK. + https://github.com/Azure/azure-sdk-for-java + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + true + true + -Xlint:unchecked + + + + + + + + + junit + junit + 4.12 + test + + + + + + ./template/client + + diff --git a/template/client/README.md b/template/client/README.md new file mode 100644 index 000000000000..97562a72e63e --- /dev/null +++ b/template/client/README.md @@ -0,0 +1,3 @@ +# Azure Template + +This project provides a starter template for a Java client package. diff --git a/template/client/pom.xml b/template/client/pom.xml new file mode 100644 index 000000000000..68c4478902db --- /dev/null +++ b/template/client/pom.xml @@ -0,0 +1,25 @@ + + 4.0.0 + + + com.microsoft.azure + azure-sdk-parent + 1.0-SNAPSHOT + ../../pom.client.xml + + + azure-sdk-template + jar + + Microsoft Azure SDK for Template + This package contains Microsoft Azure SDK for Template. + + + + junit + junit + test + + + diff --git a/template/client/src/main/java/com/microsoft/azure/template/Hello.java b/template/client/src/main/java/com/microsoft/azure/template/Hello.java new file mode 100644 index 000000000000..a8d495a8abd3 --- /dev/null +++ b/template/client/src/main/java/com/microsoft/azure/template/Hello.java @@ -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"; + } +} diff --git a/template/client/src/test/java/com/microsoft/azure/template/HelloTest.java b/template/client/src/test/java/com/microsoft/azure/template/HelloTest.java new file mode 100644 index 000000000000..0bcf2265d0ae --- /dev/null +++ b/template/client/src/test/java/com/microsoft/azure/template/HelloTest.java @@ -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()); + } +} diff --git a/test.client.yml b/test.client.yml new file mode 100644 index 000000000000..01d0ea7ca09f --- /dev/null +++ b/test.client.yml @@ -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.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' From 16808a5caf78904b728bd4574c13f1ed24e9b9d9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Fri, 9 Nov 2018 14:08:51 -0800 Subject: [PATCH 2/4] Move pipelines yml files into folder --- test.client.yml => .azure-pipelines/client.test.yml | 0 azure-pipelines.client.yml => .azure-pipelines/client.yml | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename test.client.yml => .azure-pipelines/client.test.yml (100%) rename azure-pipelines.client.yml => .azure-pipelines/client.yml (92%) diff --git a/test.client.yml b/.azure-pipelines/client.test.yml similarity index 100% rename from test.client.yml rename to .azure-pipelines/client.test.yml diff --git a/azure-pipelines.client.yml b/.azure-pipelines/client.yml similarity index 92% rename from azure-pipelines.client.yml rename to .azure-pipelines/client.yml index 93c74ab5f6b1..c96e10f86998 100644 --- a/azure-pipelines.client.yml +++ b/.azure-pipelines/client.yml @@ -2,17 +2,17 @@ trigger: - master jobs: -- template: test.client.yml +- template: client.test.yml parameters: name: Linux vmImage: 'ubuntu-16.04' -- template: test.client.yml +- template: client.test.yml parameters: name: macOS vmImage: 'macOS-10.13' -- template: test.client.yml +- template: client.test.yml parameters: name: Windows vmImage: 'vs2017-win2016' From 84801372607caa14d5c7a481ba01487a6b2e2a5a Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Mon, 12 Nov 2018 16:23:54 -0800 Subject: [PATCH 3/4] Use inheritance-aggregator model (#2589) --- pom.client.build.xml | 22 ++++++++++++++++++++++ pom.client.xml | 3 --- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 pom.client.build.xml diff --git a/pom.client.build.xml b/pom.client.build.xml new file mode 100644 index 000000000000..d0a1dc8c2df8 --- /dev/null +++ b/pom.client.build.xml @@ -0,0 +1,22 @@ + + 4.0.0 + + com.microsoft.azure + azure-sdk-parent + 1.0-SNAPSHOT + ./pom.client.xml + + + azure-sdk-parent-build + ${parent.version} + pom + + Microsoft Azure SDK Build + This package bundles all the SDKs in a multi-module for build/CI purposes. + https://github.com/Azure/azure-sdk-for-java + + + ./template/client + + diff --git a/pom.client.xml b/pom.client.xml index d7d3eab86ba5..60222bd17f4f 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -38,7 +38,4 @@ - - ./template/client - From fa04ed4be185c99e072714447f2ba087435628ec Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 12 Nov 2018 16:27:40 -0800 Subject: [PATCH 4/4] Update azure pipelines to use pom.client.build.xml --- .azure-pipelines/client.test.yml | 2 +- .azure-pipelines/client.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/client.test.yml b/.azure-pipelines/client.test.yml index 01d0ea7ca09f..24b2a548f732 100644 --- a/.azure-pipelines/client.test.yml +++ b/.azure-pipelines/client.test.yml @@ -12,7 +12,7 @@ jobs: - task: Maven@3 displayName: 'Run tests' inputs: - mavenPomFile: 'pom.client.xml' + 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' diff --git a/.azure-pipelines/client.yml b/.azure-pipelines/client.yml index c96e10f86998..c59bead812dc 100644 --- a/.azure-pipelines/client.yml +++ b/.azure-pipelines/client.yml @@ -30,7 +30,7 @@ jobs: steps: - task: Maven@3 inputs: - mavenPomFile: 'pom.client.xml' + 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'