Skip to content

Commit f1fabdd

Browse files
committed
update
1 parent 71d789f commit f1fabdd

File tree

4 files changed

+69
-14
lines changed

4 files changed

+69
-14
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5a1f970dc9331ab41755d374a90b811365927b42
1+
5a1f970dc9331ab41755d374a90b811365927b42

NEXT_CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@
126126
* [Breaking] Removed `disabled` field for `com.databricks.sdk.service.jobs.RunTask`.
127127
* [Breaking] Removed `defaultDataSecurityMode` and `effectiveDefaultDataSecurityMode` fields for `com.databricks.sdk.service.settingsv2.Setting`.
128128
* Added `listShares()` method for `workspaceClient.shares()` service.
129-
* [Breaking] Removed `list()` method for `workspaceClient.shares()` service.
129+
* [Breaking] Removed `list()` method for `workspaceClient.shares()` service.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/sharing/SharesImpl.java

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/cleanup-services.sh

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ SERVICE_DIR="databricks-sdk-java/src/main/java/com/databricks/sdk/service"
1111
# Files/directories to exclude from deletion (relative to service directory)
1212
# Add specific files or directories that should be preserved during cleanup
1313
EXCLUDES=(
14-
"iam/*"
15-
"sharing/*"
14+
"iam"
15+
"sharing/SharesExtService.java"
16+
"sharing/SharesExtImpl.java"
17+
"sharing/SharesExtAPI.java"
1618
)
1719

1820
echo "🧹 Cleaning service directory: $SERVICE_DIR"
@@ -28,23 +30,77 @@ fi
2830
should_exclude() {
2931
local item="$1"
3032
local relative_path="${item#$SERVICE_DIR/}"
33+
# Remove trailing slash if present
34+
relative_path="${relative_path%/}"
3135

3236
for exclude_pattern in "${EXCLUDES[@]}"; do
33-
if [[ -n "$exclude_pattern" && "$relative_path" == $exclude_pattern ]]; then
34-
return 0 # Should exclude
37+
if [[ -n "$exclude_pattern" ]]; then
38+
# Handle directory exclusions (exact match)
39+
if [[ "$relative_path" == "$exclude_pattern" ]]; then
40+
return 0 # Should exclude
41+
fi
42+
# Handle file exclusions (check if this item contains the excluded file)
43+
if [[ "$exclude_pattern" == *"/"* ]]; then
44+
local exclude_dir="${exclude_pattern%%/*}"
45+
if [[ "$relative_path" == "$exclude_dir" ]]; then
46+
# This is a directory that contains excluded files, handle specially
47+
return 2 # Special case: partial exclusion
48+
fi
49+
fi
3550
fi
3651
done
3752
return 1 # Should not exclude
3853
}
3954

55+
# Function to selectively clean a directory with file-level exclusions
56+
selective_clean_directory() {
57+
local dir="$1"
58+
local dir_name="${dir#$SERVICE_DIR/}"
59+
dir_name="${dir_name%/}"
60+
61+
echo "🔍 Selectively cleaning directory: $dir_name"
62+
63+
# Find all files in this directory
64+
while IFS= read -r -d '' file; do
65+
local file_relative="${file#$SERVICE_DIR/}"
66+
local should_keep=false
67+
68+
# Check if this file should be excluded
69+
for exclude_pattern in "${EXCLUDES[@]}"; do
70+
if [[ "$file_relative" == "$exclude_pattern" ]]; then
71+
should_keep=true
72+
break
73+
fi
74+
done
75+
76+
if $should_keep; then
77+
echo "⏭️ Keeping: $file_relative"
78+
else
79+
echo "🗑️ Deleting: $file_relative"
80+
rm -f "$file"
81+
fi
82+
done < <(find "$dir" -type f -print0)
83+
84+
# Remove empty subdirectories
85+
find "$dir" -type d -empty -delete 2>/dev/null || true
86+
}
87+
4088
# Find all items in the service directory (1 level deep)
4189
while IFS= read -r -d '' item; do
42-
if should_exclude "$item"; then
43-
echo "⏭️ Skipping: ${item#$SERVICE_DIR/}"
44-
else
45-
echo "🗑️ Deleting: ${item#$SERVICE_DIR/}"
46-
rm -rf "$item"
47-
fi
48-
done < <(find "$SERVICE_DIR" -mindepth 1 -maxdepth 1 -print0)
90+
exclusion_result=$(should_exclude "$item"; echo $?)
91+
92+
case $exclusion_result in
93+
0) # Full exclusion
94+
echo "⏭️ Skipping: ${item#$SERVICE_DIR/}"
95+
;;
96+
2) # Partial exclusion (directory with some excluded files)
97+
selective_clean_directory "$item"
98+
;;
99+
*) # No exclusion - delete entirely
100+
echo "🗑️ Deleting: ${item#$SERVICE_DIR/}"
101+
rm -rf "$item"
102+
;;
103+
esac
104+
done < <(find "$SERVICE_DIR" -mindepth 1 -maxdepth 1 -type d -print0)
49105

50106
echo "✅ Service directory cleanup completed"

0 commit comments

Comments
 (0)