This commit is contained in:
Grahame Grieve 2020-06-26 06:05:25 +10:00
commit c6e424d50d
6 changed files with 557 additions and 704 deletions

View File

@ -1,18 +1,23 @@
# HAPI FHIR - HL7 FHIR Core Artifacts # HAPI FHIR - HL7 FHIR Core Artifacts
### CI/CD | CI Status (master) |
| master Branch CI | SNAPSHOT Publisher | | :---: |
| :---: | :---: | | [![Build Status][Badge-BuildPipeline]][Link-BuildPipeline] |
| [![Build Status][Badge-BuildPipeline]][Link-BuildPipeline] | [![Build Status][Badge-SnapshotPipeline]][Link-SnapshotPipeline] |
All intergration and delivery done on Azure pipelines. Every successful merge to master branch will result in a new SNAPSHOT build being published to Sonatype. Azure project can be viewed [here][Link-AzureProject]. ### CI/CD
All intergration and delivery done on Azure pipelines. Azure project can be viewed [here][Link-AzureProject].
### Current Versions ### Current Versions
| Project | Latest SNAPSHOT | Current Release | | Project | Current Release | Latest SNAPSHOT |
| :---: | :---: | :---: | | :---: | :---: | :---: |
| org.hl7.fhir.validation.cli | [![Snapshot Artifact][Badge-cliSonatypeSnapshot]][Link-cliSonatypeSnapshot] | [![Release Artifacts][Badge-cliSonatypeRelease]][Link-cliSonatypeRelease] | | org.hl7.fhir.validation.cli | [![Release Artifacts][Badge-r4SonatypeRelease]][Link-cliSonatypeRelease] | [![Snapshot Artifact][Badge-cliSonatypeSnapshot]][Link-cliSonatypeSnapshot] |
| org.hl7.fhir.r4 | [![Snapshot Artifact][Badge-r4SonatypeSnapshot]][Link-r4SonatypeSnapshot] | [![Release Artifacts][Badge-r4SonatypeRelease]][Link-r4SonatypeRelease] | | org.hl7.fhir.validation | [![Release Artifacts][Badge-validationSonatypeRelease]][Link-validationSonatypeRelease] | [![Snapshot Artifact][Badge-validationSonatypeSnapshot]][Link-validationSonatypeSnapshot] |
| org.hl7.fhir.r5 | [![Snapshot Artifact][Badge-r5SonatypeSnapshot]][Link-r5SonatypeSnapshot] | [![Release Artifacts][Badge-r5SonatypeRelease]][Link-r5SonatypeRelease] | | org.hl7.fhir.dstu2 | [![Release Artifacts][Badge-dstu2SonatypeRelease]][Link-dstu2SonatypeRelease] | [![Snapshot Artifact][Badge-dstu2SonatypeSnapshot]][Link-dstu2SonatypeSnapshot] |
| org.hl7.fhir.dstu2016may | [![Release Artifacts][Badge-dstu2016maySonatypeRelease]][Link-dstu2016maySonatypeRelease] | [![Snapshot Artifact][Badge-dstu2016maySonatypeSnapshot]][Link-dstu2016maySonatypeSnapshot] |
| org.hl7.fhir.dstu3 | [![Release Artifacts][Badge-dstu3SonatypeRelease]][Link-dstu3SonatypeRelease] | [![Snapshot Artifact][Badge-dstu3SonatypeSnapshot]][Link-dstu3SonatypeSnapshot] |
| org.hl7.fhir.r4 | [![Release Artifacts][Badge-r4SonatypeRelease]][Link-r4SonatypeRelease] | [![Snapshot Artifact][Badge-r4SonatypeSnapshot]][Link-r4SonatypeSnapshot] |
| org.hl7.fhir.r5 | [![Release Artifacts][Badge-r5SonatypeRelease]][Link-r5SonatypeRelease] | [![Snapshot Artifact][Badge-r5SonatypeSnapshot]][Link-r5SonatypeSnapshot] |
### Building this Project ### Building this Project
This project uses [Apache Maven](http://maven.apache.org) to build. To build: This project uses [Apache Maven](http://maven.apache.org) to build. To build:
@ -25,6 +30,11 @@ To skip unit tests:
``` ```
mvn -Dmaven.test.skip install mvn -Dmaven.test.skip install
``` ```
### Publishing Binaries
An brief overview of our publishing process is [here][Link-Publishing].
For more detailed instructions on cutting a release, please read [the wiki][Link-PublishingRelease]
### Download ### Download
##### org.hl7.fhir.validation.cli ##### org.hl7.fhir.validation.cli
@ -42,6 +52,36 @@ mvn -Dmaven.test.skip install
compile group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.validation.cli', version: '(latest version)' compile group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.validation.cli', version: '(latest version)'
``` ```
##### org.hl7.fhir.dstu2
###### Maven
```xml
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>(latest version)</version>
</dependency>
```
###### Gradle
```groovy
compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-dstu2', version: '(latest version)'
```
##### org.hl7.fhir.dstu3
###### Maven
```xml
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>(latest version)</version>
</dependency>
```
###### Gradle
```groovy
compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-dstu3', version: '(latest version)'
```
##### org.hl7.fhir.r4 ##### org.hl7.fhir.r4
###### Maven ###### Maven
```xml ```xml
@ -76,24 +116,41 @@ compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r5', version: '(l
This project is maintained by [Grahame Grieve][Link-grahameGithub] and [James Agnew][Link-jamesGithub] on behalf of the FHIR community. This project is maintained by [Grahame Grieve][Link-grahameGithub] and [James Agnew][Link-jamesGithub] on behalf of the FHIR community.
[Link-AzureProject]: https://dev.azure.com/fhir-pipelines/fhir-core-library [Link-AzureProject]: https://dev.azure.com/fhir-pipelines/fhir-core-library
[Link-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=16&branchName=master [Link-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=29&branchName=master
[Link-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=17&branchName=master [Link-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=17&branchName=master
[Link-dstu2SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu2&v=LATEST "Sonatype Snapshot"
[Link-dstu2SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu2&v=LATEST "Sonatype Release"
[Link-dstu2016maySonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu2016may&v=LATEST "Sonatype Snapshot"
[Link-dstu2016maySonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu2016may&v=LATEST "Sonatype Release"
[Link-dstu3SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu3&v=LATEST "Sonatype Snapshot"
[Link-dstu3SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.dstu3&v=LATEST "Sonatype Release"
[Link-r4SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Snapshot" [Link-r4SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Snapshot"
[Link-r4SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Release" [Link-r4SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Release"
[Link-r5SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Snapshot" [Link-r5SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Snapshot"
[Link-r5SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Release" [Link-r5SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Release"
[Link-cliSonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=LATEST "Sonatype Snapshot" [Link-cliSonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=LATEST "Sonatype Snapshot"
[Link-cliSonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=LATEST "Sonatype Release" [Link-cliSonatypeRelease]: https://github.com/hapifhir/org.hl7.fhir.core/releases/latest/download/validator_cli.jar
[Link-validationSonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation&v=LATEST "Sonatype Snapshot"
[Link-validationSonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation&v=LATEST "Sonatype Release"
[Link-grahameGithub]: https://github.com/grahamegrieve [Link-grahameGithub]: https://github.com/grahamegrieve
[Link-jamesGithub]: https://github.com/jamesagnew [Link-jamesGithub]: https://github.com/jamesagnew
[Link-Publishing]: https://github.com/FHIR/fhir-test-cases/wiki/Publishing-Binaries
[Link-PublishingRelease]: https://github.com/FHIR/fhir-test-cases/wiki/Detailed-Release-Instructions
[Badge-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Build%20%26%20Test?branchName=master
[Badge-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Master%20Branch%20Pipeline?branchName=master
[Badge-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Module%20SNAPSHOT%20Publisher?branchName=master [Badge-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Module%20SNAPSHOT%20Publisher?branchName=master
[Badge-dstu2SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu2.svg "Sonatype Releases"
[Badge-dstu2SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu2.svg "Sonatype Snapshots"
[Badge-dstu2016maySonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu2016may.svg "Sonatype Releases"
[Badge-dstu2016maySonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu2016may.svg "Sonatype Snapshots"
[Badge-dstu3SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu3.svg "Sonatype Releases"
[Badge-dstu3SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.dstu3.svg "Sonatype Snapshots"
[Badge-r4SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Releases" [Badge-r4SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Releases"
[Badge-r4SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Snapshots" [Badge-r4SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Snapshots"
[Badge-r5SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Releases" [Badge-r5SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Releases"
[Badge-r5SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Snapshots" [Badge-r5SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Snapshots"
[Badge-cliSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Releases" [Badge-cliSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Releases"
[Badge-cliSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Snapshots" [Badge-cliSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Snapshots"
[Badge-validationSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Releases"
[Badge-validationSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.svg "Sonatype Snapshots"

View File

@ -1,105 +0,0 @@
trigger: none
pr: none
# Different users have different machine setups, we run the build three times, on ubuntu, osx, and windows
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: "macos-10.15"
windows:
imageName: "windows-2019"
maxParallel: 3
pool:
vmImage: $(imageName)
variables:
currentImage: $(imageName)
codecov: $(CODECOV_TOKEN)
VERSION:
steps:
# This task pulls the <version> value from the org.hl7.fhir.r5 project pom.xml file. All modules are released as
# the same version, at the same time, as defined in the root level pom.xml.
- task: PowerShell@2
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
inputs:
targetType: 'inline'
script: |
[xml]$pomXml = Get-Content -Path .\pom.xml
# version
Write-Host $pomXml.project.version
$version=$pomXml.project.version
Write-Host "##vso[task.setvariable variable=version]$version"
# Prints out the build version, for debugging purposes
- bash: echo Pulled version from pom.xml => $(version)
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
# Azure pipelines cannot pass variables between pipelines, but it can pass files, so we
# pass the build id (ex: 1.1.13-SNAPSHOT) as a string in a file.
# This is used in the release pipeline, so we create it here.
# This is only done for the release branch.
- bash: |
echo $(version)
VERSION=$(version)
echo "$VERSION" > $(System.DefaultWorkingDirectory)/VERSION
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
# Copies the VERSION file containing the build id (ex: 1.1.13-SNAPSHOT) to the staging directory
# This is done for release versions only.
- task: CopyFiles@2
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(System.Defaultworkingdirectory)'
Contents: "$(System.DefaultWorkingDirectory)/VERSION"
TargetFolder: '$(build.artifactstagingdirectory)'
# Runs 'mvn clean package'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
# Upload test results to codecov
- script: bash <(curl https://codecov.io/bash) -t $(codecov)
displayName: 'codecov Bash Uploader'
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
# Publishes the test results to build artifacts.
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results '
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/'
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
# Publishes the built Validator jar to build artifacts. Primarily for testing and debugging builds.
- task: PublishPipelineArtifact@1
displayName: 'Publish Validator jar'
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
inputs:
targetPath: "$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/target/org.hl7.fhir.validation-$(version).jar"
artifactName: Validator
# Publishes the files we've moved into the staging directory, so they can be accessed by the
# release pipeline. You will notice that we only do this for the ubuntu build, as doing it
# for each of the three release pipelines will cause conflicts.
# This is done for release versions only.
- task: PublishBuildArtifacts@1
condition: and(eq(variables.currentImage, 'ubuntu-latest'), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
displayName: 'Publish Build Artifacts'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'

View File

@ -81,5 +81,5 @@ steps:
inputs: inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml' mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: deploy goals: deploy
options: '--settings $(System.DefaultWorkingDirectory)/settings.xml' options: '--settings $(System.DefaultWorkingDirectory)/settings.xml -Pdeploy'
publishJUnitResults: false publishJUnitResults: false

View File

@ -1,86 +0,0 @@
# This pipeline produces a SNAPSHOT build for each of the sub modules in
# the core library, and publishes them to ossrh.
trigger: none
pr: none
pool:
vmImage: "ubuntu-16.04"
variables:
currentModule: $(module)
steps:
# Signing, for now, occurs for all builds, SNAPSHOT or release. So we need a valid
# signing key. The next two steps download the public and private keys from the
# secure library files.
- task: DownloadSecureFile@1
displayName: 'Download public key.'
inputs:
secureFile: public.key
- task: DownloadSecureFile@1
displayName: 'Download private key.'
inputs:
secureFile: private.key
# Import both the private and public keys into gpg for signing.
- bash: |
gpg --import --no-tty --batch --yes $(Agent.TempDirectory)/public.key
gpg --import --no-tty --batch --yes $(Agent.TempDirectory)/private.key
gpg --list-keys --keyid-format LONG
gpg --list-secret-keys --keyid-format LONG
displayName: 'Import signing keys.'
# For creating the snapshot release with maven, we need to build a fake settings.xml
# for it to read from. This is done for the master branch merges only.
- bash: |
cat >$(System.DefaultWorkingDirectory)/settings.xml <<EOL
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>$(SONATYPE_USER)</username>
<password>$(SONATYPE_PASS)</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>$(SONATYPE_USER)</username>
<password>$(SONATYPE_PASS)</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>$(SONATYPE_USER)</username>
<password>$(SONATYPE_PASS)</password>
</server>
<server>
<id>$(PGP_KEYNAME)</id>
<passphrase>$(PGP_PASSPHRASE)</passphrase>
</server>
</servers>
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.keyname>$(PGP_KEYNAME)</gpg.keyname>
</properties>
</profile>
</profiles>
</settings>
EOL
displayName: 'Create .mvn/settings.xml'
# Deploy the SNAPSHOT artifact to sonatype nexus.
# This is done for the master branch merges only.
- task: Maven@3
displayName: 'Deploy $(module) to Sonatype staging'
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: deploy
options: '--settings $(System.DefaultWorkingDirectory)/settings.xml'
publishJUnitResults: false

View File

@ -30,10 +30,10 @@ package org.hl7.fhir.utilities;
*/ */
import org.apache.commons.io.FileUtils;
import org.hl7.fhir.exceptions.FHIRException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -42,7 +42,6 @@ import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -50,27 +49,18 @@ import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.hl7.fhir.exceptions.FHIRException;
import net.sf.saxon.TransformerFactoryImpl;
import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isBlank;
public class Utilities { public class Utilities {
// private static final String TOKEN_REGEX = "^a-z[A-Za-z0-9]*$";
private static final String OID_REGEX = "[0-2](\\.(0|[1-9][0-9]*))+"; private static final String OID_REGEX = "[0-2](\\.(0|[1-9][0-9]*))+";
/** /**
* Returns the plural form of the word in the string. * Returns the plural form of the word in the string.
* * <p>
* Examples: * Examples:
* *
* <pre> * <pre>
@ -81,12 +71,11 @@ public class Utilities {
* inflector.pluralize(&quot;the blue mailman&quot;) #=&gt; &quot;the blue mailmen&quot; * inflector.pluralize(&quot;the blue mailman&quot;) #=&gt; &quot;the blue mailmen&quot;
* inflector.pluralize(&quot;CamelOctopus&quot;) #=&gt; &quot;CamelOctopi&quot; * inflector.pluralize(&quot;CamelOctopus&quot;) #=&gt; &quot;CamelOctopi&quot;
* </pre> * </pre>
* * <p>
* * <p>
* * <p>
* Note that if the {@link Object#toString()} is called on the supplied object, so this method works for non-strings, too. * Note that if the {@link Object#toString()} is called on the supplied object, so this method works for non-strings, too.
* *
*
* @param word the word that is to be pluralized. * @param word the word that is to be pluralized.
* @return the pluralized form of the word, or the word itself if it could not be pluralized * @return the pluralized form of the word, or the word itself if it could not be pluralized
* @see #singularize(Object) * @see #singularize(Object)
@ -285,8 +274,7 @@ public class Utilities {
return b.toString(); return b.toString();
} }
public static String capitalize(String s) public static String capitalize(String s) {
{
if (s == null) return null; if (s == null) return null;
if (s.length() == 0) return s; if (s.length() == 0) return s;
if (s.length() == 1) return s.toUpperCase(); if (s.length() == 1) return s.toUpperCase();
@ -332,8 +320,7 @@ public class Utilities {
source = new FileInputStream(sourceFile).getChannel(); source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel(); destination = new FileOutputStream(destFile).getChannel();
destination.transferFrom(source, 0, source.size()); destination.transferFrom(source, 0, source.size());
} } finally {
finally {
if (source != null) { if (source != null) {
source.close(); source.close();
} }
@ -344,8 +331,7 @@ public class Utilities {
} }
public static boolean checkFolder(String dir, List<String> errors) public static boolean checkFolder(String dir, List<String> errors)
throws IOException throws IOException {
{
if (!new CSFile(dir).exists()) { if (!new CSFile(dir).exists()) {
errors.add("Unable to find directory " + dir); errors.add("Unable to find directory " + dir);
return false; return false;
@ -355,8 +341,7 @@ public class Utilities {
} }
public static boolean checkFile(String purpose, String dir, String file, List<String> errors) public static boolean checkFile(String purpose, String dir, String file, List<String> errors)
throws IOException throws IOException {
{
if (!new CSFile(dir + file).exists()) { if (!new CSFile(dir + file).exists()) {
if (errors != null) if (errors != null)
errors.add("Unable to find " + purpose + " file " + file + " in " + dir); errors.add("Unable to find " + purpose + " file " + file + " in " + dir);
@ -424,8 +409,7 @@ public class Utilities {
return name + ext; return name + ext;
} }
public static String cleanupTextString( String contents ) public static String cleanupTextString(String contents) {
{
if (contents == null || contents.trim().equals("")) if (contents == null || contents.trim().equals(""))
return null; return null;
else else
@ -438,8 +422,6 @@ public class Utilities {
} }
public static void bytesToFile(byte[] content, String filename) throws IOException { public static void bytesToFile(byte[] content, String filename) throws IOException {
FileOutputStream out = new FileOutputStream(filename); FileOutputStream out = new FileOutputStream(filename);
out.write(content); out.write(content);
@ -448,7 +430,6 @@ public class Utilities {
} }
public static String appendSlash(String definitions) { public static String appendSlash(String definitions) {
return definitions.endsWith(File.separator) ? definitions : definitions + File.separator; return definitions.endsWith(File.separator) ? definitions : definitions + File.separator;
} }
@ -466,8 +447,7 @@ public class Utilities {
} }
public static String systemEol() public static String systemEol() {
{
return System.getProperty("line.separator"); return System.getProperty("line.separator");
} }
@ -667,7 +647,6 @@ public class Utilities {
} }
// public static void checkCase(String filename) { // public static void checkCase(String filename) {
// File f = new CSFile(filename); // File f = new CSFile(filename);
// if (!f.getName().equals(filename)) // if (!f.getName().equals(filename))
@ -794,7 +773,6 @@ public class Utilities {
} }
public static String normalize(String s) { public static String normalize(String s) {
if (noString(s)) if (noString(s))
return null; return null;
@ -1013,8 +991,6 @@ public class Utilities {
} }
public static boolean isOid(String cc) { public static boolean isOid(String cc) {
return cc.matches(OID_REGEX) && cc.lastIndexOf('.') >= 5; return cc.matches(OID_REGEX) && cc.lastIndexOf('.') >= 5;
} }
@ -1074,12 +1050,14 @@ public class Utilities {
if (in1 != null) { if (in1 != null) {
try { try {
in1.close(); in1.close();
} catch (IOException e) {} } catch (IOException e) {
}
} }
if (in2 != null) { if (in2 != null) {
try { try {
in2.close(); in2.close();
} catch (IOException e) {} } catch (IOException e) {
}
} }
} }
} }
@ -1309,5 +1287,4 @@ public class Utilities {
} }
} }

40
pom.xml
View File

@ -311,6 +311,29 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>deploy</id>
<build>
<plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
@ -329,21 +352,8 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins> </plugins>
</build> </build>
</profile>
</profiles>
</project> </project>