Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a plugin to support gradle? #19

Closed
dunmengjun opened this issue May 26, 2018 · 8 comments
Closed

Is there a plugin to support gradle? #19

dunmengjun opened this issue May 26, 2018 · 8 comments

Comments

@dunmengjun
Copy link

:)

@JoeHegarty
Copy link
Member

There is currently no Gradle plugin.
The easiest way would likely be to to use the command line tool as the final step in your Gradle build.
I’d like to support Gradle but I haven’t had time to look into that yet.

@juddgaddie
Copy link

+1

@elventear
Copy link
Contributor

Using this snippet in my build script seems to be working for me:

dependencies {
    ...
    compileOnly "com.ea.async:ea-async:1.2.1"
}

task instrument(type: JavaExec) {
    main = 'com.ea.async.instrumentation.Main'
    classpath = sourceSets.main.compileClasspath
    args "$buildDir"
}

compileJava.doLast {
    tasks.instrument.execute()
}

@JoeHegarty
Copy link
Member

Resolved in #46 thanks to @Fleex255

@sevenaper
Copy link

Using this snippet in my build script seems to be working for me:

dependencies {
    ...
    compileOnly "com.ea.async:ea-async:1.2.1"
}

task instrument(type: JavaExec) {
    main = 'com.ea.async.instrumentation.Main'
    classpath = sourceSets.main.compileClasspath
    args "$buildDir"
}

compileJava.doLast {
    tasks.instrument.execute()
}

Thank you very much. But task.execute() can not be used after gradle 5.0. And I change it to compileJava.dependsOn(tasks.instrument), but it does not work. Do you know how to fix it?

@Fleex255
Copy link
Contributor

I haven't tested that kind of setup, but I think the instrument task needs to depend on compileJava so that instrumentation occurs after compilation. Then the Java plugin's classes task must be made to depend on instrument as well so that the build process always includes the instrumentation.

@sevenaper
Copy link

I haven't tested that kind of setup, but I think the instrument task needs to depend on compileJava so that instrumentation occurs after compilation. Then the Java plugin's classes task must be made to depend on instrument as well so that the build process always includes the instrumentation.

I have tried both. But neither of them can work.

@ctemple
Copy link

ctemple commented Mar 29, 2022

在我的构建脚本中使用此代码段似乎对我有用:

dependencies {
    ...
    compileOnly "com.ea.async:ea-async:1.2.1"
}

task instrument(type: JavaExec) {
    main = 'com.ea.async.instrumentation.Main'
    classpath = sourceSets.main.compileClasspath
    args "$buildDir"
}

compileJava.doLast {
    tasks.instrument.execute()
}

谢谢。但是 task.execute() 在 gradle 5.0 之后不能使用。我把它改成 compileJava.dependsOn(tasks.instrument),但它不起作用。你知道如何解决它吗?

dependencies {
...
compileOnly "com.ea.async:ea-async:1.2.1"
}

task instrument(type: JavaExec) {
main = 'com.ea.async.instrumentation.Main'
classpath = sourceSets.main.compileClasspath
args "$buildDir"
}

compileJava.finalizedBy(instrument)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants