Summary
Allow the SDK path and ConnectIQ installation directory to be specified via BuildConfig options, rather than always auto-discovering them from the platform-default locations.
Motivation
I've been building a Bazel toolchain for Connect IQ development and want to integrate @markw65/monkeyc-optimizer into the build pipeline. In this context, the build system already knows where the SDK and device metadata live — it resolves these paths at repository-rule time and passes them explicitly to each build action.
At the time of writing, my toolchain depends on local filesystem knowledge, but will eventually consume connect-iq-sdk-manager-cli to have its own Bazel-friendlier sandboxed SDK.
Currently, the optimizer hardcodes the ConnectIQ directory in sdk-util.ts:
export const connectiq =
process.platform === "linux"
? `${process.env.HOME}/.Garmin/ConnectIQ`
: `${appSupport}/Garmin/ConnectIQ`;
And getSdkPath() always reads current-sdk.cfg from that location. getDeviceInfo() and getLanguages() similarly use the hardcoded connectiq path to find device metadata.
This makes it a challenge to:
- Use the optimizer in sandboxed or hermetic build environments where the CIQ installation may be mounted at a non-standard path
- Run optimized builds in CI where the SDK is installed to a custom location
- Use a different SDK version than the one pointed to by
current-sdk.cfg
Proposed Change
Add two optional fields to BuildConfig:
export type BuildConfig = {
// ... existing fields ...
/** Path to the ConnectIQ SDK directory (e.g., "/path/to/connectiq-sdk-...").
* If set, bypasses reading current-sdk.cfg. */
sdkPath?: string;
/** Path to the ConnectIQ application support directory
* (e.g., "/path/to/ConnectIQ" containing Devices/, Fonts/, etc.).
* If set, overrides the default platform-specific location. */
connectIQPath?: string;
};
The changes would be localised to a few functions:
getSdkPath() — if config.sdkPath is set, return it directly instead of reading current-sdk.cfg
getDeviceInfo() — if config.connectIQPath is set, look for Devices/ under that path instead of the hardcoded connectiq constant
getLanguages() — same as above
default_jungle() in jungles.ts — uses connectiq for personality paths; would need the override here too
For the CLI driver, these could be exposed as --sdk-path and --connectiq-path arguments.
Alternatives Considered
- Symlinking the CIQ directory to the expected location — works but is fragile and requires elevated permissions in some CI environments.
- Environment variables (e.g.
CONNECTIQ_HOME) — would also work, but explicit config fields are more discoverable and composable with the existing BuildConfig pattern.
Summary
Allow the SDK path and ConnectIQ installation directory to be specified via
BuildConfigoptions, rather than always auto-discovering them from the platform-default locations.Motivation
I've been building a Bazel toolchain for Connect IQ development and want to integrate
@markw65/monkeyc-optimizerinto the build pipeline. In this context, the build system already knows where the SDK and device metadata live — it resolves these paths at repository-rule time and passes them explicitly to each build action.At the time of writing, my toolchain depends on local filesystem knowledge, but will eventually consume connect-iq-sdk-manager-cli to have its own Bazel-friendlier sandboxed SDK.
Currently, the optimizer hardcodes the ConnectIQ directory in
sdk-util.ts:And
getSdkPath()always readscurrent-sdk.cfgfrom that location.getDeviceInfo()andgetLanguages()similarly use the hardcodedconnectiqpath to find device metadata.This makes it a challenge to:
current-sdk.cfgProposed Change
Add two optional fields to
BuildConfig:The changes would be localised to a few functions:
getSdkPath()— ifconfig.sdkPathis set, return it directly instead of readingcurrent-sdk.cfggetDeviceInfo()— ifconfig.connectIQPathis set, look forDevices/under that path instead of the hardcodedconnectiqconstantgetLanguages()— same as abovedefault_jungle()injungles.ts— usesconnectiqfor personality paths; would need the override here tooFor the CLI driver, these could be exposed as
--sdk-pathand--connectiq-patharguments.Alternatives Considered
CONNECTIQ_HOME) — would also work, but explicit config fields are more discoverable and composable with the existingBuildConfigpattern.