Advertisement
Guest User

Jacoco Plugin Bug

a guest
Sep 8th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. rem  Instructions:
  4. rem  1.) Save this to a file 'C:\reproduce.bat'
  5. rem      Subdirectories should also work, but since this bug has to do with path length,
  6. rem      this seems to be close to the minimal path that recreates the bug
  7. rem  2.) Run 'C:\reproduce.bat' which will call Gradle (should be on PATH)
  8. rem      Gradle will fail to spawn the test process with Java agent
  9. rem  3.) To clean up, delete 'C:\reproduce.bat' and 'C:\my-server-root-directory'
  10.  
  11. set project_dir=.\my-server-root-directory\jenkins\workspace\top-folder\child-folder\some-fancy-project@script\top-project\category-name\child-project
  12. mkdir %project_dir%
  13.  
  14. rem Create 'settings.gradle'
  15. set settings_file=%project_dir%\settings.gradle
  16. @echo rootProject.name = 'jacoco-plugin-bug' > %settings_file%
  17.  
  18. rem Create 'build.gradle'
  19. set build_file=%project_dir%\build.gradle
  20. @echo apply plugin: 'java' > %build_file%
  21. @echo apply plugin: 'jacoco' >> %build_file%
  22. @echo sourceCompatibility = 1.8 >> %build_file%
  23. @echo buildDir = "$projectDir/../../build/category-name/child-project" >> %build_file%
  24. @echo repositories { mavenCentral() } >> %build_file%
  25. @echo dependencies { testCompile 'junit:junit:4.11' } >> %build_file%
  26.  
  27. rem Create 'Sum.java'
  28. mkdir %project_dir%\src\main\java\com\tilodickopp
  29. set java_file=%project_dir%\src\main\java\com\tilodickopp\Sum.java
  30. @echo package com.tilodickopp; > %java_file%
  31. @echo public class Sum { >> %java_file%
  32. @echo     public int add(int a, int b) { return a + b; } >> %java_file%
  33. @echo } >> %java_file%
  34.  
  35. rem Create 'SumTest.java'
  36. mkdir %project_dir%\src\test\java\com\tilodickopp
  37. set test_file=%project_dir%\src\test\java\com\tilodickopp\SumTest.java
  38. @echo package com.tilodickopp; > %test_file%
  39. @echo public class SumTest { >> %test_file%
  40. @echo     @org.junit.Test public void testAdd() { >> %test_file%
  41. @echo         org.junit.Assert.assertEquals(2, new Sum().add(1, 1)); >> %test_file%
  42. @echo     } >> %test_file%
  43. @echo } >> %test_file%
  44.  
  45. rem Run Gradle to reproduce bug
  46. gradle --settings-file %settings_file% --info clean build
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement