neva-dev / gradle-fork-plugin Goto Github PK
View Code? Open in Web Editor NEWGradle Fork Plugin - Project generator based on live archetypes (example projects) & interactive gradle.properties file generator
License: Apache License 2.0
Gradle Fork Plugin - Project generator based on live archetypes (example projects) & interactive gradle.properties file generator
License: Apache License 2.0
Imagine e.g
fork {
config {
cloneFiles()
// ...
removeLine("apply from(\"gradle/fork.gradle.kts\")", "/build.gradle.kts") // new action
removeFile("gradle/fork.gradle.kts") // new action
copyTemplateFile("README.MD") // will override existing
}
}
to be able to clean up forking configuration (fork will not be forkable)
To simplify connecting fields with documentations
https://www.codejava.net/java-se/swing/how-to-create-hyperlink-with-jlabel-in-java-swing
maybe just "define if not defined" condition need to be added
Imagine:
fork {
config {
appendPrompt "gradle.properties", ["nexusUser", "nexusPassword"]
}
}
after forking gradle.properties
will have appended
nexusUser=[userInput]
nexusPassword=[userInput]
as of throwing an exception is killing daemon state / and when running next build, creating new daemon is needed.
Hi,
I have a property that is used on the controller of other property, like this:
define("baseDir") {
defaultValue = "/default/path"
}
define("targetPath") {
enabled = false
controller {
value = other("baseDir").value + '/' + other("artifactId").value
}
}
The properity "baseDir" isn't used the "config" session, just in the "properties" session.
When I try to run "fork", I get the error Property named 'baseDir' does not exist.
This always happen with properties that aren't used in the "config" session. Is there any way to override this behaviour?
Regards,
Rodrigo
controller {}
callback is used to assign other field value; such other field value cannot be then changedto be able to show/hide tab on GUI depending on other select field value
should also be respected when GUI is not running
Design :
fork.property(name)
that will just proxy project.findProperty(name)
or if property is encrypted (basing on definition #9 #5 ) decrypted value instead of as is (logic similar to https://github.com/etiennestuder/gradle-credentials-plugin ; encrypter with passphrase based on 1) )sample usage
plugins {
id ("com.neva.fork")
}
repositories {
maven {
url = uri("http://nexus.xxx.com/groups/private")
username = fork.prop("nexus.username")
password = fork.prop("nexus.password")
}
}
I'm currently using Fork Plugin but I'd like to use it without Gradle, embedded on a custom application. I think I'll extract and adapt the code I need from this repository but I was wondering if others share the same need.
Especially when there is too many properties, then grouping them by tabs will cause that windows will be smaller / nicer
E.g when when some checkbox or select have approprate value, then toggle other fields visibility (and mandatory / mark required or not)
> Task :props FAILED
Build failure
Execution failed for task ':props'.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':props'.
> java.nio.file.FileSystemException: C:\Users\krystian.panek\Projects\gradle-aem-multi\gradle.user.properties: Proces nie mo▒e uzyska▒ dost▒pu do pliku, poniewa▒ jest on u▒ywany przez inny proces.
why? when project is open in intellij, it could prevent file saving of 'gradle.user.properties' occassionally
to fix it:
a) close IntelliJ, rerun gradlew props
b) run gradlew --stop
then rerun gradlew props
this affects only Windows machines
any ideas how to fix / avoid it?
controller {}
callback is used to assign other field value; such other field value cannot be then changedbuild/fork/config/properties.properties
to be able to show/hide tab on GUI depending on other select field value
should also be respected when GUI is not running
Consider impl {{ somePassword | password }}
filter that will decrypt the value only intentionally
like appending to gradle.properties file (but using a separate file to avoid making VCS change)
sh gradlew initProps -PinitProp1=val1
etc
The dl.bintray.com repository is not active any more, please reference this page in docs.
Check README.md file.
when tpl file has been changed then there is usually a need to regenerate gradle.user.properties file.
how about regenerating that file automatically e.g when requireProps
is called...
as of fork config should delete forking related gradle files and contents, dedicated rules for deleting e.g
build.gradle.kts
// fork:start
fork {
properties {
/// this lines should not be available in forked project
}
}
// fork:end
would be nice
Make Fork decrypt password, so other plugins like GAP don't have to use forkProps extension to pass properties.
When fork generates properties file with password encrypted it adds fp:
prefix to them:
fileTransfer.sftp.user=username
fileTransfer.sftp.password={fp:nWVIC40MKSf2ZasfflkOXA==}
knowing the peb template it can decode values on the fly, so build script author don't have to pass through in the build file:
aem {
fileTransfer {
sftp {
user = forkProps["fileTransfer.sftp.user"]
password = forkProps["fileTransfer.sftp.password"]
}
}
}
There is no way to elegantly define default value for e.g projectGroup
. Consider new DSL:
fork {
config {
cloneFiles()
moveFiles([
"/com/company/x/example": "/{{projectGroup|substitute('.', '/')}}/{{projectName}}",
"/example": "/{{projectName}}"
])
replaceContents([
"com.company.x.example": "{{projectGroup}}.{{projectName}}",
'com.company.x': "{{projectGroup}}",
"Example": "{{projectLabel}}",
"example": "{{projectName}}",
])
defineProperties([
property "projectGroup", "com.company.x"
property "projectLabel", "Example",
property "projectName", "example"
/* below mostly expected :)
property "projectName", {
defaultValue = "example"
validator = { !it.value('projectGroup').contains(it.value)) }
}
*/
property "libVersion", { // that property will be used in some template file, not in above sections directly
defaultValue = "1.0.0"
radio ['1.0.0', '2.00', '3.0.0''] // GUI control type 'radio' instead of default 'textfield'
required()
}
])
}
}
Caused by: com.neva.gradle.fork.ForkException: Fork properties GUI dialog cannot be opened!
Please run 'sh gradlew --stop' then try again.
Ultimately run command with '--no-daemon' option.
at com.neva.gradle.fork.gui.PropertyDialog$Companion.make(PropertyDialog.kt:169)
at com.neva.gradle.fork.config.Config.promptFillGui(Config.kt:166)
at com.neva.gradle.fork.config.Config.promptFill(Config.kt:122)
at com.neva.gradle.fork.config.Config.access$promptFill(Config.kt:21)
at com.neva.gradle.fork.config.Config$promptedProperties$2.invoke(Config.kt:29)
at com.neva.gradle.fork.config.Config$promptedProperties$2.invoke(Config.kt:21)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.neva.gradle.fork.config.Config.getPromptedProperties(Config.kt)
at com.neva.gradle.fork.config.Config.validate(Config.kt:293)
at com.neva.gradle.fork.config.Config.evaluate(Config.kt:287)
at com.neva.gradle.fork.tasks.ConfigTask.evaluate(ConfigTask.kt:18)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:721)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:688)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:539)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:524)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:507)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:258)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:247)
at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:63)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:153)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:67)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:41)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:174)
... 30 more
Caused by: java.lang.NullPointerException
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(WindowsFileChooserUI.java:498)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(WindowsFileChooserUI.java:212)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:149)
at com.neva.gradle.fork.gui.PropertyDialog.<init>(PropertyDialog.kt:112)
at com.neva.gradle.fork.gui.PropertyDialog$Companion.make(PropertyDialog.kt:163)
... 102 more
Imagine
sh gradlew fork -Pfork.config=properties
replaced by just
sh gradlew properties
which will use reserved in-place config named properties
the last one has always-win precedence...
expected:
-Pkey=value
actual:
actual when setting fork.override=true
e.g to allow implementing multi-checkbox, storing e.g lists in properties file is problematic.
maybe instead of using *.properties more verbose format like *.yml might be useful to be used.
based on replaceAll
for handling https://github.com/Cognifide/gradle-aem-multi/blob/master/gradle/fork.gradle.kts#L103
Hi,
Is it possible to execute a command line script inside the forked app's folder, like a git repo initialization? I could do something like fork.finalizedBy gitInit
but I don't know how to get the generated folder path.
I also tried the following in 'fork.config' but it didn't work:
action(Action { Runtime.getRuntime().exec("git init") })
Could you help me?
Thanks in advance. Regards!
Imagine
tasks {
instanceSetup {
dependsOn("propsCheck")
}
}
right now, after cloning a project, we could forget about generating user-specific configuration to run some task
maybe we could introduce separate plugin e.g com.neva.fork.props.check
with will allow to run only tasks
and props
task at first, then after generating gradle.user.properties
all others...
which will be useful for cases when changes from updated TPL need to be applied without updating values already saved on GUI dialog
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.