You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/02/20 10:00:22 UTC

[sling-org-apache-sling-feature-analyser] branch master updated: 9092 : Remove unused export-packages analyser

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e92aec  9092 : Remove unused export-packages analyser
4e92aec is described below

commit 4e92aecdddfe7685bdd212fd5756f4d3c14cac58
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 20 11:00:11 2020 +0100

    9092 : Remove unused export-packages analyser
---
 readme.md                                          |  2 -
 .../analyser/task/impl/ListExportedPackages.java   | 66 ----------------------
 2 files changed, 68 deletions(-)

diff --git a/readme.md b/readme.md
index 7f0d435..8d2309f 100644
--- a/readme.md
+++ b/readme.md
@@ -27,8 +27,6 @@ information as part of the check, to ensure that bundles don't import packages o
 
 * `requirements-capabilities`: Checks bundle requirements/capabilities for consistency and completeness.
 
-* `exported-packages`: Lists all packages in the feature and writes these to a `packages.txt` file. This 
-analyser task is not enabled by default.
 
 * `apis-jar`: validates that the `sourceId` property of a bundle, if defined, is a comma-separated value list of artifact ids.
 
diff --git a/src/main/java/org/apache/sling/feature/analyser/task/impl/ListExportedPackages.java b/src/main/java/org/apache/sling/feature/analyser/task/impl/ListExportedPackages.java
deleted file mode 100644
index 8fbbd9d..0000000
--- a/src/main/java/org/apache/sling/feature/analyser/task/impl/ListExportedPackages.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.feature.analyser.task.impl;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.sling.feature.analyser.task.AnalyserTask;
-import org.apache.sling.feature.analyser.task.AnalyserTaskContext;
-import org.apache.sling.feature.scanner.BundleDescriptor;
-import org.apache.sling.feature.scanner.PackageInfo;
-
-public class ListExportedPackages implements AnalyserTask {
-
-    @Override
-    public String getId() {
-        return "exported-packages";
-    }
-
-    @Override
-    public String getName() {
-        return "List exported packages check";
-    }
-
-    @Override
-    public void execute(AnalyserTaskContext ctx) throws Exception {
-        SortedSet<String> packages = new TreeSet<>();
-
-        for (BundleDescriptor bd : ctx.getFeatureDescriptor().getBundleDescriptors()) {
-            for (PackageInfo p : bd.getExportedPackages()) {
-                packages.add(p.getName());
-            }
-        }
-
-        File f = new File("packages.txt");
-        if (f.exists()) {
-            throw new IOException("File " + f.getAbsolutePath() +
-                    " already exists. This plugin does not overwrite an existing file");
-        }
-
-        try (FileWriter fw = new FileWriter(f)) {
-            for (String p : packages) {
-                fw.write(p);
-                fw.write(System.getProperty("line.separator"));
-            }
-        }
-        ctx.reportWarning("Finished writing exported packages to " + f.getAbsolutePath());;
-    }
-}