Skip to content

Commit

Permalink
Merge pull request #573 from SpineEventEngine/allow-short-relative-pa…
Browse files Browse the repository at this point in the history
…ths-in-imports

Allow short relative paths in imports
  • Loading branch information
dmdashenkov committed Oct 14, 2020
2 parents b7ffe45 + 51388ba commit c4d15f3
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 38 deletions.
60 changes: 30 additions & 30 deletions license-report.md
@@ -1,6 +1,6 @@


# Dependencies of `io.spine:spine-base:1.6.2`
# Dependencies of `io.spine:spine-base:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -357,12 +357,12 @@
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:05:57 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:19 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-errorprone-checks:1.6.2`
# Dependencies of `io.spine.tools:spine-errorprone-checks:1.6.3`

## Runtime
1. **Group:** com.github.ben-manes.caffeine **Name:** caffeine **Version:** 2.7.0
Expand Down Expand Up @@ -841,12 +841,12 @@ This report was generated on **Fri Oct 09 17:05:57 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:05:58 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:20 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-javadoc-filter:1.6.2`
# Dependencies of `io.spine.tools:spine-javadoc-filter:1.6.3`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -1253,12 +1253,12 @@ This report was generated on **Fri Oct 09 17:05:58 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:05:58 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:21 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-javadoc-prettifier:1.6.2`
# Dependencies of `io.spine.tools:spine-javadoc-prettifier:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -1657,12 +1657,12 @@ This report was generated on **Fri Oct 09 17:05:58 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:05:59 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:21 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-model-compiler:1.6.2`
# Dependencies of `io.spine.tools:spine-model-compiler:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -2077,12 +2077,12 @@ This report was generated on **Fri Oct 09 17:05:59 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:05:59 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:22 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-mute-logging:1.6.2`
# Dependencies of `io.spine.tools:spine-mute-logging:1.6.3`

## Runtime
1. **Group:** com.google.auto.value **Name:** auto-value-annotations **Version:** 1.6.3
Expand Down Expand Up @@ -2485,12 +2485,12 @@ This report was generated on **Fri Oct 09 17:05:59 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:22 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-plugin-base:1.6.2`
# Dependencies of `io.spine.tools:spine-plugin-base:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -2889,12 +2889,12 @@ This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:22 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-plugin-testlib:1.6.2`
# Dependencies of `io.spine.tools:spine-plugin-testlib:1.6.3`

## Runtime
1. **Group:** com.google.auto.value **Name:** auto-value-annotations **Version:** 1.6.3
Expand Down Expand Up @@ -3347,12 +3347,12 @@ This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:23 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-proto-dart-plugin:1.6.2`
# Dependencies of `io.spine.tools:spine-proto-dart-plugin:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -3751,12 +3751,12 @@ This report was generated on **Fri Oct 09 17:06:00 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:23 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-proto-js-plugin:1.6.2`
# Dependencies of `io.spine.tools:spine-proto-js-plugin:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -4155,12 +4155,12 @@ This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:24 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-protoc-api:1.6.2`
# Dependencies of `io.spine.tools:spine-protoc-api:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -4509,12 +4509,12 @@ This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:24 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-protoc-plugin:1.6.2`
# Dependencies of `io.spine.tools:spine-protoc-plugin:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -4881,12 +4881,12 @@ This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:24 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine:spine-testlib:1.6.2`
# Dependencies of `io.spine:spine-testlib:1.6.3`

## Runtime
1. **Group:** com.google.auto.value **Name:** auto-value-annotations **Version:** 1.6.3
Expand Down Expand Up @@ -5289,12 +5289,12 @@ This report was generated on **Fri Oct 09 17:06:01 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:02 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:25 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-tool-base:1.6.2`
# Dependencies of `io.spine.tools:spine-tool-base:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -5661,12 +5661,12 @@ This report was generated on **Fri Oct 09 17:06:02 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:02 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:25 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).




# Dependencies of `io.spine.tools:spine-validation-generator:1.6.2`
# Dependencies of `io.spine.tools:spine-validation-generator:1.6.3`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -6033,4 +6033,4 @@ This report was generated on **Fri Oct 09 17:06:02 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Fri Oct 09 17:06:02 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Tue Oct 13 17:36:25 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject.

<groupId>io.spine</groupId>
<artifactId>spine-base</artifactId>
<version>1.6.2</version>
<version>1.6.3</version>

<inceptionYear>2015</inceptionYear>

Expand Down Expand Up @@ -154,7 +154,7 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-protoc-plugin</artifactId>
<version>1.6.2</version>
<version>1.6.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -24,8 +24,6 @@
import com.google.common.collect.ImmutableList;
import io.spine.value.StringTypeValue;

import java.util.List;

import static io.spine.util.Preconditions2.checkNotEmptyOrBlank;

/**
Expand All @@ -38,6 +36,8 @@ public final class DirectoryReference extends StringTypeValue {

private static final long serialVersionUID = 0L;

private static final DirectoryReference CURRENT = new DirectoryReference("");

private DirectoryReference(String value) {
super(value);
}
Expand All @@ -54,10 +54,17 @@ public static DirectoryReference of(String value) {
return new DirectoryReference(value);
}

/**
* Obtains the reference to the current directory.
*/
public static DirectoryReference currentDir() {
return CURRENT;
}

/**
* Obtains all directory names composing this reference.
*/
public List<String> elements() {
public ImmutableList<String> elements() {
Iterable<String> elements = Splitter.on(FileReference.separator())
.split(value());
return ImmutableList.copyOf(elements);
Expand Down
Expand Up @@ -72,8 +72,12 @@ public String fileName() {
public DirectoryReference directory() {
String nonRelativePath = withoutRelative();
int fileNameSeparator = nonRelativePath.lastIndexOf(IMPORT_PATH_SEPARATOR);
String directory = nonRelativePath.substring(0, fileNameSeparator);
return DirectoryReference.of(directory);
if (fileNameSeparator < 0) {
return DirectoryReference.currentDir();
} else {
String directory = nonRelativePath.substring(0, fileNameSeparator);
return DirectoryReference.of(directory);
}
}

/**
Expand Down
Expand Up @@ -21,6 +21,7 @@
package io.spine.code.fs.js;

import com.google.common.testing.NullPointerTester;
import io.spine.code.fs.DirectoryReference;
import io.spine.code.fs.FileReference;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -63,4 +64,13 @@ void directorySkipRelative() {
assertEquals("foo/bar", fileReference.directory()
.value());
}

@Test
@DisplayName("obtain the empty directory path")
void emptyDirectory() {
FileReference file = FileReference.of("./neighbour.txt");
DirectoryReference directory = file.directory();
assertThat(directory.elements())
.containsExactly("");
}
}
2 changes: 1 addition & 1 deletion version.gradle.kts
Expand Up @@ -34,7 +34,7 @@
/**
* The version of this library.
*/
val base = "1.6.2"
val base = "1.6.3"


project.extra.apply {
Expand Down

0 comments on commit c4d15f3

Please sign in to comment.