Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add back support for main gradle overrides #1163

Merged
merged 7 commits into from
Oct 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = '{{BUILD_TOOLS_VERSION}}'
minSdkVersion = {{MIN_SDK_VERSION}}
compileSdkVersion = {{COMPILE_SDK_VERSION}}
targetSdkVersion = {{TARGET_SDK_VERSION}}

// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
ndkVersion = {{NDK_VERSION}}
}
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
<!--
Generate by ReNative (https://renative.org)
BASE: packages/rnv/src/sdk-android/supportFiles/AndroidManifest_android.json
HARDCODED from POC
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

{{PLUGIN_MANIFEST_FILE}}
10 changes: 5 additions & 5 deletions packages/engine-rn/templates/platforms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = '{{BUILD_TOOLS_VERSION}}'
minSdkVersion = {{MIN_SDK_VERSION}}
compileSdkVersion = {{COMPILE_SDK_VERSION}}
targetSdkVersion = {{TARGET_SDK_VERSION}}

// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
ndkVersion = {{NDK_VERSION}}
}
repositories {
google()
Expand Down
35 changes: 20 additions & 15 deletions packages/sdk-android/src/gradleParser.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import path from 'path';
import {
OverridesOptions,
RenativeConfigPlatform,
RenativeConfigPluginPlatform,
RnvContext,
RnvPlugin,
addSystemInjects,
chalk,
doResolve,
doResolvePath,
fsExistsSync,
fsWriteFileSync,
getAppFolder,
getAppId,
getAppVersion,
getAppVersionCode,
getAppId,
getBuildFilePath,
getConfigProp,
addSystemInjects,
fsExistsSync,
writeCleanFile,
fsWriteFileSync,
doResolve,
doResolvePath,
chalk,
includesPluginPath,
isSystemWin,
logDebug,
logTask,
logWarning,
logDebug,
sanitizePluginPath,
includesPluginPath,
isSystemWin,
writeCleanFile,
} from '@rnv/core';
import path from 'path';
import { Context } from './types';

export const parseBuildGradleSync = (c: Context) => {
Expand Down Expand Up @@ -79,6 +79,10 @@ export const parseBuildGradleSync = (c: Context) => {
pattern: '{{MIN_SDK_VERSION}}',
override: c.payload.pluginConfigAndroid.minSdkVersion,
},
{
pattern: '{{NDK_VERSION}}',
override: c.payload.pluginConfigAndroid.ndkVersion,
},
{
pattern: '{{INJECT_AFTER_ALL}}',
override: c.payload.pluginConfigAndroid.buildGradleAfterAll,
Expand Down Expand Up @@ -182,16 +186,17 @@ export const parseAppBuildGradleSync = (c: Context) => {

// ANDROID PROPS
c.payload.pluginConfigAndroid.minSdkVersion = getConfigProp(c, platform, 'minSdkVersion', 24);
c.payload.pluginConfigAndroid.targetSdkVersion = getConfigProp(c, platform, 'targetSdkVersion', 28);
c.payload.pluginConfigAndroid.compileSdkVersion = getConfigProp(c, platform, 'compileSdkVersion', 28);
c.payload.pluginConfigAndroid.targetSdkVersion = getConfigProp(c, platform, 'targetSdkVersion', 33);
c.payload.pluginConfigAndroid.compileSdkVersion = getConfigProp(c, platform, 'compileSdkVersion', 33);
c.payload.pluginConfigAndroid.ndkVersion = getConfigProp(c, platform, 'ndkVersion', '23.1.7779620');
c.payload.pluginConfigAndroid.gradleBuildToolsVersion = getConfigProp(
c,
platform,
'gradleBuildToolsVersion',
'4.2.2'
);
c.payload.pluginConfigAndroid.supportLibVersion = getConfigProp(c, platform, 'supportLibVersion', '28.0.0');
c.payload.pluginConfigAndroid.buildToolsVersion = getConfigProp(c, platform, 'buildToolsVersion', '28.0.0');
c.payload.pluginConfigAndroid.buildToolsVersion = getConfigProp(c, platform, 'buildToolsVersion', '33.0.0');
c.payload.pluginConfigAndroid.kotlinVersion = getConfigProp(c, platform, 'kotlinVersion', '1.4.20');
c.payload.pluginConfigAndroid.googleServicesVersion = getConfigProp(c, platform, 'googleServicesVersion', '4.2.0');

Expand Down
1 change: 1 addition & 0 deletions packages/sdk-android/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ export const configureProject = async (c: Context) => {
buildTypes: '',
compileOptions: '',
compileSdkVersion: '',
ndkVersion: '',
gradleBuildToolsVersion: '',
gradleWrapperVersion: '',
localProperties: '',
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-android/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type Payload = {
buildTypes: string;
multiAPKs: string;
minSdkVersion: string;
ndkVersion: string;
targetSdkVersion: string;
compileSdkVersion: string;
compileOptions: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@
]
}
]
}
}
Loading