mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-07 00:28:58 +00:00
commit
fba7a80627
4 changed files with 41 additions and 6 deletions
|
@ -34,7 +34,7 @@ WIN32_TARGET := $(WIN32_TARGET_DIR)-$(VERSION).zip
|
||||||
WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip
|
WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip
|
||||||
|
|
||||||
release: clean zip-win32 zip-win64 sums
|
release: clean zip-win32 zip-win64 sums
|
||||||
@echo "Release created in $(DIST)/."
|
@echo "Windows archives generated in $(DIST)/"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(GRADLE) clean
|
$(GRADLE) clean
|
||||||
|
|
|
@ -23,7 +23,7 @@ int control_event_serialize(const struct control_event *event, unsigned char *bu
|
||||||
buffer_write32be(&buf[6], event->keycode_event.metastate);
|
buffer_write32be(&buf[6], event->keycode_event.metastate);
|
||||||
return 10;
|
return 10;
|
||||||
case CONTROL_EVENT_TYPE_TEXT: {
|
case CONTROL_EVENT_TYPE_TEXT: {
|
||||||
// write length (1 byte) + date (non nul-terminated)
|
// write length (2 bytes) + string (non nul-terminated)
|
||||||
size_t len = strlen(event->text_event.text);
|
size_t len = strlen(event->text_event.text);
|
||||||
if (len > TEXT_MAX_LENGTH) {
|
if (len > TEXT_MAX_LENGTH) {
|
||||||
// injecting a text takes time, so limit the text length
|
// injecting a text takes time, so limit the text length
|
||||||
|
|
|
@ -87,13 +87,13 @@ static void test_serialize_mouse_event(void) {
|
||||||
|
|
||||||
unsigned char buf[SERIALIZED_EVENT_MAX_SIZE];
|
unsigned char buf[SERIALIZED_EVENT_MAX_SIZE];
|
||||||
int size = control_event_serialize(&event, buf);
|
int size = control_event_serialize(&event, buf);
|
||||||
assert(size == 14);
|
assert(size == 18);
|
||||||
|
|
||||||
const unsigned char expected[] = {
|
const unsigned char expected[] = {
|
||||||
0x02, // CONTROL_EVENT_TYPE_MOUSE
|
0x02, // CONTROL_EVENT_TYPE_MOUSE
|
||||||
0x00, // AKEY_EVENT_ACTION_DOWN
|
0x00, // AKEY_EVENT_ACTION_DOWN
|
||||||
0x00, 0x00, 0x00, 0x01, // AMOTION_EVENT_BUTTON_PRIMARY
|
0x00, 0x00, 0x00, 0x01, // AMOTION_EVENT_BUTTON_PRIMARY
|
||||||
0x01, 0x04, 0x04, 0x02, // 260 1026
|
0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, // 260 1026
|
||||||
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
||||||
};
|
};
|
||||||
assert(!memcmp(buf, expected, sizeof(expected)));
|
assert(!memcmp(buf, expected, sizeof(expected)));
|
||||||
|
@ -120,11 +120,11 @@ static void test_serialize_scroll_event(void) {
|
||||||
|
|
||||||
unsigned char buf[SERIALIZED_EVENT_MAX_SIZE];
|
unsigned char buf[SERIALIZED_EVENT_MAX_SIZE];
|
||||||
int size = control_event_serialize(&event, buf);
|
int size = control_event_serialize(&event, buf);
|
||||||
assert(size == 17);
|
assert(size == 21);
|
||||||
|
|
||||||
const unsigned char expected[] = {
|
const unsigned char expected[] = {
|
||||||
0x03, // CONTROL_EVENT_TYPE_SCROLL
|
0x03, // CONTROL_EVENT_TYPE_SCROLL
|
||||||
0x01, 0x04, 0x04, 0x02, // 260 1026
|
0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, // 260 1026
|
||||||
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
||||||
0x00, 0x00, 0x00, 0x01, // 1
|
0x00, 0x00, 0x00, 0x01, // 1
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // -1
|
0xFF, 0xFF, 0xFF, 0xFF, // -1
|
||||||
|
|
35
release.sh
Executable file
35
release.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# build and test locally
|
||||||
|
BUILDDIR=build_release
|
||||||
|
rm -rf "$BUILDDIR"
|
||||||
|
meson "$BUILDDIR" --buildtype release --strip -Db_lto=true
|
||||||
|
cd "$BUILDDIR"
|
||||||
|
ninja
|
||||||
|
ninja test
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# build Windows releases
|
||||||
|
make -f Makefile.CrossWindows
|
||||||
|
|
||||||
|
# the generated server must be the same everywhere
|
||||||
|
cmp "$BUILDDIR/server/scrcpy-server.jar" dist/scrcpy-win32/scrcpy-server.jar
|
||||||
|
cmp "$BUILDDIR/server/scrcpy-server.jar" dist/scrcpy-win64/scrcpy-server.jar
|
||||||
|
|
||||||
|
# get version name
|
||||||
|
TAG=$(git describe --tags --always)
|
||||||
|
|
||||||
|
# create release directory
|
||||||
|
mkdir -p "release-$TAG"
|
||||||
|
cp "$BUILDDIR/server/scrcpy-server.jar" "release-$TAG/scrcpy-server-$TAG.jar"
|
||||||
|
cp "dist/scrcpy-win32-$TAG.zip" "release-$TAG/"
|
||||||
|
cp "dist/scrcpy-win64-$TAG.zip" "release-$TAG/"
|
||||||
|
|
||||||
|
# generate checksums
|
||||||
|
cd "release-$TAG"
|
||||||
|
sha256sum "scrcpy-server-$TAG.jar" \
|
||||||
|
"scrcpy-win32-$TAG.zip" \
|
||||||
|
"scrcpy-win64-$TAG.zip" > SHA256SUMS.txt
|
||||||
|
|
||||||
|
echo "Release generated in release-$TAG/"
|
Loading…
Add table
Add a link
Reference in a new issue