Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/downstream_updates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: downstream-updates
permissions: read-all

on:
release:
types: [released]
workflow_dispatch:
inputs:
target_version:
description: 'Version of the CLI to update downstream repos to'
required: true
type: string

jobs:
update-dependencies:
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.target_version || github.event.release.tag_name }}
strategy:
matrix:
downstream_repo: ['bugsnag/bugsnag-unity']
steps:
- name: Install libcurl4-openssl-dev and net-tools
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev net-tools

- run: >
curl -X POST https://api.github.com/repos/bugsnag/bugsnag-unity/dispatches
-H 'Content-Type: application/json'
-H "Authorization: Bearer ${{ secrets.DEP_UPDATER_BEARER_TOKEN }}"
-d '{
"event_type": "update-cli",
"client_payload": {
"cli_version": "${{ env.RELEASE_VERSION }}"
}
}'
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2.9.2 (2025-02-11)

### Fixes
- Get NDK version from the `source.properties` file when uploading NDK symbol files [172](https://github.com/bugsnag/bugsnag-cli/pull/172)

## 2.9.1 - (2025-01-23)

### Fixes
Expand Down
15 changes: 15 additions & 0 deletions features/Unity-Android/unity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ Feature: Unity Android integration tests
And the sourcemap payload field "versionName" equals "1.0"
And the sourcemap payload field "overwrite" equals "true"

Scenario: Unity Android integration tests using the bundled NDK
Given I build the Unity Android example project
And I wait for the Unity symbols to generate

Given I set the NDK path to the Unity bundled version
When I run bugsnag-cli with upload unity-android --upload-api-root-url=http://localhost:9339 --api-key=1234567890ABCDEF1234567890ABCDEF --overwrite platforms-examples/Unity/
Then I wait to receive 5 sourcemaps
Then the sourcemap is valid for the Android Build API
Then the sourcemaps Content-Type header is valid multipart form-data
And the sourcemap payload field "apiKey" equals "1234567890ABCDEF1234567890ABCDEF"
And the sourcemap payload field "appId" equals "com.bugsnag.example.unity.android"
And the sourcemap payload field "versionCode" equals "1"
And the sourcemap payload field "versionName" equals "1.0"
And the sourcemap payload field "overwrite" equals "true"


Scenario: Unity Android integration tests passing the aab file
Given I build the Unity Android example project
Expand Down
5 changes: 5 additions & 0 deletions features/steps/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,8 @@ def get_version_number(file_path)
And('I wait for the Unity symbols to generate') do
Maze.check.include(`ls #{@fixture_dir}`, 'UnityExample-1.0-v1-IL2CPP.symbols.zip')
end

Given(/^I set the NDK path to the Unity bundled version$/) do
# Set the environment variable to the path of the NDK bundled with Unity
ENV['ANDROID_NDK_ROOT'] = "/Applications/Unity/Hub/Editor/#{ENV['UNITY_VERSION']}/PlaybackEngines/AndroidPlayer/NDK"
end
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ display_help() {
EOS
}

VERSION="2.9.1"
VERSION="2.9.2"

while [[ "$#" -gt 0 ]]; do
case "$1" in
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/bugsnag/bugsnag-cli/pkg/utils"
)

var package_version = "2.9.1"
var package_version = "2.9.2"

func main() {
commands := options.CLI{}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/cli",
"version": "2.9.1",
"version": "2.9.2",
"description": "BugSnag CLI",
"main": "bugsnag-cli-wrapper.js",
"bin": {
Expand Down
44 changes: 38 additions & 6 deletions pkg/android/get-ndk-version.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
package android

import (
"bufio"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
)

// GetNdkVersion - Returns the major NDK version
func GetNdkVersion(path string) (int, error) {
func GetNdkVersion(ndkPath string) (int, error) {
// Construct the path to source.properties
sourceFile := filepath.Join(ndkPath, "source.properties")

ndkVersion := strings.Split(filepath.Base(path), ".")
// Open the file
file, err := os.Open(sourceFile)
if err != nil {
return 0, fmt.Errorf("failed to open source.properties: %v", err)
}
defer file.Close()

ndkIntVersion, err := strconv.Atoi(ndkVersion[0])
// Read the file line by line
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
if strings.HasPrefix(line, "Pkg.Revision") {
// Extract version string
parts := strings.Split(line, "=")
parts[1] = strings.TrimSpace(parts[1])
if len(parts) == 2 {
versionStr := parts[1]
// Extract major version (before the first dot)
versionParts := strings.Split(versionStr, ".")
if len(versionParts) > 0 {
majorVersion, err := strconv.Atoi(versionParts[0])
if err != nil {
return 0, fmt.Errorf("failed to parse major version: %v", err)
}
return majorVersion, nil
}
}
}
}

if err != nil {
return 0, err
// Check for errors while scanning
if err := scanner.Err(); err != nil {
return 0, fmt.Errorf("error reading source.properties: %v", err)
}

return ndkIntVersion, nil
return 0, fmt.Errorf("NDK version not found in source.properties")
}
Loading