diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5578de72..16843e23 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,6 +10,14 @@ pool: vmImage: ubuntu-latest steps: +- script: | + git checkout $(Build.SourceBranchName) + git config --global user.name "Azure DevOps" + displayName: "git config" +- task: MavenAuthenticate@0 + displayName: 'authenticate maven' + inputs: + artifactsFeeds: bt - task: Gradle@2 inputs: workingDirectory: '' @@ -20,4 +28,20 @@ steps: jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/TEST-*.xml' - tasks: 'build' + tasks: 'clean test' +- task: Gradle@2 + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + inputs: + workingDirectory: '' + gradleWrapperFile: 'gradlew' + gradleOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + tasks: 'release -Prelease.useAutomaticVersion=true' +- task: PublishPipelineArtifact@1 + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + inputs: + targetPath: $(System.DefaultWorkingDirectory)/build/libs/$(artifactName) + artifactName: artifact + displayName: "publish build artifact" diff --git a/build.gradle b/build.gradle index bae122d2..f7c44b66 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,7 @@ buildscript { plugins { id("net.ltgt.errorprone") version "0.8.1" apply false + id 'net.researchgate.release' version '2.8.1' } configure(allprojects) { @@ -53,27 +54,13 @@ apply(from: "project.gradle"); group = "com.github.java-json-tools"; -ext.forRelease = !version.endsWith("-SNAPSHOT"); - /* * Repositories to use */ repositories { mavenCentral(); - if (!forRelease) { - maven { - url "https://oss.sonatype.org/content/repositories/snapshots" - } - } - /* Allow staging references for last pre-release testing. */ - if (project.properties.containsKey("sonatypeUsername")) { - maven { - url "https://oss.sonatype.org/service/local/staging/deploy/maven2" - credentials { - username = project.properties["sonatypeUsername"] - password = project.properties["sonatypePassword"] - } - } + maven { + url "https://pkgs.dev.azure.com/Gravity9Solutions/BT/_packaging/bt/maven/v1" } } @@ -117,15 +104,6 @@ allprojects { } } -/* - * Javadoc: we need to tell where the overview.html is, it will not pick it up - * automatically... - */ - -//javadoc { -// options.overview = "src/main/java/overview.html"; -//} - task javadocJar(type: Jar, dependsOn: javadoc) { classifier = "javadoc"; from javadoc.destinationDir; @@ -142,108 +120,4 @@ wrapper { distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"; } -task pom { - doLast { - pom {}.writeTo("${projectDir}/pom.xml"); - } -} - -/* - * SIGNING - */ - -project.ext { - scmUrl = sprintf("git@github.com:java-json-tools/%s.git", name); - projectURL = sprintf("https://github.com/java-json-tools/%s", name); - sonatypeStaging = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"; - sonatypeSnapshots = "https://oss.sonatype.org/content/repositories/snapshots/"; -}; - -task checkSigningRequirements { - doLast { - def requiredProperties = [ "sonatypeUsername", "sonatypePassword" ]; - def noDice = false; - requiredProperties.each { - if (project.properties[it] == null) { - noDice = true; - System.err.printf("property \"%s\" is not defined!\n", it); - } - } - if (noDice) - throw new IllegalStateException("missing required properties for " + - "upload"); - } -} - -uploadArchives { - dependsOn(checkSigningRequirements); - repositories { - mavenDeployer { - beforeDeployment { - MavenDeployment deployment -> signing.signPom(deployment); - } - - repository(url: "${sonatypeStaging}") { - authentication( - userName: project.properties["sonatypeUsername"], - password: project.properties["sonatypePassword"] - ); - } - - snapshotRepository(url: "${sonatypeSnapshots}") { - authentication( - userName: project.properties["sonatypeUsername"], - password: project.properties["sonatypePassword"] - ); - } - } - } -} - -/* - * Configure pom.xml on install, uploadArchives - */ -[ - install.repositories.mavenInstaller, - uploadArchives.repositories.mavenDeployer -]*.pom*.whenConfigured { pom -> - pom.project { - name "${project.name}"; - packaging "jar"; - description "${project.ext.description}"; - url "${projectURL}"; - - scm { - url "${scmUrl}"; - connection "${scmUrl}"; - developerConnection "scm:git:${scmUrl}"; - } - - licenses { - license { - name "Lesser General Public License, version 3 or greater"; - url "http://www.gnu.org/licenses/lgpl.html"; - distribution "repo"; - }; - license { - name "Apache Software License, version 2.0"; - url "http://www.apache.org/licenses/LICENSE-2.0"; - distribution "repo"; - } - } - - developers { - developer { - id "huggsboson"; - name "John Huffaker"; - email "jhuffaker+java-json-tools@gmail.com"; - } - } - } -} - -signing { - required { forRelease && gradle.taskGraph.hasTask("uploadArchives") }; - sign configurations.archives; -} diff --git a/project.gradle b/project.gradle index 19d30268..1d30a33e 100644 --- a/project.gradle +++ b/project.gradle @@ -21,7 +21,7 @@ * Project-specific settings. Unfortunately we cannot put the name in there! */ group = "com.github.java-json-tools"; -version = "2.0.0"; +version = "2.0.0-SNAPSHOT"; sourceCompatibility = JavaVersion.VERSION_1_7; targetCompatibility = JavaVersion.VERSION_1_7; // defaults to sourceCompatibility project.ext.description = "JSON Patch (RFC 6902) and JSON Merge Patch (RFC 7386) implementation in Java, using extended TMF620 JsonPath syntax";