From 17fc0485990e8247098507009e3dd2368dfb411c Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Wed, 28 Feb 2018 12:23:26 -0600 Subject: [PATCH] Generalize post-import Eclipse run configuration for more fixups Previously this launcher's job was to run "processTestResources" and any other Gradle tasks needed to create files that Eclipse was expecting to be available. But we also want to use it to revert the bad changes that Buildship applies to ".launch" configuration files. This is a temporary hack to work around . --- ...> After Importing WALA Into Eclipse.launch | 2 +- build.gradle | 8 +++++--- com.ibm.wala.core.testdata/build.gradle | 2 +- revert-launchers.sh | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) rename Process Test Resources.launch => After Importing WALA Into Eclipse.launch (94%) create mode 100755 revert-launchers.sh diff --git a/Process Test Resources.launch b/After Importing WALA Into Eclipse.launch similarity index 94% rename from Process Test Resources.launch rename to After Importing WALA Into Eclipse.launch index 29e05ad32..8db91ffe4 100644 --- a/Process Test Resources.launch +++ b/After Importing WALA Into Eclipse.launch @@ -13,7 +13,7 @@ - + diff --git a/build.gradle b/build.gradle index f4a7c9c90..175048c12 100644 --- a/build.gradle +++ b/build.gradle @@ -84,9 +84,7 @@ subprojects { subproject -> } } - task eclipseProcessTestResources { - dependsOn processTestResources - } + task afterEclipseBuildshipImport(dependsOn: processTestResources) test { include '**/*Test.class' @@ -97,6 +95,10 @@ subprojects { subproject -> } } +task afterEclipseBuildshipImport(type: Exec) { + commandLine './revert-launchers.sh' +} + //////////////////////////////////////////////////////////////////////// // diff --git a/com.ibm.wala.core.testdata/build.gradle b/com.ibm.wala.core.testdata/build.gradle index 5fe9a0e2f..6639f7e48 100644 --- a/com.ibm.wala.core.testdata/build.gradle +++ b/com.ibm.wala.core.testdata/build.gradle @@ -186,7 +186,7 @@ task cleanColllectTestDataA(type: Delete) { // help Eclipse build these extra jars when needed // -eclipseProcessTestResources { +afterEclipseBuildshipImport { dependsOn( collectJLex, collectTestData, diff --git a/revert-launchers.sh b/revert-launchers.sh new file mode 100755 index 000000000..cda6a8fe6 --- /dev/null +++ b/revert-launchers.sh @@ -0,0 +1,19 @@ +#!/bin/bash -eu + +cd "$(dirname "$0")" + +# be selective; revert only launchers we think we know about +launchers=(com.ibm.wala.*/launchers/*.launch com.ibm.wala.*/.launchConfigurations/*.launch) + +# if no launchers have changed, then there's nothing for us to do +if git diff --quiet "${launchers[@]}"; then + exit +fi + +# create a backup in case we revert something that we should have left alone +git stash save --quiet 'safety snapshot before reverting launcher changes made by Eclipse Buildship import' +git stash apply --quiet + +# revert launch configurations that Buildship import has mangled +# +git checkout -- "${launchers[@]}"