tadfisher / gradle2nix

Generate Nix expressions which build Gradle-based projects.
MIT License
124 stars 59 forks source link

Lenient configuration - attributes #17

Open eyJhb opened 4 years ago

eyJhb commented 4 years ago

I have tried the lenient config branch, and it seems to work well. There is one issue however.

When I use it on antennapod Android app source, I get these errors

[nix-shell:~/projects/nixos/fdroid/antennapod/src]$ ../../gradle2nix/result/bin/gradle2nix
Resolving project model: root project...
    Subproject: :
    Subproject: :app

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':app:freeDebugAndroidTestCompileClasspath'.
> More than one variant of project :core matches the consumer attributes:
    - Configuration ':core:freeDebugApiElements' variant android-aidl:
        - Unmatched attributes:
            - Found artifactType 'android-aidl' but wasn't required.
            - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
        - Compatible attributes:
            - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
            - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
            - Required market 'free' and found compatible value 'free'.
            - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    - Configuration ':core:freeDebugApiElements' variant android-manifest:
        - Unmatched attributes:
            - Found artifactType 'android-manifest' but wasn't required.
            - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
        - Compatible attributes:
            - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
            - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
            - Required market 'free' and found compatible value 'free'.
            - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    - Configuration ':core:freeDebugApiElements' variant android-renderscript:
        - Unmatched attributes:
            - Found artifactType 'android-renderscript' but wasn't required.
            - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
        - Compatible attributes:
            - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
            - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
            - Required market 'free' and found compatible value 'free'.
            - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    - Configuration ':core:freeDebugApiElements' variant android-symbol-with-package-name:
        - Unmatched attributes:
            - Found artifactType 'android-symbol-with-package-name' but wasn't required.
            - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
        - Compatible attributes:
            - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
            - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
            - Required market 'free' and found compatible value 'free'.
            - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE FAILED in 4m 17s
Exception in thread "main" org.gradle.tooling.BuildException: Could not fetch model of type 'Build' using Gradle distribution 'https://services.gradle.org/distributions/gradle-6.3-all.zip'.
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:43)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor.lambda$run$0(DefaultAsyncConsumerActionExecutor.java:57)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.lang.Thread.run(Thread.java:748)
    at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
    at org.gradle.tooling.internal.consumer.DefaultModelBuilder.get(DefaultModelBuilder.java:51)
    at org.nixos.gradle2nix.GradleRunnerKt.getBuildModel(GradleRunner.kt:30)
    at org.nixos.gradle2nix.Main.run(Main.kt:130)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:154)
    at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
    at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:252)
    at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:249)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:267)
    at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:290)
    at org.nixos.gradle2nix.MainKt.main(Main.kt:170)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Could not resolve all dependencies for configuration ':app:freeDebugAndroidTestCompileClasspath'.
    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:102)
    at org.gradle.initialization.exception.DefaultExceptionAnalyser.collectFailures(DefaultExceptionAnalyser.java:68)
    at org.gradle.initialization.exception.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:40)
    at org.gradle.initialization.exception.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
    at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:200)
    at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:127)
    at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:75)
    at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:67)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67)
    at org.gradle.internal.invocation.GradleBuildController.configure(GradleBuildController.java:61)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:56)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:80)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:68)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:freeDebugAndroidTestCompileClasspath'.
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.wrapException(ErrorHandlingConfigurationResolver.java:104)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.access$000(ErrorHandlingConfigurationResolver.java:48)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingLenientConfiguration.getArtifacts(ErrorHandlingConfigurationResolver.java:121)
    at org.nixos.gradle2nix.ConfigurationResolver.resolve(ConfigurationResolver.kt:60)
    at org.nixos.gradle2nix.Gradle2NixPluginKt.projectDependencies(Gradle2NixPlugin.kt:172)
    at org.nixos.gradle2nix.Gradle2NixPluginKt.buildProject(Gradle2NixPlugin.kt:150)
    at org.nixos.gradle2nix.Gradle2NixPluginKt.buildProject(Gradle2NixPlugin.kt:152)
    at org.nixos.gradle2nix.Gradle2NixPluginKt.buildModel(Gradle2NixPlugin.kt:103)
    at org.nixos.gradle2nix.Gradle2NixPluginKt.access$buildModel(Gradle2NixPlugin.kt:1)
    at org.nixos.gradle2nix.NixToolingModelBuilder.buildAll(Gradle2NixPlugin.kt:69)
    at org.nixos.gradle2nix.NixToolingModelBuilder.buildAll(Gradle2NixPlugin.kt:60)
    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder$1$1.create(DefaultToolingModelBuilderRegistry.java:104)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry.withLenientState(DefaultProjectStateRegistry.java:134)
    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder$1.call(DefaultToolingModelBuilderRegistry.java:100)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder.buildAll(DefaultToolingModelBuilderRegistry.java:97)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner$BuildResultAdapter.buildModel(BuildModelActionRunner.java:100)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner$BuildResultAdapter.buildFinished(BuildModelActionRunner.java:92)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:382)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:364)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:352)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:339)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:231)
    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:150)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:325)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:235)
    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:141)
    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy15.buildFinished(Unknown Source)
    at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:184)
    ... 73 more
Caused by: org.gradle.internal.component.AmbiguousVariantSelectionException: More than one variant of project :core matches the consumer attributes:
  - Configuration ':core:freeDebugApiElements' variant android-aidl:
      - Unmatched attributes:
          - Found artifactType 'android-aidl' but wasn't required.
          - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
      - Compatible attributes:
          - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required market 'free' and found compatible value 'free'.
          - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':core:freeDebugApiElements' variant android-manifest:
      - Unmatched attributes:
          - Found artifactType 'android-manifest' but wasn't required.
          - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
      - Compatible attributes:
          - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required market 'free' and found compatible value 'free'.
          - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':core:freeDebugApiElements' variant android-renderscript:
      - Unmatched attributes:
          - Found artifactType 'android-renderscript' but wasn't required.
          - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
      - Compatible attributes:
          - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required market 'free' and found compatible value 'free'.
          - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
  - Configuration ':core:freeDebugApiElements' variant android-symbol-with-package-name:
      - Unmatched attributes:
          - Found artifactType 'android-symbol-with-package-name' but wasn't required.
          - Found com.android.build.api.attributes.VariantAttr 'freeDebug' but wasn't required.
      - Compatible attributes:
          - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
          - Required market 'free' and found compatible value 'free'.
          - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    at org.gradle.api.internal.artifacts.transform.AttributeMatchingVariantSelector.doSelect(AttributeMatchingVariantSelector.java:92)
    at org.gradle.api.internal.artifacts.transform.AttributeMatchingVariantSelector.select(AttributeMatchingVariantSelector.java:76)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultArtifactSet.select(DefaultArtifactSet.java:138)
    at org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultVisitedArtifactResults.select(DefaultVisitedArtifactResults.java:48)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getSelectedArtifacts(DefaultLenientConfiguration.java:100)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFirstLevelNodes(DefaultLenientConfiguration.java:181)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFirstLevelModuleDependencies(DefaultLenientConfiguration.java:173)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFirstLevelModuleDependencies(DefaultLenientConfiguration.java:293)
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingLenientConfiguration.getFirstLevelModuleDependencies(ErrorHandlingConfigurationResolver.java:137)
    at org.nixos.gradle2nix.ConfigurationResolver.resolve(ConfigurationResolver.kt:57)
    ... 111 more

Which seems like the thing in https://github.com/gradle/gradle/issues/5953

But I have no skills in this what so ever, hoping @tadfisher might know a trick to get this running. Seems like the last thing, before we can get Android apps build.

eyJhb commented 4 years ago

Seems this is fixed, by cleaning the cache

rm -rf ~/.gradle
rm -rf .gradle
eyJhb commented 4 years ago

Going to reopen this again, as it did not fix the issue for me, I still think this may be the main blocker. Because Android does not provide defaults.. Sadly.

eyJhb commented 4 years ago

A way this might get fixed/better, is that instead of a project we allow for the ability to specify a task/list of tasks that we want the dependencies for. Because I think it is AntennaPod that has a weird task some place, that is just legacy

tadfisher commented 4 years ago

I'll look into it, but I don't think it will be possible get all of the required dependency configurations given a task. Gradle itself doesn't enforce that configurations are part of task inputs, and tasks can run arbitrary code to resolve whatever configurations they like.

An interesting idea is to duplicate the code used for dependency locking in later gradle versions, where we run a task and scan for resolved configurations after the fact. I'm not sure if this will be universally possible, however.

If you're feeling adventurous, you might try specifying configurations manually with the "--configuration/-c" flag, one per configuration. This will be annoying for Android in particular as it adds a ton of configurations; use ./gradlew :$project:dependencies to get a full list.

eyJhb commented 4 years ago

It would be nice to get a pr. task dependency list. I have tried playing a little with the other, but didn't seem to work great... Tried for a few hours to get it to work, but atm. I guess I have to accept some applications not working.

Is there maybe a way, we can use the Gradle cache to get all the dependencies, and then parse that? E.g. I will rm -rf ~/.gradle before I run a task, and then parse the ~/.gradle dir after, and all the files in there must be the dependencies?