diff --git a/plugins/android/plugin.json b/plugins/android/plugin.json index 37d7753..1a3ff9c 100644 --- a/plugins/android/plugin.json +++ b/plugins/android/plugin.json @@ -29,6 +29,7 @@ "REPORTS_DIR": "reports" }, "packages": { + "github:segment-integrations/mobile-devtools?dir=segkit&ref=main": "", "bash": "latest", "coreutils": "latest", "gnused": "latest", diff --git a/plugins/ios/plugin.json b/plugins/ios/plugin.json index 90d2f66..837ce0c 100644 --- a/plugins/ios/plugin.json +++ b/plugins/ios/plugin.json @@ -23,6 +23,7 @@ "LANG": "en_US.UTF-8" }, "packages": { + "github:segment-integrations/mobile-devtools?dir=segkit&ref=main": "", "bash": "latest", "coreutils": "latest", "gnused": "latest", diff --git a/scripts/dev/rewrite-plugin-urls.sh b/scripts/dev/rewrite-plugin-urls.sh index 869aa76..de067f6 100755 --- a/scripts/dev/rewrite-plugin-urls.sh +++ b/scripts/dev/rewrite-plugin-urls.sh @@ -65,6 +65,19 @@ case "$mode" in fi fi + # Rewrite segkit package references in plugin.json files + segkit_github="github:segment-integrations/mobile-devtools?dir=segkit&ref=main" + for plugin_file in plugins/android/plugin.json plugins/ios/plugin.json; do + if [ -f "$plugin_file" ] && grep -q "$segkit_github" "$plugin_file"; then + echo " Rewriting segkit ref in: $plugin_file" + # Replace the github flake ref with a local path ref + jq --arg gh "$segkit_github" '.packages = (.packages | to_entries | map( + if .key == $gh then .key = "path:./segkit" else . end + ) | from_entries)' "$plugin_file" > "$plugin_file.tmp" \ + && mv "$plugin_file.tmp" "$plugin_file" + fi + done + echo "✓ Rewrote plugin URLs to local paths" ;; @@ -117,6 +130,18 @@ case "$mode" in && mv "plugins/react-native/plugin.json.tmp" "plugins/react-native/plugin.json" fi + # Restore segkit package references in plugin.json files + segkit_github="github:segment-integrations/mobile-devtools?dir=segkit&ref=main" + for plugin_file in plugins/android/plugin.json plugins/ios/plugin.json; do + if [ -f "$plugin_file" ] && grep -q "path:./segkit" "$plugin_file"; then + echo " Restoring segkit ref in: $plugin_file" + jq --arg gh "$segkit_github" '.packages = (.packages | to_entries | map( + if .key == "path:./segkit" then .key = $gh else . end + ) | from_entries)' "$plugin_file" > "$plugin_file.tmp" \ + && mv "$plugin_file.tmp" "$plugin_file" + fi + done + echo "✓ Restored plugin URLs to GitHub format" ;; diff --git a/segkit/Cargo.toml b/segkit/Cargo.toml index e67b726..0bf6725 100644 --- a/segkit/Cargo.toml +++ b/segkit/Cargo.toml @@ -3,7 +3,7 @@ name = "segkit" version = "0.1.0" edition = "2024" description = "Segment SDK developer toolkit" -license = "MIT" +license = "Apache-2.0" repository = "https://github.com/segment-integrations/mobile-devtools" [[bin]] diff --git a/segkit/flake.lock b/segkit/flake.lock new file mode 100644 index 0000000..4af3961 --- /dev/null +++ b/segkit/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1778124196, + "narHash": "sha256-pYEytCNic/czazbV9r3tbQ6BZzqRBg/41x2dIC5ymOo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "68a8af93ff4297686cb68880845e61e5e2e41d92", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/segkit/flake.nix b/segkit/flake.nix new file mode 100644 index 0000000..7e9acb4 --- /dev/null +++ b/segkit/flake.nix @@ -0,0 +1,50 @@ +{ + description = "Segment SDK developer toolkit (segkit CLI)"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = + { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = + f: + builtins.listToAttrs ( + map (system: { + name = system; + value = f system; + }) systems + ); + in + { + packages = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.rustPlatform.buildRustPackage { + pname = "segkit"; + version = "0.1.0"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + doCheck = false; + + meta = { + description = "Segment SDK developer toolkit"; + license = pkgs.lib.licenses.asl20; + mainProgram = "segkit"; + }; + }; + + segkit = self.packages.${system}.default; + } + ); + }; +}