Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group library feature for embedded cdt #606

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions README-MAINTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For archiving purposes, the release is also published in a separate folder
for each version, with the archive in the top folder and the p2 repo as
a sub-folder

- <https://download.eclipse.org/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202307251916.zip>
- <https://download.eclipse.org/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202401111557.zip>
- <https://download.eclipse.org/embed-cdt/releases/6.5.0/p2/>

The official download page is
Expand All @@ -57,12 +57,13 @@ Install the **CBI Aggregator Editor** from:

- <https://download.eclipse.org/cbi/updates/aggregator/ide/4.13>

At first use, clone the SimRel Git repo:
At first use, fork the SimRel Git repo from:

```bash
git clone ssh://lionescu@git.eclipse.org:29418/simrel/org.eclipse.simrel.build org.eclipse.simrel.build.git
scp -p -P 29418 lionescu@git.eclipse.org:hooks/commit-msg org.eclipse.simrel.build.git/.git/hooks/
```
- <https://github.com/eclipse-simrel/simrel.build>

to

- <https://github.com/embed-cdt/simrel.build>

### SimRel deadline

Expand Down Expand Up @@ -272,7 +273,7 @@ In Eclipse:
- right click: **Show Properties View**
- in the right side, edit the **Location** field to the new release
candidate p2 URL (like
`https://download.eclipse.org/embed-cdt/release-candidates/6.5.0-202307251916/p2/`
`https://download.eclipse.org/embed-cdt/release-candidates/6.5.0-202401111557/p2/`
and press Enter
- select all the features in the contribution, right-click and choose
**Fix Versions**
Expand All @@ -281,7 +282,7 @@ and press Enter
- Save
- stage `simrel.aggr` & `embedcdt.aggrcon`
- commit with a message like:
- _embedcdt: update for 6.5.0-202307251916_,
- _embedcdt: update for 6.5.0-202401111557_,
- _Signed-off-by: Liviu Ionescu <ilg@livius.net>_
- click the **Commit** button (do not Push yet)
- right click, Show in local Terminal
Expand Down Expand Up @@ -311,7 +312,7 @@ In about 7-8 minutes it'll automatically rebuild the staging repo:

Announce the release candidate to the **embed-cdt-dev@eclipse.org** list;
use a subject like
**Embed CDT v6.5.0-202307251916 release candidate**,
**Embed CDT v6.5.0-202401111557 release candidate**,
and pass a link to the release page, available at:

- <https://projects.eclipse.org/projects/iot.embed-cdt/>
Expand All @@ -326,7 +327,7 @@ Go to the release candidate folder

- [https://download.eclipse.org/embed-cdt/release-candidates/](https://download.eclipse.org/embed-cdt/release-candidates/)

Copy the tag and enter it in Git, like `v6.5.0-202307251916` (with `v`).
Copy the tag and enter it in Git, like `v6.5.0-202401111557` (with `v`).

## Publish the final release

Expand Down Expand Up @@ -380,12 +381,12 @@ In the `develop` branch, in `_posts/plugins/releases`, add a new release page.
As links for the latest two, open <https://download.eclipse.org/embed-cdt/releases/>
and get the archive URL, like:

- <https://download.eclipse.org/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202307251916.zip>
- <https://download.eclipse.org/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202401111557.zip>

Isolate the part starting with `/embed-cdt/...` and update the URLs to use the download redirect:

- <https://www.eclipse.org/downloads/download.php?file=/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202307251916.zip>
- <https://www.eclipse.org/downloads/download.php?file=//embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202307251916.zip.sha>
- <https://www.eclipse.org/downloads/download.php?file=/embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202401111557.zip>
- <https://www.eclipse.org/downloads/download.php?file=//embed-cdt/releases/6.5.0/org.eclipse.embedcdt.repository-6.5.0-202401111557.zip.sha>

Go to <https://github.com/eclipse-embed-cdt/eclipse-plugins/milestones> and
update the fixed issues.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,11 @@
id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.paths"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.paths">
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.c.linker.libs"
id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs.group"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group">
</option>
<optionCategory
id="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.c.linker.misc"
name="%optionCategory.linker.misc">
Expand Down Expand Up @@ -3098,6 +3103,11 @@
id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.paths">
</option>
<option
category="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.cpp.linker.libs"
id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.libs.group"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group">
</option>
<optionCategory
id="ilg.gnuarmeclipse.managedbuild.cross.optionCategory.cpp.linker.misc"
name="%optionCategory.linker.misc">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.embedcdt.core;bundle-version="6.5.0",
org.eclipse.cdt.managedbuilder.core;bundle-version="9.0.0",
org.eclipse.core.expressions;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.13.800",
org.eclipse.core.runtime;bundle-version="3.19.0"
org.eclipse.core.runtime;bundle-version="3.19.0",
org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="8.6.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: %bundle.vendor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ option.linker.printgcsections=Print removed sections (-Xlinker --print-gc-sectio
option.linker.strip=Omit all symbol information (-s)
option.linker.libs=Libraries (-l)
option.linker.paths=Library search path (-L)
option.linker.libs.group=Group libraries (-Wl,--start-group ... -Wl,--end-group)
option.linker.flags=Linker flags (-Xlinker [option])
option.linker.otherobjs=Other objects
option.linker.other=Other linker flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@
command="-l"
id="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs"
isAbstract="true"
commandGenerator="org.eclipse.embedcdt.managedbuild.cross.core.GnuCppLibrariesCommandGenerator"
name="%option.linker.libs"
valueType="libs">
</option>
Expand All @@ -662,6 +663,13 @@
name="%option.linker.paths"
valueType="libPaths">
</option>
<option
defaultValue="false"
id="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group"
isAbstract="true"
name="%option.linker.libs.group"
valueType="boolean">
</option>
<option
command="-Xlinker ${VALUE}"
id="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.flags"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.eclipse.embedcdt.managedbuild.cross.core;

import org.eclipse.cdt.managedbuilder.gnu.ui.LibrariesCommandGenerator;

public class GnuCppLibrariesCommandGenerator extends LibrariesCommandGenerator {

public GnuCppLibrariesCommandGenerator() {
super("ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group"); //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,74 @@

package org.eclipse.embedcdt.managedbuild.cross.core;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;

@SuppressWarnings("deprecation")
public class GnuMcuMakefileGenerator extends GnuMakefileGenerator {

private Pattern doubleQuotedOption = Pattern.compile("--?[a-zA-Z]+.*?\\\".*?\\\".*"); //$NON-NLS-1$
private Pattern singleQuotedOption = Pattern.compile("--?[a-zA-Z]+.*?'.*?'.*"); //$NON-NLS-1$
private static Pattern singleGroupOption = Pattern.compile("-Wl,--start-group (.*?) -Wl,--end-group"); //$NON-NLS-1$

@Override
public String ensurePathIsGNUMakeTargetRuleCompatibleSyntax(String path) {
return escapeWhitespaces(ensureUnquoted(path));
boolean isQuotedOption = false;
if (path.startsWith("-")) { //$NON-NLS-1$
isQuotedOption = checkIfQuotedOption(path);
}
if (checkIfGroupOption(path))
return escapeGroupWhitespaces(ensureUnquoted(path));
if (!isQuotedOption)
return escapeWhitespaces(ensureUnquoted(path));

return path;
}

static public String escapeGroupWhitespaces(String path) {
Matcher m = singleGroupOption.matcher(path);
while (m.find()) {
String grouplib = m.group(1).toString().trim();
if (grouplib.length() > 0) {
StringBuffer escapedPath = new StringBuffer();
String[] segments = grouplib.split("-l"); //$NON-NLS-1$
if (segments.length > 1) {
for (int index = 0; index < segments.length; ++index) {
String segment = segments[index].trim();
if (segment.length() > 0) {
escapedPath.append("-l");
escapedPath.append(escapeWhitespaces(segment));
if (index + 1 < segments.length) {
escapedPath.append(" "); //$NON-NLS-1$
}
}
}
} else {
escapedPath.append(grouplib);
}
path = path.replace(grouplib, escapedPath.toString().trim());
}
}
return path;
}

private boolean checkIfGroupOption(String path) {
Matcher m1 = singleGroupOption.matcher(path);
if (m1.matches())
return true;
return false;
}

private boolean checkIfQuotedOption(String path) {
Matcher m1 = doubleQuotedOption.matcher(path);
if (m1.matches())
return true;
Matcher m2 = singleQuotedOption.matcher(path);
if (m2.matches())
return true;
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,11 @@
id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.paths"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.paths">
</option>
<option
category="ilg.gnumcueclipse.managedbuild.cross.riscv.optionCategory.c.linker.libs"
id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs.group"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group">
</option>
<optionCategory
id="ilg.gnumcueclipse.managedbuild.cross.riscv.optionCategory.c.linker.misc"
name="%optionCategory.linker.misc">
Expand Down Expand Up @@ -2009,6 +2014,11 @@
id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.paths"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.paths">
</option>
<option
category="ilg.gnumcueclipse.managedbuild.cross.riscv.optionCategory.cpp.linker.libs"
id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.libs.group"
superClass="ilg.gnumcueclipse.managedbuild.cross.option.base.linker.libs.group">
</option>
<optionCategory
id="ilg.gnumcueclipse.managedbuild.cross.riscv.optionCategory.cpp.linker.misc"
name="%optionCategory.linker.misc">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
<properties size='1'>
<!-- timestamp made with `date +%s%3N` on Linux -->
<property name='p2.timestamp' value='1690313001247'/>
<property name='p2.timestamp' value='1704989417557'/>
</properties>
<children size='1'>
<child location='../../releases/6.0.0/p2'/>
Expand All @@ -16,5 +16,6 @@
<child location='../../releases/6.3.1/p2'/>
<child location='../../releases/6.3.2/p2'/>
<child location='../../releases/6.4.0/p2'/>
<child location='../../releases/6.5.0/p2'/>
</children>
</repository>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
<properties size='1'>
<!-- timestamp made with `date +%s%3N` on Linux -->
<property name='p2.timestamp' value='1690313001247'/>
<property name='p2.timestamp' value='1704989417557'/>
</properties>
<children size='1'>
<child location='../../releases/6.0.0/p2'/>
Expand All @@ -16,5 +16,6 @@
<child location='../../releases/6.3.1/p2'/>
<child location='../../releases/6.3.2/p2'/>
<child location='../../releases/6.4.0/p2'/>
<child location='../../releases/6.5.0/p2'/>
</children>
</repository>