zeroc-ice / ice-builder-gradle Goto Github PK
View Code? Open in Web Editor NEWGradle plug-in to automate the compilation of Slice files to Java
Home Page: https://zeroc.com
License: BSD 3-Clause "New" or "Revised" License
Gradle plug-in to automate the compilation of Slice files to Java
Home Page: https://zeroc.com
License: BSD 3-Clause "New" or "Revised" License
Using the new gradle plugin syntax to include the zeroc slice plugin results in an error.
Example:
plugins {
id "java"
id "com.zeroc.gradle.ice-builder.slice" version "1.4.5"
}
Stacktrace:
Caused by: org.gradle.api.UnknownTaskException: Task with name 'compileJava' not found in root project 'omero-blitz'.
at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:97)
at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:44)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:329)
at org.gradle.api.internal.tasks.DefaultTaskCollection.getByName(DefaultTaskCollection.java:44)
at org.gradle.api.tasks.TaskCollection$getByName.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
at com.zeroc.gradle.icebuilder.slice.SlicePlugin.apply(SlicePlugin.groovy:42)
at com.zeroc.gradle.icebuilder.slice.SlicePlugin.apply(SlicePlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
This code should probably be contained within a project.afterEvalute
block.
Freeze build was failing with a crash of the builder, it turns out it was trying to get the timestamp of a non existent slice2freezej because of a bogus slice2freezej.df.xml in /ice/java-compat/src/Ice/build/slice2freezej.df.xml
We should check if the file exists before we check the timestamp in
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ice-compat:compileSlice'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:45)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:197)
at org.gradle.internal.Factories$1.create(Factories.java:25)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:194)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:36)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:118)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:98)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleException: /home/ubuntu/workspace/freeze/master/ice/cpp/bin/slice2freezej: cannot stat
at com.zeroc.gradle.icebuilder.slice.SliceTask.getTimestamp(SliceTask.groovy:607)
at com.zeroc.gradle.icebuilder.slice.SliceTask$getTimestamp$2.callCurrent(Unknown Source)
at com.zeroc.gradle.icebuilder.slice.SliceTask.processFreezeJ(SliceTask.groovy:86)
at com.zeroc.gradle.icebuilder.slice.SliceTask.action(SliceTask.groovy:54)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:624)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:607)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
... 69 more
BUILD FAILED
Total time: 49.228 secs
ubuntu@4cf8c315:~/workspace/freeze/master$ find . -iname slice2freezej.df.xml
./java/test/build/slice2freezej.df.xml
./java/src/Freeze/build/slice2freezej.df.xml
./java/demo/Freeze/phonebook/build/slice2freezej.df.xml
./java/demo/Freeze/library/build/slice2freezej.df.xml
./java/demo/Freeze/transform/build/slice2freezej.df.xml
./java/demo/Freeze/bench/build/slice2freezej.df.xml
./java/demo/Manual/mapFilesystem/build/slice2freezej.df.xml
./ice/java-compat/src/Ice/build/slice2freezej.df.xml
ubuntu@4cf8c315:~/workspace/freeze/master$ cat ./ice/java-compat/src/Ice/build/slice2freezej.df.xml
<state>
<timestamp value='1496961749023' />
<arg value='/home/ubuntu/workspace/freeze/master/ice/cpp/bin/slice2freezej' />
<arg value='--output-dir=/home/ubuntu/workspace/freeze/master/ice/java-compat/src/Ice/build/generated-src' />
<arg value='-I/home/ubuntu/workspace/freeze/master/ice/slice' />
</state>ubuntu@4cf8c315:~/workspace/freeze/master$ rm ./ice/java-compat/src/Ice/build/slice2freezej.df.xml
If the ICE_HOME
env variable or the slice.iceHome
property isn't set, the builder will default iceHome
to /usr or /usr/local on Linux/macOS platforms or the Ice installation directory on Windows (see README.md explanation).
To figure out slice.jarDir
we check for the existence of the directories <iceHome>/share/java
, <iceHome>/java/lib
and finally <iceHome>/lib
.
Because of this latest directory check, slice.jarDir
always ends up being set to /usr/lib
or /usr/local/lib
if the other directories don't exist. Given that JAR files aren't expected to be stored in the lib directory, it would be better to set slice.jarDir
to null in this case. Right now, slice.jarDir
will never be null (contrary to what the documentation says).
We currently assume that Ice will be installed to /usr/local
. With our default installation using brew on Apple Silicon, this will typically be /opt/homebrew/
.
We should probably check a few places and/or check for brew --prefix
.
Hi there!
We've used an internally developed gradle plugin that leverages the ice-ant task for a while now, however we've been looking at moving to use the official ice-builder-gradle plugin instead.
We've hit a minor snag with the currently implementation, however - namely that the plugin only supports a single, "global" output directory for generated source files ("slice.output"), and
doesn't allow setting it per-"Ice sourceSet". The plugin also implicitly binds the "slice.output" to the input of the "project.sourceSets.main.java" sourceSet, which may not be what
you want to do.
I understand that this is an early version of the plugin, but I wonder if I may be so bold as to suggest a slightly different alternative to the "sourceSet" organisation
based on our experience with our internally developed plugin?
Our internally developed plugin is based on the mechanism used by the standard ANTLR gradle plugin. It extends the standard gradle sourceSet to allow you to do the following:
sourceSets {
main {
slice {
srcDir "${someNonStandard.sliceDir}"
args "${someNonStandardArgs}"
outputDirectory "${someNonStandard.outputDirectory}"
// etc
}
java {
srcDir "${someNonStandardJavaDir}"
}
}
test {
slice { // srcDir defaults to "src/main/slice"
}
java { // ...
}
}
}
The advantage of this approach is that it ties the appropriate generated slice2java code to the appropriate java sourceSet automatically. The sourceSet names "main" and "test" are just
convention, but otherwise arbitrary, allowing extensions and other kinds of configurations to be managed by the end-user. Finally, this approach follows the convention used by the
standard gradle plugins - so the end user won't be required to learn a new way of doing things, and will "just work" with minimal configuration.
I'm yet to find a disadvantage with this approach - with a provisio: we are currently only using gradle to manage our java builds. I'm not sure how it fares outside of this use-case...
Thanks,
Tim.
Originally reported by Tim Patterson on the forums:
https://forums.zeroc.com/discussion/45846/support-for-multiple-output-directories-and-source-sets-with-ice-builder-gradle
Hi:
i build use source,then foud exception:
/opt/software/ice-require/ice-require/ice-3.6.3/cpp/bin/slice2java command failed: 1
BUILD FAILED
Total time: 2.576 secs
Stopped 0 compiler daemon(s).
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':test:compileSlice'.] from daemon DaemonInfo{pid=7841, address=[71d17dfd-83b7-4b6e-9a05-a60e5c93d39a port:36590, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=true, context=DefaultDaemonContext[uid=24659ea0-c311-42d7-ba73-563ca98569d8,javaHome=/opt/jdk7,daemonRegistryDir=/root/.gradle/daemon,pid=7841,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}.
why?? who can help me?? thanks..
The builder for gradle has too many properties, and this makes it harder to document and understand. We should simplify it, and remove support for the now deprecated Freeze service.
See also GRD-17,
When updating the contributor agreement for this repo I noticed that the Github Action failed https://github.com/zeroc-ice/ice-builder-gradle/actions/runs/4244255560.
I'm getting this warning when using Gradle 6.0.1 and --warning-mode all
:
> Task :demoIceAsyncInvocation:compileSlice
Property 'timestamps' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Android projects are not building the default output build/generated-src
it display a warning about this directory being created by a third party plugin.
It works after change it to something like
slice.output = file("${project.buildDir}/generated/source/ice")
Seems like with new projects all Java generated code is under ${project.buildDir}/generated/source/
seems it also create different sources per configuration for example
build/generated/source/buildConfig
build/generated/source/buildConfig/debug
build/generated/source/buildConfig/debug/com
build/generated/source/buildConfig/debug/com/example
build/generated/source/buildConfig/debug/com/example/ppgut
build/generated/source/buildConfig/debug/com/example/ppgut/minimal
build/generated/source/buildConfig/debug/com/example/ppgut/minimal/BuildConfig.java
build/generated/source/buildConfig/release
build/generated/source/buildConfig/release/com
build/generated/source/buildConfig/release/com/example
build/generated/source/buildConfig/release/com/example/ppgut
build/generated/source/buildConfig/release/com/example/ppgut/minimal
build/generated/source/buildConfig/release/com/example/ppgut/minimal/BuildConfig.java
Affects v1.4.6
When using a 32-bit JDK with a default Ice installation (C:\Program Files\ZeroC\Ice-3.7.x), the builder fails with the following error message:
A problem occurred evaluating script.
> slice2java (\bin\slice2java.exe) not found. Please ensure that Ice is installed and the iceHome property () is correct.
This occurs because:
Note that Ice 3.6 creates Windows registry entries in \HKLM\SOFTWARE\WOW6432Node\ZeroC, so in 32-bit mode, the gradle plugin will find Ice 3.6 but not Ice 3.7 when iceHome/ICE_HOME is not set.
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.