我怎样才能将Maven Javah任务写入gradle.I有POM文件,我需要将其转换为gradle但是我被困住怎样才能将Javah任务写入gradle
<executions>
<execution>
<id>javah</id>
<phase>generate-sources</phase>
<configuration>
<javahOS>linux</javahOS>
<javahProvider>default</javahProvider>
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
<workingDirectory>${basedir}</workingDirectory>
<javahOutputFileName>MegJniWrapper.h</javahOutputFileName>
<javahClassNames>
<javahClassName>com.abcdefgh.engine.common.meg.MegJniWrapper</javahClassName>
</javahClassNames>
</configuration>
<goals>
<goal>javah</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
答案 0 :(得分:0)
非常粗糙,但足以让你开始,我假设javah生成代码。
ext {
// define directories here
// ex. genSrcDir
}
configurations {
javah
}
// here you want to include it in your sourceset so that if compileJava gets call your generated code will also compile (don't know if that applies to javah)
// ex. sourceSets.main.java.srcDir genSrcDir
dependencies {
// put javah dependencies here and use javah as configuration
// ex. javah dependency.jar
}
task javah () {
description = 'javah task'
// put optional inputs.dir and outputs.dir here so gradle can skip if nothing changes
doLast {
// javaexec here to call the javah
}
}
compileJava.dependsOn javah
task generateSource (dependsOn: javah) {
description = 'Javah'
}