Skip to content

Commit

Permalink
[bndtools#5395] -export failure deadlock]
Browse files Browse the repository at this point in the history
This patch will not block the saving of the files
when the export fails. Then the next time it 
all falls in place again.


Signed-off-by: Peter Kriens <[email protected]>
  • Loading branch information
pkriens committed Nov 3, 2022
1 parent 2cc7ebc commit 2ab3f1b
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions biz.aQute.bndlib/src/aQute/bnd/build/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -1966,30 +1966,34 @@ public File[] buildLocal(boolean underTest) throws Exception {
return null;
}

Map<File, Resource> exports = builder.doExports(selectedRunFiles);

getInfo(builder);

if (!isOk()) {
return null;
}

for (Map.Entry<File, Resource> ee : exports.entrySet()) {
try (Resource resource = ee.getValue()) {
File outputFile = ee.getKey();
File actual = write(resource::write, outputFile);
if (!selectedRunFiles.isEmpty()) {
Map<File, Resource> exports = builder.doExports(selectedRunFiles);

if (actual != null) {
buildFilesSet.add(actual);
} else {
error("Could not save %s", outputFile);
getInfo(builder);

if (isOk()) {

for (Map.Entry<File, Resource> ee : exports.entrySet()) {
try (Resource resource = ee.getValue()) {
File outputFile = ee.getKey();
File actual = write(resource::write, outputFile);

if (actual != null) {
buildFilesSet.add(actual);
} else {
error("Could not save %s", outputFile);
}
}
}
}
}

if (!isOk()) {
return null;
}

boolean bfsWrite = !bfs.exists() || (lastModified > bfs.lastModified());
if (buildfiles != null) {
Expand Down Expand Up @@ -2622,7 +2626,8 @@ public Jar getValidJar(Jar jar, String id) throws Exception {
return jar;
}

public String _project(@SuppressWarnings("unused") String args[]) {
public String _project(@SuppressWarnings("unused")
String args[]) {
return IO.absolutePath(getBase());
}

Expand Down Expand Up @@ -2713,7 +2718,8 @@ public void action(String command, Object... args) throws Exception {
/**
* Run all before command plugins
*/
void before(@SuppressWarnings("unused") Project p, String a) {
void before(@SuppressWarnings("unused")
Project p, String a) {
List<CommandPlugin> testPlugins = getPlugins(CommandPlugin.class);
for (CommandPlugin testPlugin : testPlugins) {
testPlugin.before(this, a);
Expand All @@ -2723,7 +2729,8 @@ void before(@SuppressWarnings("unused") Project p, String a) {
/**
* Run all after command plugins
*/
void after(@SuppressWarnings("unused") Project p, String a, Throwable t) {
void after(@SuppressWarnings("unused")
Project p, String a, Throwable t) {
List<CommandPlugin> testPlugins = getPlugins(CommandPlugin.class);
for (int i = testPlugins.size() - 1; i >= 0; i--) {
testPlugins.get(i)
Expand All @@ -2737,7 +2744,8 @@ public void refreshAll() {
}

@SuppressWarnings("unchecked")
public void script(@SuppressWarnings("unused") String type, String script) throws Exception {
public void script(@SuppressWarnings("unused")
String type, String script) throws Exception {
script(type, script, new Object[0]);
}

Expand All @@ -2760,7 +2768,8 @@ public void script(String type, String script, Object... args) throws Exception
.eval((Map) p, new StringReader(script));
}

public String _repos(@SuppressWarnings("unused") String args[]) throws Exception {
public String _repos(@SuppressWarnings("unused")
String args[]) throws Exception {
List<RepositoryPlugin> repos = getPlugins(RepositoryPlugin.class);
List<String> names = new ArrayList<>();
for (RepositoryPlugin rp : repos)
Expand Down

0 comments on commit 2ab3f1b

Please sign in to comment.