Skip to content

Commit

Permalink
Merge pull request #57 from palantir/pl/jakarta
Browse files Browse the repository at this point in the history
Migrate to jakarta
  • Loading branch information
rustyhectors authored Oct 2, 2023
2 parents 11a3e0b + 113b3b9 commit cf66729
Show file tree
Hide file tree
Showing 23 changed files with 329 additions and 159 deletions.
148 changes: 148 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# This file was generated by the excavator check 'excavator/manage-circleci' as specified in .circleci/template.sh.
# To request a modification to the general template, file an issue on Excavator.
# To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file.

version: 2.1
jobs:

check:
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- checkout
- run:
name: delete_unrelated_tags
command: |
ALL_TAGS=$(git tag --points-at HEAD)
if [ -z "$ALL_TAGS" ]; then
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
exit 0
fi
if [ -z "${CIRCLE_TAG:+x}" ]; then
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
exit 0
fi
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
if [ -z "$TAGS_TO_DELETE" ]; then
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
exit 0
fi
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- run:
name: check-setup
command: |
if [ -x .circleci/check-setup.sh ]; then
echo "Running check-setup" && .circleci/check-setup.sh && echo "check-setup complete"
fi
- run: ./gradlew --parallel --stacktrace --continue --max-workers=2 check -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
- persist_to_workspace:
root: /home/circleci
paths: [ project ]
- save_cache:
key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
paths: [ ~/.gradle/wrapper ]
- save_cache:
key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- run:
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
when: always
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }

trial-publish:
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
resource_class: medium
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- checkout
- run:
name: delete_unrelated_tags
command: |
ALL_TAGS=$(git tag --points-at HEAD)
if [ -z "$ALL_TAGS" ]; then
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
exit 0
fi
if [ -z "${CIRCLE_TAG:+x}" ]; then
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
exit 0
fi
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
if [ -z "$TAGS_TO_DELETE" ]; then
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
exit 0
fi
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- run: ./gradlew --stacktrace publishToMavenLocal -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
- run:
command: git status --porcelain
when: always
- save_cache:
key: 'trial-publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }

publish:
docker: [{ image: 'cimg/openjdk:11.0.10-node' }]
resource_class: medium
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2g --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- attach_workspace: { at: /home/circleci }
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- deploy:
command: ./gradlew --parallel --stacktrace --continue publish -Porg.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_11_HOME,JAVA_15_HOME,JAVA_17_HOME,JAVA_HOME
- run:
command: git status --porcelain
when: always
- save_cache:
key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }


workflows:
version: 2
build:
jobs:
- check:
filters: { tags: { only: /.*/ } }

- trial-publish:
filters: { branches: { ignore: develop } }

- publish:
requires: [ check, trial-publish ]
filters: { tags: { only: /.*/ }, branches: { only: develop } }
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea/

.gradle
**/*.classpath
**/*.project
Expand Down
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ For example for these Java files:
``` java
package com.palantir.code.ts.generator.examples;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Path("/myservice")
public interface MyService {
Expand Down
47 changes: 41 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,53 @@
buildscript {
repositories {
jcenter()
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}

dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:${bintrayPlugin}"
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.5.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.33.0'
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.11.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.15.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:3.0.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.12.0'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.35.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
constraints {
classpath('org.apache.logging.log4j:log4j-core:2.17.1'){ because 'Avoid vulnerable versions of log4j' }
}
}
}

plugins {
id 'com.palantir.git-version' version '0.4.0'
}
apply plugin: 'com.palantir.git-version'
apply plugin: 'com.palantir.consistent-versions'
apply plugin: 'com.palantir.external-publish'
apply plugin: 'com.palantir.jdks.latest'

version gitVersion()

allprojects {
apply plugin: 'java-library'
apply plugin: 'com.palantir.java-format'
apply plugin: 'org.inferred.processors'
apply plugin: 'com.palantir.jakarta-package-alignment'

version rootProject.version
group 'com.palantir.ts'
version gitVersion()

repositories {
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}


tasks.withType(JavaCompile) {
options.compilerArgs += ['-Werror']
}

tasks.check.dependsOn javadoc
}

javaVersions {
libraryTarget = 11
}

22 changes: 3 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# build script
bintrayPlugin=1.4

# compile
guavaVersion=18.0
feignVersion=8.10.0
jacksonVersion=2.6.1
jaxRsVersion=2.0.1
typescriptGeneratorVersion=1.26.333
commonsIOVersion=2.4
findbugsAnnotationsVersion=3.0.0

# test compile
junitVersion=4.12
mockitoVersion=1.10.19
lang3Version=3.4

# processors
immutablesVersion=2.1.8
org.gradle.caching = true
org.gradle.parallel = true
org.gradle.jvmargs = --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
7 changes: 0 additions & 7 deletions gradle/java.gradle

This file was deleted.

46 changes: 0 additions & 46 deletions gradle/publish.gradle

This file was deleted.

4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 02 17:27:17 PDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-2.9-bin.zip
33 changes: 18 additions & 15 deletions typescript-service-generator-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
plugins {
id "org.inferred.processors" version "1.1.5"
}

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/publish.gradle"
apply plugin: 'com.palantir.external-publish-jar'

dependencies {
compile "cz.habarta.typescript-generator:typescript-generator-core:${typescriptGeneratorVersion}"
compile "com.google.guava:guava:${guavaVersion}"
compile "javax.ws.rs:javax.ws.rs-api:${jaxRsVersion}"
compile "commons-io:commons-io:${commonsIOVersion}"
compile "org.apache.commons:commons-lang3:${lang3Version}"
compile "com.google.code.findbugs:annotations:${findbugsAnnotationsVersion}"
api "com.google.guava:guava"
api "cz.habarta.typescript-generator:typescript-generator-core"
api "jakarta.ws.rs:jakarta.ws.rs-api"
api "commons-io:commons-io"
api "org.apache.commons:commons-lang3"
api "com.google.code.findbugs:jsr305"

annotationProcessor "org.immutables:value"
testAnnotationProcessor "org.immutables:value"

testImplementation "junit:junit"
testImplementation "org.mockito:mockito-core"

processor "org.immutables:value:${immutablesVersion}"
compileOnly 'org.immutables:value::annotations'
testCompileOnly 'org.immutables:value::annotations'

testCompile "junit:junit:${junitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
test {
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
}
}
Loading

0 comments on commit cf66729

Please sign in to comment.