Coder Social home page Coder Social logo

helgovic / gradle-for-delphi Goto Github PK

View Code? Open in Web Editor NEW
28.0 6.0 3.0 190 KB

Download java library (jar/aar) dependencies to your Delphi project from repositories (Maven/jitpack etc.), extract and create new jar, create JNI pas file, add to project

Pascal 100.00%
delphi gradle jar jni addon java aar radstudio android maven-repository

gradle-for-delphi's Introduction

Gradle-for-Delphi

Download dependencies from repositories, extract and create new jar, create JNI file, add to project.

This addon adds gradle functionality to the Delphi IDE. It downloads Libraries with all dependencies. It then extract all the classes from the jar files, and creates a new jar with these classes. This jar is run through Java2OP to create a JNI file. This JNI file and the jar file are added to the project.

You have to download gradle 8.1 from here https://gradle.org/releases/. Install and add gradle to your path variable.

You need to have JEDI JCL installed.

Install GetJars addon, and a new menuitem "Gradle" will appear under the Project menu.

Copy your java2op directory (e.g. C:\Program Files (x86)\Embarcadero\Studio\21.0\bin\converters\java2op) to a directory with no spaces in the path (e.g. C:\Java2OP).

Enter the path of your Java2OP/JavaImport/JDK directories in Mainmenu->Settings. Enter path to JDK that is to be used mby Gradle when it processes resources. The JDK version should be version 17.

HOW TO USE:

You have to edit the cache.txt in the Java2OP/JavaImport directory. if e.g. you are downloading google play services, you have to remove those entries. You also have to disable the build in jars in your projects libs entries. You should avoid using buildin libs, except for FMX.jar.

Add jobs that contain logical units of work. Do not put everything in one job, as the resulting jni file can grow very large, and Delphi cannot compile JNI with more than a 100000-120000 lines.

In the "Job name" box enter a jobname. This will name the JNI file.

In the "Dependencies" box, enter the libs you want to download (Copy eks. from maven repository Gradle link). The command has to be in one line (e.g ('com.azure:azure-identity:1.2.5') {exclude group: 'com.azure', module: 'azure-core-http-netty'}). "Implementation" and "Compile" prefix will be removed.

In the "Additional (Local) Dependencies" enter any local libs that is needed for this job. You have to add any dependencies to these libs in the dependencies box.

In the "Exclude when building JNI pas file" enter libs/directories/class's that are not to be processed by Java2OP. This can be content that Java2OP cannot process (Hopefully you don't need to access it in your code).

In the "Exclude from final jar" enter libs/directories/class's that are not to be included in the final jar file. It can be test or compile time dependensies.

Add repositories needed for your project in "Repositories".

Create JNI file by clicking "Create JNI pas file".

When you have finished coding against the JNI file, shrink it with "Shrink JNI Files" addon, which can be downloaded from here https://github.com/helgovic/Delphi-shrink-JNI-files.

When you are ready to compile your app, compile project jar by clicking "Compile Project Jar".

RESOURCES

Processing of resouces from libraries will merge resources from your project (Place your own resources in YOURPROJECT\Res directory), with resouces from dependencies, and place these in folder YOURPROJECT\MergedRes. Resouces from YOURPROJECT\MergedRes will be added to your Deployment files. A R.jar containing R.class'es for the libraries will be generated and added to project. Remember, if you make updates to your own app's resources, you need to run "Compile Project Jar".

EXCLUSION PARAMETERS

You can enter three types of parameters:

  1. Not prefixed (e.g. guana). This denotes jars/aars where string is contained in the file name. (Not case sensitive).
  2. Prefixed with / (e.g. /android\support\v4). Denotes a directory of classes, that are to be excluded. (Case sensitive).
  3. Prefixed with ¤ (e. g. ¤com\google\android\exoplayer2\source\CompositeMediaSource$ForwardingEventListener.class). Denotes single class that is to be excluded. (Case sensitive).
  4. Comments (//) and blank lines can be entered.

gradle-for-delphi's People

Contributors

helgovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gradle-for-delphi's Issues

Failed to install APK after using Gradle-for-Delphi

Hi I am testing out a development idea for the company I work with, and we want to implement the Flic SDK into our project.
https://github.com/50ButtonsEach/flic2lib-android

So after some trial and error and studying the code I managed to compile the JNI pas file and compile the project jar using this line in the Dependencies box
('com.github.50ButtonsEach:flic2lib-android:1.3.1') {exclude group: 'com.github.50ButtonsEach', module: 'flic2lib-android'}

I called the Job name flicsdk and pressed Create JNI pas file, and then afterwards I pressed Compile project jar

It generated the pas file and the jar file like I stated above, and the project compiles successfully.
However, when I try to push the APK to my phone and run it I get two errors regarding extracting native libraries -110 and -2, as seen in the picture.

billede

Gradle -q getDeps FAILURE > Could not find ...

Hi,

First of all thanks a lot for this tool, it's an excellent tool to add android sdk to delphi.

I'm planning to include Matrix Android SDK in my delphi project, and I tried to use this tool but I get error in "Gradle -q getDeps".

Matrix Android SDK
'org.matrix.android:matrix-android-sdk2:1.4.25'

Gradle -q getDeps FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':getDeps'.> Could not resolve all files for configuration ':myConfig'. > Could not find com.github.Zhuinden:realm-monarchy:0.7.1. Searched in the following locations: - https://repo.maven.apache.org/maven2/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom - https://dl.google.com/dl/android/maven2/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom - https://jcenter.bintray.com/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom Required by: project : > org.matrix.android:matrix-android-sdk2:1.4.25* Try:> Run with --stacktrace option to get the stack trace.> Run with --info or --debug option to get more log output.> Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 2s

I don't know why this error is caused by gradle or not, is it possible to add this sdk with this tool to delphi.

Thank you

Java2OP

Readme states that I should copy over Java2OP to my Delphi installation bin/converters folder, however the official link to Delphi's Java2OP does not seem to be working for the registered users site when I log in.
How did you manage to achieve the software?

gradle.db

when I install it, it gives me the error that the gradle.db database is not found gradle.db

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.