Коммит e87898c2 создал по автору Красавин Никита Сергеевич's avatar Красавин Никита Сергеевич
Просмотр файлов

Merge branch 'create-plugin' into 'master'

[feature] Create pdfrx

See merge request oss/flutter/flutter-community-plugins/pdfrx!1
владельцы 5487c5ed 70fc8b79
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
/pubspec.lock
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Aurora generated
/aurora/flutter
# Authors
* Daniil Girenko, <a.fedchenko@omp.ru>
* Developer, 2024
* Maintainer, 2024
* Takashi Kawasaki, <@espresso3389>
* Developer, 2018
* Noname_1111788
* Developer, 2024
* Nikita Krasavin, <n.krasavin@omp.ru>
* Product owner, 2024
* Maintainer, 2024
* Reviewer, 2024
* Vitaly Zarubin, <v.zarubin@omp.ru>
* Reviewer, 2024
* Egor Popov, <e.popov@omp.ru>
* Reviewer, 2024
The MIT License (MIT)
===============
Copyright (c) 2024 Open Mobile Platform LLC <community@omp.ru>
Copyright (c) 2024 Noname_1111788
Copyright (c) 2018 @espresso3389 (Takashi Kawasaki)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Это отличие свёрнуто
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true
comment_references: true
prefer_relative_imports: true
use_key_in_widget_constructors: true
avoid_return_types_on_setters: true
avoid_types_on_closure_parameters: true
eol_at_end_of_file: true
sort_child_properties_last: true
sort_unnamed_constructors_first: true
sort_constructors_first: true
always_put_required_named_parameters_first: true
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
- lib/src/pdfium/pdfium_bindings.dart
cmake_minimum_required(VERSION 3.18.1)
# Project-level configuration.
set(PROJECT_NAME "pdfrx")
project(${PROJECT_NAME} LANGUAGES CXX)
# Invoke the build for native code shared with the other target platforms.
# This can be changed to accommodate different builds.
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(VERSION 3.14...3.25)
set(PDFIUM_RELEASE chromium%2F6555)
set(PDFIUM_DIR ${CMAKE_BINARY_DIR}/pdfium)
set(PDFIUM_RELEASE_DIR ${PDFIUM_DIR}/${PDFIUM_RELEASE})
file(MAKE_DIRECTORY ${PDFIUM_RELEASE_DIR})
set(PDFIUM_PLATFORM "android")
set(PDFIUM_LIB_FILENAME "libpdfium.so")
set(PDFIUM_LIB_DIR "lib")
set(PDFIUM_ABI2SUF_arm64-v8a "android-arm64")
set(PDFIUM_ABI2SUF_armeabi-v7a "android-arm")
set(PDFIUM_ABI2SUF_x86 "android-x86")
set(PDFIUM_ABI2SUF_x86_64 "android-x64")
set(PDFIUM_ARCHIVE_NAME pdfium-${PDFIUM_ABI2SUF_${ANDROID_ABI}})
set(PDFIUM_SRC_LIB_FILENAME ${PDFIUM_RELEASE_DIR}/${PDFIUM_LIB_DIR}/${PDFIUM_LIB_FILENAME})
set(PDFIUM_LIBS_DIR ${CMAKE_SOURCE_DIR}/.lib/${PDFIUM_RELEASE})
set(PDFIUM_LIBS_ARCH_DIR ${PDFIUM_LIBS_DIR}/${ANDROID_ABI})
set(PDFIUM_DEST_LIB_FILENAME ${PDFIUM_LIBS_ARCH_DIR}/${PDFIUM_LIB_FILENAME})
set(PDFIUM_LATEST_DIR ${CMAKE_SOURCE_DIR}/.lib/latest)
set(PDFIUM_LATEST_LIBS_ARCH_DIR ${PDFIUM_LATEST_DIR}/${ANDROID_ABI})
set(PDFIUM_LASTEST_LIB_FILENAME ${PDFIUM_LATEST_LIBS_ARCH_DIR}/${PDFIUM_LIB_FILENAME})
if(NOT EXISTS ${PDFIUM_SRC_LIB_FILENAME})
message(STATUS "Download precompiled PDFium...")
file(DOWNLOAD https://github.com/bblanchon/pdfium-binaries/releases/download/${PDFIUM_RELEASE}/${PDFIUM_ARCHIVE_NAME}.tgz ${PDFIUM_RELEASE_DIR}/${PDFIUM_ARCHIVE_NAME}.tgz)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar zxf ${PDFIUM_RELEASE_DIR}/${PDFIUM_ARCHIVE_NAME}.tgz
WORKING_DIRECTORY ${PDFIUM_RELEASE_DIR}
ERROR_QUIET
)
if(STATUS AND NOT STATUS EQUAL 0)
message(FATAL_ERROR "Could not obtain PDFium binary for ${ANDROID_ABI}")
endif()
else()
message(STATUS "Use existing precompiled PDFium." )
endif()
if (NOT EXISTS ${PDFIUM_DEST_LIB_FILENAME})
file(MAKE_DIRECTORY ${PDFIUM_LIBS_ARCH_DIR})
file(COPY ${PDFIUM_SRC_LIB_FILENAME} DESTINATION ${PDFIUM_LIBS_ARCH_DIR})
endif()
# also copy header files for dev use
if (NOT EXISTS ${PDFIUM_LIBS_DIR}/include)
file(COPY ${PDFIUM_RELEASE_DIR}/include DESTINATION ${PDFIUM_LIBS_DIR})
endif()
file(REMOVE ${PDFIUM_LATEST_DIR})
file(CREATE_LINK ${PDFIUM_LIBS_DIR} ${PDFIUM_LATEST_DIR} SYMBOLIC)
find_library(libc++ libc++_static.a)
set(pdfrx_bundled_libraries
# Defined in ../src/CMakeLists.txt.
# This can be changed to accommodate different builds.
$<TARGET_FILE:pdfrx>
${PDFIUM_LASTEST_LIB_FILENAME}
PARENT_SCOPE
)
target_include_directories(pdfrx PRIVATE ${PDFIUM_LATEST_DIR}/include)
target_link_libraries(pdfrx PRIVATE ${PDFIUM_LASTEST_LIB_FILENAME} ${libc++})
// The Android Gradle Plugin builds the native code with the Android NDK.
group 'jp.espresso3389.pdfrx'
version '1.0'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// The Android Gradle Plugin knows how to build native code with the NDK.
classpath 'com.android.tools.build:gradle:7.3.0'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
if (project.android.hasProperty("namespace")) {
namespace 'jp.espresso3389.pdfrx'
}
// Bumping the plugin compileSdkVersion requires all clients of this plugin
// to bump the version in their app.
compileSdkVersion 33
// Use the NDK version
// declared in /android/app/build.gradle file of the Flutter project.
// Replace it with a version number if this plugin requires a specfic NDK version.
// (e.g. ndkVersion "23.1.7779620")
ndkVersion android.ndkVersion
// Invoke the shared CMake build with the Android Gradle Plugin.
externalNativeBuild {
cmake {
version "3.18.1+"
path "CMakeLists.txt"
}
}
sourceSets {
main.jniLibs.srcDirs += '.lib/latest'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 21
}
packagingOptions {
pickFirst 'lib/x86/libpdfium.so'
pickFirst 'lib/x86_64/libpdfium.so'
pickFirst 'lib/armeabi-v7a/libpdfium.so'
pickFirst 'lib/arm64-v8a/libpdfium.so'
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.espresso3389.pdfrx">
</manifest>
# SPDX-FileCopyrightText: Copyright 2018 @espresso3389 (Takashi Kawasaki)
# SPDX-FileCopyrightText: Copyright 2024 Noname_1111788
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
# The Flutter tooling requires that developers have CMake 3.10 or later
# installed. You should not increase this version, as doing so will cause
# the plugin to fail to compile for some customers of the plugin.
cmake_minimum_required(VERSION 3.10)
# Project-level configuration.
set(PROJECT_NAME "pdfrx")
project(${PROJECT_NAME} LANGUAGES CXX)
if(${PSDK_MAJOR} LESS 5)
message( FATAL_ERROR "Сannot build this project on Aurora version less than 5" )
endif()
# Determine target processor name
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x64|x86_64)")
SET(CPU_NAME "x64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86)")
SET(CPU_NAME "x86")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM64|aarch64|ARM64EC|arm64ec|ARM64E|arm64e)")
SET(CPU_NAME "arm64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM|armv7hl|armv7l|armv7)")
SET(CPU_NAME "arm")
ELSE()
MESSAGE(FATAL_ERROR "Unsupported architecture \"${CMAKE_SYSTEM_PROCESSOR}\"")
ENDIF()
message( STATUS "Target CPU Name: ${CPU_NAME}" )
# Invoke the build for native code shared with the other target platforms.
# This can be changed to accommodate different builds.
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(VERSION 3.14...3.25)
set(PDFIUM_RELEASE chromium%2F6555)
set(PDFIUM_DIR ${CMAKE_BINARY_DIR}/pdfium)
set(PDFIUM_RELEASE_DIR ${PDFIUM_DIR}/${PDFIUM_RELEASE})
file(MAKE_DIRECTORY ${PDFIUM_RELEASE_DIR})
set(PDFIUM_PLATFORM "linux")
set(PDFIUM_LIB_FILENAME "libpdfium.so")
set(PDFIUM_LIB_DIR "lib")
set(PDFIUM_LINUX_ABI ${CPU_NAME})
set(PDFIUM_ARCHIVE_NAME pdfium-${PDFIUM_PLATFORM}-${PDFIUM_LINUX_ABI})
set(PDFIUM_SRC_LIB_FILENAME ${PDFIUM_RELEASE_DIR}/${PDFIUM_LIB_DIR}/${PDFIUM_LIB_FILENAME})
set(PDFIUM_SRC_IMPLIB_FILENAME ${PDFIUM_RELEASE_DIR}/lib/${PDFIUM_LIB_FILENAME}.lib)
set(PDFIUM_LIBS_DIR ${CMAKE_BINARY_DIR}/.lib/${PDFIUM_RELEASE})
set(PDFIUM_LIBS_ARCH_DIR ${PDFIUM_LIBS_DIR}/${PDFIUM_LINUX_ABI})
set(PDFIUM_DEST_LIB_FILENAME ${PDFIUM_LIBS_ARCH_DIR}/${PDFIUM_LIB_FILENAME})
set(PDFIUM_LATEST_DIR ${CMAKE_BINARY_DIR}/.lib/latest)
set(PDFIUM_LATEST_LIBS_ARCH_DIR ${PDFIUM_LATEST_DIR}/${PDFIUM_LINUX_ABI})
set(PDFIUM_LATEST_LIB_FILENAME ${PDFIUM_LATEST_LIBS_ARCH_DIR}/${PDFIUM_LIB_FILENAME})
if(NOT EXISTS ${PDFIUM_SRC_LIB_FILENAME})
message(STATUS "Download precompiled PDFium...")
file(DOWNLOAD https://github.com/bblanchon/pdfium-binaries/releases/download/${PDFIUM_RELEASE}/${PDFIUM_ARCHIVE_NAME}.tgz ${PDFIUM_RELEASE_DIR}/${PDFIUM_ARCHIVE_NAME}.tgz)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar zxf ${PDFIUM_RELEASE_DIR}/${PDFIUM_ARCHIVE_NAME}.tgz
WORKING_DIRECTORY ${PDFIUM_RELEASE_DIR}
ERROR_QUIET
)
if(STATUS AND NOT STATUS EQUAL 0)
message(FATAL_ERROR "Could not obtain PDFium binary for ${PDFIUM_LINUX_ABI}")
endif()
else()
message(STATUS "Use existing precompiled PDFium." )
endif()
if (NOT EXISTS ${PDFIUM_DEST_LIB_FILENAME})
file(MAKE_DIRECTORY ${PDFIUM_LIBS_ARCH_DIR})
file(COPY ${PDFIUM_SRC_LIB_FILENAME} DESTINATION ${PDFIUM_LIBS_ARCH_DIR})
endif()
# also copy header files for dev use
if (NOT EXISTS ${PDFIUM_LIBS_DIR}/include)
file(COPY ${PDFIUM_RELEASE_DIR}/include DESTINATION ${PDFIUM_LIBS_DIR})
endif()
file(REMOVE ${PDFIUM_LATEST_DIR})
file(CREATE_LINK ${PDFIUM_LIBS_DIR} ${PDFIUM_LATEST_DIR} SYMBOLIC)
# List of absolute paths to libraries that should be bundled with the plugin.
# This list could contain prebuilt libraries, or libraries created by an
# external build triggered from this build file.
set(pdfrx_bundled_libraries
# Defined in ../src/CMakeLists.txt.
# This can be changed to accommodate different builds.
$<TARGET_FILE:pdfrx>
${PDFIUM_LATEST_LIB_FILENAME}
PARENT_SCOPE
)
target_include_directories(pdfrx INTERFACE PRIVATE ${PDFIUM_LATEST_DIR}/include)
target_link_libraries(pdfrx PRIVATE ${PDFIUM_LATEST_LIB_FILENAME})
// Relative import to be able to reuse the C sources.
// See the comment in ../{projectName}}.podspec for more information.
#include "../../src/pdfium_interop.cpp"
#!/bin/zsh -e
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
cd $SCRIPT_DIR
# for iOS/iPhoneSimulator
if [[ ! -d ios/pdfium.xcframework ]]; then
./build-config.sh ios arm64
./build-config.sh iossim arm64
./build-config.sh iossim x64
mkdir -p .tmp/out/lib/iossim-release
lipo -create .tmp/out/lib/iossim-arm64-release/libpdfium.a .tmp/out/lib/iossim-x64-release/libpdfium.a -output .tmp/out/lib/iossim-release/libpdfium.a
mkdir -p ios/
xcodebuild -create-xcframework -library .tmp/out/lib/ios-arm64-release/libpdfium.a -headers .tmp/out/include -library .tmp/out/lib/iossim-release/libpdfium.a -headers .tmp/out/include -output ios/pdfium.xcframework
tar -czvf pdfium-ios.tgz ios
fi
# for macOS
if [[ ! -d macos/pdfium.xcframework ]]; then
./build-config.sh macos arm64
./build-config.sh macos x64
mkdir -p .tmp/out/lib/macos-release
lipo -create .tmp/out/lib/macos-arm64-release/libpdfium.a .tmp/out/lib/macos-x64-release/libpdfium.a -output .tmp/out/lib/macos-release/libpdfium.a
mkdir -p macos/
rm -rf macos/pdfium.xcframework
xcodebuild -create-xcframework -library .tmp/out/lib/macos-release/libpdfium.a -headers .tmp/out/include -output macos/pdfium.xcframework
tar -czvf pdfium-macos.tgz macos
fi
#!/bin/zsh -e
if [ "$2" = "" ]; then
echo "Usage: $0 linux|android|macos|ios|iossim x86|x64|arm|arm64"
exit 1
fi
# https://pdfium.googlesource.com/pdfium/+/refs/heads/chromium/6555
LAST_KNOWN_GOOD_COMMIT=5a6a8741b0e111a6b5bd9ab4e1036377c98885dc
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
# linux, android, macos, ios
TARGET_OS_ORIG=$1
# x64, x86, arm64, ...
TARGET_ARCH=$2
# static or dll
STATIC_OR_DLL=static
# release or debug
REL_OR_DBG=release
if [[ "$TARGET_OS_ORIG" == "iossim" ]]; then
TARGET_OS=ios
TARGET_ENVIRONMENT=simulator
elif [[ "$TARGET_OS_ORIG" == "macos" ]]; then
TARGET_OS=mac
else
TARGET_OS=$TARGET_OS_ORIG
# only for ios; simulator or device
TARGET_ENVIRONMENT=device
fi
WORK_ROOT_DIR=$SCRIPT_DIR/.tmp
DIST_DIR=$WORK_ROOT_DIR/out
DEPOT_DIR=$WORK_ROOT_DIR/depot_tools
WORK_DIR=$WORK_ROOT_DIR/work
mkdir -p $WORK_ROOT_DIR $WORK_DIR $DIST_DIR
if [[ ! -d $DEPOT_DIR ]]; then
pushd $WORK_ROOT_DIR
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
popd
fi
export PATH=$DEPOT_DIR:$PATH
IS_SHAREDLIB=false
if [[ "$REL_OR_DBG" = "release" ]]; then
IS_DEBUG=false
DEBUG_DIR_SUFFIX=
else
IS_DEBUG=true
DEBUG_DIR_SUFFIX=/debug
fi
if [[ "$TARGET_OS" == "macos" || "$TARGET_OS" == "ios" || "$TARGET_OS" == "android" ]]; then
IS_CLANG=true
else
IS_CLANG=false
fi
cd $WORK_DIR
if [[ ! -e pdfium/.git/index ]]; then
fetch pdfium
fi
PDFIUM_SRCDIR=$WORK_DIR/pdfium
BUILDDIR=$PDFIUM_SRCDIR/out/$TARGET_OS_ORIG-$TARGET_ARCH-$REL_OR_DBG
mkdir -p $BUILDDIR
if [[ "$LAST_KNOWN_GOOD_COMMIT" != "" ]]; then
pushd $PDFIUM_SRCDIR
git reset --hard
git checkout $LAST_KNOWN_GOOD_COMMIT
cd $PDFIUM_SRCDIR/build
git reset --hard
cd $PDFIUM_SRCDIR/third_party/libjpeg_turbo
git reset --hard
popd
fi
INCLUDE_DIR=$DIST_DIR/include
if [[ ! -d $INCLUDE_DIR ]]; then
mkdir -p $INCLUDE_DIR
cp -r $PDFIUM_SRCDIR/public/* $INCLUDE_DIR
fi
if [[ "$TARGET_OS" == "ios" ]]; then
# (cd $PDFIUM_SRCDIR && git diff > ../../../patches/ios/pdfium.patch)
pushd $PDFIUM_SRCDIR
git apply --reject --whitespace=fix $SCRIPT_DIR/patches/ios/pdfium.patch
popd
# (cd $PDFIUM_SRCDIR/third_party/libjpeg_turbo && git diff > ../../../../../patches/ios/libjpeg_turbo.patch)
pushd $PDFIUM_SRCDIR/third_party/libjpeg_turbo/
git apply --reject --whitespace=fix $SCRIPT_DIR/patches/ios/libjpeg_turbo.patch
popd
fi
if [[ "$TARGET_OS" == "mac" ]]; then
# (cd $PDFIUM_SRCDIR && git diff > ../../../patches/macos/pdfium.patch)
pushd $PDFIUM_SRCDIR
git apply --reject --whitespace=fix $SCRIPT_DIR/patches/macos/pdfium.patch
popd
# (cd $PDFIUM_SRCDIR/build && git diff > ../../../../patches/macos/build-config.patch)
pushd $PDFIUM_SRCDIR/build
git apply --reject --whitespace=fix $SCRIPT_DIR/patches/macos/build-config.patch
popd
fi
cat <<EOF > $BUILDDIR/args.gn
is_clang = $IS_CLANG
target_os = "$TARGET_OS"
target_cpu = "$TARGET_ARCH"
pdf_is_complete_lib = true
pdf_is_standalone = true
is_component_build = $IS_SHAREDLIB
is_debug = $IS_DEBUG
enable_iterator_debugging = $IS_DEBUG
pdf_enable_xfa = false
pdf_enable_v8 = false
EOF
if [[ "$TARGET_OS" == "ios" ]]; then
# See ios/pdfium/.tmp/work/pdfium/build/config/ios/rules.gni
cat <<EOF >> $BUILDDIR/args.gn
ios_enable_code_signing = false
ios_deployment_target = "12.0"
use_custom_libcxx = false
pdf_use_partition_alloc = false
target_environment = "$TARGET_ENVIRONMENT"
EOF
fi
if [[ "$TARGET_OS" == "mac" ]]; then
cat <<EOF >> $BUILDDIR/args.gn
use_custom_libcxx = false
pdf_use_partition_alloc = false
EOF
fi
pushd $BUILDDIR
gn gen .
popd
ninja -C $BUILDDIR pdfium
LIB_DIR=$DIST_DIR/lib/$TARGET_OS_ORIG-$TARGET_ARCH-$REL_OR_DBG
rm -rf $LIB_DIR
mkdir -p $LIB_DIR
cp $BUILDDIR/obj/libpdfium.a $LIB_DIR
cd $SCRIPT_DIR
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint pdfrx.podspec` to validate before publishing.
#
lib_tag = 'pdfium-apple-v9'
Pod::Spec.new do |s|
s.name = 'pdfrx'
s.version = '0.0.3'
s.summary = 'Yet another PDF renderer for Flutter using PDFium.'
s.description = <<-DESC
Yet another PDF renderer for Flutter using PDFium.
DESC
s.homepage = 'https://github.com/espresso3389/pdfrx'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Takashi Kawasaki' => 'espresso3389@gmail.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.ios.deployment_target = '12.0'
s.ios.dependency 'Flutter'
s.ios.private_header_files = "pdfium/.lib/#{lib_tag}/ios/pdfium.xcframework/ios-arm64/Headers/*.h"
s.ios.vendored_frameworks = "pdfium/.lib/#{lib_tag}/ios/pdfium.xcframework"
# Flutter.framework does not contain a i386 slice.
s.ios.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',
}
s.osx.deployment_target = '10.11'
s.osx.dependency 'FlutterMacOS'
s.osx.private_header_files = "pdfium/.lib/#{lib_tag}/macos/pdfium.xcframework/macos-arm64_x86_64/Headers/*.h"
s.osx.vendored_frameworks = "pdfium/.lib/#{lib_tag}/macos/pdfium.xcframework"
s.osx.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.prepare_command = <<-CMD
mkdir -p pdfium/.lib/#{lib_tag}
cd pdfium/.lib/#{lib_tag}
if [ ! -f ios.tgz ]; then
curl -Lo ios.tgz https://github.com/espresso3389/pdfrx/releases/download/#{lib_tag}/pdfium-ios.tgz
fi
if [ ! -d ios ]; then
tar xzf ios.tgz
fi
if [ ! -f macos.tgz ]; then
curl -Lo macos.tgz https://github.com/espresso3389/pdfrx/releases/download/#{lib_tag}/pdfium-macos.tgz
fi
if [ ! -d macos ]; then
tar xzf macos.tgz
fi
CMD
s.swift_version = '5.0'
end
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
/pubspec.lock
/windows/flutter
/linux/flutter
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
/android/local.properties
# Aurora generated
/aurora/flutter
/windows/flutter
/macos/Flutter
/linux/flutter
/android/local.properties
/macos/Podfile.lock
# pdfrx_example
Demonstrates how to use the pdfrx plugin.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
package jp.espresso3389.pdfrx_example
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "jp.espresso3389.pdfrx_example"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "jp.espresso3389.pdfrx_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {}
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать