-
Notifications
You must be signed in to change notification settings - Fork 776
Linter Infrastructure to support formatting the Compiler Component #22943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dsouzai
wants to merge
1
commit into
eclipse-openj9:master
Choose a base branch
from
dsouzai:clangformat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+176
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /******************************************************************************* | ||
| * Copyright IBM Corp. and others 2025 | ||
| * | ||
| * This program and the accompanying materials are made available under | ||
| * the terms of the Eclipse Public License 2.0 which accompanies this | ||
| * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * or the Apache License, Version 2.0 which accompanies this distribution and | ||
| * is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
| * | ||
| * This Source Code may also be made available under the following | ||
| * Secondary Licenses when the conditions for such availability set | ||
| * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU | ||
| * General Public License, version 2 with the GNU Classpath | ||
| * Exception [1] and GNU General Public License, version 2 with the | ||
| * OpenJDK Assembly Exception [2]. | ||
| * | ||
| * [1] https://www.gnu.org/software/classpath/license.html | ||
| * [2] https://openjdk.org/legal/assembly-exception.html | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 | ||
| *******************************************************************************/ | ||
|
|
||
| timestamps { | ||
| timeout(time: 8, unit: 'HOURS') { | ||
| stage('Queue') { | ||
| node('Linux && x86') { | ||
| def tmpDesc = currentBuild.description ? currentBuild.description + "<br>" : "" | ||
| currentBuild.description = tmpDesc + "<a href=${JENKINS_URL}computer/${NODE_NAME}>${NODE_NAME}</a>" | ||
| try { | ||
| def gitConfig = scm.getUserRemoteConfigs().get(0) | ||
| def refspec = gitConfig.getRefspec() ? gitConfig.getRefspec() : "" | ||
| checkout changelog: false, poll: false, | ||
| scm: [$class: 'GitSCM', | ||
| branches: [[name: scm.branches[0].name]], | ||
| userRemoteConfigs: [[ | ||
| refspec: "${refspec}", | ||
| url: "${gitConfig.getUrl()}"]] | ||
| ] | ||
| stage('Pull Infra') { | ||
| sh "buildenv/jenkins/clang_format/pullInfra.sh" | ||
| } | ||
| stage('Docker Build') { | ||
| dir('buildenv/jenkins/clang_format') { | ||
| sh "docker build -t clang-format -f Dockerfile ." | ||
| } | ||
| } | ||
| stage('Format Check') { | ||
| sh "buildenv/jenkins/clang_format/clangFormatCheck.sh" | ||
| } | ||
| stage('Cleanup Infra') { | ||
| sh "buildenv/jenkins/clang_format/cleanupInfra.sh" | ||
| } | ||
| } finally { | ||
| cleanWs() | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/bin/bash -f | ||
| ############################################################################### | ||
| # Copyright IBM Corp. and others 2025 | ||
| # | ||
| # This program and the accompanying materials are made available under | ||
| # the terms of the Eclipse Public License 2.0 which accompanies this | ||
| # distribution and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| # or the Apache License, Version 2.0 which accompanies this distribution and | ||
| # is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # This Source Code may also be made available under the following | ||
| # Secondary Licenses when the conditions for such availability set | ||
| # forth in the Eclipse Public License, v. 2.0 are satisfied: GNU | ||
| # General Public License, version 2 with the GNU Classpath | ||
| # Exception [1] and GNU General Public License, version 2 with the | ||
| # OpenJDK Assembly Exception [2]. | ||
| # | ||
| # [1] https://www.gnu.org/software/classpath/license.html | ||
| # [2] https://openjdk.org/legal/assembly-exception.html | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 | ||
| ############################################################################### | ||
|
|
||
| allFiles=$(git diff -C --diff-filter=ACM --name-only origin/master HEAD --) | ||
| if [ x"$allFiles" = x ] ; then | ||
| echo "There are no files to check for code formatting." | ||
| else | ||
| lines='-----------------------------------' | ||
| badFiles= | ||
| for file in $allFiles ; do | ||
| case "$file" in | ||
| runtime/compiler/*.c | \ | ||
| runtime/compiler/*.cpp | \ | ||
| runtime/compiler/*.h | \ | ||
| runtime/compiler/*.hpp) | ||
| echo "file:$file" | ||
| good="$file.good" | ||
| docker run --rm -v "$WORKSPACE:/src" clang-format:latest clang-format -style=file:runtime/compiler/.clang-format "/src/$file" > "$good" | ||
| diffOutput=$(diff -u "$file" "$good") | ||
| if [ "$diffOutput" != "" ] ; then | ||
| echo "ERROR - not formatted as expected: '$file'" | ||
| echo "$diffOutput" | ||
| echo "$lines" | ||
| badFiles="$badFiles $file" | ||
| rm -f "$good" | ||
| fi | ||
| ;; | ||
| *) | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ x"$badFiles" = x ] ; then | ||
| echo "All modified files appear to have correct code formatting." | ||
| else | ||
| hashes='###################################' | ||
| echo "$hashes" | ||
| echo "The following files were modified and have incorrect code formatting:" | ||
| for file in $badFiles ; do | ||
| echo "$file" | ||
| done | ||
| echo "$hashes" | ||
| exit 1 | ||
| fi | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash -f | ||
| ############################################################################### | ||
| # Copyright IBM Corp. and others 2025 | ||
| # | ||
| # This program and the accompanying materials are made available under | ||
| # the terms of the Eclipse Public License 2.0 which accompanies this | ||
| # distribution and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| # or the Apache License, Version 2.0 which accompanies this distribution and | ||
| # is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # This Source Code may also be made available under the following | ||
| # Secondary Licenses when the conditions for such availability set | ||
| # forth in the Eclipse Public License, v. 2.0 are satisfied: GNU | ||
| # General Public License, version 2 with the GNU Classpath | ||
| # Exception [1] and GNU General Public License, version 2 with the | ||
| # OpenJDK Assembly Exception [2]. | ||
| # | ||
| # [1] https://www.gnu.org/software/classpath/license.html | ||
| # [2] https://openjdk.org/legal/assembly-exception.html | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 | ||
| ############################################################################### | ||
|
|
||
| rm -f runtime/compiler/.clang-format | ||
| rm -f buildenv/jenkins/clang_format/Dockerfile | ||
| rm -f buildenv/jenkins/clang_format/clang-format-wrapper.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash -f | ||
| ############################################################################### | ||
| # Copyright IBM Corp. and others 2025 | ||
| # | ||
| # This program and the accompanying materials are made available under | ||
| # the terms of the Eclipse Public License 2.0 which accompanies this | ||
| # distribution and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| # or the Apache License, Version 2.0 which accompanies this distribution and | ||
| # is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
| # | ||
| # This Source Code may also be made available under the following | ||
| # Secondary Licenses when the conditions for such availability set | ||
| # forth in the Eclipse Public License, v. 2.0 are satisfied: GNU | ||
| # General Public License, version 2 with the GNU Classpath | ||
| # Exception [1] and GNU General Public License, version 2 with the | ||
| # OpenJDK Assembly Exception [2]. | ||
| # | ||
| # [1] https://www.gnu.org/software/classpath/license.html | ||
| # [2] https://openjdk.org/legal/assembly-exception.html | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 | ||
| ############################################################################### | ||
|
|
||
| wget https://raw.githubusercontent.com/eclipse-omr/omr/refs/heads/master/compiler/.clang-format runtime/compiler/ | ||
| wget https://raw.githubusercontent.com/eclipse-omr/omr/refs/heads/master/buildenv/jenkins/clang_format/Dockerfile buildenv/jenkins/clang_format/ | ||
| wget https://raw.githubusercontent.com/eclipse-omr/omr/refs/heads/master/buildenv/jenkins/clang_format/clang-format-wrapper.sh buildenv/jenkins/clang_format/ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the
-Pflag.