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

Use compileOnly for kotlin/agp plugins #648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrodbx
Copy link
Collaborator

@jrodbx jrodbx commented Dec 7, 2022

No description provided.

@@ -10,7 +10,7 @@ buildscript {

dependencies {
classpath libs.plugin.kotlin
classpath libs.plugin.android
classpath 'com.android.tools.build:gradle:7.3.1'

Choose a reason for hiding this comment

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

Not sure if this change was intented? 7.4-rc1 is in the toml.
/paparazzi/build.gradle and your new compileOnly still uses the 7.4 so you might get overridden.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a feeling this was him testing the solution.

See the last classpath below and https://github.com/cashapp/paparazzi/blob/master/settings.gradle#L9 where that plugin is being replaced.

Copy link
Contributor

@TWiStErRob TWiStErRob Dec 15, 2022

Choose a reason for hiding this comment

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

I think I understand this more now. As I ran into an issue with this.

The the paparazzi-gradle-plugin can use the latest version, but for testing and building the paparazzi AAR an older version can be used.

@jrodbx I suggest splitting it into 3:

  • libs.plugin.android.build (for AAR build)
  • libs.plugin.android.test (for integration tests)
  • libs.plugin.android.api (for dependency)

The api should be behind a bit (stable), the build can be the latest alpha, and the test is the best compatible version.

implementation libs.plugin.kotlin
implementation libs.plugin.android
Copy link
Contributor

@TWiStErRob TWiStErRob Dec 15, 2022

Choose a reason for hiding this comment

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

please merge this PR, I can't use Android Studio Dolphin with 1.2.0-SNAPSHOT, because AS-D doesn't support 7.4:

The project is using an incompatible version (AGP 7.4.0-rc01) of the Android Gradle plugin. Latest supported version is AGP 7.3.1
See Android Studio & AGP compatibility options.

I'm not even sure of a workaround yet, because I'm using plugins {} so there's no classpath(...) { exclude }.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tried this, but it doesn't apply transitively and I don't want to list all modules:

buildscript {
	configurations.classpath.configure {
		resolutionStrategy { 
			force(libs.android.gradle)
			force(libs.android.lint.common)
    }

This crazy hack works 🤦‍♂️:

buildscript {
	configurations.classpath.configure {
		resolutionStrategy { 
			eachDependency { 
				if (requested.version == "30.4.0-rc01") {
					useVersion("30.3.1")
				}
				if (requested.version == "7.4.0-rc01") {
					useVersion("7.3.1")
				}
			}
		}
	}
}

@yogurtearl
Copy link

Looks like this PR is superseded by ->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants