Skip to content

Commit

Permalink
Hmm, recursion. bndrun created a bndeditmodel
Browse files Browse the repository at this point in the history
---
 Signed-off-by: Peter Kriens <[email protected]>

Signed-off-by: Peter Kriens <[email protected]>
  • Loading branch information
pkriens committed Apr 4, 2024
1 parent a0697bc commit 83e192d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
@SuppressWarnings("deprecation")
public class BndEditModel {

private static final String BUILDFILE = Workspace.CNFDIR
+ "/" + Workspace.BUILDFILE;
public static final String NEWLINE_LINE_SEPARATOR = "\\n\\\n\t";
public static final String LIST_SEPARATOR = ",\\\n\t";

Expand Down Expand Up @@ -273,13 +271,6 @@ public ImportPattern error(

// for change detection when multiple wizards look at the same model
private long lastChangedAt;
/**
* Is either the workspace (when cnf/build.bnd) or a project (when its
* bnd.bnd) or a random bndrun linked to workspace (event if it isn't a
* bndrun). Primary purpose is to walk the inheritance chain implied in the
* Workspace/Project/sub bnd files/bndrun files
*/
Processor owner;

// Converter<String, ResolveMode> resolveModeFormatter =
// EnumFormatter.create(ResolveMode.class, ResolveMode.manual);
Expand Down Expand Up @@ -395,16 +386,29 @@ public BndEditModel(Project bndrun) throws IOException {
this(bndrun.getWorkspace());
this.project = bndrun;
File propertiesFile = bndrun.getPropertiesFile();
this.owner = workspace.findProcessor(propertiesFile)
.orElse(bndrun);

if (propertiesFile.isFile())
this.document = new Document(IO.collect(propertiesFile));
else
this.document = new Document("");
loadFrom(this.document);
}

/**
* Is either the workspace (when cnf/build.bnd) or a project (when its
* bnd.bnd) or a random bndrun linked to workspace (event if it isn't a
* bndrun). Primary purpose is to walk the inheritance chain implied in the
* Workspace/Project/sub bnd files files
*/
Processor getOwner() {
File propertiesFile = project.getPropertiesFile();
if (!propertiesFile.getName()
.endsWith(".bnd"))
return project;

return workspace.findProcessor(propertiesFile)
.orElse(project);
}

public void loadFrom(IDocument document) throws IOException {
try (InputStream in = toEscaped(document.get())) {
loadFrom(in);
Expand Down

0 comments on commit 83e192d

Please sign in to comment.