Skip to content

Commit e426c1a

Browse files
author
i-net /// software
committed
Minor changes
1 parent a2331b4 commit e426c1a

File tree

7 files changed

+64
-54
lines changed

7 files changed

+64
-54
lines changed

.settings/org.eclipse.buildship.core.prefs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
auto.sync=false
12
build.commands=org.eclipse.jdt.core.javabuilder
23
build.scans.enabled=false
34
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.3.1))

src/com/inet/gradle/appbundler/AppBundler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
/**
2525
* The Gradle extension for appBundler task.
26-
*
26+
*
2727
* @author Gerry Weißbach
2828
*/
2929
public class AppBundler extends AbstractSetupBuilder implements SetupSources {
3030

31-
private String jnlpLauncherName;
31+
private String jnlpLauncherName;
3232

3333
/**
3434
* Create a new instance.

src/com/inet/gradle/appbundler/AppBundlerApplicationBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ void buildApplication(DesktopStarter application) throws Exception {
5454
application.setExecutable( getSetupBuilder().getAppIdentifier() );
5555
}
5656

57-
prepareApplication( application );
57+
String jnlpLauncherName = getSetupBuilder().getJnlpLauncherName();
58+
prepareApplication( application, jnlpLauncherName != null );
59+
getAppBundler().setJnlpLauncherName( jnlpLauncherName );
5860
setDocumentTypes( application.getDocumentType() );
59-
getAppBundler().setJnlpLauncherName( ((AppBundler)getSetupBuilder()).getJnlpLauncherName() );
6061

6162
finishApplication();
6263
copyBundleFiles( application );

src/com/inet/gradle/setup/abstracts/AbstractTask.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@
4242
import org.gradle.api.internal.file.copy.DefaultCopySpec;
4343
import org.gradle.api.internal.file.copy.FileCopyDetailsInternal;
4444
import org.gradle.api.internal.project.ProjectInternal;
45-
import org.gradle.api.internal.tasks.SimpleWorkResult;
4645
import org.gradle.api.tasks.InputFiles;
4746
import org.gradle.api.tasks.OutputFile;
4847
import org.gradle.api.tasks.TaskAction;
4948
import org.gradle.api.tasks.WorkResult;
49+
/*// if gradleVersion < 3.4
50+
import org.gradle.api.internal.tasks.SimpleWorkResult;
51+
*/// else
52+
import org.gradle.api.tasks.WorkResults;
53+
//// endif
5054
import org.gradle.internal.nativeplatform.filesystem.FileSystem;
5155
import org.gradle.internal.reflect.Instantiator;
5256

@@ -71,7 +75,6 @@ public abstract class AbstractTask extends DefaultTask implements SetupSources {
7175
* @param extension of the setup
7276
* @param setupType the class of the SetupBuilder
7377
*/
74-
@SuppressWarnings("unchecked")
7578
public AbstractTask( String extension, Class<? extends AbstractSetupBuilder> setupType ) {
7679
this.extension = extension;
7780
this.rootSpec = (CopySpecInternal)getProject().copySpec( (Closure<CopySpec>)null );
@@ -169,7 +172,11 @@ private void processFiles( CopyActionProcessingStreamAction action, CopySpecInte
169172
@Override
170173
public WorkResult execute( CopyActionProcessingStream stream ) {
171174
stream.process( action );
175+
/*// if gradleVersion < 3.4
172176
return new SimpleWorkResult( true );
177+
*/// else
178+
return WorkResults.didWork( true );
179+
//// endif
173180
}
174181
};
175182
copyActionExecuter.execute( copySpec, copyAction );
@@ -201,10 +208,9 @@ protected FileLookup getFileLookup() {
201208
public abstract void build();
202209

203210
/**
204-
* Return the setupBuilder using the specified type
211+
* Return the setupBuilder using the specified type
205212
* @return setupBuilder
206213
*/
207-
@SuppressWarnings("unchecked")
208214
protected AbstractSetupBuilder getAbstractSetupBuilder() {
209215
return setupBuilder;
210216
}
@@ -232,7 +238,7 @@ public FileTree getSetupSource() {
232238
try {
233239
return setupBuilder.getSource();
234240
} catch ( Throwable e ) {
235-
throw new IllegalArgumentException( "You have to specify input sources for your application", e );
241+
throw new IllegalArgumentException( "You have to specify input sources for your application", e );
236242
}
237243
}
238244

@@ -254,7 +260,7 @@ public File getSetupFile() {
254260

255261
/**
256262
* Get the file extension.
257-
*
263+
*
258264
* @return the extension
259265
*/
260266
public String getExtension() {
@@ -263,7 +269,7 @@ public String getExtension() {
263269

264270
/**
265271
* Set the file extension of the installer. The default is equals the task name.
266-
*
272+
*
267273
* @param extension the file extension
268274
*/
269275
public void setExtension( String extension ) {

src/com/inet/gradle/setup/dmg/AbstractOSXApplicationBuilder.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
/**
4141
* Abstract implementation for creating the resulting app bundler image
42-
*
42+
*
4343
* @author gamma
4444
*
4545
* @param <T> the Task
@@ -53,7 +53,7 @@ public abstract class AbstractOSXApplicationBuilder<T extends AbstractTask, S ex
5353

5454
/**
5555
* Setup this builder.
56-
*
56+
*
5757
* @param task - original task
5858
* @param setup - original setup
5959
* @param fileResolver - original fileResolver
@@ -66,11 +66,11 @@ protected AbstractOSXApplicationBuilder( T task, S setup, FileResolver fileResol
6666

6767
/**
6868
* Prepare the basic settings of the application
69-
*
69+
*
7070
* @param application to use
7171
* @throws Exception on errors
7272
*/
73-
protected void prepareApplication( Application application ) throws Exception {
73+
protected void prepareApplication( Application application, boolean isJNLPBuild ) throws Exception {
7474

7575
String appName = application.getDisplayName();
7676

@@ -106,17 +106,19 @@ protected void prepareApplication( Application application ) throws Exception {
106106

107107
appBundler.setIdentifier( identifier );
108108

109-
110-
if ( application.getMainClass() == null ) {
111-
throw new ConfigurationException( "A main class is required for the application. You have to configure at least the following:\n\n\tsetupBuilder {\n\t\t[..]\n\t\tmainClass = 'your.org.main.class'\n\t}\n\n" );
112-
}
113-
appBundler.setMainClassName( application.getMainClass() );
109+
if ( !isJNLPBuild ) {
110+
// Main Class and Jar File are required.
111+
if ( application.getMainClass() == null ) {
112+
throw new ConfigurationException( "A main class is required for the application. You have to configure at least the following:\n\n\tsetupBuilder {\n\t\t[..]\n\t\tmainClass = 'your.org.main.class'\n\t}\n\n" );
113+
}
114+
appBundler.setMainClassName( application.getMainClass() );
114115

115-
// Check for mainJar to not be null
116-
if ( mainJar == null ) {
117-
throw new ConfigurationException( "A main jar file is required for the application. You have to configure at least the following:\n\n\tsetupBuilder {\n\t\t[..]\n\t\tmainJar = '/path/to/yourMain.jar'\n\t}\n\n" );
116+
// Check for mainJar to not be null
117+
if ( mainJar == null ) {
118+
throw new ConfigurationException( "A main jar file is required for the application. You have to configure at least the following:\n\n\tsetupBuilder {\n\t\t[..]\n\t\tmainJar = '/path/to/yourMain.jar'\n\t}\n\n" );
119+
}
120+
appBundler.setJarLauncherName( mainJar );
118121
}
119-
appBundler.setJarLauncherName( mainJar );
120122

121123
appBundler.setCopyright( setup.getCopyright() );
122124
appBundler.setIcon( getApplicationIcon() );
@@ -138,7 +140,7 @@ protected void finishApplication() {
138140

139141
/**
140142
* Set the document types from the list
141-
*
143+
*
142144
* @param list of document types
143145
* @throws IOException on complications with the icon
144146
*/
@@ -193,7 +195,7 @@ protected void bundleJre() {
193195

194196
/**
195197
* Returns the icns application icon file
196-
*
198+
*
197199
* @return Icon file
198200
* @throws IOException when there are errors while getting the file
199201
*/
@@ -207,7 +209,7 @@ protected File getApplicationIcon() throws IOException {
207209

208210
/**
209211
* Modify a plist file
210-
*
212+
*
211213
* @param plist file to modify
212214
* @param property property to set
213215
* @param value of property
@@ -226,7 +228,7 @@ protected void setPlistProperty( File plist, String property, String value ) {
226228

227229
/**
228230
* Add an entry to a plist file
229-
*
231+
*
230232
* @param plist file to modify
231233
* @param property property to set
232234
* @param type of property
@@ -246,7 +248,7 @@ protected void addPlistProperty( File plist, String property, String type, Strin
246248

247249
/**
248250
* Add an entry to a plist file
249-
*
251+
*
250252
* @param plist file to modify
251253
* @param property property to set
252254
*/
@@ -264,7 +266,7 @@ protected void deletePlistProperty( File plist, String property ) {
264266

265267
/**
266268
* Copy the files defined in the gradle script into their final destination
267-
*
269+
*
268270
* @param application the application
269271
* @throws IOException on errors
270272
*/
@@ -277,7 +279,7 @@ protected void copyBundleFiles( Application application ) throws IOException {
277279

278280
/**
279281
* Set File permissions to the resulting application
280-
*
282+
*
281283
* @param destination of the files to manipulate
282284
* @throws IOException on errors
283285
*/
@@ -311,7 +313,7 @@ protected void setApplicationFilePermissions( File destination ) throws IOExcept
311313

312314
/**
313315
* Return the current AppBundler.
314-
*
316+
*
315317
* @return appBundler
316318
*/
317319
protected AppBundlerTask getAppBundler() {

src/com/inet/gradle/setup/dmg/OSXApplicationBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
/**
1212
* Build an OSX Application - service
13-
*
13+
*
1414
* @author gamma
1515
*
1616
*/
1717
public class OSXApplicationBuilder extends AbstractOSXApplicationBuilder<Dmg, SetupBuilder> {
1818

1919
/**
2020
* Setup this builder.
21-
*
21+
*
2222
* @param task - original task
2323
* @param setup - original setup
2424
* @param fileResolver - original fileResolver
@@ -30,7 +30,7 @@ protected OSXApplicationBuilder( Dmg task, SetupBuilder setup, FileResolver file
3030
/**
3131
* Create Application from service provided. Also create the preference panel
3232
* and put it into the application. Will also create the installer wrapper package of this application
33-
*
33+
*
3434
* @param service the service
3535
* @throws Throwable error.
3636
*/
@@ -42,7 +42,7 @@ void buildService( Service service ) throws Throwable {
4242
}
4343

4444
System.err.println( "Having executable of: '" + service.getExecutable() + "'" );
45-
prepareApplication( service );
45+
prepareApplication( service, false );
4646
finishApplication();
4747
copyBundleFiles( service );
4848
new OSXPrefPaneCreator( task, getSetupBuilder(), fileResolver ).create( service );
@@ -53,7 +53,7 @@ void buildService( Service service ) throws Throwable {
5353

5454
/**
5555
* Create Application from the desktop starter provided
56-
*
56+
*
5757
* @param application - the application
5858
* @throws Exception on errors
5959
*/
@@ -64,7 +64,7 @@ void buildApplication( DesktopStarter application ) throws Exception {
6464
application.setExecutable( getSetupBuilder().getAppIdentifier() );
6565
}
6666

67-
prepareApplication( application );
67+
prepareApplication( application, false );
6868
setDocumentTypes( application.getDocumentType() );
6969
finishApplication();
7070
copyBundleFiles( application );

src/com/inet/gradle/setup/dmg/template/applescript.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
try
22
tell application "Finder"
3-
3+
44
#Prepare centering on screen
55
set screenSize to bounds of window of desktop
66
set screenWidth to item 3 of screenSize
77
set screenHeight to item 4 of screenSize
8-
8+
99
set windowWidth to {{windowWidth}}
1010
set windowHeight to {{windowHeight}}
1111
set iconSize to {{iconSize}}
12-
12+
1313
tell disk "{{displayName}}"
1414
open
1515
set current view of container window to icon view
@@ -30,22 +30,22 @@ try
3030
set ourXPos to (windowWidth - 2.0 * iconSize) / 3.0 + iconSize / 3.0
3131
set appXPos to windowWidth - ourXPos
3232
set yPos to (windowHeight - iconSize) / 3.0 * 2.0
33-
34-
try
35-
set position of item "{{executable}}.app" of container window to {ourXPos, yPos}
36-
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
37-
set position of item "Applications" of container window to {appXPos, yPos}
33+
34+
try
35+
set position of item "{{executable}}.app" of container window to {ourXPos, yPos}
36+
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
37+
set position of item "Applications" of container window to {appXPos, yPos}
3838
end try
39-
39+
4040
try
41-
set ourXPos to windowWidth / 2.0
42-
set position of item "{{executable}}.pkg" of container window to {ourXPos, yPos}
43-
end try
44-
41+
set ourXPos to windowWidth / 2.0
42+
set position of item "{{executable}}.pkg" of container window to {ourXPos, yPos}
43+
end try
44+
4545
try
46-
set background picture of theViewOptions to file ".resources:background{{backgroundExt}}"
47-
end try
48-
46+
set background picture of theViewOptions to file ".resources:background{{backgroundExt}}"
47+
end try
48+
4949
update without registering applications
5050
close
5151
open

0 commit comments

Comments
 (0)