Another pair of eyes


(Ante Ilic) #1
So I have a gradle file with 

model {
	components {
		unitTest(NativeLibrarySpec) { m ->
			sources {
				cpp {
					source {
						srcDir "$projectDir/src"
						include "*.cpp"
					}

					exportedHeaders {
						srcDir "$projectDir/src"
					}
				}
			}
//
//			binaries.all {
//				sources {
//					if (targetPlatform.operatingSystem.windows) {
//						windowsSource(CppSourceSet) {
//							source.srcDir "$projectDir/src/Win32"
//							source.include "*.cpp"
//							exportedHeaders.srcDir "$projectDir/src"
//							lib m.sources.cpp
//						}
//					}
//				}
//				if(toolChain in VisualCpp) {
//					defines.each { define ->
//						cppCompiler.define define
//					}
//				}
//			}
		}
	}
}

And I get an error when I run the ‘gradle tasks’ command
> Exception thrown while executing model rule: unitTest(org.gradle.nativeplatform.NativeLibrarySpec) { … } @ External\UnitTest++\build.gradle line 158, column 3
> No signature of method: java.util.ArrayList.call() is applicable for argument types: (build_dtgx3fd689k4cry9um8ms2csh$_run_closure1$_closure2$_closure3$_closure4) values: [build_dtgx3fd689k4cry9um8ms2csh$_run_closure1$_closure2$_closure3$_closure4@240e2999]
Possible solutions: tail(), tail(), wait(), last(), any(), max()

If I comment out everything in the NativeLibrary block I no longer get the error and the tasks are displayed correctly. Another pair of eyes looking at this code would be great as I can’t seem to find anything wrong with it.


(Ante Ilic) #2

Well this was a humbling experience, never under estimate how using a gradle keyword for a variable name can throw you off. I had an array with the ‘sources’ name which is where this error was coming from.

Thanks to all who looked at this.