@@ -1241,6 +1241,16 @@ idea {
12411241 }
12421242}
12431243
1244+ // ForgeGradle 2 generated these launch names with the removed GradleStart
1245+ // bootstrap. They can survive an in-place Buildship migration and remain the
1246+ // last-run Eclipse configuration even after ForgeGradle 7 generates runClient
1247+ // and runServer. Remove only the exact obsolete launch types; leave any
1248+ // independently maintained launch with the same file name untouched.
1249+ def obsoleteForgeGradle2EclipseLaunches = [
1250+ ' OreSpawn_Client.launch' : ' GradleStart' ,
1251+ ' OreSpawn_Server.launch' : ' GradleStartServer'
1252+ ]
1253+
12441254eclipse {
12451255 classpath {
12461256 downloadSources = true
@@ -1279,6 +1289,18 @@ tasks.register('isolateEclipseProductionRuns') {
12791289 dependsOn tasks. named(' configureEclipseBuildship' )
12801290
12811291 doLast {
1292+ obsoleteForgeGradle2EclipseLaunches. each { String name , String mainClass ->
1293+ File launch = file(name)
1294+ if (launch. isFile()) {
1295+ String contents = launch. getText(' UTF-8' )
1296+ String obsoleteMainType =
1297+ " org.eclipse.jdt.launching.MAIN_TYPE\" value=\" ${ mainClass} \" "
1298+ if (contents. contains(obsoleteMainType) && ! launch. delete()) {
1299+ throw new GradleException (" Could not remove obsolete ForgeGradle 2 launch ${ name} " )
1300+ }
1301+ }
1302+ }
1303+
12821304 [' runClient.launch' , ' runServer.launch' ]. each { name ->
12831305 File launch = file(name)
12841306 if (! launch. isFile()) {
@@ -1316,6 +1338,14 @@ tasks.register('verifyEclipseProductionClasspath') {
13161338 if (launchFiles. size() < 2 ) {
13171339 throw new GradleException (' ForgeGradle did not generate ordinary client/server Eclipse launches' )
13181340 }
1341+ obsoleteForgeGradle2EclipseLaunches. each { String name , String mainClass ->
1342+ File launch = file(name)
1343+ if (launch. isFile() && launch. getText(' UTF-8' ). contains(
1344+ " org.eclipse.jdt.launching.MAIN_TYPE\" value=\" ${ mainClass} \" " )) {
1345+ throw new GradleException (
1346+ " Obsolete ForgeGradle 2 ${ mainClass} launch remains at ${ name} " )
1347+ }
1348+ }
13191349 List<String > forbidden = [
13201350 ' src/test' , ' bin/test' , ' build/classes/java/test' ,
13211351 ' biomeIntegrationTest' , ' migrationIntegrationTest' , ' clientIntegrationTest' ,
0 commit comments