Binaries.all in components

software-model

(Joshua Graessley) #1

The following example from the C C++ Workshop Part 1 video at about the 1 hour mark doesn’t seem to work:


apply plugin: 'c'

model {
    components {
        main(NativeExecutableSpec) {
            binaries.all {
            }
        }

        hello(NativeLibrarySpec) {
            binaries.all {
            }
        }

        binaries.all {
        }
    }
}

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/private/tmp/build.gradle’ line: 15

  • What went wrong:
    A problem occurred configuring root project ‘tmp’.

Exception thrown while executing model rule: components { … } @ build.gradle line 4, column 5
No such property: binaries for class: org.gradle.model.ModelMap

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Any tips? Thanks.


(Andrzej Lichnerowicz) #2

Went through the same workshop, with same error. Found solution in the docs[1], 72.12:

instead of:

model {
  component {
    binaries.all {
      // do sth that applies to all binaries
    }
  }
}

do:

model {
  binaries {
    all {
      ..
    }
  }
}

[1] https://docs.gradle.org/current/userguide/native_software.html#N18987