Skip to content

Commit 514e25b

Browse files
committed
Add MySQL Router to Extension Packaging
- Updated packaging script to include MySQL Router - Updated packaging script to reduce OCI SDK to what is really needed - Changed Router bootstrap to use different directories for each connection - Update MRS SDK generation to include config - Added Rebuild MRS SDK functionality Change-Id: I982d1f410fbf3f25d6e4cd40f7ce43e2492fbb7b
1 parent d4801cb commit 514e25b

Some content is hidden

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

61 files changed

+1758
-615
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=1.13.6
1+
VERSION=1.14.0

gui/backend/gui_plugin/core/dbms/DbMySQLSession.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def _initialize_setup_tasks(self):
103103
SetupTasks.HeatWaveCheckTask(self),
104104
SetupTasks.BastionHandlerTask(
105105
self, lambda message: self._message_callback('PENDING', "", message)),
106+
SetupTasks.RemoveExternalOptionsTask(self),
106107
DbPingHandlerTask(self)]
107108

108109
@property

gui/backend/gui_plugin/core/dbms/DbMySQLSessionSetupTasks.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2022, 2023, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0,
@@ -121,3 +121,10 @@ def on_connected(self):
121121

122122
def on_failed_connection(self):
123123
self.reset(include_data=False)
124+
125+
class RemoveExternalOptionsTask(DbSessionSetupTask):
126+
def __init__(self, session) -> None:
127+
super().__init__(session)
128+
129+
def on_connect(self):
130+
self.extract_option("mrs-service-host", False)

gui/backend/gui_plugin/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from mysqlsh.plugin_manager import plugin_function
2323

2424
# Define plugin version
25-
VERSION = "1.13.6"
25+
VERSION = "1.14.0"
2626

2727
@plugin_function('gui.info', shell=True, cli=True, web=True)
2828
def info():

gui/extension/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# MySQL Shell for VS Code Change Log
22

3+
## Changes in 1.14.0+8.1.1
4+
5+
### Additions
6+
7+
- Added support for MRS functions
8+
- Added MySQL Router to extension package
9+
- Changed the MRS sample code to make use of SDK
10+
11+
### Fixes
12+
13+
- Fixed broken Copy/Paste function on DB Notebooks
14+
- Fix for breaking OCI SDK change for listing MySQL DB Systems
15+
- Fixed auto-completion for @... decorators for MRS SQL statements
16+
- Fixes in MRS SQL generation
17+
318
## Changes in 1.13.6+8.1.1
419

520
### Fixes

gui/extension/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MySQL Shell for VS Code 1.13.6+8.1.1 Preview
1+
# MySQL Shell for VS Code 1.14.0+8.1.1 Preview
22

33
This extension enables interactive editing and execution of SQL for MySQL Databases and the MySQL HeatWave Service. It integrates the MySQL Shell directly into VS Code development workflows.
44

gui/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"color": "#2789e1",
88
"theme": "dark"
99
},
10-
"version": "1.13.6",
10+
"version": "1.14.0",
1111
"publisher": "Oracle",
1212
"license": "SEE LICENSE IN LICENSE.txt",
1313
"repository": {

gui/extension/scripts/package_extension.sh

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2022, 2023, Oracle and/or its affiliates.
33

44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License, version 2.0,
@@ -38,6 +38,19 @@
3838
# packaging/mysql-shell/darwin-arm64
3939
# packaging/mysql-shell/darwin-x64
4040
# packaging/mysql-shell/win32-x64
41+
# packaging/mysql-shell/linux-arm64
42+
# packaging/mysql-shell/linux-x64
43+
#
44+
# The MySQL Router is now also included in the extension package. The following
45+
# folders need to be created in the packaging directory. When building from PB2
46+
# the latest router version from the mysql-trunk-http-rest-preview-release PB2
47+
# branch needs to be used.
48+
#
49+
# packaging/mysql-router/darwin-arm64
50+
# packaging/mysql-router/darwin-x64
51+
# packaging/mysql-router/win32-x64
52+
# packaging/mysql-router/linux-arm64
53+
# packaging/mysql-router/linux-x64
4154

4255
# Simple function to check url exists
4356
# Usage: if `validate_url $url`; then dosomething; else echo "does not exist"; fi
@@ -79,6 +92,40 @@ function download_shell_mac_pkg(){
7992
fi
8093
}
8194

95+
# Function that cleans up the OCI package to include just the modules that are used
96+
# Usage: strip_oci_package ./path/to/oci
97+
function strip_oci_package(){
98+
# Collect all folders to delete, except the ones in the list
99+
delFolders=()
100+
prefix="$1/"
101+
for dir in $1/*; do
102+
if [ -d "$dir" ]; then
103+
case ${dir#"$prefix"} in
104+
"core"|"constants.py"|"version.py"|"work_requests"|"compute_instance_agent"|"request.py"|"alloy.py"|"service_endpoints.py"|"regions.py"|"circuit_breaker"|"decorators.py"|"regions_definitions.py"|"signer.py"|"util.py"|"dns"|"config.py"|"fips.py"|"load_balancer"|"object_storage"|"exceptions.py"|"retry"|"_vendor"|"waiter.py"|"response.py"|"base_client.py"|"mysql"|"pagination"|"auth"|"bastion"|"identity")
105+
# do nothing
106+
;;
107+
*)
108+
# error
109+
delFolders+=("$dir")
110+
esac
111+
fi
112+
done
113+
114+
# Delete the folders
115+
if [ ${#delFolders[@]} -gt 0 ]; then
116+
rm -rf "${delFolders[@]}"
117+
118+
# Remove full import from __init__.py
119+
if [[ $OSTYPE == 'darwin'* ]]; then
120+
sed -i '' '16,$d' $1/__init__.py
121+
else
122+
sed -i '16,$d' $1/__init__.py
123+
fi
124+
else
125+
echo OCI cleanup failed. Folder $1 not found.
126+
fi
127+
}
128+
82129
echo "Starting MySQL Shell for VS Code Extension packaging..."
83130

84131
if [ ! -d "$HOME/.mysqlsh/plugins/gui_plugin" ]; then
@@ -161,9 +208,17 @@ for d in packaging/mysql-shell/*; do
161208
echo "Copy shell binaries, lib and share"
162209
cp -R $d/bin shell/.
163210
cp -R $d/lib shell/.
164-
cp -R $d/libexec shell/.
211+
cp -R $d/libexec shell/. 2>/dev/null || :
165212
cp -R $d/share shell/.
166213

214+
echo "Cleanup OCI SDK folder"
215+
OCIPATH=shell/lib/mysqlsh/lib/python3.10/site-packages/oci
216+
if [ "$PLATFORM" == "linux-arm64" ] || [ "$PLATFORM" == "linux-x64" ]; then
217+
OCIPATH=shell/lib/mysqlsh/lib/python3.9/site-packages/oci
218+
elif [ "$PLATFORM" == "win32-x64" ]; then
219+
OCIPATH=shell/lib/Python3.10/Lib/site-packages/oci
220+
fi
221+
strip_oci_package $OCIPATH
167222

168223
echo "Copy plugins"
169224
cp -RL $HOME/.mysqlsh/plugins/gui_plugin shell/lib/mysqlsh/plugins/.
@@ -178,13 +233,35 @@ for d in packaging/mysql-shell/*; do
178233
rm -rf shell/lib/mysqlsh/plugins/gui_plugin/wrappers
179234
fi
180235

236+
# Remove the shell directory if it exists
237+
if [ -d "router" ]; then
238+
rm -rf router
239+
fi
240+
241+
# Make router directory where the extension will expect the router
242+
if [ -d "packaging/mysql-router/$PLATFORM/bin" ]; then
243+
echo "Copy router binaries, lib and share for platform $PLATFORM"
244+
245+
mkdir router
246+
247+
cp -R packaging/mysql-router/$PLATFORM/bin router/.
248+
cp -R packaging/mysql-router/$PLATFORM/lib router/.
249+
else
250+
echo "MySQL Router not found, skipping MySQL Router packaging."
251+
fi
252+
181253
echo "Create VSIX package"
182254
vsce package --target $PLATFORM --baseImagesUrl https://github.com/mysql/mysql-shell-plugins/raw/master/gui/extension || exit 1
183255

184256
mv -f *.vsix packaging/extension-packages/.
185257
fi
186258
done
187259

260+
# Remove the router directory if it exists
261+
if [ -d "router" ]; then
262+
rm -rf router
263+
fi
264+
188265
# Remove the shell directory if it exists
189266
if [ -d "shell" ]; then
190267
rm -rf shell

0 commit comments

Comments
 (0)