diff --git a/.travis.yml b/.travis.yml index 7c6423f5079cc..05c26fa53735e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,6 @@ android: - extra-android-m2repository sudo: false script: - - mvn clean package + - mvn clean install + - mvn checkstyle:check - cd ./azure-android-client-authentication && ./gradlew check diff --git a/azure-client-authentication/build.gradle b/azure-client-authentication/build.gradle index b183d677e4a54..2b40ada004e0e 100644 --- a/azure-client-authentication/build.gradle +++ b/azure-client-authentication/build.gradle @@ -13,9 +13,10 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { diff --git a/azure-client-runtime/build.gradle b/azure-client-runtime/build.gradle index e8a50ca112428..5c29359536abc 100644 --- a/azure-client-runtime/build.gradle +++ b/azure-client-runtime/build.gradle @@ -13,10 +13,10 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - toolVersion = "6.9" - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java index 56f377008512e..f6eaecdb44676 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java @@ -13,6 +13,12 @@ import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.ServiceResponseWithHeaders; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Response; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Url; import java.io.IOException; import java.lang.reflect.Type; @@ -22,13 +28,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Response; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Url; - /** * An instance of this class defines a ServiceClient that handles polling and * retrying for long running operations when accessing Azure resources. @@ -288,8 +287,7 @@ public ServiceResponse getPostOrDeleteResult(Response respo } // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { throw new CloudException("Async operation failed"); } @@ -778,7 +776,7 @@ class PutPatchPollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.url = url; @@ -835,7 +833,7 @@ class PostDeletePollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.clientCallback = clientCallback; @@ -867,8 +865,7 @@ public void run() { } } else { // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { clientCallback.failure(new ServiceException("Async operation failed")); } else { clientCallback.success(new ServiceResponse<>(pollingState.getResource(), pollingState.getResponse())); diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java index f501163ff03e0..a88a044f751e7 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java @@ -9,6 +9,8 @@ import com.microsoft.rest.RestException; +import javax.xml.bind.DataBindingException; +import javax.xml.ws.WebServiceException; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -17,9 +19,6 @@ import java.util.ListIterator; import java.util.NoSuchElementException; -import javax.xml.bind.DataBindingException; -import javax.xml.ws.WebServiceException; - /** * Defines a list response from a paging operation. The pages are * lazy initialized when an instance of this class is iterated. @@ -128,7 +127,7 @@ private class ListItr implements ListIterator { * * @param index the position in the list to start. */ - public ListItr(int index) { + ListItr(int index) { itemsListItr = items.listIterator(index); } diff --git a/build-tools/pom.xml b/build-tools/pom.xml new file mode 100644 index 0000000000000..d540f8f5e6980 --- /dev/null +++ b/build-tools/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + autorest-build-tools + jar + + Build tools for AutoRest client runtime for Java + This package contains the build tools for AutoRest generated Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + diff --git a/build-tools/src/main/resources/checkstyle.xml b/build-tools/src/main/resources/checkstyle.xml new file mode 100644 index 0000000000000..d156ff63e65f6 --- /dev/null +++ b/build-tools/src/main/resources/checkstyle.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build-tools/src/main/resources/suppressions.xml b/build-tools/src/main/resources/suppressions.xml new file mode 100644 index 0000000000000..690bb7a9fc35f --- /dev/null +++ b/build-tools/src/main/resources/suppressions.xml @@ -0,0 +1,36 @@ + + + + + + + + + \ No newline at end of file diff --git a/client-runtime/build.gradle b/client-runtime/build.gradle index 2558fc5055f9a..a163e9a9f89f1 100644 --- a/client-runtime/build.gradle +++ b/client-runtime/build.gradle @@ -15,10 +15,10 @@ group = 'com.microsoft.rest' version = '1.0.0-SNAPSHOT' checkstyle { - toolVersion = "6.9" - configFile = new File("$rootDir/Tools/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/Tools/checkstyle"] - reportsDir = new File("$rootDir/Tools/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { diff --git a/pom.xml b/pom.xml index b6bb0bb29b042..51a8ab8ffdcc5 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,6 @@ UTF-8 - playback @@ -143,6 +142,29 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + + com.microsoft.azure + autorest-build-tools + 1.0.0-SNAPSHOT + + + com.puppycrawl.tools + checkstyle + 6.18 + + + + checkstyle.xml + samedir=build-tools/src/main/resources + suppressions.xml + + + org.apache.maven.plugins maven-compiler-plugin @@ -172,12 +194,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.17 - - org.apache.maven.plugins maven-resources-plugin @@ -195,9 +211,6 @@ **/*Tests.java **/*TestCase.java - - ${testMode} - @@ -209,8 +222,9 @@ - ./client-runtime - ./azure-client-runtime - ./azure-client-authentication + build-tools + client-runtime + azure-client-runtime + azure-client-authentication