Skip to content

Commit

Permalink
FileSystemNotFoundException was thrown when listing manifest files.
Browse files Browse the repository at this point in the history
  • Loading branch information
gericlockify committed Aug 23, 2024
1 parent 337bab9 commit 1f3f9ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion annotation-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.cake.clockify</groupId>
<artifactId>addon-sdk-annotation-processor</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Constants {
public static final String DELIMITER_NAME_PARTS = "_";
Expand All @@ -12,6 +14,10 @@ public class Constants {

public static final String CLOCKIFY_MODEL_PACKAGE = "com.cake.clockify.addonsdk.clockify.model";
public static final String CLOCKIFY_MANIFESTS_DIR = "clockify-manifests";
public static final List<String> CLOCKIFY_MANIFESTS = List.of(
CLOCKIFY_MANIFESTS_DIR + "/1.2.json",
CLOCKIFY_MANIFESTS_DIR + "/1.3.json"
);

public static final String CLOCKIFY_PREFIX = "Clockify";
public static final String CLOCKIFY_MANIFEST_INTERFACE = "ClockifyManifest";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.List;
import java.util.Set;

import static com.cake.clockify.annotationprocessor.Constants.CLOCKIFY_MANIFESTS;

@AutoService(javax.annotation.processing.Processor.class)
@SupportedSourceVersion(SourceVersion.RELEASE_18)
@NoArgsConstructor
Expand Down Expand Up @@ -44,7 +46,7 @@ private void processAnnotation(TypeElement annotation, RoundEnvironment roundEnv
for (Element element : elements) {
DeclaredType type = (DeclaredType) element.asType();

for (String manifestPath: Utils.getClockifyManifestPaths()) {
for (String manifestPath: CLOCKIFY_MANIFESTS) {
try {
files.addAll(new ClockifyManifestProcessor(type, manifestPath).process());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@

import javax.lang.model.type.DeclaredType;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import static com.cake.clockify.annotationprocessor.Constants.CLOCKIFY_PREFIX;
import static com.cake.clockify.annotationprocessor.Constants.CLOCKIFY_MANIFESTS_DIR;
import static com.cake.clockify.annotationprocessor.Constants.REGEX_METHOD_NAME_SPLIT;
import static com.cake.clockify.annotationprocessor.Constants.REGEX_UPPER_CASE_SPLIT;
import static java.util.Collections.emptyList;
Expand All @@ -34,17 +29,6 @@ public class Utils {
"lifecycle", "lifecycleEvent"
);

@SneakyThrows
public static List<String> getClockifyManifestPaths() {
URL url = Utils.class.getClassLoader().getResource(CLOCKIFY_MANIFESTS_DIR);
Path path = Paths.get(url.toURI());
try (var files = Files.walk(path, 1)) {
return files.filter(p -> p.toFile().isFile())
.map(p -> CLOCKIFY_MANIFESTS_DIR + "/" + p.getFileName().toString())
.toList();
}
}

@SneakyThrows
public static JsonNode readManifestDefinition(ObjectMapper mapper, String manifestPath) {
InputStream is = Utils.class.getClassLoader().getResourceAsStream(manifestPath);
Expand Down

0 comments on commit 1f3f9ea

Please sign in to comment.