0

Я создаю компилятор времени для обработки аннотаций для создания кода на Android.Как запустить минимальную задачу на Gradle для запуска apt-плагина

Чтобы запустить процессор аннотаций я использую android-apt плагин от hvisser https://bitbucket.org/hvisser/android-apt/overview

На данный момент, при каждом изменении я делаю на моем Processor extends AbstractProcessor я должен запустить полную /.gradlew clean build, чтобы увидеть результаты, и это своего рода медленный процесс, даже для небольшого образца проекта.

Итак, мой вопрос: есть ли какой-либо из gradlew tasks, который я мог бы использовать для запуска процессора аннотаций?

Выход из моей текущей ./gradlew tasks является:

------------------------------------------------------------ 
All tasks runnable from root project 
------------------------------------------------------------ 

Android tasks 
------------- 
androidDependencies - Displays the Android dependencies of the project. 
signingReport - Displays the signing info for each variant. 

Build tasks 
----------- 
assemble - Assembles the outputs of this project. 
assembleAndroidTest - Assembles all the Test applications. 
assembleDebug - Assembles all Debug builds. 
assembleDebugAndroidTest - Assembles the android (on device) tests for the Debug build. 
assembleRelease - Assembles all Release builds. 
build - Assembles and tests this project. 
buildDependents - Assembles and tests this project and all projects that depend on it. 
buildNeeded - Assembles and tests this project and all projects it depends on. 
classes - Assembles classes 'main'. 
clean - Deletes the build directory. 
compileDebugAndroidTestSources 
compileDebugSources 
compileDebugUnitTestSources 
compileReleaseSources 
compileReleaseUnitTestSources 
jar - Assembles a jar archive containing the main classes. 
mockableAndroidJar - Creates a version of android.jar that's suitable for unit tests. 
testClasses - Assembles classes 'test'. 

Build Setup tasks 
----------------- 
init - Initializes a new Gradle build. [incubating] 
wrapper - Generates Gradle wrapper files. [incubating] 

Documentation tasks 
------------------- 
javadoc - Generates Javadoc API documentation for the main source code. 

Help tasks 
---------- 
components - Displays the components produced by root project 'Decorator'. [incubating] 
dependencies - Displays all dependencies declared in root project 'Decorator'. 
dependencyInsight - Displays the insight into a specific dependency in root project 'Decorator'. 
help - Displays a help message. 
projects - Displays the sub-projects of root project 'Decorator'. 
properties - Displays the properties of root project 'Decorator'. 
tasks - Displays the tasks runnable from root project 'Decorator' (some of the displayed tasks may belong to subprojects). 

Install tasks 
------------- 
installDebug - Installs the Debug build. 
installDebugAndroidTest - Installs the android (on device) tests for the Debug build. 
uninstallAll - Uninstall all applications. 
uninstallDebug - Uninstalls the Debug build. 
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build. 
uninstallRelease - Uninstalls the Release build. 

Verification tasks 
------------------ 
check - Runs all checks. 
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices. 
connectedAndroidTestDebug - Installs and runs the tests for Debug build on connected devices. 
connectedCheck - Runs all device checks on currently connected devices. 
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers. 
deviceCheck - Runs all device checks using Device Providers and Test Servers. 
lint - Runs lint on all variants. 
lintDebug - Runs lint on the Debug build. 
lintRelease - Runs lint on the Release build. 
test - Runs the unit tests. 
testDebug - Run unit tests for the debug build. 
testRelease - Run unit tests for the release build. 

Other tasks 
----------- 
jarDebugClasses 
jarReleaseClasses 
+0

Вы смогли найти решение по этому вопросу? – Abdullah

+0

@ Abdullah no. Я бегал по сборкеДебуг, но было бы здорово иметь что-то лучше – Budius

ответ

0

поколение Source происходит при компиляции. Так работает gradlew cleanCompileDebugSources compileDebugSources - это то, что вам нужно. Это то же самое, что Android Studio работает, когда вы используете make свой проект из меню build.

Если вы разрабатываете свой процессор аннотаций как часть своего проекта, вы можете использовать опцию processor в android-apt, не требуя упаковки вашего проектного проекта. Предполагается, что ваш процессорный модуль зависит от apt project(':myprocessor') (compile также будет работать).

apt { 
    processor "my.class.name" 
} 

 Смежные вопросы

  • Нет связанных вопросов^_^