Skip to content

chore: only check for min android runtime version for scoped runtime#6067

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
Akylas:fix/custom_runtime_min_version
Jun 30, 2026
Merged

chore: only check for min android runtime version for scoped runtime#6067
NathanWalker merged 1 commit into
NativeScript:mainfrom
Akylas:fix/custom_runtime_min_version

Conversation

@farfromrefug

@farfromrefug farfromrefug commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

We were checking for runtime > 1.5.0. Does not make sense with custom runtimes

Summary by CodeRabbit

  • Bug Fixes
    • Improved Android project creation and platform updates to apply runtime version checks only for the scoped Android runtime.
    • Reduced unexpected failures for projects using a custom Android runtime package name.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change modifies android-project-service.ts to restrict two existing minimum runtime version checks (related to Gradle support) so they only apply when the Android runtime package name matches the scoped runtime constant, derived from projectData.nsConfig.android?.runtimePackageName.

Changes

Scoped Runtime Version Gating

Layer / File(s) Summary
Gate version checks by scoped runtime package name
lib/services/android-project-service.ts
createProject and updatePlatform each compute packageName from projectData.nsConfig.android?.runtimePackageName (defaulting to constants.SCOPED_ANDROID_RUNTIME_NAME) and now gate their existing minimum-version comparison logic behind packageName === constants.SCOPED_ANDROID_RUNTIME_NAME.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

A rabbit hops through code so neat,
Gating versions, no more deceit.
Scoped runtimes get their special check,
Others now don't take the trek.
Hop, skip, merge — a tidy feat! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: limiting the Android minimum runtime version check to scoped runtimes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lib/services/android-project-service.ts (1)

331-342: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate packageName resolution logic across two methods.

Both createProject and updatePlatform repeat the identical expression projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME. Extract this into a shared private helper (e.g. isScopedAndroidRuntime(projectData)) to avoid drift if the fallback logic changes later.

♻️ Suggested refactor
+	private isScopedAndroidRuntime(projectData: IProjectData): boolean {
+		const packageName =
+			projectData.nsConfig.android?.runtimePackageName ||
+			constants.SCOPED_ANDROID_RUNTIME_NAME;
+		return packageName === constants.SCOPED_ANDROID_RUNTIME_NAME;
+	}
+
 	public async createProject(
 		frameworkDir: string,
 		frameworkVersion: string,
 		projectData: IProjectData
 	): Promise<void> {
-		const packageName = projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME;
 		if (
-			packageName === constants.SCOPED_ANDROID_RUNTIME_NAME &&
+			this.isScopedAndroidRuntime(projectData) &&
 			semver.lt(
 	): Promise<boolean> {
-		const packageName = projectData.nsConfig.android?.runtimePackageName || constants.SCOPED_ANDROID_RUNTIME_NAME;
 		if (
-			packageName === constants.SCOPED_ANDROID_RUNTIME_NAME &&
+			this.isScopedAndroidRuntime(projectData) &&
 			semver.eq(

Also applies to: 523-536

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/services/android-project-service.ts` around lines 331 - 342, The
`packageName` fallback logic is duplicated in both `createProject` and
`updatePlatform`, so extract `projectData.nsConfig.android?.runtimePackageName
|| constants.SCOPED_ANDROID_RUNTIME_NAME` into a shared private helper on
`AndroidProjectService` (for example, `isScopedAndroidRuntime(projectData)` or a
similar resolver) and update both call sites to use it, keeping the semver check
and existing `this.$errors.fail` behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/services/android-project-service.ts`:
- Around line 331-342: The `packageName` fallback logic is duplicated in both
`createProject` and `updatePlatform`, so extract
`projectData.nsConfig.android?.runtimePackageName ||
constants.SCOPED_ANDROID_RUNTIME_NAME` into a shared private helper on
`AndroidProjectService` (for example, `isScopedAndroidRuntime(projectData)` or a
similar resolver) and update both call sites to use it, keeping the semver check
and existing `this.$errors.fail` behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 49720012-3767-4cef-83de-95d36daa7e8d

📥 Commits

Reviewing files that changed from the base of the PR and between 1344dc2 and 5f95018.

📒 Files selected for processing (1)
  • lib/services/android-project-service.ts

@NathanWalker NathanWalker merged commit 95b93f5 into NativeScript:main Jun 30, 2026
5 checks passed
@NathanWalker NathanWalker deleted the fix/custom_runtime_min_version branch June 30, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants