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

๐Ÿ”€ :: (#62) - BuildConfig๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜์˜€์Šต๋‹ˆ๋‹ค. #63

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

audgns10
Copy link
Member

@audgns10 audgns10 commented Oct 9, 2024

๐Ÿ’ก ๊ฐœ์š”

  • local.properties์— baseUrl ๊ฐ’์„ ๋„ฃ์–ด ํ•ด๋‹น ์ •๋ณด๋ฅผ ๋ณดํ˜ธํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋„๋ก ํ•˜๋ฉด Remote ์ €์žฅ์†Œ์—๋Š” Push๊ฐ€ ๋˜์ง€ ์•Š์œผ๋ฏ€๋กœ ์ด๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด BuildConfig๋ฅผ ์‚ฌ์šฉํ•  ํ•„์š”๊ฐ€ ์žˆ์–ด๋ณด์˜€์Šต๋‹ˆ๋‹ค.

๐Ÿ“ƒ ์ž‘์—…๋‚ด์šฉ

  • BuildConfig๋ฅผ ์„ธํŒ…ํ•˜๊ณ  ์ด๋ฅผ ์ ์šฉ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.

๐Ÿ”€ ๋ณ€๊ฒฝ์‚ฌํ•ญ

  • chore build.gradle.kts(:core:network)
  • chore NetworkModule
  • chore expo_ci.yml File

๐Ÿ™‹โ€โ™‚๏ธ ์งˆ๋ฌธ์‚ฌํ•ญ

  • ๊ฐœ์„ ํ•  ์ , ์˜คํƒ€, ์ฝ”๋“œ์— ์ด์‚ฐํ•œ ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด Comment ๋‹ฌ์•„์ฃผ์„ธ์š”.

๐Ÿด ์‚ฌ์šฉ๋ฐฉ๋ฒ•

  • BASE_URL์„ ์‚ฌ์šฉํ•  ๋ถ€๋ถ„์— buildConfig.BASE_URL ์ด๋Ÿฐ์‹์œผ๋กœ ์‚ฌ์šฉํ•ด์„œ ์›๋ž˜์žˆ๋˜ ๋ฌธ์ž์—ด ๋Œ€์‹  ๋„ฃ์–ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-10-09 แ„‹แ…ฉแ„’แ…ฎ 2 39 59

๐ŸŽธ ๊ธฐํƒ€

  • x

Summary by CodeRabbit

  • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ

    • CI ์›Œํฌํ”Œ๋กœ์šฐ์— local.properties ํŒŒ์ผ ์ƒ์„ฑ ๋‹จ๊ณ„ ์ถ”๊ฐ€.
    • Retrofit ์ธ์Šคํ„ด์Šค์˜ ๊ธฐ๋ณธ URL์„ ๋นŒ๋“œ ๊ตฌ์„ฑ์—์„œ ๋™์ ์œผ๋กœ ๊ฐ€์ ธ์˜ค๋„๋ก ์—…๋ฐ์ดํŠธ.
  • ๋ฒ„๊ทธ ์ˆ˜์ •

    • build.gradle.kts ํŒŒ์ผ์—์„œ API ํ‚ค๋ฅผ ๋กœ๋“œํ•˜๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€.
  • ๋ฌธ์„œํ™”

    • ์ฝ”๋“œ ๊ตฌ์กฐ ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ์ฃผ์„ ์ถ”๊ฐ€.

@audgns10 audgns10 added 1๏ธโƒฃ Priority: High ์šฐ์„ ์ˆœ์œ„ - ์ƒ โš™ Setting ํ™˜๊ฒฝ ์„ธํŒ… โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ labels Oct 9, 2024
@audgns10 audgns10 self-assigned this Oct 9, 2024
Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์€ Android CI ์›Œํฌํ”Œ๋กœ์šฐ์™€ ๋„คํŠธ์›Œํฌ ๋ชจ๋“ˆ์˜ Gradle ์„ค์ •์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. .github/workflows/expo_ci.yml ํŒŒ์ผ์— local.properties ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๋Š” ๋‹จ๊ณ„๊ฐ€ ์ถ”๊ฐ€๋˜์–ด, CI ๊ณผ์ •์—์„œ LOCAL_PROPERTIES ๋น„๋ฐ€์ด ์ด ํŒŒ์ผ์— ๊ธฐ๋ก๋ฉ๋‹ˆ๋‹ค. core/network/build.gradle.kts ํŒŒ์ผ์—์„œ๋Š” BASE_URL์„ ์ •์˜ํ•˜๋Š” buildConfigField๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ๊ณ , getApiKey ํ•จ์ˆ˜๊ฐ€ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ, NetworkModule.kt์—์„œ Retrofit ์ธ์Šคํ„ด์Šค์˜ ๊ธฐ๋ณธ URL์„ BuildConfig.BASE_URL๋กœ ์—…๋ฐ์ดํŠธํ–ˆ์Šต๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ์š”์•ฝ
.github/workflows/expo_ci.yml local.properties ํŒŒ์ผ ์ƒ์„ฑ ๋‹จ๊ณ„ ์ถ”๊ฐ€ (- name: Create LOCAL_PROPERTIES)
core/network/build.gradle.kts FileInputStream ๋ฐ Properties ์ž„ํฌํŠธ ์ถ”๊ฐ€, buildConfig ๊ธฐ๋Šฅ ํ™œ์„ฑํ™”, BASE_URL์„ ์œ„ํ•œ buildConfigField ์ถ”๊ฐ€, getApiKey ํ•จ์ˆ˜ ๊ตฌํ˜„
core/network/src/main/java/com/school_of_company/network/di/NetworkModule.kt Retrofit ์ธ์Šคํ„ด์Šค์˜ ๊ธฐ๋ณธ URL์„ BuildConfig.BASE_URL๋กœ ์—…๋ฐ์ดํŠธ

Possibly related PRs

Suggested reviewers

  • diejdkll
  • Chaejongin12
  • Xixn2

Poem

๐Ÿ‡ ๋ณ€ํ™”์˜ ๋ฐ”๋žŒ์ด ๋ถˆ์–ด์™€,
์ƒˆ๋กœ์šด ์†์„ฑ์ด ์ƒ๊ฒจ๋‚˜.
local.properties์™€ ํ•จ๊ป˜,
๋„คํŠธ์›Œํฌ๊ฐ€ ๋” ๊ฐ•ํ•ด์ง€๋„ค.
๋นŒ๋“œ์˜ ๊ธฐ์จ์„ ํ•จ๊ป˜ ๋‚˜๋ˆ„๊ณ ,
๋ชจ๋‘์˜ ๊ฟˆ์„ ์ด๋ฃจ๋Š” ๊ธธ๋กœ! ๐ŸŒŸ


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

๐Ÿงน Outside diff range and nitpick comments (2)
.github/workflows/expo_ci.yml (1)

40-41: ์ข‹์€ ๋ณ€๊ฒฝ์‚ฌํ•ญ์ž…๋‹ˆ๋‹ค. ๋ณด์•ˆ์„ ์œ„ํ•œ ์ œ์•ˆ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

local.properties ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๋Š” ๋‹จ๊ณ„๋ฅผ ์ถ”๊ฐ€ํ•œ ๊ฒƒ์€ ์ข‹์€ ์ ‘๊ทผ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณด์•ˆ์„ ๋”์šฑ ๊ฐ•ํ™”ํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ๊ณ ๋ คํ•ด ๋ณด์„ธ์š”:

      - name: Create LOCAL_PROPERTIES
-       run: echo '${{ secrets.LOCAL_PROPERTIES }}' > ./local.properties
+       run: |
+         echo '${{ secrets.LOCAL_PROPERTIES }}' > ./local.properties
+         chmod 600 ./local.properties

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด local.properties ํŒŒ์ผ์˜ ๊ถŒํ•œ์„ ์ œํ•œํ•˜์—ฌ ๋ณด์•ˆ์„ ๊ฐ•ํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

core/network/build.gradle.kts (1)

15-19: ํ™˜๊ฒฝ๋ณ„๋กœ BASE_URL์„ ๊ด€๋ฆฌํ•˜๋„๋ก ๊ฐœ์„ ํ•˜์„ธ์š”

ํ˜„์žฌ BASE_URL์„ local.properties์—์„œ ์ฝ์–ด์˜ค๋„๋ก ์„ค์ •ํ•˜์…จ์ง€๋งŒ, ๋นŒ๋“œ ํƒ€์ž…์ด๋‚˜ ํ™˜๊ฒฝ(dev, staging, production)์— ๋”ฐ๋ผ ๋‹ค๋ฅธ URL์„ ์‚ฌ์šฉํ•ด์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด buildConfigField๋ฅผ ๋นŒ๋“œ ํƒ€์ž…๋ณ„๋กœ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ คํ•ด๋ณด์„ธ์š”.

์˜ˆ๋ฅผ ๋“ค์–ด, ์•„๋ž˜์™€ ๊ฐ™์ด ๋นŒ๋“œ ํƒ€์ž…๋ณ„๋กœ BASE_URL์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

android {
    buildTypes {
        debug {
            buildConfigField("String", "BASE_URL", "\"${getApiKey("DEBUG_BASE_URL")}\"")
        }
        release {
            buildConfigField("String", "BASE_URL", "\"${getApiKey("RELEASE_BASE_URL")}\"")
        }
    }
}

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๊ฐ ๋นŒ๋“œ ํƒ€์ž…์— ๋งž๋Š” URL์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด ์œ ์—ฐ์„ฑ์ด ๋†’์•„์ง‘๋‹ˆ๋‹ค.

๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Files that changed from the base of the PR and between ccdf666 and b2bd687.

๐Ÿ“’ Files selected for processing (3)
  • .github/workflows/expo_ci.yml (1 hunks)
  • core/network/build.gradle.kts (2 hunks)
  • core/network/src/main/java/com/school_of_company/network/di/NetworkModule.kt (2 hunks)
๐Ÿงฐ Additional context used
๐Ÿ”‡ Additional comments (2)
core/network/src/main/java/com/school_of_company/network/di/NetworkModule.kt (2)

5-5: BuildConfig ๊ฐ€์ ธ์˜ค๊ธฐ ์ถ”๊ฐ€ ์Šน์ธ

BuildConfig๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ์€ BASE_URL์„ ์•ˆ์ „ํ•˜๊ฒŒ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์ข‹์€ ์ ‘๊ทผ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์ด๋Š” PR์˜ ๋ชฉํ‘œ์™€ ์ผ์น˜ํ•˜๋ฉฐ ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ๋ณดํ˜ธํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.


69-69: BuildConfig.BASE_URL ์‚ฌ์šฉ ์Šน์ธ ๋ฐ ๊ฒ€์ฆ ์ œ์•ˆ

BuildConfig.BASE_URL์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ๋ณธ URL์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์€ ์ข‹์€ ๋ณ€๊ฒฝ์‚ฌํ•ญ์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์ฝ”๋“œ์—์„œ ์ง์ ‘์ ์œผ๋กœ URL์„ ๋…ธ์ถœํ•˜์ง€ ์•Š์•„ ๋ณด์•ˆ์„ ํ–ฅ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ฝ”๋“œ๋ฒ ์ด์Šค ์ „์ฒด์—์„œ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ธฐ๋ณธ URL์ด ์—†๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”:

์ด ๊ฒ€์ฆ ๋‹จ๊ณ„๋ฅผ ํ†ตํ•ด ๋ชจ๋“  ํ•˜๋“œ์ฝ”๋”ฉ๋œ URL์ด ์ œ๊ฑฐ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

โœ… Verification successful

BuildConfig.BASE_URL ์‚ฌ์šฉ ๊ฒ€์ฆ ์™„๋ฃŒ

์ฝ”๋“œ๋ฒ ์ด์Šค ์ „๋ฐ˜์—์„œ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๊ธฐ๋ณธ URL์ด ๋ฐœ๊ฒฌ๋˜์ง€ ์•Š์•˜์œผ๋ฉฐ, ์ด์ „์— ๋ฐœ๊ฒฌ๋œ URL๋“ค์€ ์„ค์ • ํŒŒ์ผ๊ณผ ํ…Œ์ŠคํŠธ ํŒŒ์ผ์— ๊ตญํ•œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. NetworkModule.kt์—์„œ BuildConfig.BASE_URL์„ ์‚ฌ์šฉํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# ํ•˜๋“œ์ฝ”๋”ฉ๋œ URL ํŒจํ„ด์„ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.
rg --type kotlin --type java 'http[s]?://[^\s/$.?#].[^\s]*'

Length of output: 2805

core/network/build.gradle.kts Show resolved Hide resolved
core/network/build.gradle.kts Show resolved Hide resolved
core/network/build.gradle.kts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1๏ธโƒฃ Priority: High ์šฐ์„ ์ˆœ์œ„ - ์ƒ โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ โš™ Setting ํ™˜๊ฒฝ ์„ธํŒ…
Projects
None yet
3 participants