Skip to content

Commit 5cd623b

Browse files
authored
Merge pull request #1 from umjammer/0.0.2
0.0.2
2 parents 25d426e + 434acbc commit 5cd623b

File tree

6 files changed

+92
-33
lines changed

6 files changed

+92
-33
lines changed

.github/workflows/codeql.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@v3
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
5656
# uses: github/codeql-action/autobuild@v2
5757

5858
- name: Set up JDK 17
59-
uses: actions/setup-java@v3
59+
uses: actions/setup-java@v4
6060
with:
6161
java-version: '17'
6262
distribution: 'temurin'
@@ -73,4 +73,4 @@ jobs:
7373
run: mvn -B package --file pom.xml -DskipTests
7474

7575
- name: Perform CodeQL Analysis
76-
uses: github/codeql-action/analyze@v2
76+
uses: github/codeql-action/analyze@v3

.github/workflows/maven.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313

1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Check w/o SNAPSHOT when "bump version"
1919
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
2020
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT
2121

2222
- name: Set up JDK 17
23-
uses: actions/setup-java@v3
23+
uses: actions/setup-java@v4
2424
with:
2525
java-version: '17'
2626
distribution: 'temurin'

README.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,38 @@
55

66
# vavi-nio-file-adb
77

8-
📱 mount the android world!
8+
<img src="https://github.com/umjammer/vavi-nio-file-adb/assets/493908/869f4bc6-95e1-42a9-907e-6ee01445b52c" width="200" alt="android_debug_bridge" /><sub><a href="https://androidcommunity.com/how-to-getting-adb-on-your-pc-without-installing-full-android-sdk-20180307/">© Android Community</a></sub>
9+
10+
mount the android world!
911

1012
## Status
1113

12-
| fs | list | upload | download | copy | move | rm | mkdir | cache | watch | library |
13-
|------------|------|--------|----------|------|------|----|-------|-------|-------|-------------------------------------------|
14-
| adb |||| | | | || | [jadb](https://github.com/umjammer/jadb/) |
15-
| adb (fuse) |||| | | | || | [jadb](https://github.com/umjammer/jadb/) |
14+
| fs | list | upload | download | copy | move | rm | mkdir | cache | watch | library |
15+
|------------|------|--------|----------|------|------|----|-------|-------|-------|------------------------------------------------------------------|
16+
| adb |||| | | | || | [jadb](https://github.com/umjammer/jadb/) |
17+
| adb (fuse) |||| | | | || | [vavi-net-fuse](https://github.com/umjammer/vavi-apps-fuse/tree/master/vavi-net-fuse) |
1618

1719
## Install
1820

1921
* [maven](https://jitpack.io/#umjammer/vavi-nio-file-adb)
2022

23+
## Usage
24+
25+
```shell
26+
$ (
27+
> export JAVA_HOME=`/usr/libexec/java_home -v 17`; \
28+
> ${ANDROID_SDK}/platform-tools/adb start-server; \
29+
> cd ${PROJECT_DIR}; \
30+
> mvn -o -P run test-compile antrun:run -Dmaven.test.skip=true -DmountPoint=${MOUNT_POINT}
31+
> )
32+
```
2133

2234
## TODO
2335

2436
* integration test
2537
* make other functions using shell commands?
2638
* ~~SyncTransport#readChunk is too slow, threading?~~ because of [#4782263](https://github.com/umjammer/jadb/commit/4782263f0cbd78bff12546ffee86e7f63dddf5a9)
39+
* symbolic link
2740

2841
## References
2942

@@ -38,5 +51,7 @@
3851
* [Android File Transfer](https://www.android.com/filetransfer/)
3952
* mtp
4053
* https://github.com/pranav-prakash/jmtpfs
41-
* sdcard image is qcow2
42-
* ~~[libvirt](https://libvirt.org/) ... too much? needs server?~~[vavi-nio-file-qcow](https://github.com/umjammer/vavi-nio-file-qcow)
54+
* sdcard image ~~is qcow2~~
55+
* ~~[libvirt](https://libvirt.org/) ... too much? needs server?~~[vavi-nio-file-qcow](https://github.com/umjammer/vavi-nio-file-qcow)
56+
* fat32?
57+
* other storages are yaffs

pom.xml

+50-16
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,27 @@
55

66
<groupId>vavi</groupId>
77
<artifactId>vavi-nio-file-adb</artifactId>
8-
<version>0.0.1</version>
8+
<version>0.0.2</version>
99

1010
<properties>
11-
<vavi-apps-fuse.version>0.1.8</vavi-apps-fuse.version>
11+
<vavi-nio-file-fuse.groupId>com.github.umjammer</vavi-nio-file-fuse.groupId> <!-- vavi / com.github.umjammer -->
12+
<vavi-nio-file-fuse.version>0.0.16</vavi-nio-file-fuse.version>
1213
</properties>
1314

1415
<build>
1516
<plugins>
1617
<plugin>
1718
<groupId>org.apache.maven.plugins</groupId>
1819
<artifactId>maven-compiler-plugin</artifactId>
19-
<version>3.10.1</version>
20+
<version>3.11.0</version>
2021
<configuration>
2122
<release>17</release>
2223
</configuration>
2324
</plugin>
2425
<plugin>
2526
<groupId>org.apache.maven.plugins</groupId>
2627
<artifactId>maven-surefire-plugin</artifactId>
27-
<version>3.0.0-M7</version>
28+
<version>3.2.2</version>
2829
<configuration>
2930
<argLine>
3031
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
@@ -47,7 +48,7 @@
4748
<dependency>
4849
<groupId>org.junit</groupId>
4950
<artifactId>junit-bom</artifactId>
50-
<version>5.9.3</version>
51+
<version>5.10.1</version>
5152
<type>pom</type>
5253
<scope>import</scope>
5354
</dependency>
@@ -58,19 +59,19 @@
5859
<dependency>
5960
<groupId>com.github.umjammer</groupId>
6061
<artifactId>vavi-commons</artifactId>
61-
<version>1.1.9</version>
62+
<version>1.1.10</version>
6263
</dependency>
6364

6465
<dependency>
65-
<groupId>com.github.umjammer</groupId> <!-- se.vidstige -->
66+
<groupId>com.github.umjammer</groupId> <!-- se.vidstige / com.github.umjammer -->
6667
<artifactId>jadb</artifactId>
67-
<version>1.2.3v</version>
68+
<version>1.2.4v</version>
6869
</dependency>
6970

7071
<dependency>
7172
<groupId>com.github.umjammer</groupId>
72-
<artifactId>java7-fs-base</artifactId>
73-
<version>0.0.13v</version>
73+
<artifactId>vavi-nio-file-base</artifactId>
74+
<version>0.0.14v</version>
7475
</dependency>
7576

7677
<dependency>
@@ -95,17 +96,50 @@
9596
</dependency>
9697

9798
<dependency>
98-
<groupId>com.github.umjammer.vavi-apps-fuse</groupId>
99-
<artifactId>vavi-net-fuse</artifactId>
100-
<version>${vavi-apps-fuse.version}</version>
99+
<groupId>${vavi-nio-file-fuse.groupId}</groupId>
100+
<artifactId>vavi-nio-file-fuse</artifactId>
101+
<version>${vavi-nio-file-fuse.version}</version>
101102
<scope>test</scope>
102103
</dependency>
103104
<dependency>
104-
<groupId>com.github.umjammer.vavi-apps-fuse</groupId>
105-
<artifactId>vavi-net-fuse</artifactId>
106-
<version>${vavi-apps-fuse.version}</version>
105+
<groupId>${vavi-nio-file-fuse.groupId}</groupId>
106+
<artifactId>vavi-nio-file-fuse</artifactId>
107+
<version>${vavi-nio-file-fuse.version}</version>
107108
<type>test-jar</type>
108109
<scope>test</scope>
109110
</dependency>
110111
</dependencies>
112+
113+
<profiles>
114+
<profile>
115+
<!-- mvn -P run antrun:run -DmountPoint='DmountPoint' -->
116+
<id>run</id>
117+
<build>
118+
<plugins>
119+
<plugin>
120+
<!-- GOOD: fork: OK, test jars: OK, user args, default args: OK -->
121+
<groupId>org.apache.maven.plugins</groupId>
122+
<artifactId>maven-antrun-plugin</artifactId>
123+
<version>3.1.0</version>
124+
<goals>
125+
<goal>run</goal>
126+
</goals>
127+
<configuration>
128+
<target>
129+
<java classname="vavi.nio.file.adb.Main4" fork="true">
130+
<classpath>
131+
<path refid="maven.compile.classpath"/>
132+
<path refid="maven.test.classpath"/>
133+
</classpath>
134+
<jvmarg value="-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties" />
135+
<jvmarg value="-Djna.library.path=/usr/local/lib" />
136+
<arg value="${mountPoint}" />
137+
</java>
138+
</target>
139+
</configuration>
140+
</plugin>
141+
</plugins>
142+
</build>
143+
</profile>
144+
</profiles>
111145
</project>

src/main/java/vavi/nio/file/adb/AdbBasicFileAttributesProvider.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import java.nio.file.attribute.PosixFileAttributes;
1414
import java.nio.file.attribute.PosixFilePermission;
1515
import java.nio.file.attribute.UserPrincipal;
16-
import java.util.Collections;
1716
import java.util.HashSet;
1817
import java.util.Set;
1918
import java.util.concurrent.TimeUnit;
@@ -57,7 +56,7 @@ public FileTime lastModifiedTime() {
5756
*/
5857
@Override
5958
public boolean isRegularFile() {
60-
return !entry.isDirectory();
59+
return entry.isRegularFile();
6160
}
6261

6362
/**
@@ -68,6 +67,11 @@ public boolean isDirectory() {
6867
return entry.isDirectory();
6968
}
7069

70+
@Override
71+
public boolean isSymbolicLink() {
72+
return entry.isSymbolicLink();
73+
}
74+
7175
/**
7276
* Returns the size of the file (in bytes). The size may differ from the
7377
* actual size on the file system due to compression, support for sparse

src/test/java/vavi/nio/file/adb/Test1.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@ void test2() throws Exception {
4343
}
4444
System.err.println("\n# ls -l /");
4545
for (RemoteFile f : device.list("/")) {
46-
System.err.printf("%s %8d %s %s%n", PosixFilePermissions.toString(f.permissions()), f.getSize(), LocalDateTime.ofInstant(Instant.ofEpochSecond(f.getLastModified()), ZoneId.systemDefault()), f.getName());
46+
System.err.printf("%c%s %06o %8d %s %s%n", lsChar(f), PosixFilePermissions.toString(f.permissions()), f.getMode(), f.getSize(), LocalDateTime.ofInstant(Instant.ofEpochSecond(f.getLastModified()), ZoneId.systemDefault()), f.getName());
4747
}
4848
System.err.println("\n# ls -l /sdcard");
4949
for (RemoteFile f : device.list("/sdcard")) {
50-
System.err.printf("%s %8d %s %s%n", PosixFilePermissions.toString(f.permissions()), f.getSize(), LocalDateTime.ofInstant(Instant.ofEpochSecond(f.getLastModified()), ZoneId.systemDefault()), f.getName());
50+
System.err.printf("%c%s %06o %8d %s %s%n", lsChar(f), PosixFilePermissions.toString(f.permissions()), f.getMode(), f.getSize(), LocalDateTime.ofInstant(Instant.ofEpochSecond(f.getLastModified()), ZoneId.systemDefault()), f.getName());
5151
}
5252
}
53+
54+
static char lsChar(RemoteFile f) {
55+
if (f.isDirectory()) return 'd';
56+
if (f.isSymbolicLink()) return 'l';
57+
return '-';
58+
}
5359
}
5460

5561
/* */

0 commit comments

Comments
 (0)