-
Notifications
You must be signed in to change notification settings - Fork 133
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
Refactor build configs (build.gradle, Podfile) #305
Merged
hyochan
merged 9 commits into
crossplatformkorea:master
from
WoonHaKim:refactor-build-gradles
May 21, 2022
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c565efa
Refactor android build.gradle to use ext values
452de44
Set kakao_sdk_version as predefined or user specified version
ea92ac0
Fix gradle properties file
0dd8e1c
Add mark for $KakaoSDKVersion testing
6438329
Remove jcenter deps.
028f686
Remove unused comment
153a84c
Move iOS default version settings to podspec
41dc93e
Add feature to docs
8cac122
Rollback RNKakaoLogins_kakaoSdkVersion to 2.9.0
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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,60 +1,144 @@ | ||
buildscript { | ||
ext { | ||
gradleVersion = '4.1.0' | ||
kotlinVersion = '1.3.41' | ||
} | ||
|
||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
// 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['RNKakaoLogins_kotlinVersion'] | ||
def gradle_version = rootProject.ext.has('gradleVersion') ? rootProject.ext.get('gradleVersion') : project.properties['RNKakaoLogins_gradleVersion'] | ||
|
||
dependencies { | ||
classpath("com.android.tools.build:gradle:$gradleVersion") | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" | ||
} | ||
} | ||
repositories { | ||
google() | ||
mavenCentral() | ||
jcenter() | ||
WoonHaKim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/' } | ||
} | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
dependencies { | ||
classpath "com.android.tools.build:gradle:$gradle_version" | ||
// noinspection DifferentKotlinGradleVersion | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
|
||
android { | ||
compileSdkVersion safeExtGet('compileSdkVersion', 29) | ||
|
||
defaultConfig { | ||
minSdkVersion safeExtGet('minSdkVersion', 19) | ||
targetSdkVersion safeExtGet('targetSdkVersion', 29) | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
def getExtOrDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNKakaoLogins_' + name] | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
} | ||
def getExtOrIntegerDefault(name) { | ||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RNKakaoLogins_' + name]).toInteger() | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
android { | ||
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') | ||
defaultConfig { | ||
minSdkVersion 21 | ||
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
} | ||
} | ||
lintOptions { | ||
disable 'GradleCompatible' | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
|
||
repositories { | ||
maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/' } | ||
mavenCentral() | ||
jcenter() | ||
google() | ||
|
||
maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/' } | ||
|
||
|
||
def found = false | ||
def defaultDir = null | ||
def androidSourcesName = 'React Native sources' | ||
|
||
if (rootProject.ext.has('reactNativeAndroidRoot')) { | ||
defaultDir = rootProject.ext.get('reactNativeAndroidRoot') | ||
} else { | ||
defaultDir = new File( | ||
projectDir, | ||
'/../../../node_modules/react-native/android' | ||
) | ||
} | ||
|
||
if (defaultDir.exists()) { | ||
maven { | ||
url defaultDir.toString() | ||
name androidSourcesName | ||
} | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") | ||
found = true | ||
} else { | ||
def parentDir = rootProject.projectDir | ||
|
||
1.upto(5, { | ||
if (found) return true | ||
parentDir = parentDir.parentFile | ||
|
||
def androidSourcesDir = new File( | ||
parentDir, | ||
'node_modules/react-native' | ||
) | ||
|
||
def androidPrebuiltBinaryDir = new File( | ||
parentDir, | ||
'node_modules/react-native/android' | ||
) | ||
|
||
if (androidPrebuiltBinaryDir.exists()) { | ||
maven { | ||
url androidPrebuiltBinaryDir.toString() | ||
name androidSourcesName | ||
} | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") | ||
found = true | ||
} else if (androidSourcesDir.exists()) { | ||
maven { | ||
url androidSourcesDir.toString() | ||
name androidSourcesName | ||
} | ||
|
||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") | ||
found = true | ||
} | ||
}) | ||
} | ||
|
||
if (!found) { | ||
throw new GradleException( | ||
"${project.name}: unable to locate React Native android sources. " + | ||
"Ensure you have you installed React Native as a dependency in your project and try again." | ||
) | ||
} | ||
} | ||
|
||
def kotlin_version = getExtOrDefault('kotlinVersion') | ||
def kakao_sdk_version = getExtOrDefault('kakaoSdkVersion') | ||
|
||
dependencies { | ||
implementation 'com.facebook.react:react-native:+' | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${project.ext.kotlinVersion}" | ||
implementation "com.kakao.sdk:v2-user:2.9.0" | ||
implementation "com.kakao.sdk:v2-talk:2.9.0" | ||
implementation "com.kakao.sdk:v2-story:2.9.0" | ||
} | ||
// noinspection GradleDynamicVersion | ||
api 'com.facebook.react:react-native:+' | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
|
||
// Kakao | ||
implementation "com.kakao.sdk:v2-user:$kakao_sdk_version" // 카카오 로그인 | ||
implementation "com.kakao.sdk:v2-talk:$kakao_sdk_version" // 친구, 메시지(카카오톡) | ||
implementation "com.kakao.sdk:v2-story:$kakao_sdk_version" // 카카오 스토리 | ||
} |
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,5 @@ | ||
RNKakaoLogins_kotlinVersion=1.3.50 | ||
RNKakaoLogins_compileSdkVersion=31 | ||
RNKakaoLogins_targetSdkVersion=31 | ||
RNKakaoLogins_kakaoSdkVersion=2.9.1 | ||
RNKakaoLogins_gradleVersion=4.1.0 |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
라이브러리 호환성을 위해서
default
로 설정을 해주는게 좋지 않을까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트를 위한 코맨트가 남아있었군요. kakao-login.podspec의
kakao_sdk_version
을 기본으로 사용하도록 수정되었습니다.2.9.1에서 별 문제는 없었으나, 만약의 호환성을 위해 sdk버전이 2.9.0로 롤백되었습니다. 감사합니다.