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

Add Java Plugin to the Gradle build #46

Closed
jeandersonbc opened this issue May 16, 2018 · 5 comments
Closed

Add Java Plugin to the Gradle build #46

jeandersonbc opened this issue May 16, 2018 · 5 comments

Comments

@jeandersonbc
Copy link
Collaborator

The Gradle Java plugin already has common build tasks for Java/JVM project such as generating jars, compiling classes, and so on. Also, it is configurable to support jpf project layout.

More info: https://docs.gradle.org/current/userguide/tutorial_java_projects.html

@jeandersonbc
Copy link
Collaborator Author

I added a Gradle script for compilation and test execution. I compared the number of tests executed and both (Gradle and Ant) are consistent.

However, only 75% of tests are passing on the Gradle build.
I sampled some errors to investigate, and I noticed that some of them are due to hardcoded paths on tests, like here in the MethodInfoTest class:

  @Test
  public void testMethodArgs() {
    File file = new File("build/tests/gov/nasa/jpf/jvm/MethodInfoTest$MyClass.class");

The build directory generated by Gradle has a different layout.
I need to confirm all cases first to be 100% sure but I believe that all errors are similar to this.
Changing those hardcoded paths doesn't seem to help the problem at all.
I need to figure a way to preserve the generated directories.

@jeandersonbc
Copy link
Collaborator Author

I found similar entry lines in the standard output of other tests:

running jpf with args: +listener=.test.mc.basic.BreakTest$FieldBreaker +vm.max_transition_length=1000000
[WARNING] unknown classpath element: /Users/jeandersonbc/projects/jpf/jpf-core/build/tests
[WARNING] unknown classpath element: /Users/jeandersonbc/projects/jpf/jpf-core/build/jpf-classes.jar
[WARNING] unknown classpath element: /Users/jeandersonbc/projects/jpf/jpf-core/build/examples
[WARNING] unknown classpath element: /Users/jeandersonbc/projects/jpf/jpf-symbc/build/jpf-symbc-classes.jar
...

@jeandersonbc
Copy link
Collaborator Author

jeandersonbc commented May 21, 2018

I made some marginal improvement by making the generated directory three similar to the ant-generated build directories. Now, 78% of tests pass.

This means that only 3% depends on a compiled class file as a test resource (passing now, since the .class files exist on the expected place)
All the remaining 22% failed tests depend on a jar file as a test resource.

I must work on this to have 100% of tests passing.

I wonder if jar dependent tests shouldn't be considered integration tests and be executed only in a later stage of the build cycle.

cyrille-artho pushed a commit that referenced this issue May 22, 2018
* Added settings.gradle file

* Added support to Java gradle plugin (#46)

* Added fork configuration (#46)

* Updated classpath settings and generated directories (#46)

* Temporarily ignoring failing tests (#46)

* Created compile task and marked it as the default task (#46)

* Updated travis configuration for Gradle
@cyrille-artho
Copy link
Member

Let's try to get the paths fixed by eliminating hard-coded paths wherever possible.
Perhaps we can define some compile-time settings for this.
The paths will change again with JDK 9/10, so having a single configuration entry for them would be good.

@jeandersonbc
Copy link
Collaborator Author

Alright, I'm closing this issue for now, since changes were merged.

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

2 participants