Merge branch 'master' into issue-3175-doc-language-modules

This commit is contained in:
Juan Martín Sotuyo Dodero 2023-10-19 21:11:32 -03:00 committed by GitHub
commit 854d6e5c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
363 changed files with 10524 additions and 3143 deletions

View File

@ -2153,7 +2153,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/11549103?v=4",
"profile": "https://github.com/cyw3",
"contributions": [
"bug"
"bug",
"doc"
]
},
{
@ -7153,7 +7154,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/111259588?v=4",
"profile": "https://github.com/nwcm",
"contributions": [
"doc"
"doc",
"bug"
]
},
{
@ -7202,6 +7204,80 @@
"bug",
"code"
]
},
{
"login": "AndreyBozhko",
"name": "Andrey Bozhko",
"avatar_url": "https://avatars.githubusercontent.com/u/22246447?v=4",
"profile": "https://github.com/AndreyBozhko",
"contributions": [
"doc"
]
},
{
"login": "rcorfieldffdc",
"name": "Richard Corfield",
"avatar_url": "https://avatars.githubusercontent.com/u/42997936?v=4",
"profile": "https://github.com/rcorfieldffdc",
"contributions": [
"code"
]
},
{
"login": "m0rjc",
"name": "Richard Corfield",
"avatar_url": "https://avatars.githubusercontent.com/u/994206?v=4",
"profile": "https://github.com/m0rjc",
"contributions": [
"bug",
"code"
]
},
{
"login": "eant60",
"name": "eant60",
"avatar_url": "https://avatars.githubusercontent.com/u/41472980?v=4",
"profile": "https://github.com/eant60",
"contributions": [
"bug"
]
},
{
"login": "Marcono1234",
"name": "Marcono1234",
"avatar_url": "https://avatars.githubusercontent.com/u/11685886?v=4",
"profile": "https://github.com/Marcono1234",
"contributions": [
"bug"
]
},
{
"login": "eugenepugach",
"name": "eugenepugach",
"avatar_url": "https://avatars.githubusercontent.com/u/133967768?v=4",
"profile": "https://github.com/eugenepugach",
"contributions": [
"bug"
]
},
{
"login": "harbulot",
"name": "Bruno Harbulot",
"avatar_url": "https://avatars.githubusercontent.com/u/80994?v=4",
"profile": "http://blog.distributedmatter.net/",
"contributions": [
"bug"
]
},
{
"login": "shai-bennathan",
"name": "Shai Bennathan",
"avatar_url": "https://avatars.githubusercontent.com/u/62336907?v=4",
"profile": "https://github.com/shai-bennathan",
"contributions": [
"bug",
"code"
]
}
],
"contributorsPerLine": 7,

View File

@ -9,7 +9,7 @@ SCRIPT_INCLUDES="log.bash utils.bash setup-secrets.bash openjdk.bash maven.bash
source "$(dirname "$0")/inc/fetch_ci_scripts.bash" && fetch_ci_scripts
function build() {
pmd_ci_log_group_start "Prepare Java 8+11+17, Bundler"
pmd_ci_log_group_start "Prepare Java 8+11+17+21, Bundler"
pmd_ci_openjdk_install_adoptium 11
pmd_ci_openjdk_setdefault 11
PMD_MAVEN_EXTRA_OPTS=()
@ -18,7 +18,13 @@ function build() {
pmd_ci_openjdk_install_adoptium 8
pmd_ci_log_info "Install openjdk17 for integration tests and pmd-regression-tests"
pmd_ci_openjdk_install_adoptium 17
PMD_MAVEN_EXTRA_OPTS=(-Djava8.home="${HOME}/openjdk8" -Djava17.home="${HOME}/openjdk17")
pmd_ci_log_info "Install openjdk21 for integration tests and pmd-regression-tests"
pmd_ci_openjdk_install_adoptium 21
PMD_MAVEN_EXTRA_OPTS=(
-Djava8.home="${HOME}/openjdk8"
-Djava17.home="${HOME}/openjdk17"
-Djava21.home="${HOME}/openjdk21"
)
fi
pmd_ci_build_setup_bundler
pmd_ci_log_group_end
@ -100,7 +106,8 @@ function build() {
pmd_ci_build_and_upload_doc
pmd_ci_log_group_end
if pmd_ci_maven_isReleaseBuild; then
# release is published only for the case b) pmd-cli/pmd-dist release
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" == *-dist ]]; then
pmd_ci_log_group_start "Publishing Release"
pmd_ci_gh_releases_publishRelease "$GH_RELEASE"
pmd_ci_sourceforge_selectDefault "${PMD_CI_MAVEN_PROJECT_VERSION}"
@ -108,10 +115,14 @@ function build() {
pmd_ci_log_group_end
fi
# create a baseline for snapshot builds (when pmd-dist is built)
# or for release builds for case b) when pmd-cli/pmd-dist is released
if pmd_ci_maven_isSnapshotBuild || [[ "${PMD_CI_TAG}" == *-dist ]]; then
pmd_ci_log_group_start "Creating new baseline for regression tester"
regression_tester_setup_ci
regression_tester_uploadBaseline
pmd_ci_log_group_end
fi
#
# everything from here runs only on snapshots, not on release builds
@ -130,7 +141,7 @@ function build() {
-Dpmd.skip \
--show-version --errors --batch-mode \
clean package \
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar,cli-dist
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
pmd_ci_log_group_end
@ -146,7 +157,7 @@ function build() {
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
--show-version --errors --batch-mode \
clean package jacoco:report \
coveralls:report -Pcoveralls
coveralls:report -Pcoveralls,cli-dist
pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
pmd_ci_log_group_end
fi
@ -172,30 +183,58 @@ function pmd_ci_build_run() {
if pmd_ci_maven_isReleaseBuild; then
pmd_ci_log_info "This is a release build"
mvn_profiles="${mvn_profiles},pmd-release"
# There are two possible (release) builds:
if [[ "${PMD_CI_TAG}" != *-dist ]]; then
# a) pmd-core and languages modules
./mvnw clean deploy -P"${mvn_profiles}",'!cli-dist' --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
else
# b) pmd-cli and pmd-dist
./mvnw clean deploy -P"${mvn_profiles},cli-dist" -pl pmd-cli,pmd-dist --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
fi
else
pmd_ci_log_info "This is a snapshot build"
./mvnw clean deploy -P"${mvn_profiles},cli-dist" --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
fi
./mvnw clean deploy -P${mvn_profiles} --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
}
#
# Deploys the binary distribution
#
function pmd_ci_deploy_build_artifacts() {
# Deploy to sourceforge files https://sourceforge.net/projects/pmd/files/pmd/
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
# Deploy SBOM
cp pmd-dist/target/bom.xml "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
cp pmd-dist/target/bom.json "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
if pmd_ci_maven_isSnapshotBuild; then
# Deploy to sourceforge files https://sourceforge.net/projects/pmd/files/pmd/
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
# Deploy SBOM
cp pmd-dist/target/bom.xml "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
cp pmd-dist/target/bom.json "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
fi
if pmd_ci_maven_isReleaseBuild; then
# release build case a): only pmd-core and language modules released
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
# create a draft github release
pmd_ci_gh_releases_createDraftRelease "${PMD_CI_TAG}" "$(git rev-list -n 1 "${PMD_CI_TAG}")"
GH_RELEASE="$RESULT"
fi
# release build case b): pmd-cli and pmd-dist are released
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" == *-dist ]]; then
# Deploy to sourceforge files https://sourceforge.net/projects/pmd/files/pmd/
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
# Deploy SBOM
cp pmd-dist/target/bom.xml "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
cp pmd-dist/target/bom.json "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
# draft release has already been created
pmd_ci_gh_releases_getLatestDraftRelease
GH_RELEASE="$RESULT"
# Deploy to github releases
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
@ -215,7 +254,7 @@ function pmd_ci_build_and_upload_doc() {
pmd_doc_create_archive
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
if pmd_ci_maven_isReleaseBuild; then
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
fi
@ -224,19 +263,21 @@ function pmd_ci_build_and_upload_doc() {
# Deploy javadoc to https://docs.pmd-code.org/apidocs/*/${PMD_CI_MAVEN_PROJECT_VERSION}/
pmd_code_uploadJavadoc "${PMD_CI_MAVEN_PROJECT_VERSION}" "$(pwd)"
# render release notes
# updating github release text
rm -f .bundle/config
bundle config set --local path vendor/bundle
bundle config set --local with release_notes_preprocessing
bundle install
# renders, and skips the first 6 lines - the Jekyll front-matter
local rendered_release_notes
rendered_release_notes=$(bundle exec docs/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
local release_name
release_name="PMD ${PMD_CI_MAVEN_PROJECT_VERSION} ($(date -u +%d-%B-%Y))"
# Upload to https://sourceforge.net/projects/pmd/files/pmd/${PMD_CI_MAVEN_PROJECT_VERSION}/ReadMe.md
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
if pmd_ci_maven_isSnapshotBuild || [[ "${PMD_CI_TAG}" != *-dist ]]; then
# render release notes
# updating github release text
rm -f .bundle/config
bundle config set --local path vendor/bundle
bundle config set --local with release_notes_preprocessing
bundle install
# renders, and skips the first 6 lines - the Jekyll front-matter
local rendered_release_notes
rendered_release_notes=$(bundle exec docs/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
local release_name
release_name="PMD ${PMD_CI_MAVEN_PROJECT_VERSION} ($(date -u +%d-%B-%Y))"
# Upload to https://sourceforge.net/projects/pmd/files/pmd/${PMD_CI_MAVEN_PROJECT_VERSION}/ReadMe.md
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
fi
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
@ -248,7 +289,7 @@ function pmd_ci_build_and_upload_doc() {
pmd_ci_sourceforge_rsyncSnapshotDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
fi
if pmd_ci_maven_isReleaseBuild; then
if pmd_ci_maven_isReleaseBuild && [[ "${PMD_CI_TAG}" != *-dist ]]; then
# documentation is already uploaded to https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
# we only need to setup symlinks for the released version
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "latest"

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="All Regression Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"

View File

@ -55,7 +55,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/22/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -24,7 +24,7 @@ jobs:
shell: bash
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/22/scripts" >> $GITHUB_ENV
- name: Sync
run: .ci/git-repo-sync.sh
shell: bash

View File

@ -36,7 +36,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/22/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -1,8 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
claide (1.1.0)
claide-plugins (0.9.2)
cork
@ -12,23 +13,24 @@ GEM
concurrent-ruby (1.2.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.2.0)
danger (9.3.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 3.0)
faraday-http-cache (~> 2.0)
git (~> 1.7)
git (~> 1.13)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 5.0)
octokit (~> 6.0)
terminal-table (>= 1, < 4)
differ (0.1.2)
et-orbi (1.2.7)
tzinfo
faraday (2.7.5)
faraday (2.7.11)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-http-cache (2.5.0)
@ -46,13 +48,13 @@ GEM
kramdown (~> 2.0)
liquid (5.4.0)
logger-colors (1.0.0)
mini_portile2 (2.8.2)
mini_portile2 (2.8.4)
nap (1.1.0)
no_proxy_fix (0.1.2)
nokogiri (1.15.2)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (5.6.1)
octokit (6.1.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
@ -63,14 +65,14 @@ GEM
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.9)
public_suffix (5.0.1)
public_suffix (5.0.3)
raabro (1.4.0)
racc (1.6.2)
racc (1.7.1)
rchardet (1.8.0)
rexml (3.2.5)
rouge (4.1.1)
rexml (3.2.6)
rouge (4.1.3)
ruby2_keywords (0.0.5)
rufus-scheduler (3.8.2)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
sawyer (0.9.2)

View File

@ -101,8 +101,8 @@ echo " the new release based on the release notes. Also add any deprecated ru
echo
echo "* Update **../pmd.github.io/_config.yml** to mention the new release"
echo
echo "* Update property \`pmd-designer.version\` in **pom.xml** to reference the latest pmd-designer release"
echo " See <https://search.maven.org/search?q=g:net.sourceforge.pmd%20AND%20a:pmd-ui&core=gav> for the available releases."
echo "* Update property \`pmd-designer.version\` in **pom.xml** to reference the version, that will be released"
echo " later in this process."
echo
echo "Press enter to continue..."
read -r
@ -170,8 +170,8 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
-DreleaseVersion="${RELEASE_VERSION}" \
-DdevelopmentVersion="${DEVELOPMENT_VERSION}" \
-DscmCommentPrefix="[release] " \
-Pgenerate-rule-docs
-Darguments='-Pgenerate-rule-docs,!cli-dist' \
'-Pgenerate-rule-docs,!cli-dist'
echo
echo "Tag has been pushed.... now check github actions: <https://github.com/pmd/pmd/actions>"
@ -235,14 +235,46 @@ EOF
git commit -a -m "Prepare next development version [skip ci]"
git push origin "${CURRENT_BRANCH}"
./mvnw -B release:clean
echo
echo
echo
echo "* Wait until the new version is synced to maven central and appears as latest version in"
echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-metadata.xml>."
echo
echo
echo "Then proceed with releasing pmd-designer..."
echo "<https://github.com/pmd/pmd-designer/blob/master/releasing.md>"
echo
echo "Press enter to continue when pmd-designer is available in maven-central..."
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-ui/maven-metadata.xml>."
read -r
echo
echo "Continuing with release of pmd-cli and pmd-dist..."
git checkout "pmd_releases/${RELEASE_VERSION}"
./mvnw versions:update-parent -DparentVersion="${RELEASE_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
git add pmd-cli/pom.xml pmd-dist/pom.xml
git commit -m "[release] prepare release pmd_releases/${RELEASE_VERSION}-dist"
git tag -m "[release] copy for tag pmd_releases/${RELEASE_VERSION}-dist" "pmd_releases/${RELEASE_VERSION}-dist"
git push origin tag "pmd_releases/${RELEASE_VERSION}-dist"
git checkout master
# make sure parent reference is correct
./mvnw versions:update-parent -DparentVersion="${DEVELOPMENT_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
git add pmd-cli/pom.xml pmd-dist/pom.xml
changes=$(git status --porcelain 2>/dev/null | grep -c -E "^[AMDRC]" || true)
if [ "$changes" -gt 0 ]; then
git commit -m "Prepare next development version [skip ci]"
git push origin "${CURRENT_BRANCH}"
fi
echo
echo "Second tag 'pmd_releases/${RELEASE_VERSION}-dist' has been pushed ... now check github actions: <https://github.com/pmd/pmd/actions>"
echo
echo
echo "Verify the new release on github: <https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION}>"
echo "and the news entry at <https://sourceforge.net/p/pmd/news/>"
echo
echo "* Wait until the new version is synced to maven central and appears as latest version in"
echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-metadata.xml>."
echo "* Send out an announcement mail to the mailing list:"
echo
echo "To: PMD Developers List <pmd-devel@lists.sourceforge.net>"

View File

@ -1,19 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.5)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.23.9)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
dnsruby (1.70.0)
simpleidn (~> 0.2.1)
@ -23,12 +24,13 @@ GEM
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
faraday (2.7.5)
execjs (2.9.1)
faraday (2.7.11)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.15.5)
ffi (1.16.2)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (228)
@ -86,7 +88,7 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (1.13.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (3.9.3)
addressable (~> 2.4)
@ -205,13 +207,13 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_portile2 (2.8.2)
mini_portile2 (2.8.4)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.18.0)
nokogiri (1.15.2)
minitest (5.20.0)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (4.25.1)
@ -220,11 +222,11 @@ GEM
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
racc (1.6.2)
racc (1.7.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rexml (3.2.6)
rouge (3.26.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)

View File

@ -17,9 +17,10 @@ Usually the latest non-preview Java Version is the default version.
| Java Version | Alias | Supported by PMD since |
|--------------|-------|------------------------|
| 21-preview | | 7.0.0 |
| 21 (default) | | 7.0.0 |
| 20-preview | | 6.55.0 |
| 20 (default) | | 6.55.0 |
| 19-preview | | 6.48.0 |
| 20 | | 6.55.0 |
| 19 | | 6.48.0 |
| 18 | | 6.44.0 |
| 17 | | 6.37.0 |
@ -41,10 +42,10 @@ Usually the latest non-preview Java Version is the default version.
## Using Java preview features
In order to analyze a project with PMD that uses preview language features, you'll need to enable
it via the environment variable `PMD_JAVA_OPTS` and select the new language version, e.g. `20-preview`:
it via the environment variable `PMD_JAVA_OPTS` and select the new language version, e.g. `21-preview`:
export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-20-preview ...
pmd check --use-version java-21-preview ...
Note: we only support preview language features for the latest two java versions.

View File

@ -7,8 +7,7 @@ last_updated: April 2021
This page describes the current status of the release process.
Since versions 5.4.5 / 5.5.4 there is an automated release process using [travis-ci](https://travis-ci.com)
in place. Since 6.30.0, the automated release process is using [Github Actions](https://github.com/pmd/pmd/actions).
Since 6.30.0, the automated release process is using [Github Actions](https://github.com/pmd/pmd/actions).
However, there are still a few steps, that need manual examination.
@ -19,10 +18,16 @@ required in order to verify that the release was successful or in case the autom
some reason. Then individual steps need to be executed manually. Because the build is reproducible, these
steps can be repeated again if the same tag is used.
There is one special case in this project: The release of PMD is done in two steps:
1. All modules except pmd-cli and pmd-dist are released. That means, pmd-core and all the language modules
are released. This is, so that these libs can be used by pmd-designer to create a new release.
2. pmd-cli and pmd-dist are released afterwards. Both depend on pmd-designer, and this two-step release
process is used for now to break the cycling release dependency.
The three main steps are:
* Preparations (which creates the tag) - use `do-release.sh` for that
* The actual release (which is automated)
* Preparations (which creates the tags) - use `do-release.sh` for that
* The actual release (which is automated) - GitHub Actions will build the tags when they have been pushed.
* Prepare the next release (make sure the current main branch is ready for further development)
## Preparations
@ -30,7 +35,7 @@ The three main steps are:
This is the first step. It is always manual and is executed locally. It creates in the end the tag from which
the release is created.
Make sure code is up to date and everything is committed and pushed with git:
Make sure code is up-to-date and everything is committed and pushed with git:
$ ./mvnw clean
$ git pull
@ -71,8 +76,8 @@ pmd:
The release type could be one of "bugfix" (e.g. 6.34.x), "minor" (6.x.0), or "major" (x.0.0).
The release notes usual mention any new rules that have been added since the last release.
Please double check the file `pmd-core/src/main/resources/rulesets/releases/<version>.xml`, so
The release notes usually mention any new rules that have been added since the last release.
Please double-check the file `pmd-core/src/main/resources/rulesets/releases/<version>.xml`, so
that all new rules are listed.
Add the new rules as comments to the quickstart rulesets:
@ -80,12 +85,12 @@ Add the new rules as comments to the quickstart rulesets:
* `pmd-java/src/main/resources/rulesets/java/quickstart.xml`
The designer lives at [pmd/pmd-designer](https://github.com/pmd/pmd-designer).
Update property `pmd-designer.version` in **pom.xml** to reference the latest pmd-designer release.
See <https://search.maven.org/search?q=g:net.sourceforge.pmd%20AND%20a:pmd-ui&core=gav> for the available releases.
Update property `pmd-designer.version` in **pom.xml** to reference the new version, that will be released
shortly. Note: This version does at the moment not exist.
Starting with PMD 6.23.0 we'll provide small statistics for every release. This needs to be added
to the release notes as the last section. To count the closed issues and pull requests, the milestone
on github with the title of the new release is searched. Make sure, there is a milestone
on GitHub with the title of the new release is searched. Make sure, there is a milestone
on <https://github.com/pmd/pmd/milestones>. The following snippet will
create the numbers, that can be attached to the release notes as a last section:
@ -149,27 +154,31 @@ next snapshot version after the release.
RELEASE_VERSION=6.34.0
DEVELOPMENT_VERSION=6.35.0-SNAPSHOT
./mvnw -B release:clean release:prepare \
-Dtag=pmd_releases/${RELEASE_VERSION} \
-DreleaseVersion=${RELEASE_VERSION} \
-DdevelopmentVersion=${DEVELOPMENT_VERSION}
-Dtag="pmd_releases/${RELEASE_VERSION}" \
-DreleaseVersion="${RELEASE_VERSION}" \
-DdevelopmentVersion="${DEVELOPMENT_VERSION}" \
-DscmCommentPrefix="[release] " \
-Darguments='-Pgenerate-rule-docs,!cli-dist' \
'-Pgenerate-rule-docs,!cli-dist'
```
Once the maven plugin has pushed the tag, github actions will start and build a new version from this tag. Since
it is a tag build and a released version build, the build script will do a couple of additional stuff.
This is all automated in `.ci/build.sh`.
Note: The profile "cli-dist" is deactivated, so this release command doesn't include pmd-cli and pmd-dist.
They will be released separately after pmd-designer is released. Since pmd-dist is not included in this first
step, no binaries are created yet.
Here is, what happens:
* Deploy and release the build to maven central, so that it can be downloaded from
<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/>. This is done automatically, if
all unit tests pass and the build doesn't fail for any other reason.
The plugin [nexus-staging-maven-plugin](https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin) is used for that.
* Upload the new binaries to github releases under <https://github.com/pmd/pmd/releases>. It also uploads
the release notes from `docs/pages/release_notes.md`.
Note: The during the process, the release is a draft mode and not visible yet.
At the end of the process, the release will be published.
* Upload the new binaries additionally to sourceforge, so that they can be downloaded from
<https://sourceforge.net/projects/pmd/files/pmd/>, including the release notes.
* Create a draft release on GitHub and upload the release notes from `docs/pages/release_notes.md`.
Note: During the process, the release is a draft mode and not visible yet.
At the end of the process, the release will be published.
* Render the documentation in `docs/` with `bundle exec jekyll build` and create a zip file from it.
* Upload the doc zip file to the current github release under <https://github.com/pmd/pmd/releases> and
to <https://sourceforge.net/projects/pmd/files/pmd/>.
@ -186,15 +195,47 @@ Here is, what happens:
* Copy the documentation to sourceforge's web space, so that it is available as
<https://pmd.sourceforge.io/pmd-6.34.0/>. All previously copied versions are listed
under <https://pmd.sourceforge.io/archive.phtml>.
The release on github actions currently takes about 30-45 minutes. Once this is done, you
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/master/releasing.md>.
Make sure to release the version, you have used earlier for the property `pmd-designer.version`.
Once the pmd-designer release is done, you can proceed with part 2. We'll checkout the release tag, add
a new commit with the changed versions for pmd-cli and pmd-dist on top of it and create a new tag:
```shell
git checkout "pmd_releases/${RELEASE_VERSION}"
./mvnw versions:update-parent -DparentVersion="${RELEASE_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
git add pmd-cli/pom.xml pmd-dist/pom.xml
git commit -m "[release] prepare release pmd_releases/${RELEASE_VERSION}-dist"
git tag -m "[release] copy for tag pmd_releases/${RELEASE_VERSION}-dist" "pmd_releases/${RELEASE_VERSION}-dist"
git push origin tag "pmd_releases/${RELEASE_VERSION}-dist"
git checkout master
# make sure parent reference is correct
./mvnw versions:update-parent -DparentVersion="${DEVELOPMENT_VERSION}" -DskipResolution=true -DgenerateBackupPoms=false -pl pmd-cli,pmd-dist
git add pmd-cli/pom.xml pmd-dist/pom.xml
git commit -m "Prepare next development version [skip ci]"
git push origin "${CURRENT_BRANCH}"
```
Since pmd-cli/pmd-dist were not part of the first maven-release-plugin call, we might need to fix the parent references
manually to set to the new development version.
The new created tag ends with the suffix `-dist`, and this is used as a marker for the GitHub action. The same build
script `.ci/build.sh` is executed, but now, it does the following steps:
* Build only modules pmd-cli and pmd-dist
* Upload the new binaries to the existing draft release under <https://github.com/pmd/pmd/releases>.
* Upload the new binaries additionally to sourceforge, so that they can be downloaded from
<https://sourceforge.net/projects/pmd/files/pmd/>, including the release notes.
* After all this is done, the release on github (<https://github.com/pmd/pmd/releases>) is published
and the news post on sourceforge (https://sourceforge.net/p/pmd/news/> is publishes as well.
and the news post on sourceforge (https://sourceforge.net/p/pmd/news/> is published as well.
* The new binary at <https://sourceforge.net/projects/pmd/files/pmd/> is
selected as the new default for PMD.
* As a last step, a new baseline for the [regression tester](https://github.com/pmd/pmd-regression-tester)
is created and uploaded to <https://pmd-code.org/pmd-regression-tester>.
The release on github actions currently takes about 30-45 minutes. Once this is done, you can spread additional
news:
Once this second GitHub Action run is done, you can spread additional news:
* Write an email to the mailing list

File diff suppressed because it is too large Load Diff

View File

@ -333,8 +333,14 @@ For details, see [CPD Report Formats](pmd_userdocs_cpd_report_formats.html).
Andy Glover wrote an Ant task for CPD; here's how to use it:
```xml
<path id="pmd.classpath">
<fileset dir="/home/joe/pmd-bin-{{site.pmd.version}}/lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="cpd" classname="net.sourceforge.pmd.ant.CPDTask" classpathref="pmd.classpath" />
<target name="cpd">
<taskdef name="cpd" classname="net.sourceforge.pmd.ant.CPDTask" />
<cpd minimumTokenCount="100" outputFile="/home/tom/cpd.txt">
<fileset dir="/home/tom/tmp/ant">
<include name="**/*.java"/>

View File

@ -181,7 +181,6 @@ automatically and the latest language version is used.
`ruleset` nested element - another way to specify rulesets. You can specify multiple elements. Here's an example:
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd>
<ruleset>rulesets/java/quickstart.xml</ruleset>
<ruleset>config/my-ruleset.xml</ruleset>
@ -213,7 +212,7 @@ accordingly and this rule won't be executed.
The specific version of a language to be used is selected via the `sourceLanguage`
nested element. Example:
<sourceLanguage name="java" version="17"/>
<sourceLanguage name="java" version="21"/>
The available versions depend on the language. You can get a list of the currently supported language versions
via the CLI option `--help`.
@ -373,7 +372,6 @@ You can run pmd then with `ant pmd`.
An HTML report with the "linkPrefix" and "linePrefix" properties:
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd rulesetfiles="rulesets/java/quickstart.xml">
<formatter type="html" toFile="pmd_report.html">
<param name="linkPrefix" value="https://maven.apache.org/plugins/maven-pmd-plugin/xref/"/>

View File

@ -1,13 +1,14 @@
---
title: Tools / Integrations
tags: [userdocs, tools]
permalink: pmd_userdocs_tools.html
author: David Dixon-Peugh <dpeugh@users.sourceforge.net>
---
## Automated Code Review
{% include note.html content="The tools are listed in alphabetical order without rating." %}
### Codacy
[Codacy](https://www.codacy.com/) automates code reviews and monitors code quality on every commit and pull request.
@ -42,6 +43,24 @@ The action can also be used as a code scanner to create "Code scanning alerts".
* Homepage: [pmd/pmd-github-action](https://github.com/pmd/pmd-github-action)
### TCA
[Tencent Cloud Code Analysis](http://tca.tencent.com/) (TCA for short, code-named CodeDog inside the company early)
is a comprehensive platform for code analysis and issue tracking. TCA consist of three components, server, web and
client. It integrates of a number of self-developed tools, and also supports dynamic integration of code analysis
tools in various programming languages.
Using TCA can help team find normative, structural, security vulnerabilities and other issues in the code,
continuously monitor the quality of the project code and issue alerts. At the same time, TCA opens up APIs to
support connection with upstream and downstream systems, so as to integrate code analysis capabilities, ensure
code quality, and be more conducive to inheriting an excellent team code culture.
With TCA you have PMD analysis out-of-the-box, and it is open source under the MIT license.
* Homepage: [http://tca.tencent.com/](http://tca.tencent.com/)
* Source code: [https://github.com/Tencent/CodeAnalysis](https://github.com/Tencent/CodeAnalysis)
* Documentation: [https://tencent.github.io/CodeAnalysis](https://tencent.github.io/CodeAnalysis)
* Maintainer: TCA
## IDE Integrations

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -215,6 +215,29 @@ module `pmd-coco`.
Contributors: [Wener](https://github.com/wener-tiobe) (@wener-tiobe)
### New: Java 21 Support
This release of PMD brings support for Java 21. There are the following new standard language features,
that are supported now:
* [JEP 440: Record Patterns](https://openjdk.org/jeps/440)
* [JEP 441: Pattern Matching for switch](https://openjdk.org/jeps/441)
PMD also supports the following preview language features:
* [JEP 430: String Templates (Preview)](https://openjdk.org/jeps/430)
* [JEP 443: Unnamed Patterns and Variables (Preview)](https://openjdk.org/jeps/443)
* [JEP 445: Unnamed Classes and Instance Main Methods (Preview)](https://openjdk.org/jeps/445)
In order to analyze a project with PMD that uses these language features,
you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language
version `21-preview`:
export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-21-preview ...
Note: Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available.
### New: CPD support for Apache Velocity Template Language
PMD supports Apache Velocity for a very long time, but the CPD integration never got finished.
@ -248,6 +271,11 @@ Related issue: [[core] Explicitly name all language versions (#4120)](https://gi
literals were ignored. The new option additional ignores identifiers as well in sequences.
* See [PR #4470](https://github.com/pmd/pmd/pull/4470) for details.
### Changed: Apex Jorje Updated
With the new version of Apex Jorje, the new language constructs like User Mode Database Operations
can be parsed now. PMD should now be able to parse Apex code up to version 59.0 (Winter '23).
## 🌟 New and changed rules
### New Rules
@ -257,6 +285,7 @@ Related issue: [[core] Explicitly name all language versions (#4120)](https://gi
**Java**
* {% rule java/codestyle/UnnecessaryBoxing %} reports boxing and unboxing conversions that may be made implicit.
* {% rule java/codestyle/UseExplicitTypes %} reports usages of `var` keyword, which was introduced with Java 10.
**Kotlin**
* {% rule kotlin/bestpractices/FunctionNameTooShort %}
@ -268,6 +297,9 @@ Related issue: [[core] Explicitly name all language versions (#4120)](https://gi
* {% rule swift/errorprone/ForceCast %}
* {% rule swift/errorprone/ForceTry %}
**XML**
* {% rule xml/bestpractices/MissingEncoding %} finds XML files without explicit encoding.
### Changed Rules
**General changes**
@ -476,6 +508,11 @@ The following previously deprecated rules have been finally removed:
## 💥 Compatibility and Migration Notes
{% include note.html content="
The full detailed documentation of the changes are available in the
[Migration Guide for PMD 7](pmd_userdocs_migrating_to_pmd7.html)
" %}
### For endusers
* PMD 7 requires Java 8 or above to execute.
@ -731,6 +768,187 @@ See [PR #4397](https://github.com/pmd/pmd/pull/4397) for details.
### API changes
#### 7.0.0-rc4
##### pmd-java
* Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available.
##### Rule properties
* The old deprecated classes like `IntProperty` and `StringProperty` have been removed. Please use
{% jdoc core::properties.PropertyFactory %} to create properties.
* All properties which accept multiple values now use a comma (`,`) as a delimiter. The previous default was a
pipe character (`|`). The delimiter is not configurable anymore. If needed, the comma can be escaped
with a backslash.
* The `min` and `max` attributes in property definitions in the XML are now optional and can appear separately
or be omitted.
##### New Programmatic API for CPD
See [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.html#new-programmatic-api-for-cpd)
and [PR #4397](https://github.com/pmd/pmd/pull/4397) for details.
##### Removed classes and methods
The following previously deprecated classes have been removed:
* pmd-core
* `net.sourceforge.pmd.cpd.AbstractTokenizer` ➡️ use {%jdoc core::cpd.AnyTokenizer %} instead
* `net.sourceforge.pmd.cpd.CPD` ➡️ use {% jdoc cli::cli.PmdCli %} from `pmd-cli` module for CLI support or use
{%jdoc core::cpd.CpdAnalysis %} for programmatic API
* `net.sourceforge.pmd.cpd.GridBagHelper` (now package private)
* `net.sourceforge.pmd.cpd.TokenEntry.State`
* `net.sourceforge.pmd.lang.document.CpdCompat`
* `net.sourceforge.pmd.properties.BooleanMultiProperty`
* `net.sourceforge.pmd.properties.BooleanProperty`
* `net.sourceforge.pmd.properties.CharacterMultiProperty`
* `net.sourceforge.pmd.properties.CharacterProperty`
* `net.sourceforge.pmd.properties.DoubleMultiProperty`
* `net.sourceforge.pmd.properties.DoubleProperty`
* `net.sourceforge.pmd.properties.EnumeratedMultiProperty`
* `net.sourceforge.pmd.properties.EnumeratedProperty`
* `net.sourceforge.pmd.properties.EnumeratedPropertyDescriptor`
* `net.sourceforge.pmd.properties.FileProperty` (note: without replacement)
* `net.sourceforge.pmd.properties.FloatMultiProperty`
* `net.sourceforge.pmd.properties.FloatProperty`
* `net.sourceforge.pmd.properties.IntegerMultiProperty`
* `net.sourceforge.pmd.properties.IntegerProperty`
* `net.sourceforge.pmd.properties.LongMultiProperty`
* `net.sourceforge.pmd.properties.LongProperty`
* `net.sourceforge.pmd.properties.MultiValuePropertyDescriptor`
* `net.sourceforge.pmd.properties.NumericPropertyDescriptor`
* `net.sourceforge.pmd.properties.PropertyDescriptorField`
* `net.sourceforge.pmd.properties.RegexProperty`
* `net.sourceforge.pmd.properties.SingleValuePropertyDescriptor`
* `net.sourceforge.pmd.properties.StringMultiProperty`
* `net.sourceforge.pmd.properties.StringProperty`
* `net.sourceforge.pmd.properties.ValueParser`
* `net.sourceforge.pmd.properties.ValueParserConstants`
* `net.sourceforge.pmd.properties.builders.MultiNumericPropertyBuilder`
* `net.sourceforge.pmd.properties.builders.MultiPackagedPropertyBuilder`
* `net.sourceforge.pmd.properties.builders.MultiValuePropertyBuilder`
* `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilder`
* `net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilderConversionWrapper`
* `net.sourceforge.pmd.properties.builders.PropertyDescriptorExternalBuilder`
* `net.sourceforge.pmd.properties.builders.SingleNumericPropertyBuilder`
* `net.sourceforge.pmd.properties.builders.SinglePackagedPropertyBuilder`
* `net.sourceforge.pmd.properties.builders.SingleValuePropertyBuilder`
* `net.sourceforge.pmd.properties.modules.EnumeratedPropertyModule`
* `net.sourceforge.pmd.properties.modules.NumericPropertyModule`
The following previously deprecated methods have been removed:
* pmd-core
* `net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)`
* `net.sourceforge.pmd.properties.PropertySource#setProperty(...)`
* `net.sourceforge.pmd.properties.PropertyTypeId#factoryFor(...)`
* `net.sourceforge.pmd.properties.PropertyTypeId#typeIdFor(...)`
* `net.sourceforge.pmd.properties.PropertyDescriptor`: removed methods errorFor, type, isMultiValue,
uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString
The following methods have been removed:
* pmd-core
* {%jdoc core::cpd.CPDConfiguration %}
* `#sourceCodeFor(File)`, `#postConstruct()`, `#tokenizer()`, `#filenameFilter()` removed
* {%jdoc core::cpd.Mark %}
* `#getSourceSlice()`, `#setLineCount(int)`, `#getLineCount()`, `#setSourceCode(SourceCode)` removed
* `#getBeginColumn()`, `#getBeginLine()`, `#getEndLine()`, `#getEndColumn()` removed
➡️ use {%jdoc core::cpd.Mark#getLocation() %} instead
* {%jdoc core::cpd.Match %}
* `#LABEL_COMPARATOR` removed
* `#setMarkSet(...)`, `#setLabel(...)`, `#getLabel()`, `#addTokenEntry(...)` removed
* `#getSourceCodeSlice()` removed
➡️ use {%jdoc !!core::cpd.CPDReport#getSourceCodeSlice(net.sourceforge.pmd.cpd.Mark) %} instead
* {%jdoc core::cpd.TokenEntry %}
* `#getEOF()`, `#clearImages()`, `#getIdentifier()`, `#getIndex()`, `#setHashCode(int)` removed
* `#EOF` removed ➡️ use {%jdoc core::cpd.TokenEntry#isEof() %} instead
* {%jdoc core::lang.ast.Parser.ParserTask %}
* `#getFileDisplayName()` removed ➡️ use {%jdoc core::lang.ast.Parser.ParserTask#getFileId() %} instead
(`getFileId().getAbsolutePath()`)
The following classes have been removed:
* pmd-core
* `net.sourceforge.pmd.cpd.AbstractLanguage`
* `net.sourceforge.pmd.cpd.AnyLanguage`
* `net.sourceforge.pmd.cpd.Language`
* `net.sourceforge.pmd.cpd.LanguageFactory`
* `net.sourceforge.pmd.cpd.MatchAlgorithm` (now package private)
* `net.sourceforge.pmd.cpd.MatchCollector` (now package private)
* `net.sourceforge.pmd.cpd.SourceCode` (and all inner classes like `FileCodeLoader`, ...)
* `net.sourceforge.pmd.cpd.token.TokenFilter`
##### Moved packages
* pmd-core
* {%jdoc core::net.sourceforge.pmd.properties.NumericConstraints %} (old package: `net.sourceforge.pmd.properties.constraints.NumericConstraints`)
* {%jdoc core::net.sourceforge.pmd.properties.PropertyConstraint %} (old package: `net.sourceforge.pmd.properties.constraints.PropertyConstraint`)
* not experimental anymore
* {%jdoc ant::ant.ReportException %} (old package: `net.sourceforge.pmd.cpd`, moved to module `pmd-ant`)
* it is now a RuntimeException
* {%jdoc core::cpd.CPDReportRenderer %} (old package: `net.sourceforge.pmd.cpd.renderer`)
* {%jdoc core::cpd.impl.AntlrTokenFilter %} (old package: `net.sourceforge.pmd.cpd.token`)
* {%jdoc core::cpd.impl.BaseTokenFilter %} (old package: `net.sourceforge.pmd.cpd.token.internal`)
* {%jdoc core::cpd.impl.JavaCCTokenFilter %} (old package: `net.sourceforge.pmd.cpd.token`)
##### Changed types and other changes
* pmd-core
* {%jdoc core::net.sourceforge.pmd.properties.PropertyDescriptor %} is now a class (was an interface)
and it is not comparable anymore.
* {%jdoc !!core::AbstractConfiguration#setSourceEncoding(java.nio.charset.Charset) %}
* previously this method took a simple String for the encoding.
* {%jdoc core::PmdConfiguration %} and {%jdoc core::cpd.CPDConfiguration %}
* many getters and setters have been moved to the parent class {%jdoc core::AbstractConfiguration %}
* {%jdoc !!core::cpd.CPDListener#addedFile(int) %}
* no `File` parameter anymore
* {%jdoc !!core::cpd.CPDReport#getNumberOfTokensPerFile() %} returns a `Map` of `FileId,Integer` instead of `String`
* {%jdoc !!core::cpd.CPDReport#filterMatches(java.util.function.Predicate) %} now takes a `java.util.function.Predicate`
as parameter
* {%jdoc core::cpd.Tokenizer %}
* constants are now {%jdoc core::properties.PropertyDescriptor %} instead of `String`,
to be used as language properties
* {%jdoc core::cpd.Tokenizer#tokenize(net.sourceforge.pmd.lang.document.TextDocument, net.sourceforge.pmd.cpd.TokenFactory) %}
changed parameters. Now takes a {%jdoc core::lang.document.TextDocument %} and a {%jdoc core::cpd.TokenFactory %}
(instead of `SourceCode` and `Tokens`)
* {% jdoc core::lang.Language %}
* method `#createProcessor(LanguagePropertyBundle)` moved to {%jdoc core::lang.PmdCapableLanguage %}
* {% jdoc !!core::util.StringUtil#linesWithTrimIndent(net.sourceforge.pmd.lang.document.Chars) %} now takes a `Chars`
instead of a `String`.
* All language modules (like pmd-apex, pmd-cpp, ...)
* consistent package naming: `net.sourceforge.pmd.lang.<langId>.cpd`
* adapted to use {% jdoc core::cpd.CpdCapableLanguage %}
* consistent static method `#getInstance()`
* removed constants like `ID`, `TERSE_NAME` or `NAME`. Use `getInstance().getName()` etc. instead
##### Internal APIs
* {% jdoc core::cpd.Tokens %}
* {% jdoc core::net.sourceforge.pmd.properties.PropertyTypeId %}
##### Deprecated API
* {% jdoc !!core::lang.Language#getTerseName() %} ➡️ use {% jdoc core::lang.Language#getId() %} instead
* The method {%jdoc !!java::lang.java.ast.ASTPattern#getParenthesisDepth() %} has been deprecated and will be removed.
It was introduced for supporting parenthesized patterns, but that was removed with Java 21. It is only used when
parsing code as java-19-preview.
##### Experimental APIs
* To support the Java preview language features "String Templates" and "Unnamed Patterns and Variables", the following
AST nodes have been introduced as experimental:
* {% jdoc java::lang.java.ast.ASTTemplateExpression %}
* {% jdoc java::lang.java.ast.ASTTemplate %}
* {% jdoc java::lang.java.ast.ASTTemplateFragment %}
* {% jdoc java::lang.java.ast.ASTUnnamedPattern %}
* The AST nodes for supporting "Record Patterns" and "Pattern Matching for switch" are not experimental anymore:
* {% jdoc java::lang.jast.ast.ASTRecordPattern %}
* {% jdoc java::lang.jast.ast.ASTPatternList %} (Note: it was renamed from `ASTComponentPatternList`)
* {% jdoc java::lang.jast.ast. %} (Note: it was renamed from `ASTSwitchGuard`)
#### 7.0.0-rc3
* The following previously deprecated classes have been removed:

View File

@ -43,7 +43,7 @@
<property name="ast-api-package" value="net.sourceforge.pmd.lang.ast" />
<property name="ast-impl-package" value="${ast-api-package}.impl.javacc" />
<property name="grammar-file" value="etc/grammar/${lang-name}.jjt" />
<property name="grammar-file" value="${basedir}/etc/grammar/${lang-name}.jjt" />
<property name="parser-name" value="${lang-name}ParserImpl" />
<property name="parser-file" value="${target-package-dir}/${parser-name}.java" />
@ -108,6 +108,10 @@
<touch file="${stamp-file}" />
<delete dir="${target-package-dir}" />
<mkdir dir="${target-package-dir}" />
<condition property="option-token-manager-uses-parser">
<resourcecontains resource="${grammar-file}" substring="TOKEN_MANAGER_USES_PARSER"/>
</condition>
</target>
<target name="cleanup" unless="javaccBuildNotRequired">
@ -128,7 +132,7 @@
<arg value="-OUTPUT_DIRECTORY:${target-package-dir}" />
<arg value="-NODE_USES_PARSER:false" />
<arg value="-NODE_PACKAGE:${lang-ast-package}" />
<arg value="etc/grammar/${lang-name}.jjt" />
<arg value="${grammar-file}" />
</java>
</target>
@ -189,6 +193,7 @@
<antcall target="constants-files" />
<antcall target="constants-files-token-manager-uses-parser" />
<!-- For compatibility -->
@ -359,8 +364,7 @@
<replaceregexp>
<regexp pattern="package ${lang-ast-package};" />
<substitution expression="\0
import static ${lang-ast-package}.${token-constants-name}.*;" />
<substitution expression="\0${line.separator}${line.separator}import static ${lang-ast-package}.${token-constants-name}.*;" />
<fileset file="${tokenmgr-file}" />
<fileset file="${parser-file}" />
</replaceregexp>
@ -455,6 +459,15 @@ public final class ${token-constants-name} \{${line.separator}
</target>
<target name="constants-files-token-manager-uses-parser" if="option-token-manager-uses-parser">
<echo level="info">Option TOKEN_MANAGER_USES_PARSER is enabled</echo>
<replaceregexp flags="g">
<regexp pattern="return new ${tokenmgr-name}\(cs\);" />
<substitution expression="return new ${parser-name}(cs).token_source;" />
<fileset file="${token-constants-file}"/>
</replaceregexp>
</target>
<target name="cleanup-nodes">
<replaceregexp flags="g">

View File

@ -40,20 +40,26 @@ import net.sourceforge.pmd.lang.LanguageRegistry;
*
* <p>Runs the CPD utility via ant. The ant task looks like this:</p>
*
* <pre>
* &lt;project name="CPDProj" default="main" basedir="."&gt;
* &lt;taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" /&gt;
* &lt;target name="main"&gt;
* &lt;cpd encoding="UTF-16LE" language="java" ignoreIdentifiers="true"
* ignoreLiterals="true" ignoreAnnotations="true" minimumTokenCount="100"
* outputFile="c:\cpdrun.txt"&gt;
* &lt;fileset dir="/path/to/my/src"&gt;
* &lt;include name="*.java"/&gt;
* &lt;/fileset&gt;
* &lt;/cpd&gt;
* &lt;/target&gt;
* &lt;/project&gt;
* </pre>
* <pre>{@code
* <project name="CPDProject" default="main" basedir=".">
* <path id="pmd.classpath">
* <fileset dir="/home/joe/pmd-bin-VERSION/lib">
* <include name="*.jar"/>
* </fileset>
* </path>
* <taskdef name="cpd" classname="net.sourceforge.pmd.ant.CPDTask" classpathref="pmd.classpath" />
*
* <target name="main">
* <cpd encoding="UTF-16LE" language="java" ignoreIdentifiers="true"
* ignoreLiterals="true" ignoreAnnotations="true" minimumTokenCount="100"
* outputFile="c:\cpdrun.txt">
* <fileset dir="/path/to/my/src">
* <include name="*.java"/>
* </fileset>
* </cpd>
* </target>
* </project>
* }</pre>
*
* <p>Required: minimumTokenCount, outputFile, and at least one file</p>
*/

View File

@ -11,6 +11,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@ -220,11 +221,12 @@ public class Formatter {
// fall-through
}
// Maybe this is Java17? Then there will be
// Maybe this is Java17+? Then there will be
// https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/Console.html#charset()
// instead of the field "cs".
try {
Charset charset = (Charset) MethodUtils.invokeMethod(console, "charset");
Method charsetMethod = Console.class.getDeclaredMethod("charset");
Charset charset = (Charset) charsetMethod.invoke(console);
return charset.name();
} catch (IllegalArgumentException | ReflectiveOperationException ignored) {
// fall-through

View File

@ -24,6 +24,31 @@ import net.sourceforge.pmd.ant.internal.PMDTaskImpl;
/**
* PMD Ant task. Setters of this class are interpreted by Ant as properties
* settable in the XML. This is therefore published API.
*
* <p>Runs PMD analysis via ant. The ant task looks like this:</p>
*
* <pre>{@code
* <project name="PMDProject" default="main" basedir=".">
* <path id="pmd.classpath">
* <fileset dir="/home/joe/pmd-bin-VERSION/lib">
* <include name="*.jar"/>
* </fileset>
* </path>
* <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
*
* <target name="main">
* <pmd>
* <ruleset>rulesets/java/quickstart.xml</ruleset>
* <ruleset>config/my-ruleset.xml</ruleset>
* <fileset dir="/usr/local/j2sdk1.4.1_01/src/">
* <include name="java/lang/*.java"/>
* </fileset>
* </pmd>
* </target>
* </project>
* }</pre>
*
* <p>Required: rulesetfiles/ruleset, fileset</p>
*/
public class PMDTask extends Task {

View File

@ -13,7 +13,7 @@
</parent>
<properties>
<apex.jorje.version>2021-10-08-631b8c</apex.jorje.version>
<apex.jorje.version>2023-06-05-c27a5d</apex.jorje.version>
</properties>
<build>
@ -48,7 +48,7 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version> <!-- apex jorje actually depends on 3.2.0 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
<version>3.3.0</version> <!-- apex jorje actually depends on 3.2.0 (https://github.com/forcedotcom/salesforcedx-vscode/commit/c27a5d6c91b494f4797e3c1d8782152b091e6233) -->
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
@ -58,7 +58,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<!-- apex jorje actually depends on 2.7 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
<!-- apex jorje actually depends on 2.7 (https://github.com/forcedotcom/salesforcedx-vscode/commit/c27a5d6c91b494f4797e3c1d8782152b091e6233) -->
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
@ -68,7 +68,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<!-- apex jorje actually depends on 26.0-jre (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
<!-- apex jorje actually depends on 26.0-jre (https://github.com/forcedotcom/salesforcedx-vscode/commit/c27a5d6c91b494f4797e3c1d8782152b091e6233) -->
</dependency>
<dependency>
<groupId>com.google.j2objc</groupId>
@ -94,17 +94,12 @@
<artifactId>animal-sniffer-annotations</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<!-- apex jorje actually depends on 1.7.20 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003) -->
<!-- apex jorje actually depends on 1.7.20 (https://github.com/forcedotcom/salesforcedx-vscode/commit/c27a5d6c91b494f4797e3c1d8782152b091e6233) -->
</dependency>
<!-- apex jorje actually depends on 1.17 (https://github.com/forcedotcom/salesforcedx-vscode/commit/631b8cfb85cff5e989bfea13bca681b6cedcb003)
<!-- apex jorje actually depends on 1.17 (https://github.com/forcedotcom/salesforcedx-vscode/commit/c27a5d6c91b494f4797e3c1d8782152b091e6233)
however, it is not really needed, so we don't add it here as a dependency,
so that it doesn't end up in pmd-dist
-->

View File

@ -8,7 +8,7 @@ Apex Reference:
<https://resources.docs.salesforce.com/sfdc/pdf/salesforce_apex_language_reference.pdf>
In order to download the jar file, minimize it and add a the jar files to the local repo, use the following script:
In order to download the jar file, minimize it and add the jar files to the local repo, use the following script:
./create-local-repo.sh

View File

@ -0,0 +1,4 @@
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Sat Jun 24 18:50:10 CEST 2023
apex-jorje-lsp-minimized-2023-06-05-c27a5d.jar>=
apex-jorje-lsp-minimized-2023-06-05-c27a5d.pom>=

View File

@ -4,6 +4,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>apex</groupId>
<artifactId>apex-jorje-lsp-minimized</artifactId>
<version>2021-10-08-631b8c</version>
<version>2023-06-05-c27a5d</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -3,10 +3,10 @@
<groupId>apex</groupId>
<artifactId>apex-jorje-lsp-minimized</artifactId>
<versioning>
<release>2021-10-08-631b8c</release>
<release>2023-06-05-c27a5d</release>
<versions>
<version>2021-10-08-631b8c</version>
<version>2023-06-05-c27a5d</version>
</versions>
<lastUpdated>20211014081008</lastUpdated>
<lastUpdated>20230624165009</lastUpdated>
</versioning>
</metadata>

View File

@ -31,19 +31,39 @@ function download() {
}
#
# Unfortunately, jorje is provided as a blob, which seems to be a jar-with-dependencies
# kind of thing. We try to keep only the apex related classes and delete anything that has
# been added into the big apex-jorje-lsp-jar. The deleted classes will be added as dependencies again.
#
# We unfortunately need to keep some classes in com.google.common (guava), since jorje seems
# to have added classes there, which are not in the official guava packages.
#
function minimize() {
unzip -d temp ${FILENAME}
pushd temp
find . -not -path "." \
-and -not -path ".." \
-and -not -path "./apex" \
find . -type f \
-and -not -path "./apex/*" \
-and -not -path "./StandardApex*" \
-and -not -path "./messages*" \
-and -not -path "./com" \
-and -not -path "./com/google" \
-and -not -path "./com/google/common*" \
-and -not -path "./com/google/common/collect/ConcatenatedLists*" \
-and -not -path "./com/google/common/collect/MoreLists*" \
-and -not -path "./com/google/common/collect/MoreMaps*" \
-and -not -path "./com/google/common/collect/MoreSets*" \
-and -not -path "./com/google/common/collect/PairList*" \
-and -not -path "./com/google/common/collect/SingleAppendList*" \
-and -not -path "./com/google/common/collect/SinglePrependList*" \
-and -not -path "./com/google/common/collect/WellBehavedMap*" \
-and -not -path "./com/google/common/graph/ConfigurableMutableGraph*" \
-and -not -path "./com/google/common/graph/ConfigurableMutableNetwork*" \
-and -not -path "./com/google/common/graph/ConfigurableMutableValueGraph*" \
-and -not -path "./com/google/common/graph/ConfigurableNetwork*" \
-and -not -path "./com/google/common/graph/ConfigurableValueGraph*" \
-and -not -path "./com/google/common/reflect/Element*" \
-and -not -path "./com/google/common/util/concurrent/AbstractCheckedFuture*" \
-print0 | xargs -0 rm -rf
# delete empty directories
find . -depth -type d -empty -delete
popd
jar --create --file ${FILENAME_MINIMIZED} -C temp/ .
rm -rf temp

Some files were not shown because too many files have changed in this diff Show More