Skip to content

Commit

Permalink
Merge pull request #4479 from aaronhurst-google:experimental-apex-parser
Browse files Browse the repository at this point in the history
Merge main (7.x) branch into experimental-apex-parser and fix tests #4479
  • Loading branch information
adangel committed Sep 22, 2023
2 parents 65ec632 + e191bb9 commit 93d3d73
Show file tree
Hide file tree
Showing 4,825 changed files with 252,667 additions and 226,870 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
130 changes: 127 additions & 3 deletions .all-contributorsrc
Expand Up @@ -2153,7 +2153,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/11549103?v=4",
"profile": "https://github.com/cyw3",
"contributions": [
"bug"
"bug",
"doc"
]
},
{
Expand Down Expand Up @@ -2679,7 +2680,7 @@
]
},
{
"login": "Fernal73",
"login": "linusjf",
"name": "Linus Fernandes",
"avatar_url": "https://avatars.githubusercontent.com/u/24714685?v=4",
"profile": "https://linusfernandes.com/",
Expand Down Expand Up @@ -4496,7 +4497,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/25647167?v=4",
"profile": "https://github.com/nawforce",
"contributions": [
"bug"
"bug",
"code"
]
},
{
Expand Down Expand Up @@ -7107,6 +7109,128 @@
"bug",
"code"
]
},
{
"login": "dague1",
"name": "dague1",
"avatar_url": "https://avatars.githubusercontent.com/u/42275566?v=4",
"profile": "https://github.com/dague1",
"contributions": [
"doc"
]
},
{
"login": "sfdcsteve",
"name": "Steven Stearns",
"avatar_url": "https://avatars.githubusercontent.com/u/16338550?v=4",
"profile": "https://github.com/sfdcsteve",
"contributions": [
"bug",
"code"
]
},
{
"login": "nirvikpatel",
"name": "Nirvik Patel",
"avatar_url": "https://avatars.githubusercontent.com/u/76862984?v=4",
"profile": "https://github.com/nirvikpatel",
"contributions": [
"code"
]
},
{
"login": "mohui1999",
"name": "Seren",
"avatar_url": "https://avatars.githubusercontent.com/u/46819179?v=4",
"profile": "https://github.com/mohui1999",
"contributions": [
"bug",
"code"
]
},
{
"login": "nwcm",
"name": "nwcm",
"avatar_url": "https://avatars.githubusercontent.com/u/111259588?v=4",
"profile": "https://github.com/nwcm",
"contributions": [
"doc"
]
},
{
"login": "PimvanderLoos",
"name": "Pim van der Loos",
"avatar_url": "https://avatars.githubusercontent.com/u/3114723?v=4",
"profile": "https://github.com/PimvanderLoos",
"contributions": [
"code",
"test"
]
},
{
"login": "joaodinissf",
"name": "João Dinis Ferreira",
"avatar_url": "https://avatars.githubusercontent.com/u/6786818?v=4",
"profile": "https://github.com/joaodinissf",
"contributions": [
"doc"
]
},
{
"login": "wener-tiobe",
"name": "Wener",
"avatar_url": "https://avatars.githubusercontent.com/u/85687939?v=4",
"profile": "https://github.com/wener-tiobe",
"contributions": [
"code"
]
},
{
"login": "anastasiia-koba",
"name": "Anastasiia Koba",
"avatar_url": "https://avatars.githubusercontent.com/u/42797303?v=4",
"profile": "https://github.com/anastasiia-koba",
"contributions": [
"code"
]
},
{
"login": "krdabrowski",
"name": "Krystian Dabrowski",
"avatar_url": "https://avatars.githubusercontent.com/u/98942253?v=4",
"profile": "https://github.com/krdabrowski",
"contributions": [
"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"
]
}
],
"contributorsPerLine": 7,
Expand Down
2 changes: 1 addition & 1 deletion .ci/README.md
Expand Up @@ -138,7 +138,7 @@ f=check-environment.sh; \

Calling `.ci/build.sh` directly would re-release the tag $TAG_NAME - that's why it is commented out.
All the side-effects of a release would be carried out like creating and publishing a release on github,
uploading the release to sourceforge, uploading the docs to pmd.github.io/docs.pmd-code.org, uploading a
uploading the release to sourceforge, uploading the docs to docs.pmd-code.org, uploading a
new baseline for the regression tester and so on. While the release should be reproducible and therefore should
produce exactly the same artifacts, re-uploading artifacts is not desired just for testing.

Expand Down
92 changes: 56 additions & 36 deletions .ci/build.sh
Expand Up @@ -9,15 +9,16 @@ 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 7+11+17, Bundler"
pmd_ci_log_group_start "Prepare Java 8+11+17, Bundler"
pmd_ci_openjdk_install_adoptium 11
pmd_ci_openjdk_setdefault 11
PMD_MAVEN_EXTRA_OPTS=()
if [ "$(pmd_ci_utils_get_os)" = "linux" ]; then
pmd_ci_log_info "Install openjdk7 for integration tests"
pmd_ci_openjdk_install_zuluopenjdk 7
pmd_ci_log_info "Install openjdk8 for integration tests and pmd-regression-tests"
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=(-Djava7.home="${HOME}/openjdk7" -Djava17.home="${HOME}/openjdk17")
PMD_MAVEN_EXTRA_OPTS=(-Djava8.home="${HOME}/openjdk8" -Djava17.home="${HOME}/openjdk17")
fi
pmd_ci_build_setup_bundler
pmd_ci_log_group_end
Expand All @@ -29,7 +30,7 @@ function build() {

if pmd_ci_utils_is_fork_or_pull_request; then
pmd_ci_log_group_start "Build with mvnw"
./mvnw clean install --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}"
./mvnw clean install --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
pmd_ci_log_group_end

# Execute danger and dogfood only for pull requests in our own repository
Expand All @@ -54,9 +55,16 @@ function build() {
# stop early for invalid maven version and branch/tag combination
pmd_ci_maven_verify_version || exit 0

# skip tests when doing a release build - this makes the process faster
# it's a manual task now to verify that a release is only started, when the main branch
# was green before. This is usually checked via a local build, see ./do-release.sh
if pmd_ci_maven_isReleaseBuild; then
PMD_MAVEN_EXTRA_OPTS+=(-DskipTests=true)
fi

if [ "$(pmd_ci_utils_get_os)" != "linux" ]; then
pmd_ci_log_group_start "Build with mvnw"
./mvnw clean verify --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}"
./mvnw clean verify --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
pmd_ci_log_group_end

pmd_ci_log_info "Stopping build here, because os is not linux"
Expand All @@ -73,7 +81,7 @@ function build() {

if [ "${PMD_CI_BRANCH}" = "experimental-apex-parser" ]; then
pmd_ci_log_group_start "Build with mvnw"
./mvnw clean install --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}"
./mvnw clean install --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}"
pmd_ci_log_group_end

pmd_ci_log_group_start "Creating new baseline for regression tester"
Expand Down Expand Up @@ -120,7 +128,7 @@ function build() {
-Dmaven.source.skip \
-Dcheckstyle.skip \
-Dpmd.skip \
--show-version --errors --batch-mode --no-transfer-progress \
--show-version --errors --batch-mode \
clean package \
sonar:sonar -Dsonar.login="${SONAR_TOKEN}" -Psonar
pmd_ci_log_success "New sonar results: https://sonarcloud.io/dashboard?id=net.sourceforge.pmd%3Apmd"
Expand All @@ -136,7 +144,7 @@ function build() {
-Dcheckstyle.skip \
-Dpmd.skip \
-DrepoToken="${COVERALLS_REPO_TOKEN}" \
--show-version --errors --batch-mode --no-transfer-progress \
--show-version --errors --batch-mode \
clean package jacoco:report \
coveralls:report -Pcoveralls
pmd_ci_log_success "New coveralls result: https://coveralls.io/github/pmd/pmd"
Expand Down Expand Up @@ -168,47 +176,70 @@ function pmd_ci_build_run() {
pmd_ci_log_info "This is a snapshot build"
fi

./mvnw clean deploy -P${mvn_profiles} --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}"
./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
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-bin-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-dist/target/pmd-src-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
# 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_isReleaseBuild; 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"

# Deploy to github releases
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-bin-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-src-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-bin.zip"
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-src.zip"
# Deploy SBOM
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.xml"
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "pmd-dist/target/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}-cyclonedx.json"
fi
}

#
# Builds and uploads the documentation site
# Renders release notes and uploads them as ReadMe.md to sourceforge
#
function pmd_ci_build_and_upload_doc() {
pmd_doc_generate_jekyll_site
pmd_doc_create_archive

pmd_ci_sourceforge_uploadFile "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
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
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
pmd_ci_gh_releases_uploadAsset "$GH_RELEASE" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
fi

# Deploy doc to https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/
pmd_code_uploadDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "docs/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}.zip"
pmd_code_uploadDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "docs/pmd-dist-${PMD_CI_MAVEN_PROJECT_VERSION}-doc.zip"
# 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_BRANCH}" = "master" ]; then
# only for snapshot builds from branch master
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"

# update github pages https://pmd.github.io/pmd/
Expand All @@ -223,34 +254,23 @@ function pmd_ci_build_and_upload_doc() {
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "latest"
# remove old doc and point to the new version
pmd_code_removeDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}-SNAPSHOT"
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "${PMD_CI_MAVEN_PROJECT_VERSION}-SNAPSHOT"
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}-SNAPSHOT"
# remove old javadoc
pmd_code_removeJavadoc "${PMD_CI_MAVEN_PROJECT_VERSION}-SNAPSHOT"

# 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))"
# github release only for releases
pmd_ci_gh_releases_updateRelease "$GH_RELEASE" "$release_name" "${rendered_release_notes}"
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"

local rendered_release_notes_with_links
rendered_release_notes_with_links="
* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${PMD_CI_MAVEN_PROJECT_VERSION}
* Documentation: https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}/
* Documentation: https://docs.pmd-code.org/pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}/
${rendered_release_notes}"
pmd_ci_sourceforge_createDraftBlogPost "${release_name} released" "${rendered_release_notes_with_links}" "pmd,release"
SF_BLOG_URL="${RESULT}"

# updates https://pmd.github.io/latest/ and https://pmd.github.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}
publish_release_documentation_github
# rsync site to https://pmd.sourceforge.io/pmd-${PMD_CI_MAVEN_PROJECT_VERSION}
pmd_ci_sourceforge_rsyncSnapshotDocumentation "${PMD_CI_MAVEN_PROJECT_VERSION}" "pmd-${PMD_CI_MAVEN_PROJECT_VERSION}"
fi
}
Expand All @@ -264,9 +284,9 @@ function pmd_ci_dogfood() {
sed -i 's/<version>[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}.*<\/version>\( *<!-- pmd.dogfood.version -->\)/<version>'"${PMD_CI_MAVEN_PROJECT_VERSION}"'<\/version>\1/' pom.xml
if [ "${PMD_CI_MAVEN_PROJECT_VERSION}" = "7.0.0-SNAPSHOT" ]; then
sed -i 's/pmd-dogfood-config\.xml/pmd-dogfood-config7.xml/' pom.xml
mpmdVersion=(-Denforcer.skip=true -Dpmd.plugin.version=3.18.0-pmd7-SNAPSHOT)
mpmdVersion=(-Denforcer.skip=true -Dpmd.plugin.version=3.21.1-pmd-7.0.0-SNAPSHOT)
fi
./mvnw verify --show-version --errors --batch-mode --no-transfer-progress "${PMD_MAVEN_EXTRA_OPTS[@]}" \
./mvnw verify --show-version --errors --batch-mode "${PMD_MAVEN_EXTRA_OPTS[@]}" \
"${mpmdVersion[@]}" \
-DskipTests \
-Dmaven.javadoc.skip=true \
Expand Down
1 change: 1 addition & 0 deletions .ci/inc/pmd-code-api.inc
Expand Up @@ -18,6 +18,7 @@ function pmd_code_uploadDocumentation() {
scp "${filename}" ${PMD_CODE_SSH_USER}@pmd-code.org:${PMD_CODE_DOCS_PATH}
# shellcheck disable=SC2029
ssh ${PMD_CODE_SSH_USER}@pmd-code.org "cd \"${PMD_CODE_DOCS_PATH}\" && \
( test -h pmd-doc-${pmdVersion} && rm pmd-doc-${pmdVersion} || true ) && \
unzip -qo \"${basefilename}\" && \
rm \"${basefilename}\""
pmd_ci_log_info "Docs updated: https://docs.pmd-code.org/pmd-doc-${pmdVersion}/"
Expand Down

0 comments on commit 93d3d73

Please sign in to comment.