skiptools / skiptools/skip

Skip plugin should report error when the target has no transitive skip dependencies

Open
#154 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

configuration documentation enhancement
Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

I have been trying out skip on a small a modular project that's started giving a gradle error. It started when I added a dependency on Model to the API and DataStore modules. The Package.swift parses and the iOS build phase completes successfully I don't think there's anything wrong with the Package.swift (below). I've tried clean and rebuild, reset packages etc.

Any ideas or pointers? Thanks!

The error transcript is:

Error: /Users/markw/Library/Developer/Xcode/DerivedData/LAQN-ccxxvnzqbwxafpefjhxnlucgbyof/Build/Intermediates.noindex/LAQN.build/Debug-iphonesimulator/LAQN.build/skip-gradle.log.txt:41:0: error: The gradle command failed. Review the log for details and consult https://skip.tools/docs/faq for common solutions. Command: gradle -p ../Android launchDebug
GRADLE> Configuration on demand is an incubating feature.
GRADLE> > Task :skip-plugins:checkKotlinGradlePluginConfigurationErrors
GRADLE> > Task :skip-plugins:compileKotlin UP-TO-DATE
GRADLE> > Task :skip-plugins:compileJava NO-SOURCE
GRADLE> > Task :skip-plugins:pluginDescriptors UP-TO-DATE
GRADLE> > Task :skip-plugins:processResources UP-TO-DATE
GRADLE> > Task :skip-plugins:classes UP-TO-DATE
GRADLE> > Task :skip-plugins:jar UP-TO-DATE
GRADLE> Configuring project ':SkipFFI' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipFFI' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':DataStore' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/DataStore' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipSQL' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipSQL' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':LAQN' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/LAQN' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipModel' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipModel' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipFoundation' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipFoundation' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipUI' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipUI' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipUnit' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipUnit' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':Model' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/Model' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> Configuring project ':SkipLib' without an existing directory is deprecated. The configured projectDirectory '/Users/markw/imperial/laqn/Android/SkipLib' does not exist, can't be written to or is not a directory. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Make sure the project directory exists and can be written. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#deprecated_missing_project_directory
GRADLE> 
GRADLE> FAILURE: Build failed with an exception.
GRADLE> 
GRADLE> * What went wrong:
GRADLE> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
error: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
GRADLE> > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
GRADLE>    > Could not resolve project :skipstone:Model.
GRADLE>      Required by:
GRADLE>          project :app > project :skipstone:LAQN
GRADLE>          project :app > project :skipstone:LAQN > project :skipstone:DataStore
GRADLE>       > No matching variant of project :skipstone:Model was found. The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.2.2', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
GRADLE>           - None of the variants have attributes.
GRADLE> 
GRADLE> * Try:
GRADLE> > Review the variant matching algorithm at https://docs.gradle.org/8.7/userguide/variant_attributes.html#sec:abm_algorithm.
GRADLE> > No matching variant errors are explained in more detail at https://docs.gradle.org/8.7/userguide/variant_model.html#sub:variant-no-match.
GRADLE> > Run with --stacktrace option to get the stack trace.
GRADLE> > Run with --info or --debug option to get more log output.
GRADLE> > Run with --scan to get full insights.
GRADLE> > Get more help at https://help.gradle.org.
GRADLE> 
GRADLE> BUILD FAILED in 784ms
GRADLE> 5 actionable tasks: 1 executed, 4 up-to-date
note: Gradle FAILED: 
/Users/markw/Library/Developer/Xcode/DerivedData/LAQN-ccxxvnzqbwxafpefjhxnlucgbyof/Build/Intermediates.noindex/LAQN.build/Debug-iphonesimulator/LAQN.build/skip-gradle.log.txt:41:0: error: The gradle command failed. Review the log for details and consult https://skip.tools/docs/faq for common solutions. Command: gradle -p ../Android launchDebug

Package.swift

// swift-tools-version: 5.9
// This is a Skip (https://skip.tools) package,
// containing a Swift Package Manager project
// that will use the Skip build plugin to transpile the
// Swift Package, Sources, and Tests into an
// Android Gradle Project with Kotlin sources and JUnit tests.
import PackageDescription
import Foundation

// Set SKIP_ZERO=1 to build without Skip libraries
let zero = ProcessInfo.processInfo.environment["SKIP_ZERO"] != nil
let skipstone = !zero ? [Target.PluginUsage.plugin(name: "skipstone", package: "skip")] : []

let package = Package(
    name: "laqn",
    defaultLocalization: "en",
    platforms: [.iOS(.v16), .macOS(.v13), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v16)],
    products: [
        .library(name: "LAQNApp", type: .dynamic, targets: ["LAQN"]),
        .library(name: "DataStore", targets: ["DataStore"]),
        .library(name: "Model", targets: ["Model"]),
        .library(name: "API", targets: ["API"]),
    ],
    dependencies: [
        .package(url: "https://source.skip.tools/skip.git", from: "0.8.36"),
        .package(url: "https://source.skip.tools/skip-ui.git", from: "0.0.0"),
        .package(url: "https://source.skip.tools/skip-model.git", from: "0.0.0"),
        .package(url: "https://source.skip.tools/skip-foundation.git", from: "0.0.0"),
        .package(url: "https://github.com/skiptools/skip-sql.git", from: "0.0.0")
    ],
    targets: [
        .target(name: "LAQN", dependencies: ["DataStore", "Model"] + (zero ? [] : [.product(name: "SkipUI", package: "skip-ui")]), resources: [.process("Resources")], plugins: skipstone),
        .testTarget(name: "LAQNTests", dependencies: ["LAQN"] + (zero ? [] : [.product(name: "SkipTest", package: "skip")]), resources: [.process("Resources")], plugins: skipstone),
        .target(name: "DataStore", dependencies: ["Model"] + (zero ? [] : [.product(name: "SkipFoundation", package: "skip-foundation"), .product(name: "SkipModel", package: "skip-model"), .product(name: "SkipSQL", package: "skip-sql")]), resources: [.process("Resources")], plugins: skipstone),
        .testTarget(name: "DataStoreTests", dependencies: ["DataStore"] + (zero ? [] : [.product(name: "SkipTest", package: "skip")]), resources: [.process("Resources")], plugins: skipstone),
        .target(name: "Model", dependencies: [], resources: [.process("Resources")], plugins: skipstone),
        .testTarget(name: "ModelTests", dependencies: ["Model"] + (zero ? [] : [.product(name: "SkipTest", package: "skip")]), resources: [.process("Resources")], plugins: skipstone),
        .target(name: "API", dependencies: ["Model"] + (zero ? [] : [.product(name: "SkipFoundation", package: "skip-foundation")]), resources: [.process("Resources")], plugins: skipstone),
        .testTarget(name: "APITests", dependencies: ["API"] + (zero ? [] : [.product(name: "SkipTest", package: "skip")]), resources: [.process("Resources")], plugins: skipstone),
    ]
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Package.swift dependency graph and the skip plugin's handling of the Model target when it is used transitively by DataStore and LAQN. Reproduce the Android build and inspect the generated Gradle project and the reported variant resolution failure. Done means a target with no transitive skip dependencies no longer produces the missing-variant error and the sample project builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, swift
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.