Skip to content

Commit

Permalink
moved to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
eyr1n committed Apr 27, 2024
1 parent 7ee1749 commit 16bf897
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 52 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml → AndroidManifest.xml.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jp.eyrin.fastdds_prefab">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="@MAVEN_GROUP_ID@.@PROJECT_NAME_UNDERSCORE@">
</manifest>
57 changes: 41 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
cmake_minimum_required(VERSION 3.22.1)
project(fastdds-prefab VERSION 2.13.4)
project(fastdds-prefab VERSION 2.13.4.2)

# Config
set(MIN_SDK_VERSION 24)
set(MAVEN_GROUP_ID io.github.eyr1n)
string(REPLACE "." "/" MAVEN_GROUP_ID_SLASH ${MAVEN_GROUP_ID})
string(REPLACE "-" "_" PROJECT_NAME_UNDERSCORE ${PROJECT_NAME})

set(android_aar_name fastdds-prefab-${CMAKE_PROJECT_VERSION})
set(prefab_modules_dir ${CMAKE_CURRENT_BINARY_DIR}/${android_aar_name}/prefab/modules)
set(PREFAB_MODULES_DIR ${CMAKE_CURRENT_BINARY_DIR}/prefab/modules)
set(MAVEN_BUNDLE_DIR ${CMAKE_CURRENT_BINARY_DIR}/maven/${MAVEN_GROUP_ID_SLASH}/${PROJECT_NAME}/${PROJECT_VERSION})

include(ExternalProject)

Expand Down Expand Up @@ -44,13 +47,13 @@ function(build_with_abi android_abi)
)
install(
DIRECTORY ${ext_install_dir}/Fast-CDR/include
DESTINATION ${prefab_modules_dir}/fastcdr/libs/android.${android_abi}
DESTINATION ${PREFAB_MODULES_DIR}/fastcdr/libs/android.${android_abi}
)
install(
FILES
${ext_install_dir}/Fast-CDR/lib/libfastcdr.so
${CMAKE_CURRENT_BINARY_DIR}/${android_abi}/abi.json
DESTINATION ${prefab_modules_dir}/fastcdr/libs/android.${android_abi}
DESTINATION ${PREFAB_MODULES_DIR}/fastcdr/libs/android.${android_abi}
)

# Fast-DDS
Expand All @@ -73,19 +76,19 @@ function(build_with_abi android_abi)
)
install(
DIRECTORY ${ext_install_dir}/Fast-DDS/include
DESTINATION ${prefab_modules_dir}/fastrtps/libs/android.${android_abi}
DESTINATION ${PREFAB_MODULES_DIR}/fastrtps/libs/android.${android_abi}
)
install(
FILES
${ext_install_dir}/Fast-DDS/lib/libfastrtps.so
${CMAKE_CURRENT_BINARY_DIR}/${android_abi}/abi.json
DESTINATION ${prefab_modules_dir}/fastrtps/libs/android.${android_abi}
DESTINATION ${PREFAB_MODULES_DIR}/fastrtps/libs/android.${android_abi}
)
endfunction()

configure_file(fastdds-prefab.pom.in ${android_aar_name}.pom @ONLY)
configure_file(prefab.json.in ${android_aar_name}/prefab/prefab.json @ONLY)
install(FILES AndroidManifest.xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${android_aar_name})
configure_file(${PROJECT_NAME}.pom.in ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.pom @ONLY)
configure_file(AndroidManifest.xml.in AndroidManifest.xml @ONLY)
configure_file(prefab.json.in prefab/prefab.json @ONLY)

build_with_abi(arm64-v8a)
build_with_abi(x86_64)
Expand All @@ -94,17 +97,39 @@ build_with_abi(x86_64)
install(CODE
"execute_process(
COMMAND
${CMAKE_COMMAND} -E tar cvf ${CMAKE_CURRENT_BINARY_DIR}/${android_aar_name}.aar --format=zip
prefab AndroidManifest.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${android_aar_name}
${CMAKE_COMMAND} -E tar cvf ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.aar --format=zip
AndroidManifest.xml prefab
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)"
)

# Create Maven package
# Sign
install(CODE
"execute_process(
COMMAND gpg --batch --yes -ab ${PROJECT_NAME}-${PROJECT_VERSION}.pom
COMMAND gpg --batch --yes -ab ${PROJECT_NAME}-${PROJECT_VERSION}.aar
WORKING_DIRECTORY ${MAVEN_BUNDLE_DIR}
)"
)

# Checksum
install(CODE
"file(MD5 ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.pom POM_MD5)
file(WRITE ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.pom.md5 \${POM_MD5})
file(SHA1 ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.pom POM_SHA1)
file(WRITE ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.pom.sha1 \${POM_SHA1})
file(MD5 ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.aar AAR_MD5)
file(WRITE ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.aar.md5 \${AAR_MD5})
file(SHA1 ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.aar AAR_SHA1)
file(WRITE ${MAVEN_BUNDLE_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.aar.sha1 \${AAR_SHA1})"
)

# Create Maven bundle
install(CODE
"execute_process(
COMMAND
${CMAKE_COMMAND} -E tar cvf ${CMAKE_CURRENT_BINARY_DIR}/${android_aar_name}.zip --format=zip
${android_aar_name}.aar ${android_aar_name}.pom
${CMAKE_COMMAND} -E tar cvf ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${PROJECT_VERSION}.zip --format=zip .
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maven
)"
)
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
```sh
mkdir -p build
pushd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=~/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake
cmake --build . --target install
popd

mkdir -p maven/jp/eyrin/fastdds-prefab/2.13.4
cp build/fastdds-prefab-2.13.4.aar maven/jp/eyrin/fastdds-prefab/2.13.4/
cp build/fastdds-prefab-2.13.4.pom maven/jp/eyrin/fastdds-prefab/2.13.4/
cmake -DCMAKE_TOOLCHAIN_FILE=<path-to-android-ndk>/build/cmake/android.toolchain.cmake -B build -S .
cmake --build build --target install
```
34 changes: 31 additions & 3 deletions fastdds-prefab.pom.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,36 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.eyrin</groupId>
<artifactId>fastdds-prefab</artifactId>
<version>@CMAKE_PROJECT_VERSION@</version>
<groupId>@MAVEN_GROUP_ID@</groupId>
<artifactId>@PROJECT_NAME@</artifactId>
<version>@PROJECT_VERSION@</version>
<packaging>aar</packaging>

<name>@PROJECT_NAME@</name>
<description>Prebuilt Fast DDS binary for Android Prefab.</description>
<url>https://github.com/eyr1n/fastdds-prefab</url>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<developers>
<developer>
<id>eProsima</id>
<name>Proyectos y Sistemas de Mantenimiento SL</name>
<email>[email protected]</email>
</developer>
<developer>
<id>eyr1n</id>
<name>Rin Iwai</name>
<email>[email protected]</email>
</developer>
</developers>

<scm>
<url>https://github.com/eyr1n/fastdds-prefab.git</url>
</scm>
</project>
3 changes: 0 additions & 3 deletions jitpack.yml

This file was deleted.

Binary file not shown.
9 changes: 0 additions & 9 deletions maven/jp/eyrin/fastdds-prefab/1.0.0/fastdds-prefab-1.0.0.pom

This file was deleted.

Binary file not shown.

This file was deleted.

4 changes: 2 additions & 2 deletions prefab.json.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schema_version": 2,
"name": "fastdds-prefab",
"version": "@CMAKE_PROJECT_VERSION@",
"name": "@PROJECT_NAME@",
"version": "@PROJECT_VERSION@",
"dependencies": []
}

0 comments on commit 16bf897

Please sign in to comment.