From 0f859e7bb4d9bb8ce83fc7fd0de12d141195695c Mon Sep 17 00:00:00 2001 From: hailtondecastro Date: Tue, 29 Oct 2019 22:18:51 -0300 Subject: [PATCH] HHH-13656 Can not build and run test on Eclipse IDE Eclipse windows --- hibernate-core/hibernate-core.gradle | 83 ++++++++++------------ hibernate-testing/hibernate-testing.gradle | 2 - 2 files changed, 36 insertions(+), 49 deletions(-) diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index c462098b50..ced2dbed1a 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -9,6 +9,7 @@ import org.apache.tools.ant.filters.ReplaceTokens import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.gradle.plugins.ide.eclipse.model.Library import org.apache.tools.ant.taskdefs.condition.Os +import java.io.StringWriter apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: Antlr4Plugin @@ -183,24 +184,31 @@ eclipse { project { file { withXml { provider -> + //println('name:') + //println(name) def projectDescriptionNode = provider.asNode() -// projectDescriptionNode.children( ).each { nodeItem -> -// println( 'nodeItem: ' + nodeItem ) -// } def buildSpecNode = projectDescriptionNode.children().find { child -> child.name( ).equals('buildSpec') } - def buildCommandMkp = new StreamingMarkupBuilder().bind { - buildCommand { - name( 'org.eclipse.ui.externaltools.ExternalToolBuilder' ) - triggers( 'full,incremental,' ) - arguments( ) { - dictionary( ) { - key ( 'LaunchConfigHandle' ) - value ( '/.externalToolBuilders/gradlew_process_test_resources.launch' ) - } + def buildCommandSW = new StringWriter() + def buildCommandXml = new MarkupBuilder(new IndentPrinter(buildCommandSW, " ", true)) + buildCommandXml.doubleQuotes = true + buildCommandXml.buildCommand( ) { + //[java - Groovy's MarkupBuilder exception on generating "id" XML tag - Stack Overflow](https://stackoverflow.com/a/14284927/1350308) + "${'name'}"( "org.eclipse.ui.externaltools.ExternalToolBuilder" ) { } + triggers( 'auto,full,incremental,' ) + arguments( ) { + dictionary( ) { + key ( 'LaunchConfigHandle' ) + value ( '/.externalToolBuilders/gradlew_process_test_resources.launch' ) + } + dictionary( ) { + key ( 'incclean' ) + value ( true ) } } } - def buildCommandNode = new XmlParser().parseText( buildCommandMkp.toString() ) + def buildCommandNode = new XmlParser().parseText( buildCommandSW.toString() ) + //println('strWriter:') + //println(buildCommandSW.toString()) buildSpecNode.append( buildCommandNode ) } } @@ -221,9 +229,18 @@ eclipse { } else { stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew').absolutePath ) } + booleanAttribute( key:'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', value: false ) + stringAttribute( + key: 'org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE', + value: '\${working_set: \ + \ + \ + \ + }' + ) stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', value: 'incremental,auto,' ) stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', value: 'hibernate-core:processTestResources --no-daemon' ) - booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: 'true' ) + booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: true ) stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', value: file('../').absolutePath ) } xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task") @@ -243,10 +260,10 @@ eclipse { } stringAttribute( key: 'org.eclipse.jdt.junit.CONTAINER', value: "=${project.name}" ) stringAttribute( key: 'org.eclipse.jdt.junit.EXCLUDE_TAGS', value: '' ) - booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: 'false' ) - booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: 'true' ) + booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: false ) + booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: true ) stringAttribute( key: 'org.eclipse.jdt.junit.INCLUDE_TAGS', value: 'RunnableIdeTest' ) - booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: 'false' ) + booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: false ) stringAttribute( key: 'org.eclipse.jdt.junit.TESTNAME', value: '' ) stringAttribute( key: 'org.eclipse.jdt.junit.TEST_KIND', value: 'org.eclipse.jdt.junit.loader.junit5' ) stringAttribute( key: 'org.eclipse.jdt.launching.MAIN_TYPE', value: '' ) @@ -274,10 +291,10 @@ eclipse { List newSourceSet = [] classpath.entries.each { item -> if( !exclusionSourceSet.contains( item.path ) ) { - println( 'INCLUDING: ' + item ) + //println( 'INCLUDING: ' + item ) newSourceSet.add( item ) } else { - println( 'NOT INCLUDING: ' + item ) + //println( 'NOT INCLUDING: ' + item ) } } @@ -291,35 +308,7 @@ eclipse { resourceMain, resourceTest ] -// def resourceMain = new Library( frf.fromFile( file ( 'target/resources/main' ) ) ) -// def resourceTest = new Library( frf.fromFile( file ( 'target/resources/test' ) ) ) - println( 'newSourceSet:' ) - println( newSourceSet ) classpath.entries = newSourceSet - -// classpath.configure([ -// aptMain, -// aptTest, -// resourceMain, -// resourceTest -// ]) - - // Find the "source" entry and add the exclude for the folder containing our super-source code -// Set exclusionSourceSet = [ -// 'src/main/resources', -// 'src/test/resources' -// ] -// Set newSourceSet = [] -// classpath.entries.each { item -> -// if( !exclusionSourceSet.contains( item.path ) ) { -// println( 'INCLUDING: ' + item ) -// newSourceSet.add( item ) -// } else { -// println( 'NOT INCLUDING: ' + item ) -// } -// } -// println( 'newSourceSet:' ) -// println( newSourceSet ) } } } diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle index 151a558b5b..44351eecb7 100644 --- a/hibernate-testing/hibernate-testing.gradle +++ b/hibernate-testing/hibernate-testing.gradle @@ -63,8 +63,6 @@ eclipse { //println( 'NOT INCLUDING: ' + item ) } } - println( 'newSourceSet:' ) - println( newSourceSet ) def hibernateCore = new ProjectDependency('/hibernate-core') newSourceSet += [