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

[1.2.0/AN-Config] Project 단 build.gradle.kts 에서 buildScript 문 삭제 #485

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

murjune
Copy link
Contributor

@murjune murjune commented Dec 13, 2024

작업한 내용

  • 불필요한 legacy인 buildScript를 걷어냄

작업 설명

image

  • 우리 프로젝트 Gradle 버전: 8.4

Gradle 7.0 이상에서는 buldScript 대신 pluginspluginManagement 를 사용해서 플러그인 의존성을 관리하라고 나와있습니다.
제가 초기에 프로젝트 설정할 때, 이에 대한 지식이 부족해서 2가지 방식 모두 중복 적용했었네요 🥲

두 방식의 차이를 궁금해하실까봐 간략하게 설명 남기겠습니다.

buldScript 방식(legacy)

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
          classPath(libs.agp)
    }
}

apply(plugin = "com.android.application") // 플러그인 수동 적용

buildscript는 Gradle이 빌드 스크립트를 실행하기 전에, 필요한 플러그인 의존성을 먼저 클래스패스에 추가하는 역할을 했습니다.
다운 받을 repository와 classPath를 지정해준 후, apply를 통해 플러그인을 적용했습니다.

plugins 방식 + version catalog

// settings.gradle.kts
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
// build.gradle.kts
plugins {
    alias(libs.plugins.android.application) apply false
}
  • pluginManagement를 통해 plugin을 어느 저장소에서 다운받고 가져올지 지정
  • plugins 을 활용하면 Gradle의 플러그인 시스템과 통합되어, 플러그인의 의존성 로딩과 적용을 통합할 수 있음

referenece

Gradle 공식문서 - Using Plugins

🚀Next Feature

  • 버튼 스케일 업/다운 애니메이션

Copy link
Contributor

@sh1mj1 sh1mj1 left a comment

Choose a reason for hiding this comment

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

오 그런 문제가 있어군요.
gradle 문서 링크 고맙습니다.
덕분에 배웠네요.

develop 브랜치에 먼저 머지하고 나서 main에 따로 머지해야 하지 않나요?

@murjune
Copy link
Contributor Author

murjune commented Dec 14, 2024

아.. 실수했네요 develop으로 바꾸겠습니다 ㅋㅋㅋ

@murjune murjune changed the base branch from main to an/develop December 14, 2024 20:41
Copy link
Contributor

@JoYehyun99 JoYehyun99 left a comment

Choose a reason for hiding this comment

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

오호 덕분에 배워갑니당~

Copy link
Contributor

@kkosang kkosang left a comment

Choose a reason for hiding this comment

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

참고자료까지 감사합니다 굿 👍👍

@murjune murjune merged commit ff6de04 into an/develop Dec 18, 2024
@murjune murjune deleted the an/config/gradle-refactor branch December 18, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants