Skip to content

Commit

Permalink
More annotations for Gradle 7. #107
Browse files Browse the repository at this point in the history
  • Loading branch information
Horcrux7 committed Oct 18, 2021
1 parent 9a5148c commit 5e7d853
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/com/inet/gradle/appbundler/AppBundler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package com.inet.gradle.appbundler;

import org.gradle.api.Project;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;

import com.inet.gradle.setup.abstracts.AbstractSetupBuilder;
import com.inet.gradle.setup.abstracts.SetupSources;
Expand All @@ -41,6 +43,7 @@ public AppBundler( Project project ) {
/**
* {@inheritDoc}
*/
@Input
@Override
public String getArchiveName() {
return getApplication();
Expand All @@ -51,6 +54,8 @@ public String getArchiveName() {
* This can be used instead of the mainJar
* @return the launcher file
*/
@Input
@Optional
public String getJnlpLauncherName() {
return jnlpLauncherName;
}
Expand Down
7 changes: 7 additions & 0 deletions src/com/inet/gradle/appbundler/AppBundlerGradleTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.gradle.api.Action;
import org.gradle.api.GradleException;
import org.gradle.api.internal.project.ProjectInternal;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import org.gradle.util.ConfigureUtil;

Expand All @@ -47,6 +50,8 @@ public AppBundlerGradleTask() {
* Get the app builder
* @return the app builder
*/
@Nested
@Optional
public AppBundler getAppBuilder() {
return (AppBundler)super.getAbstractSetupBuilder();
}
Expand Down Expand Up @@ -99,6 +104,8 @@ public void codeSign( Action<? super OSXCodeSign<? super AppBundlerGradleTask,?
*
* @return the settings or null
*/
@Input
@Optional
public OSXCodeSign<AppBundlerGradleTask,AppBundler> getCodeSign() {
return codeSign;
}
Expand Down
29 changes: 28 additions & 1 deletion src/com/inet/gradle/setup/abstracts/AbstractSetupBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
import org.gradle.api.file.CopySpec;
import org.gradle.api.file.FileTree;
import org.gradle.api.internal.file.copy.CopySpecInternal;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectories;

import com.inet.gradle.setup.image.ImageFactory;
import com.inet.gradle.setup.util.Logging;

import groovy.lang.Closure;

Expand Down Expand Up @@ -81,6 +85,7 @@ public AbstractSetupBuilder( Project project ) {
project.getLogger().lifecycle( "setting default Destination to: " + getDestinationDir() );
}

@Internal
@Override
public CopySpecInternal getRootSpec() {
return rootSpec;
Expand All @@ -91,13 +96,15 @@ public CopySpecInternal getRootSpec() {
*
* @return the project
*/
@Internal
public Project getProject() {
return project;
}

/**
* Override to remove the annotation OutputDirectories in the Copy task. {@inheritDoc}
*/
@OutputDirectories
public File getDestinationDir() {
return new File( project.getBuildDir(), String.valueOf( destinationDir ) );
}
Expand All @@ -106,6 +113,7 @@ public File getDestinationDir() {
* All the inputs
* @return FileTree
*/
@InputFiles
@Override
public FileTree getSource() {
FileTree allSource = rootSpec.buildRootResolver().getAllSource();
Expand All @@ -128,6 +136,7 @@ public void setDestinationDir( Object destinationDir ) {
* Vendor of this setup
* @return vendor
*/
@Input
public String getVendor() {
if( vendor != null ) {
return vendor;
Expand All @@ -147,6 +156,7 @@ public void setVendor( String vendor ) {
* Return the name of the application
* @return name of the application
*/
@Input
public String getApplication() {
if( application != null ) {
return application;
Expand All @@ -166,6 +176,7 @@ public void setApplication( String application ) {
* Get the version of the setup. If not set a version of 1.0 is returned
* @return the version
*/
@Input
public String getVersion() {
if( version != null ) {
return version;
Expand Down Expand Up @@ -194,6 +205,7 @@ public void setVersion( String version ) {
*
* @return the application identifier
*/
@Input
public String getAppIdentifier() {
if( appIdentifier != null ) {
return appIdentifier;
Expand All @@ -218,6 +230,7 @@ public void setAppIdentifier( String identifier ) {
*
* @return the setup file name
*/
@Input
public String getArchiveName() {
if( archiveName != null ) {
return archiveName;
Expand All @@ -237,6 +250,8 @@ public void setArchiveName( String setupName ) {
* Get the icons for the setup.
* @return the icons
*/
@Input
@Optional
public Object getIcons() {
return icons;
}
Expand All @@ -248,6 +263,7 @@ public Object getIcons() {
* @return the icon file
* @throws IOException if an error occurs
*/
@Internal
public File getIconForType( File buildDir, String type ) throws IOException {
return ImageFactory.getImageFile( project, getIcons(), buildDir, type);
}
Expand All @@ -267,6 +283,8 @@ public void setIcons( Object icons ) {
*
* @return the value
*/
@Input
@Optional
public Object getBundleJre() {
return bundleJre;
}
Expand All @@ -287,6 +305,8 @@ public void setBundleJre( Object bundleJre ) {
*
* @return the target
*/
@Input
@Optional
public String getBundleJreTarget() {
if( bundleJreTarget != null ) {
if( bundleJreTarget.startsWith( "/" ) ) {
Expand Down Expand Up @@ -314,6 +334,8 @@ public void setBundleJreTarget( String bundleJreTarget ) {
*
* @return the class name
*/
@Input
@Optional
public String getMainClass() {
return mainClass;
}
Expand All @@ -332,6 +354,8 @@ public void setMainClass( String mainClass ) {
*
* @return the main jar
*/
@Input
@Optional
public String getMainJar() {
return mainJar;
}
Expand All @@ -351,6 +375,7 @@ public void setMainJar( String mainJar ) {
*
* @return true, if enabled
*/
@Internal
public boolean isFailOnEmptyFrom() {
return failOnEmptyFrom;
}
Expand All @@ -368,6 +393,7 @@ public void setFailOnEmptyFrom( boolean failOnEmptyFrom ) {
* Get a global description. Never null.
* @return the description
*/
@Input
public String getDescription() {
if( description == null ) {
return "";
Expand All @@ -387,6 +413,7 @@ public void setDescription( String description ) {
* Get the Copyright information.
* @return the copyright notice
*/
@Input
public String getCopyright() {
if( copyright != null ) {
return copyright;
Expand Down

0 comments on commit 5e7d853

Please sign in to comment.