gpt4 book ai didi

gradle - Gradle找不到方法c()

转载 作者:行者123 更新时间:2023-12-03 05:51:19 25 4
gpt4 key购买 nike

我有以下build.gradle文件:

apply plugin: 'c'

model {
sources {
c {
source {
srcDir "src/myapi/c"
include "**/*.c"
}
}
}
platforms {
x86 {
architecture "x86"
}
}
components {
myapi(NativeLibrarySpec) {
targetPlatform "x86"
}
}
}
gradle myapiSharedLibrarygradle tasksgradle components,所有任务都会失败并显示

Exception thrown while executing model rule: sources { ... } @ build.gradle line 5, column 2

Could not find method c() for arguments [build_1nkbkdtma2ngpuhlkja2lnmoa$_run_closure1$_closure2$_closure5@2cefd5e6] on [] of type org.gradle.language.base.internal.DefaultProjectSourceSet.


gradle docs中的示例似乎不适用于我。
还是我做错了什么?
Gradle 版本为
> gradle --version

------------------------------------------------------------
Gradle 4.3.1
------------------------------------------------------------

Build time: 2017-11-08 08:59:45 UTC
Revision: e4f4804807ef7c2829da51877861ff06e07e006d

Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_51 (Oracle Corporation 25.51-b03)
OS: Windows 7 6.1 amd64

最佳答案

真正解决问题的方法是将sources移到components块中,如下所示:

    components {
myapi(NativeLibrarySpec) {

targetPlatform "x86"

sources {
c {
source {
srcDir "src/myapi/c"
include "**/*.c"
}
}
}
}
}

关于gradle - Gradle找不到方法c(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47595073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com