Skip to content

Commit a21e678

Browse files
Merge branch 'release/1.1.0'
2 parents a4908c6 + 878bccb commit a21e678

28 files changed

+991
-45
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ jobs:
88
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
99
steps:
1010
- uses: actions/checkout@v2
11-
- uses: actions/setup-java@v1
11+
- uses: actions/setup-java@v2
1212
with:
13-
java-version: 11
14-
- uses: actions/cache@v2
15-
with:
16-
path: ~/.m2/repository
17-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
18-
restore-keys: |
19-
${{ runner.os }}-maven-
13+
distribution: 'temurin'
14+
java-version: 17
15+
cache: 'maven'
2016
- name: Ensure to use tagged version
2117
if: startsWith(github.ref, 'refs/tags/')
2218
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ jobs:
1818
- uses: actions/checkout@v2
1919
with:
2020
fetch-depth: 2
21-
- uses: actions/setup-java@v1
21+
- uses: actions/setup-java@v2
2222
with:
23-
java-version: 11
24-
- uses: actions/cache@v2
25-
with:
26-
path: ~/.m2/repository
27-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
restore-keys: |
29-
${{ runner.os }}-maven-
23+
distribution: 'temurin'
24+
java-version: 17
25+
cache: 'maven'
3026
- name: Initialize CodeQL
3127
uses: github/codeql-action/init@v1
3228
with:

.github/workflows/publish-central.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@ jobs:
1313
- uses: actions/checkout@v2
1414
with:
1515
ref: "refs/tags/${{ github.event.inputs.tag }}"
16-
- uses: actions/setup-java@v1
16+
- uses: actions/setup-java@v2
1717
with:
18-
java-version: 11
18+
distribution: 'temurin'
19+
java-version: 17
20+
cache: 'maven'
1921
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
2022
server-username: MAVEN_USERNAME # env variable for username in deploy
2123
server-password: MAVEN_PASSWORD # env variable for token in deploy
2224
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
2325
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
24-
- uses: actions/cache@v2
25-
with:
26-
path: ~/.m2/repository
27-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
restore-keys: |
29-
${{ runner.os }}-maven-
3026
- name: Enforce project version ${{ github.event.inputs.tag }}
3127
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
3228
- name: Deploy
3329
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
3430
env:
31+
MAVEN_OPTS: >
32+
--add-opens=java.base/java.util=ALL-UNNAMED
33+
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
34+
--add-opens=java.base/java.text=ALL-UNNAMED
35+
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED
3536
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3637
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
3738
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}

.github/workflows/publish-github.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ jobs:
88
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
99
steps:
1010
- uses: actions/checkout@v2
11-
- uses: actions/setup-java@v1
11+
- uses: actions/setup-java@v2
1212
with:
13-
java-version: 11
13+
distribution: 'temurin'
14+
java-version: 17
15+
cache: 'maven'
1416
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
1517
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
16-
- uses: actions/cache@v2
17-
with:
18-
path: ~/.m2/repository
19-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
20-
restore-keys: |
21-
${{ runner.os }}-maven-
2218
- name: Enforce project version ${{ github.event.release.tag_name }}
2319
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
2420
- name: Deploy

.idea/codeStyles/Project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>integrations-api</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.1.0</version>
99

1010
<name>Cryptomator Integrations API</name>
1111
<description>Defines optional service interfaces that may be used by Cryptomator</description>
@@ -37,14 +37,47 @@
3737
</license>
3838
</licenses>
3939

40+
<dependencies>
41+
<dependency>
42+
<groupId>org.slf4j</groupId>
43+
<artifactId>slf4j-api</artifactId>
44+
<version>1.7.36</version>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.jetbrains</groupId>
49+
<artifactId>annotations</artifactId>
50+
<version>23.0.0</version>
51+
<scope>provided</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>org.slf4j</groupId>
55+
<artifactId>slf4j-simple</artifactId>
56+
<version>1.7.36</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.junit.jupiter</groupId>
61+
<artifactId>junit-jupiter</artifactId>
62+
<version>5.8.2</version>
63+
<scope>test</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.mockito</groupId>
67+
<artifactId>mockito-core</artifactId>
68+
<version>4.3.1</version>
69+
<scope>test</scope>
70+
</dependency>
71+
</dependencies>
72+
4073
<build>
4174
<plugins>
4275
<plugin>
4376
<groupId>org.apache.maven.plugins</groupId>
4477
<artifactId>maven-compiler-plugin</artifactId>
45-
<version>3.8.1</version>
78+
<version>3.9.0</version>
4679
<configuration>
47-
<release>11</release>
80+
<release>17</release>
4881
</configuration>
4982
</plugin>
5083
<plugin>
@@ -72,7 +105,7 @@
72105
</executions>
73106
<configuration>
74107
<quiet>true</quiet>
75-
<release>11</release>
108+
<release>17</release>
76109
<tags>
77110
<!-- workaround for "unknown tag: implNote", see https://blog.codefx.org/java/new-javadoc-tags/#Maven -->
78111
<tag>
@@ -110,7 +143,7 @@
110143
<plugins>
111144
<plugin>
112145
<artifactId>maven-gpg-plugin</artifactId>
113-
<version>1.6</version>
146+
<version>3.0.1</version>
114147
<executions>
115148
<execution>
116149
<id>sign-artifacts</id>
@@ -137,7 +170,7 @@
137170
<repository>
138171
<id>ossrh</id>
139172
<name>Maven Central</name>
140-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
173+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
141174
</repository>
142175
</distributionManagement>
143176
<build>
@@ -149,7 +182,7 @@
149182
<extensions>true</extensions>
150183
<configuration>
151184
<serverId>ossrh</serverId>
152-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
185+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
153186
<autoReleaseAfterClose>true</autoReleaseAfterClose>
154187
</configuration>
155188
</plugin>

src/main/java/module-info.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
import org.cryptomator.integrations.tray.TrayMenuController;
2+
import org.cryptomator.integrations.autostart.AutoStartProvider;
3+
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
4+
import org.cryptomator.integrations.tray.TrayIntegrationProvider;
5+
import org.cryptomator.integrations.uiappearance.UiAppearanceProvider;
6+
7+
18
module org.cryptomator.integrations.api {
9+
requires static org.jetbrains.annotations;
10+
requires org.slf4j;
11+
212
exports org.cryptomator.integrations.autostart;
13+
exports org.cryptomator.integrations.common;
314
exports org.cryptomator.integrations.keychain;
415
exports org.cryptomator.integrations.tray;
516
exports org.cryptomator.integrations.uiappearance;
17+
18+
uses AutoStartProvider;
19+
uses KeychainAccessProvider;
20+
uses TrayIntegrationProvider;
21+
uses TrayMenuController;
22+
uses UiAppearanceProvider;
623
}

src/main/java/org/cryptomator/integrations/autostart/AutoStartProvider.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
package org.cryptomator.integrations.autostart;
22

3+
import org.cryptomator.integrations.common.IntegrationsLoader;
4+
import org.jetbrains.annotations.Blocking;
5+
6+
import java.util.Optional;
7+
38
public interface AutoStartProvider {
49

10+
/**
11+
* Loads the best-suited AutoStartProvider.
12+
*
13+
* @return preferred AutoStartProvider (if any)
14+
* @since 1.1.0
15+
*/
16+
static Optional<AutoStartProvider> get() {
17+
return IntegrationsLoader.load(AutoStartProvider.class);
18+
}
19+
20+
@Blocking
521
void enable() throws ToggleAutoStartFailedException;
622

23+
@Blocking
724
void disable() throws ToggleAutoStartFailedException;
825

926
boolean isEnabled();
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.cryptomator.integrations.common;
2+
3+
import org.jetbrains.annotations.ApiStatus;
4+
5+
import java.lang.annotation.Documented;
6+
import java.lang.annotation.ElementType;
7+
import java.lang.annotation.Inherited;
8+
import java.lang.annotation.Retention;
9+
import java.lang.annotation.RetentionPolicy;
10+
import java.lang.annotation.Target;
11+
12+
/**
13+
* Identifies 0..n public methods to check preconditions for the integration to work. These are the rules:
14+
*
15+
* <ul>
16+
* <li>Both the type and the method(s) must be annotated with {@code @CheckAvailability}</li>
17+
* <li>Only public no-arg boolean methods are considered</li>
18+
* <li>Methods <em>may</em> be {@code static}, in which case they get invoked before instantiating the service</li>
19+
* <li>Should the method throw an exception, it has the same effect as returning {@code false}</li>
20+
* <li>No specific execution order is guaranteed in case of multiple annotated methods</li>
21+
* <li>Annotations must be present on classes or ancestor classes, not on interfaces</li>
22+
* </ul>
23+
*
24+
* Example:
25+
* <pre>
26+
* {@code
27+
* @CheckAvailability
28+
* public class Foo {
29+
* @CheckAvailability
30+
* public static boolean isSupported() {
31+
* return "enabled".equals(System.getProperty("plugin.status"));
32+
* }
33+
* }
34+
* }
35+
* </pre>
36+
* <p>
37+
* Annotations are discovered at runtime using reflection, so make sure to make relevant classes accessible to this
38+
* module ({@code opens X to org.cryptomator.integrations.api}).
39+
*
40+
* @since 1.1.0
41+
*/
42+
@Documented
43+
@Retention(RetentionPolicy.RUNTIME)
44+
@Target({ElementType.TYPE, ElementType.METHOD})
45+
@Inherited
46+
@ApiStatus.Experimental
47+
public @interface CheckAvailability {
48+
}

0 commit comments

Comments
 (0)