-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from ngocle2497/feat/new_arch
feat(arch): add support new arch
- Loading branch information
Showing
192 changed files
with
4,603 additions
and
17,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yarnPath: .yarn/releases/yarn-3.6.4.cjs |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,126 @@ | ||
import groovy.json.JsonSlurper | ||
|
||
/* | ||
* Copyright (c) 2017, Okta, Inc. and/or its affiliates. All rights reserved. | ||
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") | ||
* | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
// Buildscript is evaluated before everything else so we can't use getExtOrDefault | ||
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["OktaReactNative_kotlinVersion"] | ||
|
||
dependencies { | ||
classpath('com.android.tools.build:gradle:8.1.4') | ||
} | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath "com.android.tools.build:gradle:7.2.1" | ||
// noinspection DifferentKotlinGradleVersion | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
plugins { | ||
id('maven-publish') | ||
def isNewArchitectureEnabled() { | ||
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: "com.android.library" | ||
apply plugin: "kotlin-android" | ||
|
||
if (isNewArchitectureEnabled()) { | ||
apply plugin: "com.facebook.react" | ||
} | ||
|
||
def getExtOrDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["OktaReactNative_" + name] | ||
} | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
def getExtOrIntegerDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OktaReactNative_" + name]).toInteger() | ||
} | ||
|
||
// Matches values in recent template from React Native (0.59) | ||
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9 | ||
def DEFAULT_COMPILE_SDK_VERSION = 33 | ||
def DEFAULT_MIN_SDK_VERSION = 21 | ||
def DEFAULT_TARGET_SDK_VERSION = 33 | ||
def supportsNamespace() { | ||
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') | ||
def major = parsed[0].toInteger() | ||
def minor = parsed[1].toInteger() | ||
|
||
// Namespace support was added in 7.3.0 | ||
return (major == 7 && minor >= 3) || major >= 8 | ||
} | ||
|
||
android { | ||
namespace "com.oktareactnative" | ||
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) | ||
if (supportsNamespace()) { | ||
namespace "com.oktareactnative" | ||
|
||
sourceSets { | ||
main { | ||
manifest.srcFile "src/main/AndroidManifestNew.xml" | ||
} | ||
} | ||
} | ||
|
||
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") | ||
|
||
defaultConfig { | ||
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) | ||
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) | ||
versionCode 1 | ||
versionName "1.0" | ||
manifestPlaceholders = [ | ||
"appAuthRedirectScheme": "" | ||
] | ||
minSdkVersion getExtOrIntegerDefault("minSdkVersion") | ||
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
manifestPlaceholders = [ | ||
"appAuthRedirectScheme": "" | ||
] | ||
} | ||
lintOptions { | ||
abortOnError false | ||
|
||
buildFeatures { | ||
buildConfig true | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
maven { url 'https://www.jitpack.io' } | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "com.facebook.react:react-android:+" | ||
implementation 'com.okta.android:okta-oidc-android:1.3.4' | ||
implementation 'com.squareup.okhttp3:okhttp:4.11.0' | ||
implementation 'com.squareup.okio:okio:3.5.0' | ||
implementation 'com.squareup.okio:okio-jvm:3.5.0' | ||
} | ||
} | ||
|
||
def configureReactNativePom(def pom) { | ||
def packageJson = new JsonSlurper().parseText(file('../package.json').text) | ||
|
||
pom.project { | ||
name packageJson.title | ||
artifactId packageJson.name | ||
version = packageJson.version | ||
group = "com.oktareactnative" | ||
description packageJson.description | ||
url packageJson.repository.baseUrl | ||
|
||
licenses { | ||
license { | ||
name packageJson.license | ||
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename | ||
distribution 'repo' | ||
} | ||
} | ||
} | ||
} | ||
lintOptions { | ||
disable "GradleCompatible" | ||
} | ||
|
||
afterEvaluate { project -> | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier = 'sources' | ||
from android.sourceSets.main.java.srcDirs | ||
include '**/*.java' | ||
sourceSets { | ||
main { | ||
if (isNewArchitectureEnabled()) { | ||
java.srcDirs += [ | ||
"src/newarch", | ||
// This is needed to build Kotlin project with NewArch enabled | ||
"${project.buildDir}/generated/source/codegen/java" | ||
] | ||
} else { | ||
java.srcDirs += ["src/oldarch"] | ||
} | ||
} | ||
} | ||
} | ||
|
||
android.libraryVariants.all { variant -> | ||
def name = variant.name.capitalize() | ||
def javaCompileTask = variant.javaCompileProvider.get() | ||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) { | ||
from javaCompileTask.destinationDir | ||
} | ||
} | ||
def kotlin_version = getExtOrDefault("kotlinVersion") | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
} | ||
dependencies { | ||
// For < 0.71, this will be from the local maven repo | ||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin | ||
//noinspection GradleDynamicVersion | ||
implementation "com.facebook.react:react-native:+" | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'com.okta.android:okta-oidc-android:1.3.4' | ||
implementation 'com.squareup.okhttp3:okhttp:4.11.0' | ||
implementation 'com.squareup.okio:okio:3.5.0' | ||
implementation 'com.squareup.okio:okio-jvm:3.5.0' | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
artifact androidSourcesJar | ||
} | ||
} | ||
} | ||
if (isNewArchitectureEnabled()) { | ||
react { | ||
jsRootDir = file("../src/") | ||
libraryName = "OktaReactNative" | ||
codegenJavaPackageName = "com.oktareactnative" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
# Project-wide Gradle settings. | ||
|
||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
|
||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
|
||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
org.gradle.jvmargs=-Xmx1536m | ||
|
||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
android.useAndroidX=true | ||
android.enableJetifier=true | ||
OktaReactNative_kotlinVersion=1.7.0 | ||
OktaReactNative_minSdkVersion=21 | ||
OktaReactNative_targetSdkVersion=31 | ||
OktaReactNative_compileSdkVersion=31 | ||
OktaReactNative_ndkversion=21.4.7075529 |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.