-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
498 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...pendency-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/organize/BundleInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.extras.pde.organize; | ||
|
||
import java.util.jar.Manifest; | ||
|
||
import org.osgi.framework.Constants; | ||
import org.osgi.framework.Version; | ||
|
||
public class BundleInfo { | ||
|
||
private Version version; | ||
private Manifest manifest; | ||
|
||
public BundleInfo(Manifest manifest) { | ||
this.manifest = manifest; | ||
} | ||
|
||
public Manifest manifest() { | ||
return manifest; | ||
} | ||
|
||
public Version version() { | ||
if (version == null) { | ||
String v = manifest().getMainAttributes().getValue(Constants.BUNDLE_VERSION); | ||
if (v == null) { | ||
v = "0"; | ||
} | ||
version = Version.parseVersion(v); | ||
} | ||
return version; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...cy-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/organize/ExportedPackages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.extras.pde.organize; | ||
|
||
public class ExportedPackages { | ||
|
||
public ExportedPackages(String manifestValue) { | ||
// TODO Auto-generated constructor stub | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
...ncy-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/organize/ImportedPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.extras.pde.organize; | ||
|
||
import org.osgi.framework.Constants; | ||
|
||
import aQute.bnd.header.Attrs; | ||
|
||
public class ImportedPackage { | ||
|
||
private ImportedPackages packages; | ||
private String packageName; | ||
private Attrs attrs; | ||
|
||
public ImportedPackage(ImportedPackages packages, String packageName, Attrs attrs) { | ||
this.packages = packages; | ||
this.packageName = packageName; | ||
this.attrs = attrs; | ||
} | ||
|
||
public String getPackageName() { | ||
return packageName; | ||
} | ||
|
||
public String getVersion() { | ||
return attrs.get(Constants.VERSION_ATTRIBUTE); | ||
} | ||
|
||
public boolean isJava() { | ||
return packageName.startsWith("java."); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String version = getVersion(); | ||
if (version != null) { | ||
return getPackageName() + " " + version; | ||
} | ||
return getPackageName(); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...cy-tools-plugin/src/main/java/org/eclipse/tycho/extras/pde/organize/ImportedPackages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.tycho.extras.pde.organize; | ||
|
||
import java.util.Map; | ||
import java.util.Map.Entry; | ||
import java.util.TreeMap; | ||
import java.util.stream.Stream; | ||
|
||
import aQute.bnd.header.Attrs; | ||
import aQute.bnd.header.OSGiHeader; | ||
import aQute.bnd.header.Parameters; | ||
|
||
public class ImportedPackages { | ||
|
||
//import package order is not important so we can sort here by name | ||
private Map<String, ImportedPackage> packages = new TreeMap<>(); | ||
|
||
public ImportedPackages(String manifestValue) { | ||
if (manifestValue != null) { | ||
Parameters header = OSGiHeader.parseHeader(manifestValue); | ||
for (Entry<String, Attrs> entry : header.entrySet()) { | ||
packages.put(entry.getKey(), new ImportedPackage(this, entry.getKey(), entry.getValue())); | ||
} | ||
} | ||
} | ||
|
||
public Stream<ImportedPackage> packages() { | ||
return packages.values().stream(); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.