Skip to content

Commit 14b732d

Browse files
committed
Update all dependencies
1 parent 856f2b7 commit 14b732d

File tree

45 files changed

+1609
-130
lines changed

Some content is hidden

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

45 files changed

+1609
-130
lines changed

.github/workflows/build.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: [ macos-latest, windows-latest, ubuntu-20.04 ]
12+
os: [ macos-latest, windows-latest, ubuntu-latest ]
1313
include:
14-
- os: ubuntu-20.04
14+
- os: ubuntu-latest
1515
cli_assembly_id: linux-amd64
1616
cli_assembly_format: tar.gz
1717
- os: windows-latest
1818
cli_assembly_id: windows-amd64
1919
cli_assembly_format: zip
2020
gu_executable_ext: .cmd
2121
- os: macos-latest
22-
cli_assembly_id: macos-amd64
22+
cli_assembly_id: macos-aarch64
2323
cli_assembly_format: tar.gz
2424
steps:
2525
- uses: ilammy/msvc-dev-cmd@v1
2626
if: ${{ matrix.os == 'windows-latest'}}
2727
- run: ldd --version
28-
if: ${{ matrix.os == 'ubuntu-20.04'}}
28+
if: ${{ matrix.os == 'ubuntu-latest'}}
2929
- uses: actions/checkout@v4
3030
- uses: actions/cache@v4
3131
with:
@@ -37,19 +37,19 @@ jobs:
3737
path: ~/.m2
3838
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
3939
restore-keys: ${{ runner.os }}-m2
40-
- uses: Project-Env/project-env-github-action@v1.3.1
41-
- uses: repolevedavaj/[email protected].1
40+
- uses: Project-Env/project-env-github-action@v1.4.0
41+
- uses: repolevedavaj/[email protected].2
4242
with:
4343
nsis-version: 3.08
4444
if: ${{ matrix.os == 'windows-latest'}}
4545
- run: mvn -B -s etc/m2/settings.xml verify -Pnative-image -Psonar "-Dcli.assembly.id=${{ matrix.cli_assembly_id }}" "-Dcli.assembly.format=${{ matrix.cli_assembly_format }}"
46-
if: ${{ matrix.os == 'ubuntu-20.04' && github.actor != 'dependabot[bot]' }}
46+
if: ${{ matrix.os == 'ubuntu-latest' && github.actor != 'dependabot[bot]' }}
4747
env:
4848
GITHUB_USER: ${{ github.actor }}
4949
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5050
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5151
- run: mvn -B -s etc/m2/settings.xml verify -Pnative-image "-Dcli.assembly.id=${{ matrix.cli_assembly_id }}" "-Dcli.assembly.format=${{ matrix.cli_assembly_format }}"
52-
if: ${{ matrix.os != 'ubuntu-20.04' || github.actor == 'dependabot[bot]' }}
52+
if: ${{ matrix.os != 'ubuntu-latest' || github.actor == 'dependabot[bot]' }}
5353
env:
5454
GITHUB_USER: ${{ github.actor }}
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/homebrew-releaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
formula-path: Casks/project-env-cli.rb
1515
homebrew-tap: Project-Env/homebrew-tap
1616
base-branch: main
17-
download-url: https://github.com/Project-Env/project-env-cli/releases/download/v${{ steps.revision.outputs.revision }}/cli-${{ steps.revision.outputs.revision }}-macos-amd64.tar.gz
17+
download-url: https://github.com/Project-Env/project-env-cli/releases/download/v${{ steps.revision.outputs.revision }}/cli-${{ steps.revision.outputs.revision }}-macos-aarch64.tar.gz
1818
commit-message: bump {{formulaName}} to {{version}}
1919
env:
2020
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_RELEASER_TOKEN }}

.github/workflows/release.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
create-release:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99
permissions:
1010
contents: write
1111
pull-requests: write
@@ -29,42 +29,42 @@ jobs:
2929
needs: create-release
3030
strategy:
3131
matrix:
32-
os: [ macos-latest, windows-latest, ubuntu-20.04 ]
32+
os: [ macos-latest, windows-latest, ubuntu-latest ]
3333
include:
34-
- os: ubuntu-20.04
34+
- os: ubuntu-latest
3535
cli_assembly_id: linux-amd64
3636
cli_assembly_format: tar.gz
3737
- os: windows-latest
3838
cli_assembly_id: windows-amd64
3939
cli_assembly_format: zip
4040
gu_executable_ext: .cmd
4141
- os: macos-latest
42-
cli_assembly_id: macos-amd64
42+
cli_assembly_id: macos-aarch64
4343
cli_assembly_format: tar.gz
4444
steps:
4545
- uses: ilammy/msvc-dev-cmd@v1
4646
if: ${{ matrix.os == 'windows-latest'}}
4747
- run: ldd --version
48-
if: ${{ matrix.os == 'ubuntu-20.04'}}
48+
if: ${{ matrix.os == 'ubuntu-latest'}}
4949
- uses: actions/checkout@v4
5050
- uses: actions/cache@v4
5151
with:
5252
path: ~/.m2
5353
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
5454
restore-keys: ${{ runner.os }}-m2
55-
- uses: Project-Env/project-env-github-action@v1.3.1
56-
- uses: repolevedavaj/[email protected].1
55+
- uses: Project-Env/project-env-github-action@v1.4.0
56+
- uses: repolevedavaj/[email protected].2
5757
with:
5858
nsis-version: 3.08
5959
if: ${{ matrix.os == 'windows-latest'}}
6060
- run: mvn -B -s etc/m2/settings.xml deploy -Pnative-image "-Drevision=${{ needs.create-release.outputs.revision }}" "-Dcli.assembly.id=${{ matrix.cli_assembly_id }}" "-Dcli.assembly.format=${{ matrix.cli_assembly_format }}"
61-
if: ${{ matrix.os == 'ubuntu-20.04' }}
61+
if: ${{ matrix.os == 'ubuntu-latest' }}
6262
env:
6363
GITHUB_USER: ${{ github.actor }}
6464
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6666
- run: mvn -B -s etc/m2/settings.xml verify -Pnative-image "-Drevision=${{ needs.create-release.outputs.revision }}" "-Dcli.assembly.id=${{ matrix.cli_assembly_id }}" "-Dcli.assembly.format=${{ matrix.cli_assembly_format }}"
67-
if: ${{ matrix.os != 'ubuntu-20.04' }}
67+
if: ${{ matrix.os != 'ubuntu-latest' }}
6868
env:
6969
GITHUB_USER: ${{ github.actor }}
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

code/cli/pom.xml

+17-7
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@
5555
</dependency>
5656

5757
<dependency>
58-
<groupId>io.projectenv.commons</groupId>
58+
<groupId>io.projectenv.core.commons</groupId>
5959
<artifactId>native-image</artifactId>
60+
<version>${project.version}</version>
6061
</dependency>
6162
<dependency>
62-
<groupId>io.projectenv.commons</groupId>
63+
<groupId>io.projectenv.core.commons</groupId>
6364
<artifactId>gson</artifactId>
65+
<version>${project.version}</version>
6466
</dependency>
6567

6668
<dependency>
67-
<groupId>com.moandjiezana.toml</groupId>
69+
<groupId>io.hotmoka</groupId>
6870
<artifactId>toml4j</artifactId>
6971
</dependency>
7072

@@ -95,8 +97,9 @@
9597
</dependency>
9698

9799
<dependency>
98-
<groupId>io.projectenv.commons</groupId>
100+
<groupId>io.projectenv.core.commons</groupId>
99101
<artifactId>system-test</artifactId>
102+
<version>${project.version}</version>
100103
<scope>test</scope>
101104
</dependency>
102105
<dependency>
@@ -111,14 +114,19 @@
111114
</dependency>
112115
<dependency>
113116
<groupId>org.mockito</groupId>
114-
<artifactId>mockito-inline</artifactId>
117+
<artifactId>mockito-core</artifactId>
115118
<scope>test</scope>
116119
</dependency>
117120
<dependency>
118121
<groupId>com.tngtech.archunit</groupId>
119122
<artifactId>archunit-junit5</artifactId>
120123
<scope>test</scope>
121124
</dependency>
125+
<dependency>
126+
<groupId>org.slf4j</groupId>
127+
<artifactId>slf4j-simple</artifactId>
128+
<scope>test</scope>
129+
</dependency>
122130
</dependencies>
123131

124132
<profiles>
@@ -138,8 +146,10 @@
138146
</execution>
139147
</executions>
140148
<configuration>
141-
<buildArgs>--enable-url-protocols=https --no-fallback
142-
--features=io.projectenv.core.cli.nativeimage.ProjectEnvFeature
149+
<buildArgs>
150+
<buildArg>--enable-url-protocols=https</buildArg>
151+
<buildArg>--no-fallback</buildArg>
152+
<buildArg>--features=io.projectenv.core.cli.nativeimage.ProjectEnvFeature</buildArg>
143153
</buildArgs>
144154
<mainClass>io.projectenv.core.cli.ProjectEnvCli</mainClass>
145155
<imageName>${cli.binary}</imageName>

code/commons/archive/pom.xml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>io.projectenv.core.commons</groupId>
10+
<artifactId>commons-root</artifactId>
11+
<version>${revision}</version>
12+
</parent>
13+
14+
<artifactId>archive</artifactId>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.projectenv.core.commons</groupId>
19+
<artifactId>system</artifactId>
20+
<version>${project.version}</version>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>commons-io</groupId>
25+
<artifactId>commons-io</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.apache.commons</groupId>
29+
<artifactId>commons-compress</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.tukaani</groupId>
33+
<artifactId>xz</artifactId>
34+
</dependency>
35+
</dependencies>
36+
37+
<build>
38+
<plugins>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-deploy-plugin</artifactId>
42+
<configuration>
43+
<skip>false</skip>
44+
</configuration>
45+
</plugin>
46+
</plugins>
47+
</build>
48+
49+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.projectenv.core.commons.archive;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
6+
public interface ArchiveExtractor {
7+
8+
void extractArchive(File archive, File targetDirectory) throws IOException;
9+
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.projectenv.core.commons.archive;
2+
3+
import io.projectenv.core.commons.archive.impl.DefaultArchiveExtractor;
4+
5+
public final class ArchiveExtractorFactory {
6+
7+
private ArchiveExtractorFactory() {
8+
// noop
9+
}
10+
11+
public static ArchiveExtractor createArchiveExtractor() {
12+
return new DefaultArchiveExtractor();
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
package io.projectenv.core.commons.archive.impl;
2+
3+
import io.projectenv.core.commons.archive.ArchiveExtractor;
4+
import io.projectenv.core.commons.archive.impl.accessor.ArchiveAccessor;
5+
import io.projectenv.core.commons.archive.impl.accessor.ArchiveAccessorFactory;
6+
import io.projectenv.core.commons.archive.impl.accessor.ArchiveEntry;
7+
import io.projectenv.core.commons.system.OperatingSystem;
8+
import org.apache.commons.io.FileUtils;
9+
import org.apache.commons.io.IOUtils;
10+
11+
import java.io.*;
12+
import java.nio.file.Files;
13+
import java.nio.file.attribute.PosixFilePermission;
14+
import java.nio.file.attribute.PosixFilePermissions;
15+
import java.util.Collections;
16+
import java.util.List;
17+
import java.util.Set;
18+
import java.util.regex.Pattern;
19+
20+
public class DefaultArchiveExtractor implements ArchiveExtractor {
21+
22+
private static final List<Pattern> IGNORED_ARCHIVE_ENTRIES = Collections.singletonList(
23+
// dot underscore files which are created on macOS systems and hold metadata
24+
Pattern.compile(".*/\\._.+")
25+
);
26+
27+
public void extractArchive(File archive, File targetDirectory) throws IOException {
28+
try (ArchiveAccessor archiveAccessor = ArchiveAccessorFactory.createArchiveAccessor(archive)) {
29+
30+
ArchiveEntry entry;
31+
32+
while ((entry = archiveAccessor.getNextEntry()) != null) {
33+
if (!shouldExtractEntry(entry)) {
34+
continue;
35+
}
36+
37+
File target = new File(targetDirectory, entry.getName());
38+
checkThatPathIsInsideBasePath(target, targetDirectory);
39+
40+
if (entry.isDirectory()) {
41+
createDirectory(target);
42+
} else if (entry.isSymbolicLink()) {
43+
createSymbolicLink(entry, target, targetDirectory);
44+
} else {
45+
createFile(entry, target);
46+
}
47+
48+
setPermissions(entry, target);
49+
}
50+
}
51+
}
52+
53+
private boolean shouldExtractEntry(ArchiveEntry archiveEntry) {
54+
return IGNORED_ARCHIVE_ENTRIES.stream().noneMatch(pattern -> pattern.matcher(archiveEntry.getName()).matches());
55+
}
56+
57+
private void checkThatPathIsInsideBasePath(File file, File baseDirectory) throws IOException {
58+
if (!file.getCanonicalPath().startsWith(baseDirectory.getCanonicalPath())) {
59+
throw new IllegalStateException("path " + file.getPath() + " is pointing to a location outside " + baseDirectory.getCanonicalPath());
60+
}
61+
}
62+
63+
protected void createDirectory(File target) throws IOException {
64+
FileUtils.forceMkdir(target.getCanonicalFile());
65+
}
66+
67+
protected void createSymbolicLink(ArchiveEntry archiveEntry, File target, File targetDirectory) throws IOException {
68+
File linkDestination = new File(archiveEntry.getLinkName());
69+
checkThatPathIsInsideBasePath(new File(target.isDirectory() ? target : target.getParentFile(), archiveEntry.getLinkName()), targetDirectory);
70+
71+
FileUtils.forceMkdirParent(target.getCanonicalFile());
72+
73+
Files.createSymbolicLink(target.toPath(), linkDestination.toPath());
74+
}
75+
76+
private void createFile(ArchiveEntry archiveEntry, File target) throws IOException {
77+
FileUtils.forceMkdirParent(target.getCanonicalFile());
78+
79+
try (InputStream inputStream = archiveEntry.createInputStream();
80+
OutputStream outputStream = new FileOutputStream(target)) {
81+
82+
IOUtils.copy(inputStream, outputStream);
83+
}
84+
}
85+
86+
private void setPermissions(ArchiveEntry archiveEntry, File target) throws IOException {
87+
// we do not set any permissions on Windows
88+
if (OperatingSystem.getCurrentOperatingSystem() == OperatingSystem.WINDOWS) {
89+
return;
90+
}
91+
92+
if (archiveEntry.isSymbolicLink()) {
93+
return;
94+
}
95+
96+
Integer mode = archiveEntry.getMode();
97+
if (mode != null) {
98+
Files.setPosixFilePermissions(target.toPath(), posixFilePermissionsFromMode(mode));
99+
}
100+
}
101+
102+
private Set<PosixFilePermission> posixFilePermissionsFromMode(int decimalMode) {
103+
// to determine the Posix permission flags, we only need the last 12 bits
104+
int relevantPermissionBits = decimalMode & 0b111111111;
105+
106+
char[] permissionFlags = Integer.toOctalString(relevantPermissionBits).toCharArray();
107+
108+
StringBuilder posixPermissions = new StringBuilder();
109+
for (char permissionFlag : permissionFlags) {
110+
if ((permissionFlag & 0b100) != 0) {
111+
posixPermissions.append('r');
112+
} else {
113+
posixPermissions.append('-');
114+
}
115+
116+
if ((permissionFlag & 0b010) != 0) {
117+
posixPermissions.append('w');
118+
} else {
119+
posixPermissions.append('-');
120+
}
121+
122+
if ((permissionFlag & 0b001) != 0) {
123+
posixPermissions.append('x');
124+
} else {
125+
posixPermissions.append('-');
126+
}
127+
}
128+
129+
return PosixFilePermissions.fromString(posixPermissions.toString());
130+
}
131+
132+
}

0 commit comments

Comments
 (0)