Skip to content

Commit 6c077e8

Browse files
peterkirchrisrueger
authored andcommitted
Revert "Add sonatype/MavenCentral repository support"
This reverts commit 2e1cec0. revert gradle plugin related sonatype changes Revert "Update release logging to use bndProject name" This reverts commit 0ba4bc7. Revert "log in github action" This reverts commit 9d0c2ea. Revert "Refactor release task counting in BndPlugin" This reverts commit c6be276. disable baseline for 7.2.2 sonatype removal: this is just an exception because we remove API which was never intended to be used. Signed-off-by: Christoph Rueger <[email protected]>
1 parent 2c925e2 commit 6c077e8

43 files changed

Lines changed: 144 additions & 1750 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

biz.aQute.bnd/src/aQute/bnd/main/bnd.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969

7070
import aQute.bnd.build.Container;
7171
import aQute.bnd.build.Project;
72-
import aQute.bnd.build.Project.ReleaseParameter;
7372
import aQute.bnd.build.ProjectBuilder;
7473
import aQute.bnd.build.ProjectLauncher;
7574
import aQute.bnd.build.ProjectLauncher.LiveCoding;
@@ -1502,18 +1501,11 @@ public void _release(releaseOptions options) throws Exception {
15021501
}
15031502

15041503
}
1505-
1506-
for (Iterator<Project> iterator = projects.iterator(); iterator.hasNext();) {
1507-
Project p = iterator.next();
1504+
for (Project p : projects) {
15081505
if (repo != null) {
15091506
p.setProperty(Constants.RELEASEREPO, repo);
15101507
}
1511-
if (iterator.hasNext()) {
1512-
p.release(options.test());
1513-
} else {
1514-
// releasing last bundle in workspace
1515-
p.release(new ReleaseParameter(null, options.test(), true));
1516-
}
1508+
p.release(options.test());
15171509
}
15181510
if (project != null) {
15191511
getInfo(project);

biz.aQute.bndlib/src/aQute/bnd/build/Project.java

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,17 +1142,16 @@ public URI releaseURI(String name, String jarName, InputStream jarStream) throws
11421142
RepositoryPlugin releaseRepo = releaseRepos.get(0); // use only
11431143
// first
11441144
// release repo
1145-
return releaseRepo(releaseRepo, builder, jarName, jarStream, false);
1145+
return releaseRepo(releaseRepo, builder, jarName, jarStream);
11461146
}
11471147
}
11481148

1149-
private URI releaseRepo(RepositoryPlugin releaseRepo, Processor context, String jarName, InputStream jarStream,
1150-
boolean lastBundleInWorkspace) throws Exception {
1149+
private URI releaseRepo(RepositoryPlugin releaseRepo, Processor context, String jarName, InputStream jarStream)
1150+
throws Exception {
11511151
logger.debug("release to {}", releaseRepo.getName());
11521152
try {
11531153
PutOptions putOptions = new RepositoryPlugin.PutOptions();
11541154
// TODO find sub bnd that is associated with this thing
1155-
context.set("startSonatypePublish", Boolean.toString(lastBundleInWorkspace));
11561155
putOptions.context = context;
11571156
PutResult r = releaseRepo.put(jarStream, putOptions);
11581157
logger.debug("Released {} to {} in repository {}", jarName, r.artifact, releaseRepo);
@@ -1214,39 +1213,14 @@ public void release(boolean test) throws Exception {
12141213
* @throws Exception
12151214
*/
12161215
public void release(String name, boolean test) throws Exception {
1217-
release(new ReleaseParameter(name, test, false));
1218-
}
1219-
1220-
@Deprecated(forRemoval = true, since = "7.3.0")
1221-
public static class ReleaseParameter {
1222-
@Deprecated
1223-
public String name;
1224-
@Deprecated
1225-
public boolean test;
1226-
@Deprecated
1227-
public boolean lastBundleInWorkspace;
1228-
1229-
@Deprecated(forRemoval = true, since = "7.3.0")
1230-
public ReleaseParameter(String name, boolean test, boolean lastBundleInWorkspace) {
1231-
this.name = name;
1232-
this.test = test;
1233-
this.lastBundleInWorkspace = lastBundleInWorkspace;
1234-
}
1235-
}
1236-
1237-
/**
1238-
* Do not use this method.
1239-
*/
1240-
@Deprecated(forRemoval = true, since = "7.3.0")
1241-
public void release(ReleaseParameter relParam) throws Exception, IOException {
1242-
List<RepositoryPlugin> releaseRepos = getReleaseRepos(relParam.name);
1216+
List<RepositoryPlugin> releaseRepos = getReleaseRepos(name);
12431217
if (releaseRepos.isEmpty()) {
12441218
return;
12451219
}
12461220
logger.debug("release");
12471221
File[] jars = getBuildFiles(false);
12481222
if (jars == null) {
1249-
jars = build(relParam.test);
1223+
jars = build(test);
12501224
// If build fails jars will be null
12511225
if (jars == null) {
12521226
logger.debug("no jars built");
@@ -1258,17 +1232,9 @@ public void release(ReleaseParameter relParam) throws Exception, IOException {
12581232
try (ProjectBuilder builder = getBuilder(null)) {
12591233
builder.init();
12601234
for (RepositoryPlugin releaseRepo : releaseRepos) {
1261-
for (int i = 0; i < jars.length; i++) {
1262-
File jar = jars[i];
1235+
for (File jar : jars) {
12631236
try (InputStream jarStream = new BufferedInputStream(IO.stream(jar))) {
1264-
if (relParam.lastBundleInWorkspace && i == jars.length - 1) {
1265-
// this is the last jar builded inside bnd workspace
1266-
// and if appropriate "-sub" - the last of builded
1267-
// sub-bundles
1268-
releaseRepo(releaseRepo, builder, jar.getName(), jarStream, true);
1269-
} else {
1270-
releaseRepo(releaseRepo, builder, jar.getName(), jarStream, false);
1271-
}
1237+
releaseRepo(releaseRepo, builder, jar.getName(), jarStream);
12721238
}
12731239
}
12741240
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
*/
3-
@Version("4.7.1")
3+
@Version("4.7.2")
44
package aQute.bnd.build;
55

66
import org.osgi.annotation.versioning.Version;

biz.aQute.repository/src/aQute/bnd/repository/maven/provider/Configuration.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,4 @@ public interface Configuration {
8181
* @return a comma separated list of tags.
8282
*/
8383
String tags();
84-
85-
/**
86-
* @return SonatypeMode for this repository none, manual or autopublish
87-
*/
88-
SonatypeMode sonatypeMode(String deflt);
8984
}

biz.aQute.repository/src/aQute/bnd/repository/maven/provider/MavenBndRepository.java

Lines changed: 27 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.io.UnsupportedEncodingException;
1313
import java.net.URI;
1414
import java.net.URLDecoder;
15-
import java.util.ArrayList;
1615
import java.util.Arrays;
1716
import java.util.Collection;
1817
import java.util.Collections;
@@ -100,20 +99,13 @@
10099
@BndPlugin(name = "MavenBndRepository", parameters = Configuration.class)
101100
public class MavenBndRepository extends BaseRepository implements RepositoryPlugin, RegistryPlugin, Plugin, Closeable,
102101
Refreshable, Actionable, ToDependencyPom, ReleaseBracketingPlugin {
102+
final static Pattern PREPROCESS_P = Pattern.compile("\\{\\s*(?<core>[^}]+)\\s*\\}");
103103

104-
public static final String SONATYPE_RELEASE_DIR = "cnf/cache/sonatype-release";
105-
public static final String SONATYPE_SNAPSHOT_DIR = "cnf/cache/sonatype-snapshot";
106-
public static final String SONATYPE_DEPLOYMENTID_FILE = "deploymendID.txt";
104+
private final static Logger logger = LoggerFactory.getLogger(MavenBndRepository.class);
105+
private static final int DEFAULT_POLL_TIME = 5;
107106

108-
final static Pattern PREPROCESS_P = Pattern
109-
.compile("\\{\\s*(?<core>[^}]+)\\s*\\}");
110-
111-
private final static Logger logger = LoggerFactory
112-
.getLogger(MavenBndRepository.class);
113-
private static final int DEFAULT_POLL_TIME = 5;
114-
115-
private static final String NONE = "NONE";
116-
private static final String MAVEN_REPO_LOCAL = System.getProperty("maven.repo.local",
107+
private static final String NONE = "NONE";
108+
private static final String MAVEN_REPO_LOCAL = System.getProperty("maven.repo.local",
117109
"~/.m2/repository");
118110
private Configuration configuration;
119111
private Registry registry;
@@ -123,16 +115,16 @@ public class MavenBndRepository extends BaseRepository implements RepositoryPlug
123115
private boolean inited;
124116
IndexFile index;
125117
private ScheduledFuture<?> indexPoller;
126-
private RepoActions actions = new RepoActions(this);
118+
private RepoActions actions = new RepoActions(this);
127119
private String name;
128120
private HttpClient client;
129-
private ReleasePluginImpl releasePlugin = new ReleasePluginImpl(this, null);
130-
private File base = IO.work;
131-
private String status = null;
121+
private ReleasePluginImpl releasePlugin = new ReleasePluginImpl(this, null);
122+
private File base = IO.work;
123+
private String status = null;
132124
private boolean remote;
133-
private final AtomicReference<Throwable> open = new AtomicReference<>();
125+
private final AtomicReference<Throwable> open = new AtomicReference<>();
134126
Optional<Workspace> workspace;
135-
private AtomicBoolean polling = new AtomicBoolean(false);
127+
private AtomicBoolean polling = new AtomicBoolean(false);
136128

137129
/**
138130
* Put result
@@ -290,7 +282,8 @@ private void doExtra(PutOptions options, ReleaseDTO instructions, IPom pom, Rele
290282
String clazz = extra.clazz;
291283
File file = new File(path);
292284
if (!file.isFile())
293-
reporter.error("-release-maven archive contains a path to a file that does not exist: %s", file);
285+
reporter.error("-release-maven archive contains a path to a file that does not exist: %s",
286+
file);
294287
else {
295288
try (Resource r = new FileResource(file)) {
296289
Resource what;
@@ -494,6 +487,7 @@ private ReleaseDTO getReleaseDTO(Processor context) {
494487
release.passphrase = sign.get("passphrase");
495488
}
496489

490+
497491
int clazz = 0;
498492

499493
for (Iterator<Entry<String, Attrs>> it = p.entrySet()
@@ -521,7 +515,8 @@ private ReleaseDTO getReleaseDTO(Processor context) {
521515
.getAbsolutePath();
522516
} else {
523517
reporter.warning(
524-
"The -maven-release instruction has an 'archive' without the path attribute: %s", e);
518+
"The -maven-release instruction has an 'archive' without the path attribute: %s",
519+
e);
525520
continue;
526521
}
527522
extra.path = path;
@@ -654,59 +649,17 @@ synchronized boolean init() {
654649
inited = true;
655650

656651
try {
657-
List<MavenBackingRepository> release = new ArrayList<MavenBackingRepository>();
652+
List<MavenBackingRepository> release = MavenBackingRepository.create(configuration.releaseUrl(), reporter,
653+
localRepo, client);
654+
List<MavenBackingRepository> snapshot = MavenBackingRepository.create(configuration.snapshotUrl(), reporter,
655+
localRepo, client);
656+
658657
MavenBackingRepository staging = null;
659-
List<MavenBackingRepository> snapshot = new ArrayList<MavenBackingRepository>();
660-
661-
String releaseUrl = configuration.releaseUrl();
662-
SonatypeMode sonatypeMode = configuration.sonatypeMode(SonatypeMode.NONE.name());
663-
664-
String stagingUrl = configuration.stagingUrl();
665-
String snapshotUrl = configuration.snapshotUrl();
666-
667-
String sonatypeReleaseUrl = null;
668-
String sonatypeSnapshotUrl = null;
669-
switch (sonatypeMode) {
670-
case MANUAL, AUTOPUBLISH -> {
671-
logger.info("deployment via Sonatype Central Portal configured in {} mode", sonatypeMode);
672-
File releaseDir = registry.getPlugin(Workspace.class)
673-
.getFile(SONATYPE_RELEASE_DIR);
674-
File snapshotDir = registry.getPlugin(Workspace.class)
675-
.getFile(SONATYPE_SNAPSHOT_DIR);
676-
if (stagingUrl == null) {
677-
logger.debug("deployment via relase url to Sonatype Portal configured");
678-
List<MavenBackingRepository> releaseLocal = MavenBackingRepository.create(releaseDir.toURI()
679-
.toString(), reporter, localRepo, client);
680-
release.addAll(releaseLocal);
681-
sonatypeReleaseUrl = releaseUrl;
682-
} else {
683-
logger.debug("deployment via staging url to Sonatype Portal configured");
684-
release = MavenBackingRepository.create(releaseUrl, reporter, localRepo, client);
685-
staging = MavenBackingRepository.getBackingRepository(releaseDir.toURI()
686-
.toString(), reporter, localRepo, client);
687-
sonatypeReleaseUrl = stagingUrl;
688-
}
689-
if (snapshotUrl != null) {
690-
logger.debug("deployment via snapshot url to Sonatype Portal configured");
691-
List<MavenBackingRepository> snapshotLocal = MavenBackingRepository.create(snapshotDir.toURI()
692-
.toString(), reporter, localRepo, client);
693-
snapshot.addAll(snapshotLocal);
694-
sonatypeSnapshotUrl = snapshotUrl;
695-
}
696-
}
697-
case NONE -> {
698-
if (stagingUrl == null) {
699-
release = MavenBackingRepository.create(releaseUrl, reporter, localRepo, client);
700-
} else {
701-
release = MavenBackingRepository.create(releaseUrl, reporter, localRepo, client);
702-
staging = MavenBackingRepository.getBackingRepository(stagingUrl, reporter, localRepo, client);
703-
}
704-
if (snapshotUrl != null) {
705-
snapshot = MavenBackingRepository.create(snapshotUrl, reporter, localRepo, client);
706-
}
707-
}
708-
}
709658

659+
if (configuration.stagingUrl() != null) {
660+
staging = MavenBackingRepository.getBackingRepository(configuration.stagingUrl(),
661+
reporter, localRepo, client);
662+
}
710663

711664
for (MavenBackingRepository mbr : release) {
712665
if (mbr.isRemote()) {
@@ -722,14 +675,9 @@ synchronized boolean init() {
722675
}
723676
}
724677

725-
storage = new MavenRepository(localRepo, name, release, staging, snapshot, client.promiseFactory()
678+
storage = new MavenRepository(localRepo, name, release, staging, snapshot,
679+
client.promiseFactory()
726680
.executor(), reporter);
727-
MavenRepository storageMvn = (MavenRepository) storage;
728-
storageMvn.setSonatypeMode(sonatypeMode);
729-
if (sonatypeReleaseUrl != null) {
730-
storageMvn.setSonatypePublisherUrl(sonatypeReleaseUrl);
731-
storageMvn.setSonatypePublishSnapshotUrl(sonatypeSnapshotUrl);
732-
}
733681

734682
File indexFile = getIndexFile();
735683
Processor domain = (registry != null) ? registry.getPlugin(Processor.class) : null;
@@ -1137,8 +1085,4 @@ public boolean isRemote() {
11371085
return remote;
11381086
}
11391087

1140-
public HttpClient getClient() {
1141-
return client;
1142-
}
1143-
11441088
}

biz.aQute.repository/src/aQute/bnd/repository/maven/provider/SonatypeMode.java

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Version("2.3.0")
1+
@Version("2.3.1")
22
package aQute.bnd.repository.maven.provider;
33

44
import org.osgi.annotation.versioning.Version;

biz.aQute.repository/src/aQute/maven/provider/MavenBackingRepository.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ static public MavenBackingRepository getBackingRepository(String url, Reporter r
231231
if (uri.getScheme()
232232
.equalsIgnoreCase("file")) {
233233
File remote = new File(uri);
234-
MavenFileRepository fileRepo = new MavenFileRepository(localRepo, remote, reporter);
235-
fileRepo.setClient(client);
236-
return fileRepo;
234+
return new MavenFileRepository(localRepo, remote, reporter);
237235
} else {
238236
return new MavenRemoteRepository(localRepo, client, url, reporter);
239237
}

0 commit comments

Comments
 (0)