Skip to content

Commit 688b7b6

Browse files
committed
Merge remote-tracking branch 'origin/master' into query-complexity-limits
# Conflicts: # src/main/java/graphql/GraphQL.java # src/main/java/graphql/validation/OperationValidator.java
2 parents a6e885a + 50c22c1 commit 688b7b6

266 files changed

Lines changed: 107369 additions & 106337 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/pre-commit

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
# Pre-commit hook to enforce Windows compatibility and file size limits
4+
#
5+
# 1. Windows filenames: prevents characters that are reserved on Windows (< > : " | ? * \)
6+
# so the repo can be cloned on Windows systems.
7+
# 2. File size: rejects files larger than 10 MB. Many enterprise users mirror graphql-java
8+
# into internal repositories that enforce file size limits.
9+
10+
# ANSI color codes for better output readability
11+
RED='\033[0;31m'
12+
YELLOW='\033[1;33m'
13+
NC='\033[0m' # No Color
14+
15+
# Track if we found any errors
16+
ERRORS_FOUND=0
17+
18+
echo "Running pre-commit checks..."
19+
20+
# Check 1: Windows-incompatible filenames
21+
echo " Checking for Windows-incompatible filenames..."
22+
23+
# Windows reserved characters: < > : " | ? * \
24+
# Note: We escape the backslash in the regex pattern
25+
INVALID_CHARS='[<>:"|?*\\]'
26+
27+
# Get list of staged files
28+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACR)
29+
30+
if [ -n "$STAGED_FILES" ]; then
31+
# Check each staged file for invalid characters
32+
INVALID_FILES=$(echo "$STAGED_FILES" | grep -E "$INVALID_CHARS" || true)
33+
34+
if [ -n "$INVALID_FILES" ]; then
35+
echo -e "${RED}Error: The following files have Windows-incompatible characters in their names:${NC}"
36+
echo "$INVALID_FILES" | while read -r file; do
37+
echo " - $file"
38+
done
39+
echo -e "${YELLOW}Please rename these files to remove characters: < > : \" | ? * \\${NC}"
40+
echo -e "${YELLOW}For ISO timestamps, replace colons with hyphens (e.g., 08:40:24 -> 08-40-24)${NC}"
41+
ERRORS_FOUND=1
42+
fi
43+
fi
44+
45+
# Check 2: Files larger than 10MB
46+
echo " Checking for files larger than 10MB..."
47+
48+
MAX_SIZE=$((10 * 1024 * 1024)) # 10 MB in bytes
49+
LARGE_FILES=""
50+
51+
if [ -n "$STAGED_FILES" ]; then
52+
while IFS= read -r file; do
53+
if [ -f "$file" ]; then
54+
# Try to get file size with cross-platform compatibility
55+
size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null)
56+
if [ -z "$size" ]; then
57+
echo -e "${YELLOW}Warning: Could not determine size of $file, skipping size check${NC}"
58+
continue
59+
fi
60+
if [ "$size" -gt "$MAX_SIZE" ]; then
61+
# Format size in human-readable format using awk (more portable than bc)
62+
size_mb=$(awk "BEGIN {printf \"%.2f\", $size/1024/1024}")
63+
LARGE_FILES="${LARGE_FILES} - $file (${size_mb} MB)\n"
64+
fi
65+
fi
66+
done <<< "$STAGED_FILES"
67+
fi
68+
69+
if [ -n "$LARGE_FILES" ]; then
70+
echo -e "${RED}Error: The following files exceed 10MB:${NC}"
71+
echo -e "$LARGE_FILES"
72+
echo -e "${YELLOW}Please consider one of these options:${NC}"
73+
echo -e "${YELLOW} 1. Split the file into smaller parts with suffixes .part1, .part2, etc.${NC}"
74+
echo -e "${YELLOW} 2. Remove unnecessary content from the file${NC}"
75+
ERRORS_FOUND=1
76+
fi
77+
78+
# Exit with error if any checks failed
79+
if [ "$ERRORS_FOUND" -eq 1 ]; then
80+
echo -e "${RED}Pre-commit checks failed. Please fix the issues above and try again.${NC}"
81+
exit 1
82+
fi
83+
84+
echo " All pre-commit checks passed!"
85+
exit 0

.github/workflows/commit_performance_result.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
commitPerformanceResults:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: aws-actions/configure-aws-credentials@v5
20+
- uses: aws-actions/configure-aws-credentials@v6
2121
with:
2222
role-to-assume: arn:aws:iam::637423498965:role/GitHubActionGrahQLJava
2323
aws-region: "ap-southeast-2"

.github/workflows/publish_commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
if: github.event.pull_request.merged == true
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: aws-actions/configure-aws-credentials@v5
18+
- uses: aws-actions/configure-aws-credentials@v6
1919
with:
2020
role-to-assume: arn:aws:iam::637423498965:role/GitHubActionGrahQLJava
2121
aws-region: "ap-southeast-2"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Validate Files
2+
3+
# This workflow validates that all files in the repository comply with:
4+
# 1. Windows filename compatibility — no reserved characters (< > : " | ? * \)
5+
# so the repo can be cloned on Windows systems.
6+
# 2. File size limits — no files larger than 10 MB. Many enterprise users mirror
7+
# graphql-java into internal repositories that enforce file size limits.
8+
9+
on:
10+
push:
11+
branches:
12+
- master
13+
- '**'
14+
pull_request:
15+
branches:
16+
- master
17+
- 23.x
18+
- 22.x
19+
- 21.x
20+
- 20.x
21+
- 19.x
22+
23+
jobs:
24+
validate-filenames-and-size:
25+
runs-on: ubuntu-latest
26+
name: Validate Windows Compatibility and File Sizes
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0 # Fetch all history to check all files
32+
33+
- name: Check for Windows-incompatible filenames
34+
run: |
35+
echo "Checking for Windows-incompatible filenames..."
36+
37+
# Windows reserved characters: < > : " | ? * \
38+
INVALID_CHARS='[<>:"|?*\\]'
39+
40+
# Get all files in the repository (excluding .git directory)
41+
ALL_FILES=$(git ls-files)
42+
43+
# Check each file for invalid characters
44+
INVALID_FILES=$(echo "$ALL_FILES" | grep -E "$INVALID_CHARS" || true)
45+
46+
if [ -n "$INVALID_FILES" ]; then
47+
echo "::error::The following files have Windows-incompatible characters in their names:"
48+
echo "$INVALID_FILES" | while read -r file; do
49+
echo "::error file=${file}::File contains Windows-incompatible characters"
50+
echo " - $file"
51+
done
52+
echo ""
53+
echo "Please rename these files to remove characters: < > : \" | ? * \\"
54+
echo "For ISO timestamps, replace colons with hyphens (e.g., 08:40:24 -> 08-40-24)"
55+
exit 1
56+
else
57+
echo "✓ All filenames are Windows-compatible"
58+
fi
59+
60+
- name: Check for files larger than 10MB
61+
run: |
62+
echo "Checking for files larger than 10MB..."
63+
64+
MAX_SIZE=$((10 * 1024 * 1024)) # 10 MB in bytes
65+
LARGE_FILES=""
66+
67+
# Get all files in the repository (excluding .git directory)
68+
ALL_FILES=$(git ls-files)
69+
70+
# Check each file's size
71+
while IFS= read -r file; do
72+
if [ -f "$file" ]; then
73+
size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null)
74+
if [ -z "$size" ]; then
75+
echo "::warning file=${file}::Could not determine size of file"
76+
continue
77+
fi
78+
if [ "$size" -gt "$MAX_SIZE" ]; then
79+
size_mb=$(awk "BEGIN {printf \"%.2f\", $size/1024/1024}")
80+
echo "::error file=${file}::File size (${size_mb} MB) exceeds 10MB limit"
81+
LARGE_FILES="${LARGE_FILES}${file} (${size_mb} MB)\n"
82+
fi
83+
fi
84+
done <<< "$ALL_FILES"
85+
86+
if [ -n "$LARGE_FILES" ]; then
87+
echo ""
88+
echo "The following files exceed 10MB:"
89+
echo -e "$LARGE_FILES"
90+
echo ""
91+
echo "Please consider one of these options:"
92+
echo " 1. Split the file into smaller parts with suffixes .part1, .part2, etc."
93+
echo " 2. Remove unnecessary content from the file"
94+
exit 1
95+
else
96+
echo "✓ All files are within the 10MB size limit"
97+
fi

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions

build.gradle

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
1717
id "groovy"
1818
id "me.champeau.jmh" version "0.7.3"
19-
id "net.ltgt.errorprone" version '4.3.0'
19+
id "net.ltgt.errorprone" version '5.0.0'
2020
//
2121
// Kotlin just for tests - not production code
2222
id 'org.jetbrains.kotlin.jvm' version '2.3.0'
@@ -136,15 +136,15 @@ dependencies {
136136
testImplementation 'org.apache.groovy:groovy-json:5.0.4'
137137
testImplementation 'com.google.code.gson:gson:2.13.2'
138138
testImplementation 'org.eclipse.jetty:jetty-server:11.0.26'
139-
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.20.1'
139+
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.21.0'
140140
testImplementation 'org.awaitility:awaitility-groovy:4.3.0'
141141
testImplementation 'com.github.javafaker:javafaker:1.0.2'
142142

143143
testImplementation 'org.reactivestreams:reactive-streams-tck:' + reactiveStreamsVersion
144144
testImplementation "io.reactivex.rxjava2:rxjava:2.2.21"
145145
testImplementation "io.projectreactor:reactor-core:3.8.0"
146146

147-
testImplementation 'org.testng:testng:7.11.0' // use for reactive streams test inheritance
147+
testImplementation 'org.testng:testng:7.12.0' // use for reactive streams test inheritance
148148
testImplementation "com.tngtech.archunit:archunit-junit5:1.4.1"
149149
testImplementation 'org.openjdk.jmh:jmh-core:1.37' // required for ArchUnit to check JMH tests
150150

@@ -156,6 +156,7 @@ dependencies {
156156
// this is needed for the idea jmh plugin to work correctly
157157
jmh 'org.openjdk.jmh:jmh-core:1.37'
158158
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
159+
jmh 'me.bechberger:ap-loader-all:4.0-10'
159160

160161
// comment this in if you want to run JMH benchmarks from idea
161162
// jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
@@ -228,7 +229,38 @@ jmh {
228229
includes = [project.property('jmhInclude')]
229230
}
230231
if (project.hasProperty('jmhProfilers')) {
231-
profilers = [project.property('jmhProfilers')]
232+
def profStr = project.property('jmhProfilers') as String
233+
if (profStr.startsWith('async')) {
234+
// Resolve native lib from ap-loader JAR on the jmh classpath
235+
def apJar = configurations.jmh.files.find { it.name.contains('ap-loader') }
236+
if (apJar) {
237+
def proc = ['java', '-jar', apJar.absolutePath, 'agentpath'].execute()
238+
proc.waitFor(10, java.util.concurrent.TimeUnit.SECONDS)
239+
def libPath = proc.text.trim()
240+
if (libPath && new File(libPath).exists()) {
241+
if (profStr == 'async') {
242+
profilers = ["async:libPath=${libPath}"]
243+
} else {
244+
profilers = [profStr.replaceFirst('async:', "async:libPath=${libPath};")]
245+
}
246+
} else {
247+
profilers = [profStr]
248+
}
249+
} else {
250+
profilers = [profStr]
251+
}
252+
} else {
253+
profilers = [profStr]
254+
}
255+
}
256+
if (project.hasProperty('jmhFork')) {
257+
fork = project.property('jmhFork') as int
258+
}
259+
if (project.hasProperty('jmhIterations')) {
260+
iterations = project.property('jmhIterations') as int
261+
}
262+
if (project.hasProperty('jmhWarmupIterations')) {
263+
warmupIterations = project.property('jmhWarmupIterations') as int
232264
}
233265
}
234266

performance-results/2024-11-28T01:53:48Z-1d50c655aaf1a907b65f39e2eba310f3463ba5d5-jdk17.json renamed to performance-results/2024-11-28T01-53-48Z-1d50c655aaf1a907b65f39e2eba310f3463ba5d5-jdk17.json

File renamed without changes.

performance-results/2024-11-28T03:56:43Z-a3fcfcb843b2104f40e75940cea4ed03e6de12c0-jdk17.json renamed to performance-results/2024-11-28T03-56-43Z-a3fcfcb843b2104f40e75940cea4ed03e6de12c0-jdk17.json

File renamed without changes.

performance-results/2024-12-03T01:09:26Z-9d6e31e367f7b2929dd393a694dc05a0c5bb6e1a-jdk17.json renamed to performance-results/2024-12-03T01-09-26Z-9d6e31e367f7b2929dd393a694dc05a0c5bb6e1a-jdk17.json

File renamed without changes.

performance-results/2024-12-04T02:33:30Z-3e5c77ba3f27de559a65c42684fc7deb9dead263-jdk17.json renamed to performance-results/2024-12-04T02-33-30Z-3e5c77ba3f27de559a65c42684fc7deb9dead263-jdk17.json

File renamed without changes.

0 commit comments

Comments
 (0)