├── testBuilds ├── settings.gradle ├── .gitignore ├── test-icon.icns ├── template.wxs ├── jnlpBundler.gradle ├── longDesc_en.txt ├── longDesc_de.txt ├── appBundler.gradle ├── src │ └── com │ │ └── inet │ │ └── testapplication │ │ └── TestLauncher.java ├── fragmentDlg.wxs ├── license_de.txt ├── license_en.txt └── build.gradle ├── .settings ├── .gitignore ├── org.eclipse.buildship.core.prefs └── org.eclipse.jdt.core.prefs ├── .gitattributes ├── src ├── com │ ├── inet │ │ └── gradle │ │ │ ├── setup │ │ │ ├── dmg │ │ │ │ ├── preferences │ │ │ │ │ ├── settings.gradle │ │ │ │ │ ├── Resources │ │ │ │ │ │ ├── status │ │ │ │ │ │ │ ├── gray.png │ │ │ │ │ │ │ ├── red.png │ │ │ │ │ │ │ ├── green.png │ │ │ │ │ │ │ └── yellow.png │ │ │ │ │ │ ├── ProductIcon.icns │ │ │ │ │ │ ├── en.lproj │ │ │ │ │ │ │ └── Strings.strings │ │ │ │ │ │ ├── de.lproj │ │ │ │ │ │ │ └── Strings.strings │ │ │ │ │ │ └── service.plist │ │ │ │ │ ├── SetupBuilderOSXPrefPane.xcodeproj │ │ │ │ │ │ ├── xcuserdata │ │ │ │ │ │ │ └── gamma.xcuserdatad │ │ │ │ │ │ │ │ ├── xcdebugger │ │ │ │ │ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ │ │ │ │ │ └── xcschemes │ │ │ │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ │ │ └── project.xcworkspace │ │ │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ │ │ ├── xcuserdata │ │ │ │ │ │ │ └── gamma.xcuserdatad │ │ │ │ │ │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ │ │ └── SetupBuilderOSXPrefPane.xccheckout │ │ │ │ │ ├── SetupBuilderOSXPrefPane │ │ │ │ │ │ ├── PrefixHeader.pch │ │ │ │ │ │ ├── lib │ │ │ │ │ │ │ └── OnOffSwitchControl │ │ │ │ │ │ │ │ ├── OnOffSwitchControl.h │ │ │ │ │ │ │ │ ├── OnOffSwitchControlCell.h │ │ │ │ │ │ │ │ └── OnOffSwitchControl.m │ │ │ │ │ │ ├── Service │ │ │ │ │ │ │ ├── Process.h │ │ │ │ │ │ │ ├── Authorization.h │ │ │ │ │ │ │ └── ServiceController.h │ │ │ │ │ │ ├── SetupBuilderOSXPrefPane.h │ │ │ │ │ │ ├── Info.plist │ │ │ │ │ │ └── SetupBuilderOSXPrefPane.m │ │ │ │ │ ├── Common │ │ │ │ │ │ ├── NSString+MD5.h │ │ │ │ │ │ ├── Service.h │ │ │ │ │ │ ├── NSString+MD5.m │ │ │ │ │ │ ├── Variables.h │ │ │ │ │ │ └── Service.m │ │ │ │ │ └── build.gradle │ │ │ │ ├── template │ │ │ │ │ ├── dmgbuild │ │ │ │ │ │ ├── dmgbuild │ │ │ │ │ │ ├── settings.00.script.py.txt │ │ │ │ │ │ ├── settings.02.icons.py.txt │ │ │ │ │ │ ├── setIcon.sh │ │ │ │ │ │ ├── settings.03.window.py.txt │ │ │ │ │ │ ├── settings.01.base.py.txt │ │ │ │ │ │ └── settings.04.defaultview.py.txt │ │ │ │ │ ├── preinstall.remove-service.txt │ │ │ │ │ ├── preinstall.txt │ │ │ │ │ ├── postuninstall.remove.user.txt │ │ │ │ │ ├── runBeforeAfter.txt │ │ │ │ │ ├── postinstall.txt │ │ │ │ │ ├── postinstall.install-service.txt │ │ │ │ │ ├── uninstall.txt │ │ │ │ │ └── preinstall.createuser.txt │ │ │ │ ├── service │ │ │ │ │ └── watchuninstall.plist │ │ │ │ └── PreferencesLink.java │ │ │ ├── msi │ │ │ │ ├── i18n │ │ │ │ │ ├── language-en.properties │ │ │ │ │ └── language-de.properties │ │ │ │ ├── sdk │ │ │ │ │ ├── MsiTran.exe │ │ │ │ │ └── signtool.exe │ │ │ │ ├── template.wxs │ │ │ │ ├── x64 │ │ │ │ │ └── prunsrv.exe │ │ │ │ ├── x86 │ │ │ │ │ ├── prunmgr.exe │ │ │ │ │ └── prunsrv.exe │ │ │ │ ├── ia64 │ │ │ │ │ └── prunsrv.exe │ │ │ │ ├── Launch4j.java │ │ │ │ ├── CommandLine.java │ │ │ │ ├── SignTool.java │ │ │ │ ├── Launch4jManifest.java │ │ │ │ └── MsiLanguages.java │ │ │ ├── util │ │ │ │ ├── Strings.java │ │ │ │ ├── Logging.java │ │ │ │ ├── IndentationOutputStream.java │ │ │ │ └── GradleUtils.java │ │ │ ├── unix │ │ │ │ ├── systemd.service │ │ │ │ └── deb │ │ │ │ │ ├── template │ │ │ │ │ ├── preinst.sh │ │ │ │ │ ├── prerm.sh │ │ │ │ │ ├── postinst.sh │ │ │ │ │ └── postrm.sh │ │ │ │ │ └── Deb.java │ │ │ ├── image │ │ │ │ └── image4j │ │ │ │ │ ├── codec │ │ │ │ │ ├── ico │ │ │ │ │ │ ├── ICOConstants.java │ │ │ │ │ │ └── IconEntry.java │ │ │ │ │ └── bmp │ │ │ │ │ │ ├── BMPConstants.java │ │ │ │ │ │ ├── ColorEntry.java │ │ │ │ │ │ └── BMPImage.java │ │ │ │ │ ├── util │ │ │ │ │ └── ImageUtil.java │ │ │ │ │ └── io │ │ │ │ │ ├── EndianUtils.java │ │ │ │ │ ├── LittleEndianRandomAccessFile.java │ │ │ │ │ ├── LittleEndianOutputStream.java │ │ │ │ │ └── LittleEndianInputStream.java │ │ │ ├── abstracts │ │ │ │ ├── AbstractUnixSetupTask.java │ │ │ │ ├── ProtocolHandler.java │ │ │ │ ├── LocalizedResource.java │ │ │ │ ├── DocumentType.java │ │ │ │ └── AbstractSetupTask.java │ │ │ ├── SetupBuilderPlugin.java │ │ │ └── Template.java │ │ │ └── appbundler │ │ │ ├── utils │ │ │ └── xmlwise │ │ │ │ └── XmlParseException.java │ │ │ ├── AppBundlerPlugin.java │ │ │ ├── AppBundlerBuilder.java │ │ │ ├── AppBundler.java │ │ │ ├── AppBundlerApplicationBuilder.java │ │ │ └── AppBundlerGradleTask.java │ └── oracle │ │ └── appbundler │ │ ├── res.zip │ │ ├── GenericApp.icns │ │ ├── JavaAppLauncher │ │ ├── JavaAppLauncher_x86_64 │ │ ├── IconContainer.java │ │ ├── Environment.java │ │ ├── JMod.java │ │ ├── PlistEntry.java │ │ ├── Argument.java │ │ ├── Architecture.java │ │ ├── Option.java │ │ └── TypeDeclaration.java ├── META-INF │ └── gradle-plugins │ │ ├── de.inetsoftware.setupbuilder.properties │ │ └── de.inetsoftware.appbundler.properties └── test │ └── java │ └── com │ └── inet │ └── gradle │ └── setup │ └── msi │ ├── PlatformDetectionTest.java │ └── Launch4jClassifierTest.java ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .findbugs.xml ├── gradle.properties ├── LICENSE ├── .classpath ├── .project ├── scripts ├── SetupBuilderVersion.gradle └── VersionNumber.gradle ├── native └── build.gradle ├── gradlew.bat └── CHANGELOG.md /testBuilds/settings.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.settings/.gitignore: -------------------------------------------------------------------------------- 1 | /gradle/ 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh -text 2 | *.txt -text 3 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/settings.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testBuilds/.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /bin/ 3 | /.classpath 4 | /.project 5 | -------------------------------------------------------------------------------- /testBuilds/test-icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/testBuilds/test-icon.icns -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | **/build/ 3 | **/.gradle/ 4 | /target/ 5 | /build/ 6 | /.gradle/ 7 | /wrapper 8 | **/.DS_Store 9 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/i18n/language-en.properties: -------------------------------------------------------------------------------- 1 | OptionalRunAfterText=Launch [ProductName] 2 | OptionalExitText= -------------------------------------------------------------------------------- /src/META-INF/gradle-plugins/de.inetsoftware.setupbuilder.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.inet.gradle.setup.SetupBuilderPlugin -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/META-INF/gradle-plugins/de.inetsoftware.appbundler.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.inet.gradle.appbundler.AppBundlerPlugin -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/i18n/language-de.properties: -------------------------------------------------------------------------------- 1 | OptionalRunAfterText=[ProductName] ausf\u00FChren 2 | OptionalExitText= -------------------------------------------------------------------------------- /src/com/oracle/appbundler/res.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/oracle/appbundler/res.zip -------------------------------------------------------------------------------- /src/com/oracle/appbundler/GenericApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/oracle/appbundler/GenericApp.icns -------------------------------------------------------------------------------- /src/com/oracle/appbundler/JavaAppLauncher: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/oracle/appbundler/JavaAppLauncher -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/sdk/MsiTran.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/sdk/MsiTran.exe -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/template.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/x64/prunsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/x64/prunsrv.exe -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/x86/prunmgr.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/x86/prunmgr.exe -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/x86/prunsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/x86/prunsrv.exe -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/ia64/prunsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/ia64/prunsrv.exe -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/sdk/signtool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/msi/sdk/signtool.exe -------------------------------------------------------------------------------- /src/com/oracle/appbundler/JavaAppLauncher_x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/oracle/appbundler/JavaAppLauncher_x86_64 -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/dmgbuild: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/template/dmgbuild/dmgbuild -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/settings.00.script.py.txt: -------------------------------------------------------------------------------- 1 | import os.path 2 | import plistlib 3 | 4 | # 5 | # Here comes the included script 6 | # 7 | 8 | {{script}} 9 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/status/gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/Resources/status/gray.png -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/status/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/Resources/status/red.png -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/ProductIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/Resources/ProductIcon.icns -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/status/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/Resources/status/green.png -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/status/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/Resources/status/yellow.png -------------------------------------------------------------------------------- /.findbugs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/xcuserdata/gamma.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 03/02/2016. 6 | // Copyright © 2016 i-net software. All rights reserved. 7 | // 8 | 9 | #include "Variables.h" 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/xcuserdata/gamma.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i-net-software/SetupBuilder/HEAD/src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/xcuserdata/gamma.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/util/Strings.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.util; 2 | 3 | public final class Strings { 4 | private Strings() { 5 | throw new UnsupportedOperationException( "Not instantiatable" ); 6 | } 7 | 8 | public static String defaultString( String string, String fallback ) { 9 | return string != null ? string : fallback; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # SetupBuilder version 2 | # Format: .. or ..-SNAPSHOT 3 | # The major.minor part should match the Gradle version compatibility: 4 | # - Gradle 8.0+ → SetupBuilder 8.4.x 5 | # - Gradle 7.2+ → SetupBuilder 7.2.x 6 | # - Gradle 4.8+ → SetupBuilder 4.8.x 7 | # etc. (see scripts/SetupBuilderVersion.gradle for full mapping) 8 | version = 8.4.24-SNAPSHOT 9 | 10 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Common/NSString+MD5.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MD5.h 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 14.04.20. 6 | // Copyright © 2020 i-net software. All rights reserved. 7 | // 8 | 9 | #ifndef NSString_MD5_h 10 | #define NSString_MD5_h 11 | 12 | @interface NSString (MD5) 13 | 14 | - (NSString *) md5; 15 | - (BOOL) isEqualToMD5CString:(const char *)aString; 16 | 17 | @end 18 | 19 | 20 | #endif /* NSString_MD5_h */ 21 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/en.lproj/Strings.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Strings.strings 3 | SetupBuilderOSXPrefPane 4 | 5 | Created by Gerry Weißbach on 20/01/2016. 6 | Copyright © 2016 i-net software. All rights reserved. 7 | */ 8 | "informativeUninstall" = "This will remove '%@' and the preference pane it is connected to."; 9 | "willUninstall" = "Do you really want to remove '%@'?"; 10 | "Yes" = "Yes"; 11 | "Cancel" = "Cancel"; 12 | "Uninstall" = "Uninstall"; 13 | "runAsRoot" = " (runs as '%@')"; 14 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/de.lproj/Strings.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Strings.strings 3 | SetupBuilderOSXPrefPane 4 | 5 | Created by Gerry Weißbach on 20/01/2016. 6 | Copyright © 2016 i-net software. All rights reserved. 7 | */ 8 | "informativeUninstall" = "Hiermit wird '%@' und das damit verbundene Systemsteuerungsprogramm entfernt."; 9 | "willUninstall" = "Möchten Sie '%@' wirklich entfernen?"; 10 | "Yes" = "Ja"; 11 | "Cancel" = "Abbrechen"; 12 | "Uninstall" = "Deinstallation"; 13 | "runAsRoot" = " (als '%@' ausführen)"; 14 | -------------------------------------------------------------------------------- /testBuilds/template.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 1 8 | 9 | 1 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url('https://openbakery.org/repository/') 5 | } 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | classpath "org.openbakery:xcode-plugin:0.23.+" 11 | } 12 | } 13 | 14 | apply plugin: "org.openbakery.xcode-plugin" 15 | 16 | group = 'de.inetsoftware' 17 | version = '2.0' 18 | 19 | xcodebuild { 20 | scheme = 'SetupBuilderOSXPrefPane' 21 | target = 'SetupBuilderOSXPrefPane' 22 | configuration = 'Release' 23 | type = 'OSX' 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 - 2016 i-net software 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/lib/OnOffSwitchControl/OnOffSwitchControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // OnOffSwitchControl.h 3 | // OnOffSwitchControl 4 | // 5 | // Created by Peter Hosey on 2010-01-10. 6 | // Copyright 2010 Peter Hosey. All rights reserved. 7 | // 8 | // Extended by Dain Kaplan on 2012-01-31. 9 | // Copyright 2012 Dain Kaplan. All rights reserved. 10 | // 11 | // Extended by Pim Snel on 2012-12-10. 12 | // Copyright 2012 Pim Snel. All rights reserved. 13 | 14 | 15 | #import 16 | 17 | IB_DESIGNABLE 18 | @interface OnOffSwitchControl : NSButton { 19 | 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/service/watchuninstall.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | {{serviceName}}.uninstall 7 | Program 8 | watch.uninstall.application.program 9 | WatchPaths 10 | 11 | StandardOutPath 12 | /tmp/test.stdout 13 | StandardErrorPath 14 | /tmp/test.stderr 15 | RunAtLoad 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/preinstall.remove-service.txt: -------------------------------------------------------------------------------- 1 | 2 | DAEMON_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.plist" 3 | PREFPANE_DESTINATION="/Library/PreferencePanes/{{displayName}}.prefPane" 4 | if /bin/launchctl list "{{serviceName}}" &> /dev/null; then 5 | echo "Unloading previous service" 6 | /bin/launchctl unload "$DAEMON_DESTINATION" 7 | fi 8 | 9 | if test -e "$DAEMON_DESTINATION"; then 10 | echo "Removing previous service file" 11 | rm "$DAEMON_DESTINATION" 12 | fi 13 | 14 | if test -e "$PREFPANE_DESTINATION"; then 15 | echo "Removing previous preferences link" 16 | rm "$PREFPANE_DESTINATION" 17 | fi 18 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/preinstall.txt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # pre-installation script 3 | 4 | set -e 5 | 6 | SCRIPT_PATH=`dirname "$0"` 7 | TARGET_LOCATION=${2%/} 8 | 9 | # Remove watcher before anything can start 10 | AGENT_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.uninstall.plist" 11 | if /bin/launchctl list "{{serviceName}}.uninstall" &> /dev/null; then 12 | echo "Unloading previous service uninstall script" 13 | /bin/launchctl unload "$AGENT_DESTINATION" 14 | fi 15 | 16 | if [ -e "$AGENT_DESTINATION" ]; then 17 | echo "Removing previous service uninstall script" 18 | rm "$AGENT_DESTINATION" 19 | fi 20 | 21 | {{script}} 22 | -------------------------------------------------------------------------------- /.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.commands=org.eclipse.jdt.core.javabuilder 4 | build.scans.enabled=false 5 | connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.4)) 6 | connection.project.dir= 7 | containers=org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/ 8 | derived.resources=.gradle,build 9 | eclipse.preferences.version=1 10 | gradle.user.home= 11 | java.home= 12 | jvm.arguments= 13 | natures=org.eclipse.jdt.core.javanature 14 | offline.mode=false 15 | override.workspace.settings=true 16 | project.path=\: 17 | show.console.view=false 18 | show.executions.view=false 19 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SetupBuilder 4 | Project SetupBuilder created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/utils/xmlwise/XmlParseException.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.appbundler.utils.xmlwise; 2 | 3 | /** 4 | * Generic exception when parsing xml. 5 | * 6 | * @author Christoffer Lerno 7 | */ 8 | public class XmlParseException extends Exception 9 | { 10 | private static final long serialVersionUID = -3246260520113823143L; 11 | 12 | public XmlParseException(Throwable cause) 13 | { 14 | super(cause); 15 | } 16 | 17 | public XmlParseException(String message) 18 | { 19 | super(message); 20 | } 21 | 22 | public XmlParseException(String message, Throwable cause) 23 | { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/postuninstall.remove.user.txt: -------------------------------------------------------------------------------- 1 | 2 | DAEMON_USER="{{daemonUser}}" 3 | HOME_DIRECTORY="{{homeDirectory}}" 4 | 5 | dscl . -delete "/Users/${DAEMON_USER}" || echo "Could not remove the user '${DAEMON_USER}'" 6 | dscl . -delete "/Groups/${DAEMON_USER}" || echo "Could not remove the group '${DAEMON_USER}'" 7 | 8 | if [ -n "${HOME_DIRECTORY}" ] && [ -d "${HOME_DIRECTORY}" ] && [[ "${HOME_DIRECTORY}" =~ "/Library/Application Support/" ]]; then 9 | echo "Removing the Users '${DAEMON_USER}' home directory '${HOME_DIRECTORY}'." 10 | rm -r "${HOME_DIRECTORY}" 11 | else 12 | echo "Did not remove the Users '${DAEMON_USER}' home directory '${HOME_DIRECTORY}'." 13 | fi 14 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/systemd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | 3 | Description={{description}} 4 | #Documentation= 5 | #Requires= 6 | #Wants= 7 | #BindsTo= 8 | #Before= 9 | #After= 10 | #Conflicts= 11 | #Condition= 12 | #Assert= 13 | 14 | [Service] 15 | Type=simple 16 | ExecStartPre={{servicePreScript}} 17 | ExecStart={{daemonExec}} {{javaVMArguments}} -cp "{{mainJar}}" {{mainClass}} {{startArguments}} 18 | ExecStartPost={{servicePostScript}} 19 | #ExecReload= 20 | WorkingDirectory={{workdir}} 21 | Restart=on-failure 22 | User={{daemonUser}} 23 | AmbientCapabilities=CAP_NET_BIND_SERVICE 24 | 25 | [Install] 26 | WantedBy=multi-user.target 27 | #RequiredBy= 28 | #Alias= 29 | #Also= 30 | #DefaultInstance= -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/codec/ico/ICOConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ICOConstants.java 3 | * 4 | * Created on May 13, 2006, 8:07 PM 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.codec.ico; 11 | 12 | /** 13 | * Provides constants used with ICO format. 14 | * @author Ian McDonagh 15 | */ 16 | public class ICOConstants { 17 | 18 | /** 19 | * Indicates that ICO data represents an icon (.ICO). 20 | */ 21 | public static final int TYPE_ICON = 1; 22 | /** 23 | * Indicates that ICO data represents a cursor (.CUR). 24 | */ 25 | public static final int TYPE_CURSOR = 2; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/Service/Process.h: -------------------------------------------------------------------------------- 1 | // 2 | // Process.h 3 | // LaunchRocket 4 | // 5 | // Created by Josh Butts on 1/24/14. 6 | // Copyright (c) 2014 Josh Butts. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Authorization.h" 11 | 12 | @class Service; 13 | @interface Process : NSObject { 14 | 15 | id auth; 16 | } 17 | 18 | - (id) initWithAuthProvider:(id) auth; 19 | 20 | - (BOOL) runHelperTaskList:(NSArray *)argList; 21 | - (void) runTaskAsync:(NSString *)argument from:(NSString *)workingDirectory; 22 | 23 | +(NSArray*)getBSDProcessList; 24 | +(NSDictionary*)getProcessByService:(Service *)service; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/settings.02.icons.py.txt: -------------------------------------------------------------------------------- 1 | 2 | # Symlinks to create 3 | symlinks = { {{symlinks}} } 4 | 5 | # Files to hide 6 | # hide = [ 'Secret.data' ] 7 | 8 | # Files to hide the extension of 9 | # hide_extension = [ 'README.rst' ] 10 | 11 | # Volume icon 12 | # 13 | # You can either define icon, in which case that icon file will be copied to the 14 | # image, *or* you can define badge_icon, in which case the icon file you specify 15 | # will be used to badge the system's Removable Disk icon. Badge icons require 16 | # pyobjc-framework-Quartz. 17 | # 18 | icon = defines.get("icon", None) 19 | badge_icon = defines.get("badge_icon", icon_from_app(application) ) 20 | 21 | # Where to put the icons 22 | icon_locations = { {{iconLocations}} } 23 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/deb/template/preinst.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # preinst script for {{baseName}} 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `install' 10 | # * `install' 11 | # * `upgrade' 12 | # * `abort-upgrade' 13 | # for details, see http://www.debian.org/doc/debian-policy/ or 14 | # the debian-policy package 15 | 16 | . /usr/share/debconf/confmodule 17 | 18 | {{variables}} 19 | 20 | {{head}} 21 | 22 | case "$1" in 23 | install|upgrade) 24 | ;; 25 | 26 | abort-upgrade) 27 | ;; 28 | 29 | *) 30 | echo "preinst called with unknown argument \`$1'" >&2 31 | exit 1 32 | ;; 33 | esac 34 | 35 | {{tail}} 36 | 37 | exit 0 38 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/xcuserdata/gamma.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SetupBuilderOSXPrefPane.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | helper.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 3066D9CF1B60D49400729DB7 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /testBuilds/jnlpBundler.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | mavenCentral() 5 | // For snapshots, add Sonatype snapshot repository 6 | maven { 7 | url uri('https://oss.sonatype.org/content/repositories/snapshots/') 8 | } 9 | } 10 | dependencies { 11 | apply from: "${buildscript.sourceFile.parentFile.parentFile}/scripts/SetupBuilderVersion.gradle" 12 | classpath 'de.inetsoftware:SetupBuilder:' + setupBuilderVersion() 13 | } 14 | } 15 | 16 | apply plugin: 'de.inetsoftware.appbundler' 17 | 18 | appBundler { 19 | 20 | application = "jnlpBundler Test Build" 21 | description = 'Build a test programm.' 22 | appIdentifier = "com.inet.jnlpBundler" 23 | icons = "test-icon.icns" 24 | 25 | jnlpLauncherName = 'Contents/_CodeSignature/bundler.jnlp' 26 | } 27 | -------------------------------------------------------------------------------- /testBuilds/longDesc_en.txt: -------------------------------------------------------------------------------- 1 | This package installs i-net Clear Reports server in 2 steps. 2 | ================================================ 3 | First, the program files are copied to /usr/share/i-net-clear-reports. 4 | Then the installer will automatically attempt to open the browser to configure 5 | the server (i.e. set up the proxy, etc.). Depending on your environment 6 | and package installer, this may not work - if the browser does not automatically open up, 7 | please check the file /usr/share/i-net-clear-reports/webconfig.txt and enter 8 | the UUID there in the server web configuration page at http://localhost:9000/setup 9 | (note that if a different port than 9000 is specified in the webconfig.txt, use this one). 10 | Note: This package doesn't work with all graphical package managers. We recommend to use 11 | the command-line tools for installation instead. -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/SetupBuilderOSXPrefPane.h: -------------------------------------------------------------------------------- 1 | // 2 | // SetupBuilderOSXPrefPane.h 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 23/07/2015. 6 | // Copyright (c) 2015 i-net software. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "Authorization.h" 13 | 14 | @class ServiceController, Service; 15 | @interface SetupBuilderOSXPrefPane : NSPreferencePane 16 | { 17 | IBOutlet ServiceController *serviceController; 18 | IBOutlet SFAuthorizationView *authView; 19 | 20 | Service *service; 21 | NSBundle *bundle; 22 | NSString *helperPath; 23 | } 24 | 25 | - (id)initWithBundle:(NSBundle *)bundle; 26 | - (void)mainViewDidLoad; 27 | - (void)didUnselect; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/xcuserdata/gamma.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 12 | 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | SnapshotAutomaticallyBeforeSignificantChanges 18 | 19 | SnapshotLocationStyle 20 | Default 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/util/Logging.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.util; 2 | 3 | /** 4 | * Wrapper Class for logging using the environment variable _SETUPBUILDER_DEBUG=true 5 | * @author gamma 6 | * 7 | */ 8 | public class Logging { 9 | 10 | public static final boolean DEBUG_LOG = System.getenv( "_SETUPBUILDER_DEBUG" ) != null; 11 | 12 | /** 13 | * Convenience Method to log output only if environment has _SETUPBUILDER_DEBUG=true 14 | * @param message to log 15 | */ 16 | public static void sysout( String message ) { 17 | if ( ! DEBUG_LOG ) { 18 | return; 19 | } 20 | 21 | System.out.println( message ); 22 | } 23 | 24 | /** 25 | * Convenience Method for error logging. Will always log. 26 | * @param message to log 27 | */ 28 | public static void syserr( String message ) { 29 | System.err.println( message ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/deb/template/prerm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # prerm script for {{baseName}} 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `upgrade' 11 | # * `failed-upgrade' 12 | # * `remove' `in-favour' 13 | # * `deconfigure' `in-favour' 14 | # `removing' 15 | # 16 | # for details, see http://www.debian.org/doc/debian-policy/ or 17 | # the debian-policy package 18 | 19 | {{variables}} 20 | 21 | {{head}} 22 | 23 | case "$1" in 24 | remove|upgrade|deconfigure) 25 | ;; 26 | 27 | failed-upgrade) 28 | ;; 29 | 30 | *) 31 | echo "prerm called with unknown argument \`$1'" >&2 32 | exit 1 33 | ;; 34 | esac 35 | 36 | {{tail}} 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Common/Service.h: -------------------------------------------------------------------------------- 1 | // 2 | // Service.h 3 | // LaunchRocket 4 | // 5 | // Created by Josh Butts on 3/26/13. 6 | // Copyright (c) 2013 Josh Butts. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "Process.h" 11 | 12 | @interface Service : NSObject 13 | 14 | @property (retain) NSURL* plist; 15 | @property (retain) NSString* identifier; 16 | @property (retain) NSString* name; 17 | @property (retain) NSString* description; 18 | @property (retain) NSString* version; 19 | @property (retain) NSString* program; 20 | @property (retain) NSArray* starter; 21 | 22 | @property bool useSudo; 23 | @property bool runAtBoot; 24 | 25 | - (id) initWithPlistURL:(NSURL *)plistURL; 26 | - (NSString *)pathForService; 27 | - (NSDictionary *)starterForHash:(const char *)md5; 28 | 29 | + (NSString *)userFor:(NSDictionary *)starter; 30 | + (NSString *)titleFor:(NSDictionary *)starter; 31 | + (NSString *)actionFor:(NSDictionary *)starter; 32 | + (BOOL)runAsRoot:(NSDictionary *)starter; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /scripts/SetupBuilderVersion.gradle: -------------------------------------------------------------------------------- 1 | 2 | ext.setupBuilderVersion = { buildVersion = '+' -> 3 | 4 | def baseVersion = '2.0' // Base Version to build, depends on gradle version. 5 | def version = baseVersion 6 | 7 | // gradle version switch, depends the API level 8 | println 'Gradle version: ' + gradle.gradleVersion 9 | def gVersion = VersionNumber.parse( gradle.gradleVersion ) 10 | if( gVersion >= VersionNumber.parse( '3.0' ) ) version = '3.0' 11 | if( gVersion >= VersionNumber.parse( '3.1' ) ) version = '3.1' 12 | if( gVersion >= VersionNumber.parse( '3.4' ) ) version = '3.4' 13 | if( gVersion >= VersionNumber.parse( '4.2' ) ) version = '4.2' 14 | if( gVersion >= VersionNumber.parse( '4.5' ) ) version = '4.5' 15 | if( gVersion >= VersionNumber.parse( '4.8' ) ) version = '4.8' 16 | if( gVersion >= VersionNumber.parse( '7.2' ) ) version = '7.2' 17 | if( gVersion >= VersionNumber.parse( '8.0' ) ) version = '8.4' 18 | return version + '.' + buildVersion 19 | } 20 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/deb/template/postinst.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # postinst script for {{baseName}} 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `configure' 10 | # * `abort-upgrade' 11 | # * `abort-remove' `in-favour' 12 | # 13 | # * `abort-remove' 14 | # * `abort-deconfigure' `in-favour' 15 | # `removing' 16 | # 17 | # for details, see http://www.debian.org/doc/debian-policy/ or 18 | # the debian-policy package 19 | 20 | {{variables}} 21 | 22 | {{head}} 23 | 24 | case "$1" in 25 | configure) 26 | ;; 27 | 28 | abort-upgrade|abort-remove|abort-deconfigure) 29 | ;; 30 | 31 | *) 32 | echo "postinst called with unknown argument \`$1'" >&2 33 | exit 1 34 | ;; 35 | esac 36 | 37 | {{tail}} 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Common/NSString+MD5.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MD5.m 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 14.04.20. 6 | // Copyright © 2020 i-net software. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "Variables.h" 12 | 13 | @implementation NSString (MD5) 14 | 15 | - (NSString *) md5 16 | { 17 | const char *cStr = [self UTF8String]; 18 | unsigned char digest[16]; 19 | CC_MD5( cStr, (unsigned int)strlen(cStr), digest ); // This is the md5 call 20 | 21 | NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; 22 | for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { 23 | [output appendFormat:@"%02x", digest[i]]; 24 | } 25 | 26 | return output; 27 | } 28 | 29 | - (BOOL) isEqualToMD5CString:(const char *)aString 30 | { 31 | DLog(@"Checking if `%@` (%@) matches `%s`", self, [self md5], aString); 32 | return [[self md5] isEqualToString:[NSString stringWithCString:aString encoding:NSASCIIStringEncoding]]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/Service/Authorization.h: -------------------------------------------------------------------------------- 1 | // Licensed to Elasticsearch B.V. under one or more contributor 2 | // license agreements. See the NOTICE file distributed with 3 | // this work for additional information regarding copyright 4 | // ownership. Elasticsearch B.V. licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may 6 | // not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | @protocol AuthorizationProvider 19 | - (BOOL) isUnlocked; 20 | - (BOOL) forceUnlock; 21 | - (int) runAsRoot:(NSString*) program args:(NSArray*)args; 22 | - (int) runHelperAsRootWithArgs:(NSArray*)args; 23 | @end 24 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/codec/bmp/BMPConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * BMPConstants.java 3 | * 4 | * Created on 10 May 2006, 08:17 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.codec.bmp; 11 | 12 | /** 13 | * Provides constants used with BMP format. 14 | * @author Ian McDonagh 15 | */ 16 | public class BMPConstants { 17 | 18 | private BMPConstants() { } 19 | 20 | /** 21 | * The signature for the BMP format header "BM". 22 | */ 23 | public static final String FILE_HEADER = "BM"; 24 | 25 | /** 26 | * Specifies no compression. 27 | * @see InfoHeader#iCompression InfoHeader 28 | */ 29 | public static final int BI_RGB = 0; //no compression 30 | /** 31 | * Specifies 8-bit RLE compression. 32 | * @see InfoHeader#iCompression InfoHeader 33 | */ 34 | public static final int BI_RLE8 = 1; //8bit RLE compression 35 | /** 36 | * Specifies 4-bit RLE compression. 37 | * @see InfoHeader#iCompression InfoHeader 38 | */ 39 | public static final int BI_RLE4 = 2; //4bit RLE compression 40 | } 41 | -------------------------------------------------------------------------------- /scripts/VersionNumber.gradle: -------------------------------------------------------------------------------- 1 | public class VersionNumber implements Comparable { 2 | List parts 3 | 4 | VersionNumber( String version ) { 5 | parts = version.tokenize('.').collect { it.isInteger() ? it.toInteger() : 0 } 6 | } 7 | 8 | public static VersionNumber parse( String version ) { 9 | return new VersionNumber( version ); 10 | } 11 | 12 | @Override 13 | int compareTo( VersionNumber other ) { 14 | int maxLength = Math.max(this.parts.size(), other.parts.size()) 15 | for (int i = 0; i < maxLength; i++) { 16 | int a = i < this.parts.size() ? this.parts[i] : 0 17 | int b = i < other.parts.size() ? other.parts[i] : 0 18 | int cmp = a <=> b 19 | if (cmp != 0) return cmp 20 | } 21 | return 0 22 | } 23 | 24 | boolean equals(Object o) { 25 | return this.compareTo( o as VersionNumber ) == 0 26 | } 27 | 28 | int hashCode() { 29 | return parts.hashCode() 30 | } 31 | 32 | String toString() { 33 | return parts.join(".") 34 | } 35 | } 36 | 37 | ext.VersionNumber = new VersionNumber( '' ) 38 | -------------------------------------------------------------------------------- /testBuilds/longDesc_de.txt: -------------------------------------------------------------------------------- 1 | Dieses Paket istalliert den i-net Clear Reports Server in 2 Schritten. 2 | ========================================================== 3 | Zuerst werden die Programmdateien nach /usr/share/i-net-clear-reports kopiert. 4 | Danach sollte vom Installer automatisch der Browser mit der Weboberflache 5 | zur Konfiguration (z.B. Proxy) geöffnet werden. Dies kann 6 | aber in Abhängigkeit vom System und Paketinstaller nicht funktionieren. 7 | | 8 | Sollte kein Browser mit der Weboberfläche geöffnet werden, öffnen sie bitte 9 | die /usr/share/i-net-clear-reports/webconfig.txt Datei. In dieser Datei 10 | finden Sie alle notwendigen Daten um auf die Weboberfläche zuzugreifen. 11 | Standardmäßig läuft der i-net Clear Reports Server auf http://localhost:9000. 12 | | 13 | Öffnen Sie nun die Weboberfläche für die Konfiguration selbst mit http://localhost:9000/setup 14 | Dort müssen sie die UUID aus der webconfig.txt eintragen. 15 | (Hinweis: Wenn in der webconfig.txt ein anderer Port angegeben ist, benutzen Sie bitte diesen.) 16 | | 17 | Hinweis: Dieses Paket funktioniert nicht mit allen grafischen Paket-Managern. Wir empfehlen zur Installation 18 | die Kommandozeilentools. -------------------------------------------------------------------------------- /testBuilds/appBundler.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | mavenCentral() 5 | // For snapshots, add Sonatype snapshot repository 6 | maven { 7 | url uri('https://oss.sonatype.org/content/repositories/snapshots/') 8 | } 9 | } 10 | dependencies { 11 | apply from: "${buildscript.sourceFile.parentFile.parentFile}/scripts/SetupBuilderVersion.gradle" 12 | classpath 'de.inetsoftware:SetupBuilder:' + setupBuilderVersion() 13 | } 14 | } 15 | 16 | apply plugin: 'de.inetsoftware.appbundler' 17 | 18 | apply plugin: 'java' 19 | 20 | sourceSets { 21 | main { 22 | java { 23 | srcDirs 'src' 24 | } 25 | } 26 | } 27 | 28 | appBundler { 29 | 30 | application = "appBundler Test Build" 31 | description = 'Build a test programm.' 32 | icons = "test-icon.icns" 33 | 34 | from jar.outputs 35 | 36 | bundleJre = 11 37 | mainClass = 'com.inet.testapplication.TestLauncher' 38 | mainJar = 'testBuilds.jar' 39 | } 40 | 41 | bundleApp { 42 | dependsOn jar 43 | /* 44 | codeSign { 45 | identity = 'Developer ID Application' 46 | } 47 | */ 48 | } 49 | -------------------------------------------------------------------------------- /testBuilds/src/com/inet/testapplication/TestLauncher.java: -------------------------------------------------------------------------------- 1 | package com.inet.testapplication; 2 | 3 | import javax.swing.JFrame; 4 | import javax.swing.JOptionPane; 5 | import javax.swing.UIManager; 6 | 7 | /** 8 | * Test Program 9 | */ 10 | public class TestLauncher { 11 | 12 | /** 13 | * Startpunkt vom Installer 14 | * 15 | * @param args ignored 16 | * @throws Exception if any error occur on connection the server 17 | */ 18 | public static void main( String[] args ) throws Exception { 19 | try { 20 | // Set OS L&F if some error message will be displayed 21 | UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); 22 | } catch( Throwable e ) { 23 | // ignore 24 | } 25 | 26 | final JFrame frame = new JFrame( "Test Application" ); 27 | frame.setUndecorated( true ); 28 | frame.setAlwaysOnTop( true ); 29 | frame.setVisible( true ); 30 | frame.setLocationRelativeTo( null ); 31 | JOptionPane.showMessageDialog( frame, "The Application seems to work, right?", "Test Application", JOptionPane.OK_OPTION ); 32 | frame.dispose(); 33 | System.exit(0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Resources/service.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Description 6 | application.description 7 | KeepAlive 8 | 9 | Label 10 | application.label 11 | Name 12 | application name 13 | Program 14 | application.app 15 | RunAsRoot 16 | 17 | RunAtBoot 18 | 19 | RunAtLoad 20 | 21 | Version 22 | 1.0.0 23 | starter 24 | 25 | 26 | asroot 27 | 28 | title 29 | Test Link - keeps open 30 | action 31 | /usr/bin/osascript -e "display dialog \"Hello World\"" 32 | asuser 33 | root 34 | 35 | 36 | title 37 | Test Link 38 | action 39 | echo "Hello World" 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /testBuilds/fragmentDlg.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1 10 | 11 | 12 | 1 13 | 14 | 15 | 16 | 17 | 1 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/Launch4j.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.msi; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.inet.gradle.setup.abstracts.AbstractSetupBuilder; 6 | import com.inet.gradle.setup.abstracts.DesktopStarter; 7 | 8 | public class Launch4j extends DesktopStarter implements Serializable { 9 | 10 | private String requestedExecutionLevel = "requireAdministrator"; 11 | 12 | /** 13 | * Create a new DesktopStarter 14 | * 15 | * @param setup current SetupBuilder 16 | */ 17 | public Launch4j( AbstractSetupBuilder setup ) { 18 | super( setup ); 19 | } 20 | 21 | /** 22 | * Sets the requested execution level for launch4j 23 | * 24 | * @param requestedExecutionLevel the requested execution level 25 | */ 26 | public void setRequestedExecutionLevel( String requestedExecutionLevel ) { 27 | this.requestedExecutionLevel = requestedExecutionLevel; 28 | } 29 | 30 | /** 31 | * Returns the requested execution level 32 | * 33 | * @return the requested execution level, "requireAdministrator" by default or null if unset 34 | */ 35 | public String getRequestedExecutionLevel() { 36 | return requestedExecutionLevel; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/deb/template/postrm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # postrm script for {{baseName}} 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see http://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | # confmodule is required for further commands like db_purge, db_input, db_get ... 22 | . /usr/share/debconf/confmodule 23 | 24 | {{variables}} 25 | 26 | {{head}} 27 | 28 | case "$1" in 29 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 30 | ;; 31 | 32 | *) 33 | echo "postrm called with unknown argument \`$1'" >&2 34 | exit 1 35 | ;; 36 | esac 37 | 38 | if [ "$1" = "purge" ]; then 39 | # Remove my changes to the db. 40 | db_purge 41 | fi 42 | 43 | 44 | {{tail}} 45 | 46 | exit 0 47 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Common/Variables.h: -------------------------------------------------------------------------------- 1 | // 2 | // Variables.h 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 14.04.20. 6 | // Copyright © 2020 i-net software. All rights reserved. 7 | // 8 | 9 | #ifndef Variables_h 10 | #define Variables_h 11 | 12 | #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) 13 | 14 | //* 15 | #define CLog(...) DLog(__VA_ARGS__) 16 | /*/ 17 | #define CLog(...) fprintf(stderr, "%s %s", __PRETTY_FUNCTION__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]) 18 | //*/ 19 | 20 | #define localized(name) NSLocalizedStringFromTableInBundle(name, @"Strings", [NSBundle bundleForClass:[self class]], NULL) 21 | 22 | // Helper binary name 23 | #define HELPER_BINARY @"helper" 24 | 25 | // Path where to look for launch services 26 | #define LAUNCHDAEMONS_PATH @"/Library/LaunchDaemons" 27 | 28 | // Path for user daemons 29 | #define LAUNCHAGENTS_PATH @"/Library/LaunchAgents" 30 | 31 | // Path to launchctl executable 32 | #define LAUNCHCTL_PATH @"/bin/launchctl" 33 | 34 | #define SERVICE_ACTION_UNINSTALL_SOFTWARE @"uninstall" 35 | #define SERVICE_ACTION_REMOVE @"removeService" 36 | #define SERVICE_ACTION_INSTALL @"installService" 37 | #define SERVICE_ACTION_RUNAS @"runas" 38 | 39 | #endif /* Variables_h */ 40 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSHumanReadableCopyright 24 | Copyright © 2019 i-net software. All rights reserved. 25 | NSMainNibFile 26 | SetupBuilderOSXPrefPane 27 | NSPrefPaneIconFile 28 | ProductIcon.icns 29 | NSPrefPaneIconLabel 30 | PDFC Server 31 | NSPrincipalClass 32 | SetupBuilderOSXPrefPane 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/setIcon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sets an icon on file or directory 3 | # Usage setIcon.sh iconimage.jpg /path/to/[file|folder] 4 | # see https://stackoverflow.com/questions/8371790/how-to-set-icon-on-file-or-directory-using-cli-on-os-x 5 | 6 | iconSource=$1 7 | iconDestination=$2 8 | icon=/tmp/`basename "$iconSource"` 9 | rsrc=/tmp/icon.rsrc 10 | 11 | # Create icon from the iconSource 12 | cp "$iconSource" "$icon" 13 | 14 | # Add icon to image file, meaning use itself as the icon 15 | sips -i "$icon" 16 | 17 | # Take that icon and put it into a rsrc file 18 | DeRez -only icns "$icon" > "$rsrc" 19 | 20 | # Apply the rsrc file to 21 | SetFile -a C "$iconDestination" 22 | 23 | if [ -f "$iconDestination" ]; then 24 | # Destination is a file 25 | Rez -append "$rsrc" -o "$iconDestination" 26 | elif [ -d "$iconDestination" ]; then 27 | # Destination is a directory 28 | # Create the magical Icon\r file 29 | touch "$iconDestination/$'Icon\r'" 30 | Rez -append "$rsrc" -o "$iconDestination/Icon?" 31 | SetFile -a V "$iconDestination/Icon?" 32 | fi 33 | 34 | # Sometimes Finder needs to be reactivated 35 | #osascript -e 'tell application "Finder" to quit' 36 | #osascript -e 'delay 2' 37 | #osascript -e 'tell application "Finder" to activate' 38 | 39 | rm "$rsrc" "$icon" 40 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/PreferencesLink.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.dmg; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Link for the preferences 7 | * Takes a title and an action 8 | * 9 | * @author gamma 10 | * 11 | */ 12 | public class PreferencesLink implements Serializable { 13 | 14 | private String title; 15 | 16 | private String action; 17 | 18 | private boolean runAsRoot = false; 19 | 20 | /** 21 | * @return the title 22 | */ 23 | public String getTitle() { 24 | return title; 25 | } 26 | 27 | /** 28 | * @return the action 29 | */ 30 | public String getAction() { 31 | return action; 32 | } 33 | 34 | /** 35 | * @param title the title to set 36 | */ 37 | public void setTitle( String title ) { 38 | this.title = title; 39 | } 40 | 41 | /** 42 | * @param action the action to set 43 | */ 44 | public void setAction( String action ) { 45 | this.action = action; 46 | } 47 | 48 | /** 49 | * @return the runAsRoot 50 | */ 51 | public boolean isRunAsRoot() { 52 | return runAsRoot; 53 | } 54 | 55 | /** 56 | * @param runAsRoot the runAsRoot to set 57 | */ 58 | public void setRunAsRoot( boolean runAsRoot ) { 59 | this.runAsRoot = runAsRoot; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/runBeforeAfter.txt: -------------------------------------------------------------------------------- 1 | # if there is a setup or something else to be started, do so now 2 | JAVAEXECUTABLE=`find "$TARGET_LOCATION/{{installationSubdirectory}}{{displayName}}.app/Contents" -name "java" -type f` 3 | RUNAFTER_MAINJAR="{{mainJar}}" 4 | RUNAFTER_MAINCLASS="{{mainClass}}" 5 | RUNAFTER_WORKINGDIR="$TARGET_LOCATION/{{installationSubdirectory}}{{displayName}}.app/Contents/Java/{{workingDir}}" 6 | RUNINBACKGROUND="{{inBackground}}" 7 | 8 | # this is to be inteded with an embedded JRE and existing jars only 9 | if [ -n "$JAVAEXECUTABLE" ]; then 10 | 11 | # enable monitor for jobs 12 | set -o monitor 13 | 14 | # if the directory exists, start the run after 15 | if [ -e "$RUNAFTER_WORKINGDIR" ]; then 16 | if [ -z "$RUNAFTER_MAINCLASS" ]; then 17 | $(cd "$RUNAFTER_WORKINGDIR" && sudo -u "${USER:-root}" "$JAVAEXECUTABLE" -jar "$RUNAFTER_MAINJAR" {{startArgument}})& 18 | else 19 | $(cd "$RUNAFTER_WORKINGDIR" && sudo -u "${USER:-root}" "$JAVAEXECUTABLE" -classpath "$RUNAFTER_MAINJAR" "$RUNAFTER_MAINCLASS" {{startArgument}})& 20 | fi 21 | if [ ! -z "$RUNINBACKGROUND" ]; then 22 | # bring job back into foreground 23 | fg %+ 24 | fi 25 | else 26 | echo "Could not find working directory at: '$RUNAFTER_WORKINGDIR'" 27 | fi 28 | fi 29 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/settings.03.window.py.txt: -------------------------------------------------------------------------------- 1 | # .. Window configuration ...................................................... 2 | 3 | # Background 4 | # 5 | # This is a STRING containing any of the following: 6 | # 7 | # #3344ff - web-style RGB color 8 | # #34f - web-style RGB color, short form (#34f == #3344ff) 9 | # rgb(1,0,0) - RGB color, each value is between 0 and 1 10 | # hsl(120,1,.5) - HSL (hue saturation lightness) color 11 | # hwb(300,0,0) - HWB (hue whiteness blackness) color 12 | # cmyk(0,1,0,0) - CMYK color 13 | # goldenrod - X11/SVG named color 14 | # builtin-arrow - A simple built-in background with a blue arrow 15 | # /foo/bar/baz.png - The path to an image file 16 | # 17 | # The hue component in hsl() and hwb() may include a unit; it defaults to 18 | # degrees ('deg'), but also supports radians ('rad') and gradians ('grad' 19 | # or 'gon'). 20 | # 21 | # Other color components may be expressed either in the range 0 to 1, or 22 | # as percentages (e.g. 60% is equivalent to 0.6). 23 | background = "{{background}}" 24 | 25 | show_status_bar = False 26 | show_tab_view = False 27 | show_toolbar = False 28 | show_pathbar = False 29 | show_sidebar = False 30 | sidebar_width = 180 31 | 32 | # Window position in ((x, y), (w, h)) format 33 | window_rect = ((100, 100), ({{windowWidth}}, {{windowHeight}})) 34 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/IconContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015, Quality First Software GmbH and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | */ 23 | 24 | package com.oracle.appbundler; 25 | 26 | import java.io.File; 27 | 28 | public interface IconContainer { 29 | public boolean hasIcon(); 30 | public String getIcon(); 31 | public File getIconFile(); 32 | } 33 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/Environment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015, Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 | * or visit www.oracle.com if you need additional information or have any 24 | * questions. 25 | */ 26 | package com.oracle.appbundler; 27 | 28 | public class Environment extends Option { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/Service/ServiceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ServiceController.h 3 | // LaunchRocket 4 | // 5 | // Created by Josh Butts on 3/28/13. 6 | // Copyright (c) 2013 Josh Butts. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "Service.h" 12 | 13 | @class OnOffSwitchControl; 14 | @interface ServiceController : NSObject { 15 | 16 | IBOutlet OnOffSwitchControl *onOffSwitch; 17 | IBOutlet NSImageView *statusIndicator; 18 | IBOutlet NSTextField *description; 19 | IBOutlet NSTextField *productName; 20 | IBOutlet NSTextField *productVersion; 21 | IBOutlet NSStackView *actionList; 22 | IBOutlet NSButton *uninstall; 23 | } 24 | 25 | typedef enum { 26 | 27 | SERVICE_STOPPED = 0, 28 | SERVICE_RUNNING, 29 | SERVICE_STARTING, 30 | SERVICE_STOPPING 31 | 32 | } SERVICE_STATUS; 33 | 34 | 35 | @property (strong, nonatomic) Service *service; 36 | @property (strong, nonatomic) Process *process; 37 | @property (strong) NSFileManager *fm; 38 | 39 | @property SERVICE_STATUS status; 40 | 41 | -(void) start; 42 | -(void) stop; 43 | -(BOOL) serviceStatusChanged; 44 | -(void) updateStatusIndicator; 45 | -(void) pollStatus; 46 | 47 | -(NSString *)currentBundlePath; 48 | 49 | - (IBAction) handleStartStopClick:(OnOffSwitchControl *)onOff; 50 | - (IBAction) handleUninstallClick:(NSButton *)button; 51 | 52 | -(void) setEnabled:(Boolean) enabled; 53 | @end 54 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/AppBundlerPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.appbundler; 18 | 19 | import java.util.HashMap; 20 | 21 | import org.gradle.api.Plugin; 22 | import org.gradle.api.Project; 23 | import org.gradle.api.plugins.BasePlugin; 24 | 25 | /** 26 | * Plugin for the appBundler Task that will create a bundled application for OSX 27 | * @author gamma 28 | * 29 | */ 30 | public class AppBundlerPlugin implements Plugin { 31 | 32 | @Override 33 | public void apply(Project project) { 34 | // apply the BasePlugin to make the base features like "clean" available by default. 35 | HashMap> plugin = new HashMap<>(); 36 | plugin.put( "plugin", BasePlugin.class ); 37 | project.apply( plugin ); 38 | 39 | project.getExtensions().create( "appBundler", AppBundler.class, project ); 40 | project.getTasks().create( "bundleApp", AppBundlerGradleTask.class ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/JMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019, ATTO Technology, Inc. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. ATTO Technology designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by ATTO Technology in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | */ 23 | 24 | package com.oracle.appbundler; 25 | 26 | /** 27 | * Class representing a module that will be passed to jlink to build the bundled 28 | * JVM. 29 | */ 30 | public class JMod { 31 | private String name = null; 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return name; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/settings.01.base.py.txt: -------------------------------------------------------------------------------- 1 | import os.path 2 | import plistlib 3 | 4 | # 5 | # Example settings file for dmgbuild 6 | # 7 | 8 | # Use like this: dmgbuild -s settings.py "Test Volume" test.dmg 9 | 10 | # You can actually use this file for your own application (not just TextEdit) 11 | # by doing e.g. 12 | # 13 | # dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg 14 | 15 | # .. Useful stuff .............................................................. 16 | 17 | application = defines.get("app", None) # noqa: F821 18 | appname = os.path.basename(application) 19 | 20 | def icon_from_app(app_path): 21 | plist_path = os.path.join(app_path, "Contents", "Info.plist") 22 | if not os.path.exists(plist_path): 23 | return None 24 | with open(plist_path, "rb") as f: 25 | plist = plistlib.load(f) 26 | icon_name = plist["CFBundleIconFile"] 27 | icon_root, icon_ext = os.path.splitext(icon_name) 28 | if not icon_ext: 29 | icon_ext = ".icns" 30 | icon_name = icon_root + icon_ext 31 | return os.path.join(app_path, "Contents", "Resources", icon_name) 32 | 33 | 34 | # .. Basics .................................................................... 35 | 36 | # Uncomment to override the output filename 37 | # filename = 'test.dmg' 38 | 39 | # Uncomment to override the output volume name 40 | # volume_name = 'Test' 41 | 42 | # Volume format (see hdiutil create -help) 43 | format = defines.get("format", "UDRO") # noqa: F821 44 | 45 | # Compression level (if relevant) 46 | compression_level = 9 47 | 48 | # Volume size 49 | size = defines.get("size", None) # noqa: F821 50 | 51 | # Files to include 52 | files = [application] 53 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/postinstall.txt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # post-installation script 3 | 4 | SCRIPT_PATH=`dirname "$0"` 5 | TARGET_LOCATION=${2%/} 6 | UNINSTALL_WATCH="$SCRIPT_PATH/watchuninstall.plist" 7 | AGENT_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.uninstall.plist" 8 | DAEMON_USER="{{daemonUser}}" 9 | 10 | set -e 11 | 12 | echo "SCRIPT_PATH: '$SCRIPT_PATH'" 13 | echo "TARGET_LOCATION: '$TARGET_LOCATION'" 14 | echo "UNINSTALL_WATCH: '$UNINSTALL_WATCH'" 15 | echo "AGENT_DESTINATION: '$AGENT_DESTINATION'" 16 | echo "DAEMON_USER: '$DAEMON_USER'" 17 | echo "I am Batman, or: $(whoami)" 18 | 19 | {{script}} 20 | 21 | ################################################################################################ 22 | ### Update the uninstall watcher 23 | if [ -f "/usr/libexec/PlistBuddy" ]; then 24 | 25 | echo "I am Batman, or: $(whoami)" 26 | # Use libexec as told by Apple to have semipermanent storage for executable for Agent 27 | /usr/bin/ditto "$SCRIPT_PATH/uninstall.sh" "/opt/{{serviceName}}/uninstall.sh" 28 | chown "$(whoami)":wheel "/opt/{{serviceName}}/uninstall.sh" 29 | 30 | /usr/libexec/PlistBuddy -c "Add :WatchPaths: String /Library/PreferencePanes" "$UNINSTALL_WATCH" 31 | /usr/libexec/PlistBuddy -c "Set :Program /opt/{{serviceName}}/uninstall.sh" "$UNINSTALL_WATCH" 32 | else 33 | echo "Cannot properly set up the service without the PlistBuddy tool" 34 | exit 1 35 | fi 36 | 37 | /usr/bin/ditto "$UNINSTALL_WATCH" "$AGENT_DESTINATION" 38 | chown "$(whoami)":wheel "$AGENT_DESTINATION" 39 | chmod 644 "$AGENT_DESTINATION" 40 | /bin/launchctl load "$AGENT_DESTINATION" 41 | 42 | ################################################################################################ 43 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/PlistEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015, Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 | * or visit www.oracle.com if you need additional information or have any 24 | * questions. 25 | */ 26 | package com.oracle.appbundler; 27 | 28 | public class PlistEntry extends Option { 29 | private String type = null; 30 | 31 | public void setKey(String key) { 32 | setName(key); 33 | } 34 | 35 | public String getKey() { 36 | return getName(); 37 | } 38 | 39 | public void setType(String type) { 40 | this.type = type; 41 | } 42 | 43 | public String getType() { 44 | return type; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/abstracts/AbstractUnixSetupTask.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.abstracts; 2 | 3 | import org.gradle.api.tasks.Input; 4 | 5 | /** 6 | * An abstract base for the Unix SetupTask 7 | * @author gamma 8 | */ 9 | public abstract class AbstractUnixSetupTask extends AbstractSetupTask { 10 | 11 | public AbstractUnixSetupTask( String extension ) { 12 | super( extension ); 13 | } 14 | 15 | private String daemonUser = "root"; 16 | private boolean useInitD = false; 17 | 18 | /** 19 | * Returns the user with which the daemon should be running. If no user was specified the default root user will be 20 | * used. 21 | * 22 | * @return the user for the daemon 23 | */ 24 | @Input 25 | public String getDaemonUser() { 26 | if( daemonUser.trim().isEmpty() ) { 27 | return "root"; 28 | } else { 29 | return daemonUser; 30 | } 31 | } 32 | 33 | /** 34 | * Sets the user with which the daemon should be running. 35 | * @param daemonUser the user to be used for the daemon 36 | */ 37 | public void setDaemonUser( String daemonUser ) { 38 | this.daemonUser = daemonUser; 39 | } 40 | 41 | /** 42 | * Checks if the installer should use the old outdated InitD format 43 | * @return true if the installer should use the old outdated InitD format 44 | */ 45 | @Input 46 | public boolean isUseInitD() { 47 | return useInitD ; 48 | } 49 | 50 | /** 51 | * Specifies if the installer should use the old outdated InitD format. Per default the Unix installers 52 | * use the SystemD daemon format. 53 | * @param useInitD true if the old init.d format should be used. 54 | */ 55 | public void setUseInitD(boolean useInitD) { 56 | this.useInitD = useInitD; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/Argument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 | * or visit www.oracle.com if you need additional information or have any 24 | * questions. 25 | */ 26 | 27 | package com.oracle.appbundler; 28 | 29 | /** 30 | * Class representing an argument that will be passed to the Java application 31 | * at startup. 32 | */ 33 | public class Argument { 34 | private String value = null; 35 | 36 | public String getValue() { 37 | return value; 38 | } 39 | 40 | public void setValue(String value) { 41 | this.value = value; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane.xcodeproj/project.xcworkspace/xcshareddata/SetupBuilderOSXPrefPane.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 892295C5-17AD-4EBC-AC8E-CCA37D3E959D 9 | IDESourceControlProjectName 10 | SetupBuilderOSXPrefPane 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 3DA2387B8D89812891F5B904459C1B2D5AE8B51F 14 | https://github.com/i-net-software/SetupBuilderOSXPrefPane.git 15 | 16 | IDESourceControlProjectPath 17 | SetupBuilderOSXPrefPane.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 3DA2387B8D89812891F5B904459C1B2D5AE8B51F 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/i-net-software/SetupBuilderOSXPrefPane.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 3DA2387B8D89812891F5B904459C1B2D5AE8B51F 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 3DA2387B8D89812891F5B904459C1B2D5AE8B51F 36 | IDESourceControlWCCName 37 | SetupBuilderOSXPrefPane 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/Architecture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, The Infinite Kind and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. The Infinite Kind designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by The Infinite Kind in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | */ 23 | 24 | package com.oracle.appbundler; 25 | 26 | /** 27 | * Class representing an architecture that will be written in the Info.plist file 28 | * to indicate which architectures the binary support. 29 | */ 30 | public class Architecture { 31 | private String name = null; 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return name; 44 | } 45 | 46 | public static Architecture from( String name ) { 47 | Architecture architecture = new Architecture(); 48 | architecture.setName( name ); 49 | return architecture; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/AppBundlerBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.appbundler; 18 | 19 | import org.gradle.api.internal.file.FileResolver; 20 | 21 | import com.inet.gradle.setup.abstracts.AbstractBuilder; 22 | import com.inet.gradle.setup.abstracts.DesktopStarter; 23 | 24 | /** 25 | * Actual implementation to create the application bundle 26 | * @author gamma 27 | */ 28 | public class AppBundlerBuilder extends AbstractBuilder { 29 | 30 | private AppBundler setup; 31 | 32 | /** 33 | * Setup the creator 34 | * @param task that was called 35 | * @param setup that was used 36 | * @param fileResolver that we might need 37 | */ 38 | protected AppBundlerBuilder(AppBundlerGradleTask task, AppBundler setup, FileResolver fileResolver) { 39 | super(task, fileResolver); 40 | this.setup = setup; 41 | } 42 | 43 | /** 44 | * now build it 45 | */ 46 | public void build() { 47 | AppBundlerApplicationBuilder applicationBuilder = new AppBundlerApplicationBuilder( task, setup, fileResolver ); 48 | try { 49 | applicationBuilder.buildApplication( new DesktopStarter(setup) ); 50 | } catch (Exception e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/lib/OnOffSwitchControl/OnOffSwitchControlCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // OnOffSwitchControlCell.h 3 | // OnOffSwitchControl 4 | // 5 | // Created by Peter Hosey on 2010-01-10. 6 | // Copyright 2010 Peter Hosey. All rights reserved. 7 | // 8 | // Extended by Dain Kaplan on 2012-01-31. 9 | // Copyright 2012 Dain Kaplan. All rights reserved. 10 | // 11 | // Extended by Pim Snel on 2012-12-10. 12 | // Copyright 2012 Pim Snel. All rights reserved. 13 | 14 | 15 | #import 16 | 17 | typedef enum { 18 | OnOffSwitchControlDefaultColors = 0, 19 | OnOffSwitchControlCustomColors = 1, 20 | OnOffSwitchControlBlueGreyColors = 2, 21 | OnOffSwitchControlGreenRedColors = 3, 22 | OnOffSwitchControlBlueRedColors = 4 23 | } OnOffSwitchControlColors; 24 | 25 | NSRect DKCenterRect(NSRect smallRect, NSRect bigRect); 26 | 27 | IB_DESIGNABLE 28 | @interface OnOffSwitchControlCell : NSButtonCell { 29 | BOOL tracking; 30 | NSPoint initialTrackingPoint, trackingPoint; 31 | NSTimeInterval initialTrackingTime, trackingTime; 32 | NSRect trackingCellFrame; //Set by drawWithFrame: when tracking is true. 33 | CGFloat trackingThumbCenterX; //Set by drawWithFrame: when tracking is true. 34 | struct PRHOOBCStuffYouWouldNeedToIncludeCarbonHeadersFor *stuff; 35 | BOOL showsOnOffLabels; 36 | OnOffSwitchControlColors onOffSwitchControlColors; 37 | NSColor *customOnColor; 38 | NSColor *customOffColor; 39 | NSString *onSwitchLabel; 40 | NSString *offSwitchLabel; 41 | CGFloat clickTimeout; 42 | NSSize maxDist; 43 | } 44 | 45 | @property (readwrite, copy) IBInspectable NSString *onSwitchLabel; 46 | @property (readwrite, copy) IBInspectable NSString *offSwitchLabel; 47 | @property (readwrite, assign) IBInspectable BOOL showsOnOffLabels; 48 | @property (readwrite, assign) OnOffSwitchControlColors onOffSwitchControlColors; 49 | 50 | - (void) setOnOffSwitchCustomOnColor:(NSColor *)onColor offColor:(NSColor *)offColor; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/postinstall.install-service.txt: -------------------------------------------------------------------------------- 1 | 2 | # Parameter Setup 3 | DAEMON_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.plist" 4 | PREFPANE_DESTINATION="/Library/PreferencePanes/{{displayName}}.prefPane" 5 | SERVICE_APP_LOCATION="$TARGET_LOCATION/{{installationSubdirectory}}{{displayName}}.app" 6 | RESOURCE_LOCATION="$SERVICE_APP_LOCATION/Contents/Resources" 7 | SERVICE_PLIST="$RESOURCE_LOCATION/{{displayName}}.prefPane/Contents/Resources/service.plist" 8 | COMMAND="$TARGET_LOCATION/{{installationSubdirectory}}{{displayName}}.app/Contents/MacOS/{{executable}}" 9 | 10 | # change owner of the whole application. 11 | if [ ! -z "$DAEMON_USER" ]; then 12 | echo "Changing user of '$SERVICE_APP_LOCATION' to $DAEMON_USER" 13 | chown -R "$DAEMON_USER:$DAEMON_USER" "$SERVICE_APP_LOCATION/Contents/Java" || echo "Could not change user" 14 | else 15 | echo "Will not change the user of '$SERVICE_APP_LOCATION' because it is not set ('$DAEMON_USER')." 16 | fi 17 | 18 | # Link prefpane 19 | if [ -L "$PREFPANE_DESTINATION" ]; then 20 | rm "$PREFPANE_DESTINATION" 21 | fi 22 | 23 | ln -s "$RESOURCE_LOCATION/{{displayName}}.prefPane" "$PREFPANE_DESTINATION" 24 | 25 | # modify SERVICE_PLIST to reflect current installation 26 | if [ -f "/usr/libexec/PlistBuddy" ]; then 27 | # Set executable 28 | /usr/libexec/PlistBuddy -c "Set :Program $COMMAND" "$SERVICE_PLIST" 29 | 30 | # Watch for modification to trigger uninstall 31 | /usr/libexec/PlistBuddy -c "Add :WatchPaths: String $PREFPANE_DESTINATION" "$UNINSTALL_WATCH" 32 | /usr/libexec/PlistBuddy -c "Add :WatchPaths: String $SERVICE_APP_LOCATION" "$UNINSTALL_WATCH" 33 | else 34 | echo "Cannot properly set up the service without the PlistBuddy tool" 35 | exit 1 36 | fi 37 | 38 | # copy default launchd file and start daemon 39 | /usr/bin/ditto "$SERVICE_PLIST" "$DAEMON_DESTINATION" 40 | chown "$(whoami)":wheel "$DAEMON_DESTINATION" 41 | chmod 644 "$DAEMON_DESTINATION" 42 | /bin/launchctl load "$DAEMON_DESTINATION" 43 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/codec/bmp/ColorEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ColorEntry.java 3 | * 4 | * Created on 10 May 2006, 08:29 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.codec.bmp; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * Represents an RGB colour entry used in the palette of an indexed image (colour depth <= 8). 16 | * @author Ian McDonagh 17 | */ 18 | public class ColorEntry { 19 | 20 | /** 21 | * The red component, which should be in the range 0..255. 22 | */ 23 | public int bRed; 24 | /** 25 | * The green component, which should be in the range 0..255. 26 | */ 27 | public int bGreen; 28 | /** 29 | * The blue component, which should be in the range 0..255. 30 | */ 31 | public int bBlue; 32 | /** 33 | * Unused. 34 | */ 35 | public int bReserved; 36 | 37 | /** 38 | * Reads and creates a colour entry from the source input. 39 | * @param in the source input 40 | * @throws java.io.IOException if an error occurs 41 | */ 42 | public ColorEntry(com.inet.gradle.setup.image.image4j.io.LittleEndianInputStream in) throws IOException { 43 | bBlue = in.readUnsignedByte(); 44 | bGreen = in.readUnsignedByte(); 45 | bRed = in.readUnsignedByte(); 46 | bReserved = in.readUnsignedByte(); 47 | } 48 | 49 | /** 50 | * Creates a colour entry with colour components initialized to 0. 51 | */ 52 | public ColorEntry() { 53 | bBlue = 0; 54 | bGreen = 0; 55 | bRed = 0; 56 | bReserved = 0; 57 | } 58 | 59 | /** 60 | * Creates a colour entry with the specified colour components. 61 | * @param r red component 62 | * @param g green component 63 | * @param b blue component 64 | * @param a unused 65 | */ 66 | public ColorEntry(int r, int g, int b, int a) { 67 | bBlue = b; 68 | bGreen = g; 69 | bRed = r; 70 | bReserved = a; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/util/ImageUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ImageUtil.java 3 | * 4 | * Created on 15 May 2006, 01:12 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.util; 11 | 12 | import java.awt.Graphics2D; 13 | import java.awt.Image; 14 | import java.awt.image.BufferedImage; 15 | 16 | /** 17 | * Provides utility methods for handling images (java.awt.BufferedImage) 18 | * @author Ian McDonagh 19 | */ 20 | public class ImageUtil { 21 | /** 22 | * Creates a scaled copy of the source image. 23 | * @param src source image to be scaled 24 | * @param width the width for the new scaled image in pixels 25 | * @param height the height for the new scaled image in pixels 26 | * @return a copy of the source image scaled to width x height pixels. 27 | */ 28 | public static BufferedImage scaleImage(BufferedImage src, int width, int height) { 29 | Image scaled = src.getScaledInstance(width, height, 0); 30 | BufferedImage ret = null; 31 | /* 32 | ColorModel cm = src.getColorModel(); 33 | if (cm instanceof IndexColorModel) { 34 | ret = new BufferedImage( 35 | width, height, src.getType(), (IndexColorModel) cm 36 | ); 37 | } 38 | else { 39 | ret = new BufferedImage( 40 | src.getWidth(), src.getHeight(), src.getType() 41 | ); 42 | } 43 | Graphics2D g = ret.createGraphics(); 44 | //clear alpha channel 45 | Composite comp = g.getComposite(); 46 | g.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f)); 47 | Rectangle2D.Double d = new Rectangle2D.Double(0,0,ret.getWidth(),ret.getHeight()); 48 | g.fill(d); 49 | g.setComposite(comp); 50 | */ 51 | ret = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 52 | Graphics2D g = ret.createGraphics(); 53 | //copy image 54 | g.drawImage(scaled, 0, 0, null); 55 | return ret; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/SetupBuilderPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.setup; 18 | 19 | import java.util.HashMap; 20 | 21 | import org.gradle.api.Plugin; 22 | import org.gradle.api.Project; 23 | import org.gradle.api.plugins.BasePlugin; 24 | 25 | import com.inet.gradle.setup.dmg.Dmg; 26 | import com.inet.gradle.setup.msi.Msi; 27 | import com.inet.gradle.setup.unix.deb.Deb; 28 | import com.inet.gradle.setup.unix.rpm.Rpm; 29 | 30 | /** 31 | * The central plugin class of this Gradle plugin. 32 | * 33 | * @author Volker Berlin 34 | */ 35 | public class SetupBuilderPlugin implements Plugin { 36 | 37 | @Override 38 | public void apply( Project project ) { 39 | // apply the BasePlugin to make the base features like "clean" available by default. 40 | HashMap> plugin = new HashMap<>(); 41 | plugin.put( "plugin", BasePlugin.class ); 42 | project.apply( plugin ); 43 | // project.getPluginManager().apply( BasePlugin.class ); // API since Gradle 2.3 44 | 45 | project.getExtensions().create( "setupBuilder", SetupBuilder.class, project ); 46 | project.getTasks().create( "deb", Deb.class ); 47 | project.getTasks().create( "dmg", Dmg.class ); 48 | project.getTasks().create( "msi", Msi.class ); 49 | project.getTasks().create( "rpm", Rpm.class ); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/dmgbuild/settings.04.defaultview.py.txt: -------------------------------------------------------------------------------- 1 | 2 | # Select the default view; must be one of 3 | # 4 | # 'icon-view' 5 | # 'list-view' 6 | # 'column-view' 7 | # 'coverflow' 8 | # 9 | default_view = "icon-view" 10 | 11 | # General view configuration 12 | show_icon_preview = False 13 | 14 | # Set these to True to force inclusion of icon/list view settings (otherwise 15 | # we only include settings for the default view) 16 | include_icon_view_settings = "auto" 17 | include_list_view_settings = "auto" 18 | 19 | # .. Icon view configuration ................................................... 20 | 21 | arrange_by = None 22 | grid_offset = (0, 0) 23 | grid_spacing = 100 24 | scroll_position = (0, 0) 25 | label_pos = "bottom" # or 'right' 26 | text_size = {{fontSize}} 27 | icon_size = {{iconSize}} 28 | 29 | # .. List view configuration ................................................... 30 | 31 | # Column names are as follows: 32 | # 33 | # name 34 | # date-modified 35 | # date-created 36 | # date-added 37 | # date-last-opened 38 | # size 39 | # kind 40 | # label 41 | # version 42 | # comments 43 | # 44 | list_icon_size = {{iconSize}} 45 | list_text_size = {{fontSize}} 46 | list_scroll_position = (0, 0) 47 | list_sort_by = "name" 48 | list_use_relative_dates = True 49 | list_calculate_all_sizes = (False,) 50 | list_columns = ("name", "date-modified", "size", "kind", "date-added") 51 | list_column_widths = { 52 | "name": 300, 53 | "date-modified": 181, 54 | "date-created": 181, 55 | "date-added": 181, 56 | "date-last-opened": 181, 57 | "size": 97, 58 | "kind": 115, 59 | "label": 100, 60 | "version": 75, 61 | "comments": 300, 62 | } 63 | list_column_sort_directions = { 64 | "name": "ascending", 65 | "date-modified": "descending", 66 | "date-created": "descending", 67 | "date-added": "descending", 68 | "date-last-opened": "descending", 69 | "size": "descending", 70 | "kind": "ascending", 71 | "label": "ascending", 72 | "version": "ascending", 73 | "comments": "ascending", 74 | } 75 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/util/IndentationOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.util; 17 | 18 | import java.io.FilterOutputStream; 19 | import java.io.IOException; 20 | import java.io.OutputStream; 21 | 22 | /** 23 | * A OutputStream that add an indentation on efery line for formatting. 24 | * 25 | * @author Volker Berlin 26 | */ 27 | public class IndentationOutputStream extends FilterOutputStream { 28 | private boolean needIndentation = true; 29 | 30 | /** 31 | * Create a instance. 32 | * @param out underling stream. 33 | */ 34 | public IndentationOutputStream( OutputStream out ) { 35 | super( out ); 36 | } 37 | 38 | /** 39 | * {@inheritDoc} 40 | */ 41 | @Override 42 | public void write( int b ) throws IOException { 43 | if( needIndentation ) { 44 | super.write( '\t' ); 45 | super.write( '\t' ); 46 | } 47 | super.write( b ); 48 | needIndentation = b == '\n'; 49 | } 50 | 51 | /** 52 | * {@inheritDoc} 53 | */ 54 | @Override 55 | public void flush() throws IOException { 56 | if( !needIndentation ) { 57 | super.write( '\n' ); 58 | needIndentation = true; 59 | } 60 | super.flush(); 61 | } 62 | 63 | /** 64 | * {@inheritDoc} 65 | */ 66 | @Override 67 | public void close() throws IOException { 68 | // Ignore to not close System.out 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/AppBundler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.appbundler; 18 | 19 | import org.gradle.api.Project; 20 | import org.gradle.api.tasks.Input; 21 | import org.gradle.api.tasks.Optional; 22 | 23 | import com.inet.gradle.setup.abstracts.AbstractSetupBuilder; 24 | import com.inet.gradle.setup.abstracts.SetupSources; 25 | 26 | /** 27 | * The Gradle extension for appBundler task. 28 | * 29 | * @author Gerry Weißbach 30 | */ 31 | public class AppBundler extends AbstractSetupBuilder implements SetupSources { 32 | 33 | private String jnlpLauncherName; 34 | 35 | /** 36 | * Create a new instance. 37 | * @param project current project 38 | */ 39 | public AppBundler( Project project ) { 40 | super(project); 41 | } 42 | 43 | /** 44 | * {@inheritDoc} 45 | */ 46 | @Input 47 | @Override 48 | public String getArchiveName() { 49 | return getApplication(); 50 | } 51 | 52 | /** 53 | * Get the JNLP Launcher Name 54 | * This can be used instead of the mainJar 55 | * @return the launcher file 56 | */ 57 | @Input 58 | @Optional 59 | public String getJnlpLauncherName() { 60 | return jnlpLauncherName; 61 | } 62 | 63 | /** 64 | * Set the JNLP Launcher file 65 | * This can be used instead of the mainJar 66 | * @param jnlpLauncher the launcher file 67 | */ 68 | public void setJnlpLauncherName(String jnlpLauncher) { 69 | this.jnlpLauncherName = jnlpLauncher; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/lib/OnOffSwitchControl/OnOffSwitchControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // OnOffSwitchControl.m 3 | // OnOffSwitchControl 4 | // 5 | // Created by Peter Hosey on 2010-01-10. 6 | // Copyright 2010 Peter Hosey. All rights reserved. 7 | // 8 | // Extended by Dain Kaplan on 2012-01-31. 9 | // Copyright 2012 Dain Kaplan. All rights reserved. 10 | // 11 | // Extended by Pim Snel on 2012-12-10. 12 | // Copyright 2012 Pim Snel. All rights reserved. 13 | 14 | 15 | #import "OnOffSwitchControl.h" 16 | #import "OnOffSwitchControlCell.h" 17 | 18 | @implementation OnOffSwitchControl 19 | 20 | + (void) initialize { 21 | [self setCellClass:[OnOffSwitchControlCell class]]; 22 | } 23 | - (void) awakeFromNib { 24 | NSCell * oldCell = [self cell]; 25 | 26 | [self setCell:[[OnOffSwitchControlCell alloc] init]]; 27 | [self.cell setTarget:oldCell.target]; 28 | [self.cell setAction:oldCell.action]; 29 | } 30 | 31 | - (void) keyDown:(NSEvent *)event { 32 | unichar character = [[event characters] characterAtIndex:0UL]; 33 | switch (character) { 34 | case NSLeftArrowFunctionKey: 35 | case NSRightArrowFunctionKey: 36 | //Do nothing (yet). We'll handle this in keyUp:. 37 | break; 38 | default: 39 | [super keyDown:event]; 40 | break; 41 | } 42 | } 43 | 44 | - (void) keyUp:(NSEvent *)event { 45 | unichar character = [[event characters] characterAtIndex:0UL]; 46 | switch (character) { 47 | case NSLeftArrowFunctionKey: 48 | switch ([self state]) { 49 | case NSOffState: 50 | NSBeep(); 51 | break; 52 | case NSMixedState: 53 | [self setState:NSOffState]; 54 | break; 55 | case NSOnState: 56 | if ([self allowsMixedState]) 57 | [self setState:NSMixedState]; 58 | else 59 | [self setState:NSOffState]; 60 | break; 61 | } 62 | break; 63 | case NSRightArrowFunctionKey: 64 | switch ([self state]) { 65 | case NSOffState: 66 | if ([self allowsMixedState]) 67 | [self setState:NSMixedState]; 68 | else 69 | [self setState:NSOnState]; 70 | break; 71 | case NSMixedState: 72 | [self setState:NSOnState]; 73 | break; 74 | case NSOnState: 75 | NSBeep(); 76 | break; 77 | } 78 | break; 79 | default: 80 | [super keyUp:event]; 81 | break; 82 | } 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/io/EndianUtils.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.image.image4j.io; 2 | 3 | /** 4 | * Provides utility methods for endian conversions [big-endian to little-endian; little-endian to big-endian]. 5 | * @author Ian McDonagh 6 | */ 7 | public class EndianUtils { 8 | 9 | /** 10 | * Reverses the byte order of the source short value 11 | * @param value the source value 12 | * @return the converted value 13 | */ 14 | public static short swapShort(short value) { 15 | return 16 | (short) ( 17 | ((value & 0xFF00) >> 8) 18 | | ((value & 0x00FF) << 8) 19 | ) 20 | ; 21 | } 22 | 23 | /** 24 | * Reverses the byte order of the source int value 25 | * @param value the source value 26 | * @return the converted value 27 | */ 28 | public static int swapInteger(int value) { 29 | return 30 | ((value & 0xFF000000) >> 24) 31 | | ((value & 0x00FF0000) >> 8) 32 | | ((value & 0x0000FF00) << 8) 33 | | ((value & 0x000000FF) << 24) 34 | ; 35 | } 36 | 37 | /** 38 | * Reverses the byte order of the source long value 39 | * @param value the source value 40 | * @return the converted value 41 | */ 42 | public static long swapLong(long value) { 43 | return 44 | ((value & 0xFF00000000000000L) >> 56) 45 | | ((value & 0x00FF000000000000L) >> 40) 46 | | ((value & 0x0000FF0000000000L) >> 24) 47 | | ((value & 0x000000FF00000000L) >> 8) 48 | | ((value & 0x00000000FF000000L) << 8) 49 | | ((value & 0x0000000000FF0000L) << 24) 50 | | ((value & 0x000000000000FF00L) << 40) 51 | | ((value & 0x00000000000000FFL) << 56) 52 | ; 53 | } 54 | 55 | /** 56 | * Reverses the byte order of the source float value 57 | * @param value the source value 58 | * @return the converted value 59 | */ 60 | public static float swapFloat(float value) { 61 | int i = Float.floatToIntBits(value); 62 | i = swapInteger(i); 63 | return Float.intBitsToFloat(i); 64 | } 65 | 66 | /** 67 | * Reverses the byte order of the source double value 68 | * @param value the source value 69 | * @return the converted value 70 | */ 71 | public static double swapDouble(double value) { 72 | long l = Double.doubleToLongBits(value); 73 | l = swapLong(l); 74 | return Double.longBitsToDouble(l); 75 | } 76 | } -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/abstracts/ProtocolHandler.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.abstracts; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | /** 8 | * Custom Protocol handler. Will result in the registration of `scheme` 9 | * as a handler with the application as a starter. 10 | * 11 | * @author gamma 12 | */ 13 | public class ProtocolHandler extends Application { 14 | 15 | private List scheme = new ArrayList<>(); 16 | 17 | /** 18 | * Construct the protocol handler 19 | * @param setup the setup 20 | */ 21 | public ProtocolHandler( AbstractSetupBuilder setup ) { 22 | super( setup ); 23 | } 24 | 25 | /** 26 | * Return the list of scheme. A scheme is a custom URL protocol like the standard scheme "http", "https" or "ftp". 27 | * @return the list of scheme 28 | */ 29 | public List getSchemes() { 30 | return scheme; 31 | } 32 | 33 | /** 34 | * Set the scheme. Can be a string or list. A scheme is a custom URL protocol like the standard scheme "http", "https" or "ftp". 35 | * @param scheme the scheme to set 36 | */ 37 | @SuppressWarnings( "unchecked" ) 38 | public void setScheme( Object scheme ) { 39 | if ( ! ( scheme instanceof List ) ) { 40 | this.scheme = Arrays.asList( (String)scheme ); 41 | } else { 42 | this.scheme = (List)scheme; 43 | } 44 | 45 | checkSchemesAreValid(); 46 | } 47 | 48 | /** 49 | * Add one or a list of schemes 50 | * @param scheme the scheme(s) to add 51 | */ 52 | @SuppressWarnings( "unchecked" ) 53 | public void scheme( Object scheme ) { 54 | if ( ! ( scheme instanceof List ) ) { 55 | if ( !((String)scheme).matches( "^[a-zA-Z]+$" ) ) { 56 | throw new IllegalArgumentException( "The scheme only allows the letters 'a-z'. Was: " + scheme ); 57 | } 58 | this.scheme.add( (String)scheme ); 59 | } else { 60 | this.scheme.addAll( (List)scheme ); 61 | } 62 | 63 | checkSchemesAreValid(); 64 | } 65 | 66 | /** 67 | * Check validity of schemes 68 | */ 69 | private void checkSchemesAreValid() { 70 | if ( this.scheme.stream().filter( e -> !e.matches( "^[a-zA-Z]+$" ) ).findFirst().isPresent() ) { 71 | this.scheme = new ArrayList<>(); // reset 72 | throw new IllegalArgumentException( "The scheme only allows the letters 'a-z'. Was: " + this.scheme ); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/AppBundlerApplicationBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.appbundler; 18 | 19 | import java.io.File; 20 | 21 | import org.gradle.api.internal.file.FileResolver; 22 | 23 | import com.inet.gradle.setup.abstracts.DesktopStarter; 24 | import com.inet.gradle.setup.dmg.AbstractOSXApplicationBuilder; 25 | 26 | /** 27 | * Build the OSX app bundle 28 | * @author gamma 29 | * 30 | */ 31 | public class AppBundlerApplicationBuilder extends AbstractOSXApplicationBuilder { 32 | 33 | /** 34 | * Build the OSX app bundle 35 | * @param task task 36 | * @param setup setup 37 | * @param fileResolver resolver 38 | */ 39 | protected AppBundlerApplicationBuilder(AppBundlerGradleTask task, AppBundler setup, 40 | FileResolver fileResolver) { 41 | super(task, setup, fileResolver); 42 | buildDir = setup.getDestinationDir(); 43 | } 44 | 45 | /** 46 | * Create Application 47 | * @param application - the application 48 | * @throws Exception on errors 49 | */ 50 | void buildApplication(DesktopStarter application) throws Exception { 51 | 52 | // We need the executable. It has a different meaning than on other systems. 53 | if ( application.getExecutable() == null || application.getExecutable().isEmpty() ) { 54 | application.setExecutable( getSetupBuilder().getAppIdentifier() ); 55 | } 56 | 57 | String jnlpLauncherName = getSetupBuilder().getJnlpLauncherName(); 58 | prepareApplication( application, jnlpLauncherName != null ); 59 | getAppBundler().setJnlpLauncherName( jnlpLauncherName ); 60 | setDocumentTypes( application.getDocumentType() ); 61 | 62 | finishApplication(); 63 | copyBundleFiles( application ); 64 | 65 | if ( task.getCodeSign() != null ) { 66 | task.getCodeSign().signApplication( new File(buildDir, application.getDisplayName() + ".app") ); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/io/LittleEndianRandomAccessFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * LittleEndianRandomAccessFile.java 3 | * 4 | * Created on 07 November 2006, 03:04 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.io; 11 | 12 | import java.io.FileNotFoundException; 13 | import java.io.IOException; 14 | import java.io.RandomAccessFile; 15 | 16 | /** 17 | * Provides endian conversions for input and output with a RandomAccessFile. 18 | * 19 | * This class is currently not in use and has not been tested. 20 | * 21 | * @author Ian McDonagh 22 | */ 23 | public class LittleEndianRandomAccessFile extends RandomAccessFile { 24 | 25 | public LittleEndianRandomAccessFile(java.io.File file, String mode) throws FileNotFoundException { 26 | super(file, mode); 27 | } 28 | 29 | public LittleEndianRandomAccessFile(String name, String mode) throws FileNotFoundException { 30 | super(name, mode); 31 | } 32 | 33 | public short readShortLE() throws IOException { 34 | short ret = super.readShort(); 35 | ret = EndianUtils.swapShort(ret); 36 | return ret; 37 | } 38 | 39 | public int readIntLE() throws IOException { 40 | int ret = super.readInt(); 41 | ret = EndianUtils.swapInteger(ret); 42 | return ret; 43 | } 44 | 45 | public float readFloatLE() throws IOException { 46 | float ret = super.readFloat(); 47 | ret = EndianUtils.swapFloat(ret); 48 | return ret; 49 | } 50 | 51 | public long readLongLE() throws IOException { 52 | long ret = super.readLong(); 53 | ret = EndianUtils.swapLong(ret); 54 | return ret; 55 | } 56 | 57 | public double readDoubleLE() throws IOException { 58 | double ret = super.readDouble(); 59 | ret = EndianUtils.swapDouble(ret); 60 | return ret; 61 | } 62 | 63 | public void writeShortLE(short value) throws IOException { 64 | value = EndianUtils.swapShort(value); 65 | super.writeShort(value); 66 | } 67 | 68 | public void writeIntLE(int value) throws IOException { 69 | value = EndianUtils.swapInteger(value); 70 | super.writeInt(value); 71 | } 72 | 73 | public void writeFloatLE(float value) throws IOException { 74 | value = EndianUtils.swapFloat(value); 75 | super.writeFloat(value); 76 | } 77 | 78 | public void writeLongLE(long value) throws IOException { 79 | value = EndianUtils.swapLong(value); 80 | super.writeLong(value); 81 | } 82 | 83 | public void writeDoubleLE(double value) throws IOException { 84 | value = EndianUtils.swapDouble(value); 85 | super.writeDouble(value); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/uninstall.txt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # uninstall script 3 | # This script is in the installation Folder / Contents / Resources / uninstall.sh 4 | 5 | PACKAGEID="{{serviceName}}" 6 | if [ -z "$PACKAGEID" ] ; then 7 | echo "Package ID is not set" 8 | exit 1 9 | fi 10 | 11 | AGENT_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.uninstall.plist" 12 | 13 | echo "I am Batman, or: $(whoami)" 14 | 15 | FLAG=0 16 | COUNT=0 17 | RESULT=0 18 | echo "Checking for Action" 19 | while [[ $RESULT -eq 0 ]] && [[ $FLAG -eq 0 ]]; do 20 | 21 | ENTRY=`/usr/libexec/PlistBuddy "$AGENT_DESTINATION" -c "Print :WatchPaths:$COUNT"` 22 | RESULT=$? 23 | if [ $RESULT -eq 0 ]; then 24 | if [ ! -e "$ENTRY" ]; then 25 | # remove all others as well 26 | echo "Will remove all, '$ENTRY' did not exist" 27 | FLAG=1 28 | fi 29 | fi 30 | 31 | COUNT=$(( $COUNT+1 )) 32 | 33 | done 34 | 35 | echo "Flag is: $FLAG" 36 | if [[ $FLAG -eq 1 ]]; then 37 | 38 | echo "########################################" 39 | echo "# Running uninstall for {{displayName}}" 40 | 41 | # Find all files that should be present for our current package 42 | echo "# Collecting Package Information" 43 | PKGTMP="/tmp/$PACKAGEID.pkg.info" 44 | pkgutil --pkg-info-plist "$PACKAGEID" > "$PKGTMP" 45 | VOLUME=`/usr/libexec/PlistBuddy "$PKGTMP" -c "Print :volume"` 46 | LOCATION=`/usr/libexec/PlistBuddy "$PKGTMP" -c "Print :install-location"` 47 | TARGET_LOCATION="${VOLUME}${LOCATION}" 48 | TARGET_LOCATION=${TARGET_LOCATION%/} 49 | 50 | echo "# Before Script Section" 51 | 52 | {{script}} 53 | 54 | echo "# After Script Section" 55 | 56 | if [ -d "$TARGET_LOCATION" ]; then 57 | cd "$TARGET_LOCATION" && pwd 58 | fi 59 | 60 | pkgutil --only-files --files "$PACKAGEID" | tr '\n' '\0' | xargs -n 1 -0 rm -f 61 | 62 | #Beware! 63 | pkgutil --only-dirs --files "$PACKAGEID" | sed '1!G;h;$!d' | tr '\n' '\0' | xargs -n 1 -0 rm -rf 64 | pkgutil --forget "$PACKAGEID" 65 | 66 | echo "# Cleanup" 67 | rm "$PKGTMP" 68 | 69 | echo "# Done" 70 | echo "########################################" 71 | # Remove watcher for this uninstall script 72 | if /bin/launchctl list "{{serviceName}}.uninstall" &> /dev/null; then 73 | echo "# Removed uninstall watcher" 74 | echo "########################################" 75 | /bin/launchctl unload "$AGENT_DESTINATION" 76 | 77 | if [ -d "/opt/{{serviceName}}" ]; then 78 | rm -rf "/opt/{{serviceName}}" 79 | fi 80 | fi 81 | 82 | if [ -f "$AGENT_DESTINATION" ]; then 83 | rm "$AGENT_DESTINATION" 84 | fi 85 | fi 86 | 87 | exit 0 88 | -------------------------------------------------------------------------------- /native/build.gradle: -------------------------------------------------------------------------------- 1 | // see https://github.com/TheInfiniteKind/appbundler 2 | 3 | apply plugin: 'java' 4 | 5 | task getXCrun(type: Exec) { 6 | commandLine "xcrun" 7 | args "--show-sdk-path" 8 | standardOutput = new ByteArrayOutputStream() 9 | ext.run = { return standardOutput.toString().trim() } 10 | } 11 | 12 | def compileNativeStarter = { LIBJLI_DY_LIB, javahome, outputFile, List architectures -> 13 | 14 | def compileNative = project.tasks.create( [name: "compileNative-" + UUID.randomUUID(), type: Exec ] ) { 15 | workingDir "." 16 | commandLine "/usr/bin/gcc" 17 | outputs.file( outputFile ) 18 | 19 | args "-v" 20 | 21 | for( String arch : architectures ) { 22 | args "-arch" 23 | args arch 24 | } 25 | 26 | args "-I" 27 | args "${javahome}/include" 28 | args "-I" 29 | args "${javahome}/include/darwin" 30 | args "-DLIBJLI_DYLIB=\"${LIBJLI_DY_LIB}\"" 31 | args "-framework" 32 | args "Cocoa" 33 | args "-F" 34 | args "${javahome}/../.." 35 | args "-isysroot" 36 | args "${getXCrun.run()}" 37 | args "-mmacosx-version-min=10.7" 38 | args "-fobjc-exceptions" 39 | args "-std=c99" 40 | args "-o" 41 | args outputFile 42 | args "main.m" 43 | } 44 | 45 | compileNative.exec() 46 | outputFile.setExecutable( true, false) 47 | println "Copying '${outputFile}' to destination" 48 | copy { 49 | from( outputFile ) 50 | into('../src/com/oracle/appbundler') 51 | } 52 | } 53 | 54 | task createNativeStarter { 55 | 56 | dependsOn getXCrun 57 | 58 | doLast { 59 | 60 | file("${buildDir}").mkdirs() 61 | 62 | def javahome = System.getProperty( "java.home" ) 63 | def javahomeJRE = javahome; 64 | 65 | if ( file("${javahomeJRE}/../jre").exists() ) { 66 | javahomeJRE += "/../jre"; 67 | } 68 | 69 | def LIBJLI_DY_LIB="${javahomeJRE}/lib/libjli.dylib" 70 | if ( !file(LIBJLI_DY_LIB).exists() ) { 71 | LIBJLI_DY_LIB="${javahomeJRE}/lib/jli/libjli.dylib" 72 | } 73 | 74 | println "JAVA_HOME: ${javahome}"; 75 | println "JAVA_HOME_JRE: ${javahomeJRE}"; 76 | println "LIBJLI_DY_LIB: ${LIBJLI_DY_LIB}"; 77 | 78 | println "Creating JavaAppLauncher" 79 | def outputFile = new File( "${buildDir}", "JavaAppLauncher" ) 80 | compileNativeStarter LIBJLI_DY_LIB, javahome, outputFile, [ 'x86_64', 'arm64' ] 81 | 82 | println "Creating JavaAppLauncher_x86_64" 83 | def outputFileX86 = new File( "${buildDir}", "JavaAppLauncher_x86_64" ) 84 | compileNativeStarter LIBJLI_DY_LIB, javahome, outputFileX86, [ 'x86_64' ] 85 | } 86 | } 87 | 88 | defaultTasks = ["clean", "createNativeStarter"] -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/Template.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup; 17 | 18 | import java.io.File; 19 | import java.io.FileWriter; 20 | import java.io.IOException; 21 | import java.util.ArrayList; 22 | import java.util.Scanner; 23 | 24 | /** 25 | * Simple template class for replacing placeholders in text files (e.g. scripts, config files). 26 | */ 27 | public class Template { 28 | private String template; 29 | 30 | /** 31 | * Creates an instance and loads the specified file from the classpath as template. 32 | * @param file the file in classpath relative to the package of this class 33 | * @throws IOException on errors during reading the file 34 | */ 35 | public Template( String file ) throws IOException { 36 | 37 | try ( Scanner scanner = new Scanner( getClass().getResourceAsStream( file ), "UTF8" ) ) { 38 | template = scanner.useDelimiter("\\A").next(); 39 | } 40 | } 41 | 42 | /** 43 | * Creates an instance and concatenates the script from the input lines 44 | * @param script input lines 45 | */ 46 | public Template( ArrayList script ) { 47 | template = script != null && !script.isEmpty() ? String.join("\n", script) : ""; 48 | } 49 | 50 | /** 51 | * Replaces occurences of the placeholder {{NAME}} to the specified content. 52 | * @param placeholder the name of the placerholder 53 | * @param content the content to which to placeholder will be replaces 54 | * @return template 55 | */ 56 | public Template setPlaceholder(String placeholder, String content) { 57 | if ( content == null ) { 58 | content = ""; // Remove if not set. 59 | } 60 | template = template.replace( "{{" + placeholder + "}}", content ); 61 | return this; 62 | } 63 | 64 | /** 65 | * Writes the template with replaced placeholder to the specified file. 66 | * @param file the file to write to 67 | * @throws IOException on errors during writing 68 | */ 69 | public void writeTo(File file) throws IOException { 70 | try(FileWriter writer = new FileWriter( file )) { 71 | writer.write( template ); 72 | } 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return template.replaceAll( "\\{\\{.*?\\}\\}", "" ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /testBuilds/license_de.txt: -------------------------------------------------------------------------------- 1 | End User Terms and Conditions 2 | 3 | License Agreement 4 | 5 | PLEASE READ THIS AGREEMENT CAREFULLY BEFORE INSTALLING ANY PARTS OF I-NET PDFC ("THE PROGRAM"). I-NET SOFTWARE WILL ONLY LICENSE THE PROGRAM TO YOU IF YOU FIRST ACCEPT THE TERMS OF THIS AGREEMENT. The Program is owned by I-NET SOFTWARE or an I-NET SOFTWARE supplier, and is copyrighted and licensed, not sold. The term "Program" means the original program and all whole or partial copies of it, including portions merged into other programs. I-NET SOFTWARE grants you a nonexclusive license for the Program as specified herein. You agree to ensure that anyone who uses the Program (accessed either locally or remotely) does so only for your authorized use and complies with the terms of this Agreement. I-NET SOFTWARE will not charge you for the rights granted to you under this license. 6 | 7 | 1) License 8 | 9 | To develop and utilize applications which exploit the Program for your internal use only, you may, to the extent necessary for this purpose: (i) use and copy the Program, and (ii) merge the Program into another program. You must reproduce the copyright notice and any other legend of ownership on each copy, or partial copy, of the Program. You may not: 1) use, copy, merge, or transfer the Program except as provided in this Agreement; 2) reverse assemble, reverse compile, or otherwise translate the Program except as specifically permitted by law without the possibility of contractual waiver; 3) sublicense, rent or lease the Program; or 4) supply or provide copies of the Program to third parties, or allow external access to the Program.  10 | 11 | 2) Warranty 12 | 13 | This Program is supplied "AS IS", WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE PROGRAM AND ANY DOCUMENTATION REMAINS WITH YOU. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so the above exclusion or limitation may not apply to you. 14 | 15 | 3) Limitation of Liability 16 | 17 | I-NET SOFTWARE WILL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF I-NET SOFTWARE, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. I-NET SOFTWARE will not be liable for 1) loss of, or damage to, your records or data or 2) any damages claimed by you based on any third party claim. This limitation of liability also applies to any developer of a Program supplied to I-NET SOFTWARE. 18 | 19 | 4) General 20 | 21 | You may terminate your license at any time. If you do so, all your license rights to the Program are terminated. You may keep a copy of the Program in your archives. I-NET SOFTWARE may terminate your license if you fail to comply with the terms of this Agreement. If I-NET SOFTWARE does so, all your license rights to the Program are terminated and you must destroy all your copies of it. You agree to comply with all applicable laws and regulations. -------------------------------------------------------------------------------- /testBuilds/license_en.txt: -------------------------------------------------------------------------------- 1 | End User Terms and Conditions 2 | 3 | License Agreement 4 | 5 | PLEASE READ THIS AGREEMENT CAREFULLY BEFORE INSTALLING ANY PARTS OF I-NET PDFC ("THE PROGRAM"). I-NET SOFTWARE WILL ONLY LICENSE THE PROGRAM TO YOU IF YOU FIRST ACCEPT THE TERMS OF THIS AGREEMENT. The Program is owned by I-NET SOFTWARE or an I-NET SOFTWARE supplier, and is copyrighted and licensed, not sold. The term "Program" means the original program and all whole or partial copies of it, including portions merged into other programs. I-NET SOFTWARE grants you a nonexclusive license for the Program as specified herein. You agree to ensure that anyone who uses the Program (accessed either locally or remotely) does so only for your authorized use and complies with the terms of this Agreement. I-NET SOFTWARE will not charge you for the rights granted to you under this license. 6 | 7 | 1) License 8 | 9 | To develop and utilize applications which exploit the Program for your internal use only, you may, to the extent necessary for this purpose: (i) use and copy the Program, and (ii) merge the Program into another program. You must reproduce the copyright notice and any other legend of ownership on each copy, or partial copy, of the Program. You may not: 1) use, copy, merge, or transfer the Program except as provided in this Agreement; 2) reverse assemble, reverse compile, or otherwise translate the Program except as specifically permitted by law without the possibility of contractual waiver; 3) sublicense, rent or lease the Program; or 4) supply or provide copies of the Program to third parties, or allow external access to the Program.  10 | 11 | 2) Warranty 12 | 13 | This Program is supplied "AS IS", WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE PROGRAM AND ANY DOCUMENTATION REMAINS WITH YOU. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so the above exclusion or limitation may not apply to you. 14 | 15 | 3) Limitation of Liability 16 | 17 | I-NET SOFTWARE WILL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF I-NET SOFTWARE, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. I-NET SOFTWARE will not be liable for 1) loss of, or damage to, your records or data or 2) any damages claimed by you based on any third party claim. This limitation of liability also applies to any developer of a Program supplied to I-NET SOFTWARE. 18 | 19 | 4) General 20 | 21 | You may terminate your license at any time. If you do so, all your license rights to the Program are terminated. You may keep a copy of the Program in your archives. I-NET SOFTWARE may terminate your license if you fail to comply with the terms of this Agreement. If I-NET SOFTWARE does so, all your license rights to the Program are terminated and you must destroy all your copies of it. You agree to comply with all applicable laws and regulations. -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/abstracts/LocalizedResource.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.abstracts; 2 | 3 | import java.io.File; 4 | import java.io.Serializable; 5 | import java.util.List; 6 | import java.util.Locale; 7 | 8 | import com.inet.gradle.setup.SetupBuilder; 9 | 10 | import groovy.lang.Closure; 11 | 12 | /** 13 | * Stub Object for localized resources 14 | * @author Gerry Weißbach 15 | * 16 | */ 17 | public class LocalizedResource implements Serializable { 18 | 19 | private Locale locale; 20 | private Object resource; 21 | private transient SetupBuilder setup; 22 | 23 | /** 24 | * Stub Object for localized resources 25 | * @param setup the setup 26 | */ 27 | public LocalizedResource( SetupBuilder setup ) { 28 | this.setup = setup; 29 | 30 | } 31 | 32 | /** 33 | * @return the resource as file 34 | */ 35 | public File getResource() { 36 | 37 | if ( resource != null ) { 38 | return setup.getProject().file( resource ); 39 | } 40 | 41 | return null; 42 | } 43 | 44 | /** 45 | * @return the locale 46 | */ 47 | public Locale getLocale() { 48 | return locale; 49 | } 50 | 51 | /** 52 | * @return the language 53 | */ 54 | public String getLanguage() { 55 | return locale.getLanguage(); 56 | } 57 | 58 | /** 59 | * @param locale the locale to set 60 | */ 61 | public void setLocale(String locale) { 62 | this.locale = new Locale( locale ); 63 | } 64 | 65 | /** 66 | * @param resource the resource to set 67 | */ 68 | public void setResource(Object resource) { 69 | this.resource = resource; 70 | } 71 | 72 | /** 73 | * Return the localized file for a specific locale 74 | * @param list from which to receive the resource 75 | * @param locale for which to get the file 76 | * @return license file 77 | */ 78 | public static File getLocalizedResourceFile( List list, String locale ) { 79 | 80 | for (LocalizedResource res : list) { 81 | if ( locale.equalsIgnoreCase( res.getLanguage()) ) { 82 | return res.getResource(); 83 | } 84 | } 85 | 86 | return null; 87 | } 88 | 89 | /** 90 | * Set the license file 91 | * @param parent the setup builder 92 | * @param holder the list to add the entry to 93 | * @param resource file file or closure 94 | */ 95 | public static void addLocalizedResource( SetupBuilder parent, List holder, Object resource ) { 96 | 97 | LocalizedResource res = new LocalizedResource( parent ); 98 | if ( resource instanceof Closure ) { 99 | parent.getProject().configure( res, (Closure)resource ); 100 | } else { 101 | res.setLocale( parent.getDefaultResourceLanguage() ); 102 | res.setResource( resource ); 103 | } 104 | 105 | holder.add( res ); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | 74 | 75 | @rem Execute Gradle 76 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 77 | 78 | :end 79 | @rem End local scope for the variables with windows NT shell 80 | if %ERRORLEVEL% equ 0 goto mainEnd 81 | 82 | :fail 83 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 84 | rem the _cmd.exe /c_ return code! 85 | set EXIT_CODE=%ERRORLEVEL% 86 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 87 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 88 | exit /b %EXIT_CODE% 89 | 90 | :mainEnd 91 | if "%OS%"=="Windows_NT" endlocal 92 | 93 | :omega 94 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/codec/bmp/BMPImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * BMPImage.java 3 | * 4 | * Created on February 19, 2007, 8:08 AM 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.codec.bmp; 11 | 12 | /** 13 | * Contains a decoded BMP image, as well as information about the source encoded image. 14 | * @since 0.7 15 | * @author Ian McDonagh 16 | */ 17 | public class BMPImage { 18 | 19 | protected InfoHeader infoHeader; 20 | protected java.awt.image.BufferedImage image; 21 | 22 | /** 23 | * Creates a new instance of BMPImage 24 | * @param image the decoded image 25 | * @param infoHeader the InfoHeader structure providing information about the source encoded image 26 | */ 27 | public BMPImage(java.awt.image.BufferedImage image, InfoHeader infoHeader) { 28 | this.image = image; 29 | this.infoHeader = infoHeader; 30 | } 31 | 32 | /** 33 | * The InfoHeader structure representing the encoded BMP image. 34 | */ 35 | public InfoHeader getInfoHeader() { 36 | return infoHeader; 37 | } 38 | 39 | /** 40 | * Sets the InfoHeader structure used for encoding the BMP image. 41 | */ 42 | public void setInfoHeader(InfoHeader infoHeader) { 43 | this.infoHeader = infoHeader; 44 | } 45 | 46 | /** 47 | * The decoded BMP image. 48 | */ 49 | public java.awt.image.BufferedImage getImage() { 50 | return image; 51 | } 52 | 53 | /** 54 | * Sets the image to be encoded. 55 | */ 56 | public void setImage(java.awt.image.BufferedImage image) { 57 | this.image = image; 58 | } 59 | 60 | /** 61 | * The width of the BMP image in pixels. 62 | * @return the width of the BMP image, or -1 if unknown 63 | * @since 0.7alpha2 64 | */ 65 | public int getWidth() { 66 | return infoHeader == null ? -1 : infoHeader.iWidth; 67 | } 68 | 69 | /** 70 | * The height of the BMP image in pixels. 71 | * @return the height of the BMP image, or -1 if unknown. 72 | * @since 0.7alpha2 73 | */ 74 | public int getHeight() { 75 | return infoHeader == null ? -1 : infoHeader.iHeight; 76 | } 77 | 78 | /** 79 | * The colour depth of the BMP image (bits per pixel). 80 | * @return the colour depth, or -1 if unknown. 81 | * @since 0.7alpha2 82 | */ 83 | public int getColourDepth() { 84 | return infoHeader == null ? -1 : infoHeader.sBitCount; 85 | } 86 | 87 | /** 88 | * The number of possible colours for the BMP image. 89 | * @return the number of colours, or -1 if unknown. 90 | * @since 0.7alpha2 91 | */ 92 | public int getColourCount() { 93 | int bpp = infoHeader.sBitCount == 32 ? 24 : infoHeader.sBitCount; 94 | return bpp == -1 ? -1 : (int) (1 << bpp); 95 | } 96 | 97 | /** 98 | * Specifies whether this BMP image is indexed, that is, the encoded bitmap uses a colour table. 99 | * If getColourDepth() returns -1, the return value has no meaning. 100 | * @return true if indexed, false if not. 101 | * @since 0.7alpha2 102 | */ 103 | public boolean isIndexed() { 104 | return infoHeader == null ? false : infoHeader.sBitCount <= 8; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/Option.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012, Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 | * or visit www.oracle.com if you need additional information or have any 24 | * questions. 25 | */ 26 | 27 | package com.oracle.appbundler; 28 | 29 | /** 30 | * Class representing an option that will be passed to the JVM at startup. 31 | * The class can optionally be named, which allows the bundled Java program 32 | * itself to override the option. Changes will take effect upon restart of the 33 | * application.

34 | * Assuming your {@code CFBundleIdentifier} (settable via {@link AppBundlerTask#setIdentifier(String)}) 35 | * is {@code com.oracle.appbundler}. Then you can override a named option by calling 36 | *

37 |  *     import java.util.prefs.Preferences;
38 |  *     [...]
39 |  *     Preferences jvmOptions = Preferences.userRoot().node("/com/oracle/appbundler/JVMOptions");
40 |  *     jvmOptions.put("name", "value");
41 |  *     jvmOptions.flush();
42 |  * 
43 | * The corresponding entries will be stored in a file called 44 | * {@code ~/Library/Preferences/com.oracle.appbundler.plist}. 45 | * To manipulate the file without Java's {@link java.util.prefs.Preferences} from the command line, 46 | * you should use the tool 47 | * defaults. 48 | * For example, to add an entry via the command line, use: 49 | *
50 |  *     defaults write com.oracle.appbundler /com/oracle/appbundler/ -dict-add JVMOptions/ '{"name"="value";}'
51 |  * 
52 | * 53 | * @author Hendrik Schreiber (preference related code only) 54 | */ 55 | public class Option { 56 | private String value = null; 57 | private String name = null; 58 | 59 | public String getValue() { 60 | return value; 61 | } 62 | 63 | public void setValue(String value) { 64 | this.value = value; 65 | } 66 | 67 | public String getName() { 68 | return name; 69 | } 70 | 71 | public void setName(final String name) { 72 | this.name = name; 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return name == null ? value : name + "=" + value; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/test/java/com/inet/gradle/setup/msi/PlatformDetectionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.msi; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertNotNull; 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import java.io.File; 23 | 24 | import org.gradle.internal.os.OperatingSystem; 25 | import org.junit.Test; 26 | 27 | /** 28 | * Tests for Phase 1: Platform Detection & Path Handling 29 | */ 30 | public class PlatformDetectionTest { 31 | 32 | private static final OperatingSystem OS = OperatingSystem.current(); 33 | 34 | @Test 35 | public void testPlatformDetection() { 36 | // At least one platform should be detected 37 | assertTrue("Platform should be detected", 38 | OS.isWindows() || OS.isLinux() || OS.isMacOsX()); 39 | } 40 | 41 | @Test 42 | public void testFileSeparator() { 43 | String separator = File.separator; 44 | assertNotNull("File separator should not be null", separator); 45 | assertEquals("File separator should be single character", 1, separator.length()); 46 | 47 | // Should be either / or \ depending on platform 48 | assertTrue("File separator should be / or \\", 49 | separator.equals("/") || separator.equals("\\")); 50 | 51 | // Unix-like systems should use / 52 | if (OS.isLinux() || OS.isMacOsX()) { 53 | assertEquals("Unix systems should use /", "/", separator); 54 | } 55 | } 56 | 57 | @Test 58 | public void testPathSeparator() { 59 | String pathSeparator = File.pathSeparator; 60 | assertNotNull("Path separator should not be null", pathSeparator); 61 | assertTrue("Path separator should not be empty", pathSeparator.length() > 0); 62 | 63 | // Unix-like systems should use : 64 | if (OS.isLinux() || OS.isMacOsX()) { 65 | assertEquals("Unix systems should use :", ":", pathSeparator); 66 | } 67 | // Windows should use ; 68 | else if (OS.isWindows()) { 69 | assertEquals("Windows should use ;", ";", pathSeparator); 70 | } 71 | } 72 | 73 | @Test 74 | public void testOperatingSystemInstance() { 75 | assertNotNull("OperatingSystem instance should not be null", OS); 76 | } 77 | 78 | @Test 79 | public void testPlatformSpecificChecks() { 80 | // Only one platform should be true at a time 81 | int platformCount = 0; 82 | if (OS.isWindows()) platformCount++; 83 | if (OS.isLinux()) platformCount++; 84 | if (OS.isMacOsX()) platformCount++; 85 | 86 | assertEquals("Exactly one platform should be detected", 1, platformCount); 87 | } 88 | } 89 | 90 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/CommandLine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 - 2017 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.msi; 17 | 18 | import com.inet.gradle.setup.abstracts.Application; 19 | 20 | /** 21 | * Get the parts of a windows command line. 22 | */ 23 | class CommandLine { 24 | 25 | final String relativTarget; // executable inside the installation 26 | final String relativFull; // executable inside the installation 27 | final String target; 28 | final String arguments; 29 | final String full; 30 | final String workDir; 31 | 32 | /** 33 | * Generate the parts of the command line. 34 | * @param starter a command description 35 | * @param javaDir path to java if embedded 36 | */ 37 | CommandLine( Application starter, String javaDir ) { 38 | String target = starter.getExecutable(); 39 | String arguments = starter.getStartArguments(); 40 | String vmArguments = String.join( " ", starter.getJavaVMArguments() ).trim(); 41 | String dir; 42 | String workDir = starter.getWorkDir(); 43 | if( workDir == null ) { 44 | workDir = ""; 45 | } else { 46 | workDir = workDir.replace( '/', '\\' ); 47 | if( !workDir.isEmpty() && !workDir.endsWith( "\\" ) ){ 48 | workDir += '\\'; 49 | } 50 | } 51 | if( target == null || target.isEmpty() ) { 52 | if( javaDir != null ) { 53 | target = "[INSTALLDIR]" + javaDir + "\\bin\\javaw.exe"; 54 | } else { 55 | target = "javaw.exe"; 56 | } 57 | dir = ""; 58 | arguments = vmArguments + " -cp \"[INSTALLDIR]" + workDir + starter.getMainJar() + "\" " + starter.getMainClass() + " " + arguments; 59 | } else { 60 | if( !target.startsWith( "[" ) ) { 61 | dir = "[INSTALLDIR]"; 62 | target = workDir + target; 63 | } else { 64 | dir = ""; 65 | } 66 | } 67 | this.relativTarget = target; 68 | this.target = dir + target; 69 | this.arguments = arguments; 70 | if( this.target.indexOf( ' ' ) >= 0 || this.target.indexOf( '[' ) >= 0 ) { 71 | this.full = '\"' + this.target + "\" " + arguments; 72 | } else { 73 | this.full = this.target + ' ' + arguments; 74 | } 75 | if( this.relativTarget.indexOf( ' ' ) >= 0 || this.relativTarget.indexOf( '[' ) >= 0 ) { 76 | this.relativFull = '\"' + this.relativTarget + "\" " + arguments; 77 | } else { 78 | this.relativFull = this.relativTarget + ' ' + arguments; 79 | } 80 | this.workDir = workDir; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/io/LittleEndianOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * LittleEndianOutputStream.java 3 | * 4 | * Created on 07 November 2006, 08:26 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.io; 11 | 12 | import java.io.DataOutputStream; 13 | import java.io.IOException; 14 | 15 | /** 16 | * Writes little-endian data to a target OutputStream by reversing byte ordering. 17 | * @author Ian McDonagh 18 | */ 19 | public class LittleEndianOutputStream extends DataOutputStream { 20 | 21 | /** 22 | * Creates a new instance of LittleEndianOutputStream, which will write to the specified target. 23 | * @param out the target OutputStream 24 | */ 25 | public LittleEndianOutputStream(java.io.OutputStream out) { 26 | super(out); 27 | } 28 | 29 | /** 30 | * Writes a little-endian short value 31 | * @param value the source value to convert 32 | * @throws java.io.IOException if an error occurs 33 | */ 34 | public void writeShortLE(short value) throws IOException { 35 | value = EndianUtils.swapShort(value); 36 | super.writeShort(value); 37 | } 38 | 39 | /** 40 | * Writes a little-endian int value 41 | * @param value the source value to convert 42 | * @throws java.io.IOException if an error occurs 43 | */ 44 | public void writeIntLE(int value) throws IOException { 45 | value = EndianUtils.swapInteger(value); 46 | super.writeInt(value); 47 | } 48 | 49 | /** 50 | * Writes a little-endian float value 51 | * @param value the source value to convert 52 | * @throws java.io.IOException if an error occurs 53 | */ 54 | public void writeFloatLE(float value) throws IOException { 55 | value = EndianUtils.swapFloat(value); 56 | super.writeFloat(value); 57 | } 58 | 59 | /** 60 | * Writes a little-endian long value 61 | * @param value the source value to convert 62 | * @throws java.io.IOException if an error occurs 63 | */ 64 | public void writeLongLE(long value) throws IOException { 65 | value = EndianUtils.swapLong(value); 66 | super.writeLong(value); 67 | } 68 | 69 | /** 70 | * Writes a little-endian double value 71 | * @param value the source value to convert 72 | * @throws java.io.IOException if an error occurs 73 | */ 74 | public void writeDoubleLE(double value) throws IOException { 75 | value = EndianUtils.swapDouble(value); 76 | super.writeDouble(value); 77 | } 78 | 79 | /** 80 | * @since 0.6 81 | */ 82 | public void writeUnsignedInt(long value) throws IOException { 83 | int i1 = (int)(value >> 24); 84 | int i2 = (int)((value >> 16) & 0xFF); 85 | int i3 = (int)((value >> 8) & 0xFF); 86 | int i4 = (int)(value & 0xFF); 87 | 88 | write(i1); 89 | write(i2); 90 | write(i3); 91 | write(i4); 92 | } 93 | 94 | /** 95 | * @since 0.6 96 | */ 97 | public void writeUnsignedIntLE(long value) throws IOException { 98 | int i1 = (int)(value >> 24); 99 | int i2 = (int)((value >> 16) & 0xFF); 100 | int i3 = (int)((value >> 8) & 0xFF); 101 | int i4 = (int)(value & 0xFF); 102 | 103 | write(i4); 104 | write(i3); 105 | write(i2); 106 | write(i1); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/com/inet/gradle/appbundler/AppBundlerGradleTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.inet.gradle.appbundler; 18 | 19 | import java.io.File; 20 | 21 | import org.gradle.api.Action; 22 | import org.gradle.api.GradleException; 23 | import org.gradle.api.tasks.Input; 24 | import org.gradle.api.tasks.Nested; 25 | import org.gradle.api.tasks.Optional; 26 | import org.gradle.api.tasks.TaskAction; 27 | 28 | import com.inet.gradle.setup.abstracts.AbstractTask; 29 | 30 | import groovy.lang.Closure; 31 | 32 | /** 33 | * Task to create a .app archive 34 | * @author gamma 35 | */ 36 | public class AppBundlerGradleTask extends AbstractTask { 37 | 38 | private OSXCodeSign codeSign; 39 | 40 | /** 41 | * Construct static as .app 42 | */ 43 | public AppBundlerGradleTask() { 44 | super( "app", AppBundler.class ); 45 | } 46 | 47 | /** 48 | * Get the app builder 49 | * @return the app builder 50 | */ 51 | @Nested 52 | @Optional 53 | public AppBundler getAppBuilder() { 54 | return (AppBundler)super.getAbstractSetupBuilder(); 55 | } 56 | 57 | /** 58 | * {@inheritDoc} 59 | */ 60 | @Override 61 | public void build() { 62 | new AppBundlerBuilder( this, getAppBuilder(), getFileResolver() ).build(); 63 | } 64 | 65 | /** 66 | * The action called from Gradle 67 | * Will not add an artifact since it would be a directory. 68 | */ 69 | @TaskAction 70 | public void action() { 71 | build(); 72 | File setupFile = getSetupFile(); 73 | if( !setupFile.exists() ) { 74 | throw new GradleException( "Setup file was not created: " + setupFile ); 75 | } 76 | } 77 | 78 | /** 79 | * Set the needed information for signing the setup. 80 | * 81 | * @param closure the data for signing 82 | */ 83 | public void codeSign( Closure closure ) { 84 | codeSign = new OSXCodeSign( this, getFileResolver() ); 85 | getProject().configure( codeSign, closure ); 86 | } 87 | 88 | /** 89 | * Set the needed information for signing the setup. 90 | * 91 | * @param action the data for signing 92 | */ 93 | public void codeSign( Action> action ) { 94 | codeSign = new OSXCodeSign<>( this, getFileResolver() ); 95 | action.execute( codeSign ); 96 | } 97 | 98 | /** 99 | * Get the SignTool configuration if set 100 | * 101 | * @return the settings or null 102 | */ 103 | @Input 104 | @Optional 105 | public OSXCodeSign getCodeSign() { 106 | return codeSign; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/util/GradleUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.util; 17 | 18 | import java.util.List; 19 | import java.util.Objects; 20 | import java.util.Set; 21 | 22 | import org.gradle.api.Project; 23 | import org.gradle.api.Task; 24 | import org.gradle.api.tasks.TaskContainer; 25 | 26 | public abstract class GradleUtils { 27 | 28 | /** 29 | * Checked if the given task will be executed because set in command line or depends on other executed task. 30 | * 31 | * @param task the task to check 32 | * @param project the current project 33 | * @return true, if the task will be executed 34 | */ 35 | public static boolean isTaskExecute( Task task, Project project ) { 36 | String name = task.getName(); 37 | List startTasks = project.getGradle().getStartParameter().getTaskNames(); 38 | TaskContainer tasks = project.getTasks(); 39 | for( String startTaskName : startTasks ) { 40 | if( Objects.equals( name, startTaskName ) || startTaskName.endsWith( ":" + name ) ) { 41 | // direct call of the task in the command line 42 | return true; 43 | } 44 | try { 45 | Task startTask = tasks.getByName( startTaskName ); 46 | if( isTaskExecute( task, name, startTask, tasks ) ) { 47 | return true; 48 | } 49 | } catch( Throwable th ) { 50 | // can occur if there is a circle in the dependsOn 51 | } 52 | } 53 | 54 | return false; 55 | } 56 | 57 | /** 58 | * Checked if the given task will be executed because set in command line or depends on other executed task. 59 | * 60 | * @param task the task to check 61 | * @param name the name to check 62 | * @param startTask a task that will be executed 63 | * @param tasks all tasks 64 | * @return true, if the task will be executed 65 | */ 66 | private static boolean isTaskExecute( Task task, String name, Task startTask, TaskContainer tasks ) { 67 | if( startTask == null ) { 68 | return false; 69 | } 70 | Set dependsOn = startTask.getDependsOn(); // can contain a task name, a task or other objects 71 | for( Object depObject : dependsOn ) { 72 | if( Objects.equals( name, depObject ) ) { 73 | return true; 74 | } 75 | if( Objects.equals( task, depObject ) ) { 76 | return true; 77 | } 78 | Task depTask = null; 79 | if( depObject instanceof String ) { 80 | depTask = tasks.getByName( (String)depObject ); 81 | } else if( depObject instanceof Task ) { 82 | depTask = (Task)depObject; 83 | } 84 | if( isTaskExecute( task, name, depTask, tasks ) ) { 85 | return true; 86 | } 87 | } 88 | return false; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/Common/Service.m: -------------------------------------------------------------------------------- 1 | // 2 | // Service.m 3 | // LaunchRocket 4 | // 5 | // Created by Josh Butts on 3/26/13. 6 | // Copyright (c) 2013 Josh Butts. All rights reserved. 7 | // 8 | 9 | #import "Service.h" 10 | #import "Variables.h" 11 | #import "NSString+MD5.h" 12 | 13 | @implementation Service 14 | 15 | @synthesize plist; 16 | @synthesize identifier; 17 | @synthesize name; 18 | @synthesize useSudo; 19 | @synthesize runAtBoot; 20 | @synthesize description; 21 | @synthesize version; 22 | @synthesize program; 23 | @synthesize starter; 24 | 25 | - (id) initWithPlistURL:(NSURL *)plistURL 26 | { 27 | if ( self = [super init] ) { 28 | 29 | self.plist = plistURL; 30 | 31 | NSDictionary *plistData = [[NSDictionary alloc] initWithContentsOfURL:self.plist]; 32 | self.identifier = [plistData objectForKey:@"Label"]; 33 | self.name = [plistData objectForKey:@"Name"]; 34 | 35 | NSNumber *shouldUseSudo = [plistData objectForKey:@"RunAsRoot"]; 36 | if (shouldUseSudo == nil) { 37 | self.useSudo = NO; 38 | } else { 39 | self.useSudo = [shouldUseSudo boolValue]; 40 | } 41 | 42 | NSNumber *shouldRunAtLogin = [plistData objectForKey:@"RunAtBoot"]; 43 | if (shouldRunAtLogin == nil) { 44 | self.runAtBoot = NO; 45 | } else { 46 | self.runAtBoot = [shouldRunAtLogin boolValue]; 47 | } 48 | 49 | description = [plistData objectForKey:@"Description"]; 50 | version = [plistData objectForKey:@"Version"]; 51 | program = [plistData objectForKey:@"Program"]; 52 | starter = [plistData objectForKey:@"starter"]; // List of starter actions for the pref pane 53 | } 54 | 55 | return self; 56 | } 57 | 58 | - (NSString *)pathForService { 59 | 60 | NSString *plistFile = [NSString stringWithFormat:@"/tmp/%@.plist", self.identifier]; 61 | if (self.runAtBoot) { 62 | if (self.useSudo) { 63 | plistFile = [NSString stringWithFormat:@"%@/%@.plist", LAUNCHDAEMONS_PATH, self.identifier]; 64 | } else { 65 | plistFile = [NSString stringWithFormat:@"%@%@/%@.plist", NSHomeDirectory(), LAUNCHAGENTS_PATH, self.identifier]; 66 | } 67 | plistFile =[NSString stringWithFormat:@"%@/%@.plist", LAUNCHDAEMONS_PATH, self.identifier]; 68 | } 69 | 70 | /* DLog(@"Path for service: %@", plistFile); */ 71 | return plistFile; 72 | } 73 | 74 | - (NSDictionary *)starterForHash:(const char*)md5 { 75 | 76 | for ( NSDictionary *starter in self->starter ) { 77 | if ( [[Service actionFor:starter] isEqualToMD5CString:md5] ) { 78 | return starter; 79 | } 80 | } 81 | return nil; 82 | } 83 | 84 | /** 85 | Determin the user for the given Starter 86 | */ 87 | + (NSString *)userFor:(NSDictionary *)starter { 88 | NSString *user = [starter valueForKey:@"asuser"]; 89 | return user != nil ? user : @"root"; 90 | } 91 | 92 | /** 93 | Determin the title for the given Starter 94 | */ 95 | + (NSString *)titleFor:(NSDictionary *)starter { 96 | 97 | NSString *title = [starter valueForKey:@"title"]; 98 | NSString *asRootString = localized(@"runAsRoot"); 99 | 100 | if ( [self runAsRoot:starter] ) { 101 | title = [title stringByAppendingString:[NSString stringWithFormat:asRootString, [self userFor:starter]]]; 102 | } 103 | 104 | return title; 105 | } 106 | 107 | + (NSString *)actionFor:(NSDictionary *)starter { 108 | return [starter valueForKey:@"action"]; 109 | } 110 | 111 | + (BOOL)runAsRoot:(NSDictionary *)starter { 112 | return [[starter valueForKey:@"asroot"] boolValue]; 113 | } 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/template/preinstall.createuser.txt: -------------------------------------------------------------------------------- 1 | 2 | DEAMON_USER="{{daemonUser}}" 3 | HOME_DIRECTORY="{{homeDirectory}}" 4 | SERVICE_DESCRIPTION="{{displayName}}" 5 | 6 | if [ -z "${DEAMON_USER}" ]; then 7 | echo "The User that you want to create has to be set." 8 | exit 1 9 | fi 10 | 11 | if [ -z "${HOME_DIRECTORY}" ]; then 12 | HOME_DIRECTORY="/Users/${DEAMON_USER}" 13 | fi 14 | 15 | # find the next UID and GID that is below 500, so that we can create the service user 16 | # if the user or group already exists, it will use this existing ID and still do the rest. We might have changes to commit. 17 | OLDUID=$(dscl . -read "/Users/${DEAMON_USER}" UniqueID 2> /dev/null | awk '{print $2}') 18 | OLDGID=$(dscl . -read "/Groups/${DEAMON_USER}" PrimaryGroupID 2> /dev/null | awk '{print $2}') 19 | 20 | NEXTUID=$([ -n "$OLDUID" ] && echo "$OLDUID" || dscl . -list /Users UniqueID | awk 'BEGIN{i=0}{if($2>i&&$2<500)i=$2}END{print i+1}') 21 | NEXTGID=$([ -n "$OLDGID" ] && echo "$OLDGID" || dscl . -list /Groups PrimaryGroupID | awk 'BEGIN{i=0}{if($2>i&&$2<500)i=$2}END{print i+1}') 22 | 23 | echo "I am Batman, or: $(whoami)" 24 | echo "Will use '${NEXTUID}' as UserID and '${NEXTGID}' as group ID for User '${DEAMON_USER}'" 25 | 26 | ######################################################################################################### 27 | # Create Group 28 | [ -z "$OLDGID" ] && dscl . -create "/Groups/${DEAMON_USER}" PrimaryGroupID "${NEXTGID}" || echo "Group already existed" 29 | # Unusable password for standard user group 30 | [ -z "$OLDGID" ] && dscl . -create "/Groups/${DEAMON_USER}" Password \* || echo "Password for group not set" 31 | ######################################################################################################### 32 | 33 | ######################################################################################################### 34 | # Create User 35 | [ -z "$OLDUID" ] && dscl . -create "/Users/${DEAMON_USER}" UniqueID "${NEXTUID}" || echo "User already existed" 36 | [ -z "$OLDUID" ] && dscl . -create "/Users/${DEAMON_USER}" PrimaryGroupID "${NEXTGID}" || echo "User already existed, not setting PrimaryGroupID" 37 | dscl . -create "/Users/${DEAMON_USER}" NFSHomeDirectory "${HOME_DIRECTORY}" || echo "NFSHomeDirectory can not be set" 38 | 39 | # Can't login as standard user 40 | dscl . -create "/Users/${DEAMON_USER}" UserShell /usr/bin/false || echo "UserShell can not be set" 41 | dscl . -create "/Users/${DEAMON_USER}" RealName "${SERVICE_DESCRIPTION} Administrator" || echo "RealName can not be set" 42 | 43 | # Revoke Permissions 44 | dscl . -delete "/Users/${DEAMON_USER}" PasswordPolicyOptions || echo "PasswordPolicyOptions can not be removed" 45 | dscl . -delete "/Users/${DEAMON_USER}" AuthenticationAuthority || echo "AuthenticationAuthority can not be removed" 46 | 47 | # Unusable password for standard users 48 | dscl . -create "/Users/${DEAMON_USER}" Password \* || echo "Password can not be set" 49 | 50 | # Add user to group user and staff, but check first! Mojave removed the user group 51 | dseditgroup -o edit -a "${DEAMON_USER}" -t "$(dscl . -read "/Groups/user" RecordName 2> /dev/null | awk '{print $2}')" "$(dscl . -read "/Groups/staff" RecordName 2> /dev/null | awk '{print $2}')" || echo "Default groups could not be added to user" 52 | ######################################################################################################### 53 | 54 | # make home directory 55 | [ ! -d "${HOME_DIRECTORY}" ] && mkdir -p "${HOME_DIRECTORY}/Library/Preferences" || echo "HomeDirectory and preferences should already exist" 56 | [ -d "${HOME_DIRECTORY}" ] && chown -R "${DEAMON_USER}:${DEAMON_USER}" "${HOME_DIRECTORY}" || echo "Directory permissions have been set before" 57 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/io/LittleEndianInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * LittleEndianInputStream.java 3 | * 4 | * Created on 07 November 2006, 08:26 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package com.inet.gradle.setup.image.image4j.io; 11 | 12 | import java.io.EOFException; 13 | import java.io.IOException; 14 | 15 | /** 16 | * Reads little-endian data from a source InputStream by reversing byte ordering. 17 | * @author Ian McDonagh 18 | */ 19 | public class LittleEndianInputStream extends java.io.DataInputStream { 20 | 21 | /** 22 | * Creates a new instance of LittleEndianInputStream, which will read from the specified source. 23 | * @param in the source InputStream 24 | */ 25 | public LittleEndianInputStream(java.io.InputStream in) { 26 | super(in); 27 | } 28 | 29 | /** 30 | * Reads a little-endian short value 31 | * @throws java.io.IOException if an error occurs 32 | * @return short value with reversed byte order 33 | */ 34 | public short readShortLE() throws IOException { 35 | 36 | int b1 = read(); 37 | int b2 = read(); 38 | 39 | if (b1 < 0 || b2 < 0) { 40 | throw new EOFException(); 41 | } 42 | 43 | short ret = (short) ((b2 << 8) + (b1 << 0)); 44 | 45 | return ret; 46 | } 47 | 48 | /** 49 | * Reads a little-endian int value. 50 | * @throws java.io.IOException if an error occurs 51 | * @return int value with reversed byte order 52 | */ 53 | public int readIntLE() throws IOException { 54 | int b1 = read(); 55 | int b2 = read(); 56 | int b3 = read(); 57 | int b4 = read(); 58 | 59 | if (b1 < -1 || b2 < -1 || b3 < -1 || b4 < -1) { 60 | throw new EOFException(); 61 | } 62 | 63 | int ret = (b4 << 24) + (b3 << 16) + (b2 << 8) + (b1 << 0); 64 | 65 | return ret; 66 | } 67 | 68 | /** 69 | * Reads a little-endian float value. 70 | * @throws java.io.IOException if an error occurs 71 | * @return float value with reversed byte order 72 | */ 73 | public float readFloatLE() throws IOException { 74 | int i = readIntLE(); 75 | 76 | float ret = Float.intBitsToFloat(i); 77 | 78 | return ret; 79 | } 80 | 81 | /** 82 | * Reads a little-endian long value. 83 | * @throws java.io.IOException if an error occurs 84 | * @return long value with reversed byte order 85 | */ 86 | public long readLongLE() throws IOException { 87 | 88 | int i1 = readIntLE(); 89 | int i2 = readIntLE(); 90 | 91 | long ret = ((long)(i1) << 32) + (i2 & 0xFFFFFFFFL); 92 | 93 | return ret; 94 | } 95 | 96 | /** 97 | * Reads a little-endian double value. 98 | * @throws java.io.IOException if an error occurs 99 | * @return double value with reversed byte order 100 | */ 101 | public double readDoubleLE() throws IOException { 102 | 103 | long l = readLongLE(); 104 | 105 | double ret = Double.longBitsToDouble(l); 106 | 107 | return ret; 108 | } 109 | 110 | /** 111 | * @since 0.6 112 | */ 113 | public long readUnsignedInt() throws IOException { 114 | long i1 = readUnsignedByte(); 115 | long i2 = readUnsignedByte(); 116 | long i3 = readUnsignedByte(); 117 | long i4 = readUnsignedByte(); 118 | 119 | long ret = ((i1 << 24) | (i2 << 16) | (i3 << 8) | i4); 120 | 121 | return ret; 122 | } 123 | 124 | /** 125 | * @since 0.6 126 | */ 127 | public long readUnsignedIntLE() throws IOException { 128 | long i1 = readUnsignedByte(); 129 | long i2 = readUnsignedByte(); 130 | long i3 = readUnsignedByte(); 131 | long i4 = readUnsignedByte(); 132 | 133 | long ret = (i4 << 24) | (i3 << 16) | (i2 << 8) | i1; 134 | 135 | return ret; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/test/java/com/inet/gradle/setup/msi/Launch4jClassifierTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.msi; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertFalse; 20 | import static org.junit.Assert.assertNotNull; 21 | import static org.junit.Assert.assertTrue; 22 | 23 | import java.util.Arrays; 24 | import java.util.HashSet; 25 | import java.util.Set; 26 | 27 | import org.gradle.internal.os.OperatingSystem; 28 | import org.junit.Test; 29 | 30 | /** 31 | * Tests for Phase 3: Launch4j Cross-Platform Workdir Classifier Selection 32 | */ 33 | public class Launch4jClassifierTest { 34 | 35 | private static final OperatingSystem OS = OperatingSystem.current(); 36 | 37 | // Valid classifiers from Maven Central: https://repo1.maven.org/maven2/net/sf/launch4j/launch4j/3.50/ 38 | private static final Set VALID_CLASSIFIERS = new HashSet(Arrays.asList( 39 | "workdir-win32", 40 | "workdir-linux", 41 | "workdir-linux64", 42 | "workdir-mac" 43 | )); 44 | 45 | @Test 46 | public void testClassifierSelection() { 47 | String classifier = getWorkdirClassifier(); 48 | assertNotNull("Classifier should not be null", classifier); 49 | assertTrue("Classifier should be valid: " + classifier, 50 | VALID_CLASSIFIERS.contains(classifier)); 51 | } 52 | 53 | @Test 54 | public void testWindowsClassifier() { 55 | if (OS.isWindows()) { 56 | String classifier = getWorkdirClassifier(); 57 | assertEquals("Windows should use workdir-win32", "workdir-win32", classifier); 58 | } 59 | } 60 | 61 | @Test 62 | public void testLinuxClassifier() { 63 | if (OS.isLinux()) { 64 | String classifier = getWorkdirClassifier(); 65 | String arch = System.getProperty("os.arch"); 66 | 67 | if (arch != null && (arch.contains("64") || arch.equals("amd64") || arch.equals("x86_64"))) { 68 | assertEquals("64-bit Linux should use workdir-linux64", "workdir-linux64", classifier); 69 | } else { 70 | assertEquals("32-bit Linux should use workdir-linux", "workdir-linux", classifier); 71 | } 72 | } 73 | } 74 | 75 | @Test 76 | public void testMacOsClassifier() { 77 | if (OS.isMacOsX()) { 78 | String classifier = getWorkdirClassifier(); 79 | assertEquals("macOS should use workdir-mac", "workdir-mac", classifier); 80 | } 81 | } 82 | 83 | @Test 84 | public void testArchitectureDetection() { 85 | String arch = System.getProperty("os.arch"); 86 | assertNotNull("Architecture should be detected", arch); 87 | assertFalse("Architecture should not be empty", arch.isEmpty()); 88 | } 89 | 90 | /** 91 | * Simulates the getWorkdirClassifier() logic from Launch4jCreator 92 | */ 93 | private String getWorkdirClassifier() { 94 | if (OS.isWindows()) { 95 | return "workdir-win32"; 96 | } else if (OS.isLinux()) { 97 | String arch = System.getProperty("os.arch"); 98 | if (arch != null && (arch.contains("64") || arch.equals("amd64") || arch.equals("x86_64"))) { 99 | return "workdir-linux64"; 100 | } 101 | return "workdir-linux"; 102 | } else if (OS.isMacOsX()) { 103 | return "workdir-mac"; 104 | } 105 | return "workdir-win32"; // Fallback 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /testBuilds/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | mavenCentral() 5 | // For snapshots, add Sonatype snapshot repository 6 | maven { 7 | url uri('https://oss.sonatype.org/content/repositories/snapshots/') 8 | } 9 | } 10 | dependencies { 11 | apply from: "${buildscript.sourceFile.parentFile.parentFile}/scripts/VersionNumber.gradle" 12 | apply from: "${buildscript.sourceFile.parentFile.parentFile}/scripts/SetupBuilderVersion.gradle" 13 | classpath 'de.inetsoftware:SetupBuilder:' + setupBuilderVersion() 14 | } 15 | } 16 | 17 | repositories { 18 | mavenLocal() 19 | mavenCentral() 20 | } 21 | 22 | apply plugin: 'de.inetsoftware.setupbuilder' 23 | 24 | apply plugin: 'java' 25 | 26 | sourceSets { 27 | main { 28 | java { 29 | srcDirs 'src' 30 | } 31 | } 32 | } 33 | 34 | setupBuilder { 35 | 36 | application = "Setup Builder Test" 37 | description = 'Build a test Programm.' 38 | icons = "test-icon.icns" 39 | vendor = 'Sample Company Inc.' 40 | 41 | licenseFile "license_en.txt" 42 | licenseFile { 43 | locale = "de" 44 | resource = "license_de.txt" 45 | } 46 | 47 | from jar.outputs 48 | 49 | bundleJre = 1.8 50 | java.sourceCompatibility = 1.8 51 | java.targetCompatibility = 1.8 52 | mainClass = 'com.inet.testapplication.TestLauncher' 53 | mainJar = 'testBuilds.jar' 54 | 55 | runBeforeUninstall { 56 | mainClass = 'com.inet.testapplication.TestLauncher' 57 | } 58 | runAfter { 59 | mainClass = 'com.inet.testapplication.TestLauncher' 60 | mainJar = 'testBuilds.jar' 61 | } 62 | service { 63 | displayName = "i-net TestLaunch Server" 64 | id = "testservice" 65 | } 66 | version = "3.0" 67 | minimumUpdateVersion "2.5" 68 | } 69 | 70 | configure( [ deb, rpm ] ) { 71 | doFirst { 72 | setupBuilder { 73 | defaultResourceLanguage "de" 74 | longDescription "longDesc_de.txt" 75 | longDescription { 76 | locale = "en" 77 | resource = "longDesc_en.txt" 78 | } 79 | } 80 | } 81 | } 82 | 83 | deb { 84 | checkPackage = false 85 | } 86 | 87 | dmg { 88 | preferencesLink { 89 | title = "Testing Link" 90 | action = "echo Hello World" 91 | } 92 | preferencesLink { 93 | title = "Second Testing Link" 94 | action = "echo Another World, hello" 95 | } 96 | 97 | daemonUser = "testingUser" 98 | } 99 | 100 | msi{ 101 | languages = ["en-us"] 102 | //external file("fragmentDlg.wxs") 103 | //wxsTemplate = "template.wxs" 104 | multiInstanceCount = 10 105 | } 106 | 107 | dmg.dependsOn jar 108 | deb.dependsOn jar 109 | rpm.dependsOn jar 110 | msi.dependsOn jar 111 | 112 | // If the 'dmg' task is to be build, make sure that the pref pane exists as well 113 | import org.apache.tools.ant.taskdefs.condition.Os 114 | task preparePrefPane(type: GradleBuild) { 115 | 116 | buildDir = '../../SetupBuilderOSXPrefPane' 117 | tasks = ['clean', 'uploadArchives'] 118 | 119 | processResources.dependsOn 'preparePrefPane' 120 | 121 | onlyIf { 122 | file('../../SetupBuilderOSXPrefPane/build.gradle').exists() && Os.isFamily(Os.FAMILY_MAC) 123 | } 124 | } 125 | 126 | /** buildFile does not exits anymore 127 | // run the following task as a dependency to the "check"-task. 128 | task runAppBundlerTest(type: GradleBuild) { 129 | 130 | buildFile = './appBundler.gradle' 131 | tasks = ['clean', 'bundleApp'] 132 | 133 | processResources.dependsOn 'runAppBundlerTest' 134 | 135 | onlyIf { 136 | file(buildFile).exists() && Os.isFamily(Os.FAMILY_MAC) 137 | } 138 | } 139 | 140 | // run the following task as a dependency to the "check"-task. 141 | task runJNLPBundlerTest(type: GradleBuild) { 142 | 143 | buildFile = './jnlpBundler.gradle' 144 | tasks = ['clean', 'bundleApp'] 145 | 146 | processResources.dependsOn 'runJNLPBundlerTest' 147 | 148 | onlyIf { 149 | file(buildFile).exists() && Os.isFamily(Os.FAMILY_MAC) 150 | } 151 | } 152 | */ 153 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/image/image4j/codec/ico/IconEntry.java: -------------------------------------------------------------------------------- 1 | package com.inet.gradle.setup.image.image4j.codec.ico; 2 | 3 | import java.io.IOException; 4 | 5 | import com.inet.gradle.setup.image.image4j.io.LittleEndianInputStream; 6 | 7 | /** 8 | * Represents an IconEntry structure, which contains information about an ICO image. 9 | * @author Ian McDonagh 10 | */ 11 | public class IconEntry { 12 | /** 13 | * The width of the icon image in pixels. 14 | * 0 specifies a width of 256 pixels. 15 | */ 16 | public int bWidth; 17 | /** 18 | * The height of the icon image in pixels. 19 | * 0 specifies a height of 256 pixels. 20 | */ 21 | public int bHeight; 22 | /** 23 | * The number of colours, calculated from {@link #sBitCount sBitCount}. 24 | * 0 specifies a colour count of >= 256. 25 | */ 26 | public int bColorCount; 27 | /** 28 | * Unused. Should always be 0. 29 | */ 30 | public byte bReserved; 31 | /** 32 | * Number of planes, which should always be 1. 33 | */ 34 | public short sPlanes; 35 | /** 36 | * Colour depth in bits per pixel. 37 | */ 38 | public short sBitCount; 39 | /** 40 | * Size of ICO data, which should be the size of (InfoHeader + AND bitmap + XOR bitmap). 41 | */ 42 | public int iSizeInBytes; 43 | /** 44 | * Position in file where the InfoHeader starts. 45 | */ 46 | public int iFileOffset; 47 | 48 | /** 49 | * Creates an IconEntry structure from the source input 50 | * @param in the source input 51 | * @throws java.io.IOException if an error occurs 52 | */ 53 | public IconEntry(LittleEndianInputStream in) throws IOException { 54 | //Width 1 byte Cursor Width (16, 32, 64, 0 = 256) 55 | bWidth = in.readUnsignedByte(); 56 | //Height 1 byte Cursor Height (16, 32, 64, 0 = 256 , most commonly = Width) 57 | bHeight = in.readUnsignedByte(); 58 | //ColorCount 1 byte Number of Colors (2,16, 0=256) 59 | bColorCount = in.readUnsignedByte(); 60 | //Reserved 1 byte =0 61 | bReserved = in.readByte(); 62 | //Planes 2 byte =1 63 | sPlanes = in.readShortLE(); 64 | //BitCount 2 byte bits per pixel (1, 4, 8) 65 | sBitCount = in.readShortLE(); 66 | //SizeInBytes 4 byte Size of (InfoHeader + ANDbitmap + XORbitmap) 67 | iSizeInBytes = in.readIntLE(); 68 | //FileOffset 4 byte FilePos, where InfoHeader starts 69 | iFileOffset = in.readIntLE(); 70 | } 71 | 72 | /** 73 | * Creates and IconEntry structure with default values. 74 | */ 75 | public IconEntry() { 76 | bWidth = 0; 77 | bHeight = 0; 78 | bColorCount = 0; 79 | sPlanes = 1; 80 | bReserved = 0; 81 | sBitCount = 0; 82 | iSizeInBytes = 0; 83 | iFileOffset = 0; 84 | } 85 | 86 | /** 87 | * A string representation of this IconEntry structure. 88 | */ 89 | public String toString() { 90 | StringBuffer sb = new StringBuffer(); 91 | sb.append("width="); 92 | sb.append(bWidth); 93 | sb.append(",height="); 94 | sb.append(bHeight); 95 | sb.append(",bitCount="); 96 | sb.append(sBitCount); 97 | sb.append(",colorCount="+bColorCount); 98 | return sb.toString(); 99 | } 100 | 101 | /** 102 | * Writes the IconEntry structure to output 103 | * @param out the output 104 | * @throws java.io.IOException if an error occurs 105 | */ 106 | public void write(com.inet.gradle.setup.image.image4j.io.LittleEndianOutputStream out) throws IOException { 107 | //Width 1 byte Cursor Width (16, 32 or 64) 108 | out.writeByte(bWidth); 109 | //Height 1 byte Cursor Height (16, 32 or 64 , most commonly = Width) 110 | out.writeByte(bHeight); 111 | //ColorCount 1 byte Number of Colors (2,16, 0=256) 112 | out.writeByte(bColorCount); 113 | //Reserved 1 byte =0 114 | out.writeByte(bReserved); 115 | //Planes 2 byte =1 116 | out.writeShortLE(sPlanes); 117 | //BitCount 2 byte bits per pixel (1, 4, 8) 118 | out.writeShortLE(sBitCount); 119 | //SizeInBytes 4 byte Size of (InfoHeader + ANDbitmap + XORbitmap) 120 | out.writeIntLE(iSizeInBytes); 121 | //FileOffset 4 byte FilePos, where InfoHeader starts 122 | out.writeIntLE(iFileOffset); 123 | } 124 | } -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/dmg/preferences/SetupBuilderOSXPrefPane/SetupBuilderOSXPrefPane.m: -------------------------------------------------------------------------------- 1 | // 2 | // SetupBuilderOSXPrefPane.m 3 | // SetupBuilderOSXPrefPane 4 | // 5 | // Created by Gerry Weißbach on 23/07/2015. 6 | // Copyright (c) 2015 i-net software. All rights reserved. 7 | // 8 | 9 | #import "SetupBuilderOSXPrefPane.h" 10 | 11 | #import "ServiceController.h" 12 | #import "Service.h" 13 | #import "Process.h" 14 | 15 | @implementation SetupBuilderOSXPrefPane 16 | 17 | // Constructor 18 | - (id)initWithBundle:(NSBundle *)bundle 19 | { 20 | if ( ( self = [super initWithBundle:bundle] ) != nil ) { 21 | self->bundle = bundle; 22 | self->helperPath = [bundle pathForAuxiliaryExecutable:HELPER_BINARY]; 23 | DLog(@"Using helper: `%@`", helperPath); 24 | } 25 | return self; 26 | } 27 | 28 | - (void)mainViewDidLoad 29 | { 30 | NSURL *plist = [[NSBundle bundleForClass:[self class]] URLForResource:@"service" withExtension:@"plist"]; 31 | service = [[Service alloc] initWithPlistURL:plist]; 32 | 33 | // Setup SFAuthorizationView 34 | AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0}; 35 | AuthorizationRights rights = {1, &items}; 36 | [authView setAuthorizationRights:&rights]; 37 | authView.delegate = self; 38 | [authView updateStatus:nil]; 39 | } 40 | 41 | - (void)didUnselect { 42 | } 43 | 44 | // Called when the preference pane is shown 45 | - (void)didSelect { 46 | [serviceController setService:service]; 47 | [serviceController setProcess: [[Process alloc] initWithAuthProvider: self]]; 48 | [serviceController pollStatus]; 49 | [self updateUI]; 50 | } 51 | 52 | - (void)updateUI { 53 | DLog( @"Updating UI: %hhd", [self isUnlocked] ); 54 | [serviceController setEnabled: [self isUnlocked]]; 55 | } 56 | 57 | // 58 | // SFAuthorization delegates 59 | // 60 | 61 | - (void)authorizationViewDidAuthorize:(SFAuthorizationView *)view { 62 | // Enable Service Button 63 | [self updateUI]; 64 | } 65 | 66 | - (void)authorizationViewDidDeauthorize:(SFAuthorizationView *)view { 67 | // Disable Service Button 68 | [self updateUI]; 69 | } 70 | 71 | - (void)authorizationViewCreatedAuthorization:(SFAuthorizationView *)view { 72 | [self updateUI]; 73 | } 74 | 75 | // 76 | // AuthorizationProvider protocol 77 | // 78 | 79 | - (BOOL)isUnlocked { 80 | return [authView authorizationState] == SFAuthorizationViewUnlockedState; 81 | } 82 | 83 | - (int)runAsRoot:(NSString*)program args:(NSArray*)args { 84 | size_t numArgs = args.count; 85 | char **cArgs = alloca(sizeof(char*) * (1 + numArgs)); 86 | for (int i=0; i timestamps = Arrays.asList( // 35 | "http://time.certum.pl", // 36 | //"http://timestamp.verisign.com/scripts/timstamp.dll", // no connect possible 37 | "http://timestamp.globalsign.com/scripts/timestamp.dll", // 38 | "http://tsa.starfieldtech.com", // 39 | "http://timestamp.comodoca.com/authenticode" // certificate is expired 40 | ); 41 | 42 | /** 43 | * Get a certificate file. 44 | * 45 | * @return a file or null 46 | */ 47 | public Object getCertificate() { 48 | return certificate; 49 | } 50 | 51 | /** 52 | * Set a certificate file. This is used for the /f option of signtool. 53 | * 54 | * @param certificate the file 55 | */ 56 | public void setCertificate( Object certificate ) { 57 | this.certificate = certificate; 58 | } 59 | 60 | /** 61 | * Get the password for a certificate file. 62 | * 63 | * @return the password 64 | */ 65 | public String getPassword() { 66 | return password; 67 | } 68 | 69 | /** 70 | * Set the password for a certificate file. This is used for the /p option of signtool. 71 | * 72 | * @param password the password 73 | */ 74 | public void setPassword( String password ) { 75 | this.password = password; 76 | } 77 | 78 | /** 79 | * Get a SHA1 thumbprint of the signing cert. 80 | * 81 | * @return the thumbprint 82 | */ 83 | public String getSha1() { 84 | return sha1; 85 | } 86 | 87 | /** 88 | * Set the SHA1 thumbprint of the signing cert. This is used for the /sha1 option of signtool. 89 | * 90 | * @param sha1 the thumbprint 91 | */ 92 | public void setSha1( String sha1 ) { 93 | this.sha1 = sha1; 94 | } 95 | 96 | /** 97 | * Get a list of timestamp servers. 98 | * 99 | * @return the list or null 100 | */ 101 | public List getTimestamp() { 102 | return timestamps; 103 | } 104 | 105 | /** 106 | * Set a list of timestamp servers. By default there is already a list of popular timestamp servers. With null you 107 | * can disable the timestamp signing. If one server is failing then the next server is try. 108 | * 109 | * @param timestamps new timestamp servers. 110 | */ 111 | public void setTimestamp( List timestamps ) { 112 | this.timestamps = timestamps; 113 | } 114 | 115 | /** 116 | * Set a single timestamp server. With null you can disable the timestamp signing. 117 | * 118 | * @param timestamp a single timestamp server 119 | */ 120 | public void setTimestamp( String timestamp ) { 121 | this.timestamps = timestamp == null ? null : Arrays.asList( timestamp ); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/Launch4jManifest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 - 20016 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.msi; 17 | 18 | import java.io.File; 19 | import java.io.IOException; 20 | 21 | import org.w3c.dom.Element; 22 | 23 | import com.inet.gradle.setup.SetupBuilder; 24 | import com.inet.gradle.setup.util.XmlFileBuilder; 25 | 26 | /** 27 | * Create an XML configuration file for lauch4j. 28 | * 29 | * @author Volker 30 | */ 31 | class Launch4jManifest extends XmlFileBuilder { 32 | 33 | private Launch4j launch; 34 | 35 | /** 36 | * Create a instance. 37 | * 38 | * @param launch the launch description 39 | * @param task current task 40 | * @param setup the SetupBuilder 41 | * @throws Exception if any error occur 42 | */ 43 | Launch4jManifest( Launch4j launch, Msi task, SetupBuilder setup ) throws Exception { 44 | super( task, setup, File.createTempFile( "launch4j", ".manifest", task.getTemporaryDir() ), task.getTemporaryDir(), null ); 45 | this.launch = launch; 46 | } 47 | 48 | /** 49 | * Create the XML file. 50 | * 51 | * @throws IOException if an error occurs on reading the image files 52 | */ 53 | void build() throws IOException { 54 | Element assembly = getOrCreateChild( doc, "assembly" ); 55 | assembly.setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns", "urn:schemas-microsoft-com:asm.v1" ); 56 | addAttributeIfNotExists( assembly, "manifestVersion", "1.0" ); 57 | 58 | Element identity = getOrCreateChild( assembly, "assemblyIdentity" ); 59 | addAttributeIfNotExists( identity, "version", Launch4jConfig.normalizeVersionNumber( task.getVersion() ) ); 60 | addAttributeIfNotExists( identity, "processorArchitecture", "X86" ); 61 | addAttributeIfNotExists( identity, "name", launch.getDisplayName() ); 62 | addAttributeIfNotExists( identity, "type", "win32" ); 63 | 64 | Element compatibility = getOrCreateChild( assembly, "compatibility" ); 65 | compatibility.setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns", "urn:schemas-microsoft-com:compatibility.v1" ); 66 | 67 | Element application = getOrCreateChild( compatibility, "application" ); 68 | getOrCreateChildById( application, "supportedOS", "{e2011457-1546-43c5-a5fe-008deee3d3f0}" ); // support for Vista 69 | getOrCreateChildById( application, "supportedOS", "{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" ); // support for Windows 7 70 | getOrCreateChildById( application, "supportedOS", "{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" ); // support for Windows 8 71 | getOrCreateChildById( application, "supportedOS", "{1f676c76-80e1-4239-95bb-83d0f6d0da78}" ); // support for Windows 8.1 72 | getOrCreateChildById( application, "supportedOS", "{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" ); // support for Windows 10 73 | 74 | getOrCreateChild( assembly, "description" ).setTextContent( launch.getDescription() ); 75 | 76 | Element trustInfo = getOrCreateChild( assembly, "trustInfo" ); 77 | trustInfo.setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns", "urn:schemas-microsoft-com:asm.v2" ); 78 | 79 | String level = launch.getRequestedExecutionLevel(); 80 | if ( level != null && !level.isEmpty() ) { 81 | Element security = getOrCreateChild( trustInfo, "security" ); 82 | Element requestedPrivileges = getOrCreateChild( security, "requestedPrivileges" ); 83 | Element requestedExecutionLevel = getOrCreateChildByKeyValue( requestedPrivileges, "requestedExecutionLevel", "level", level ); 84 | addAttributeIfNotExists( requestedExecutionLevel, "uiAccess", "false" ); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/abstracts/DocumentType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.abstracts; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | * This class contains content for registering file extensions. 23 | * 24 | * @author Volker 25 | */ 26 | public class DocumentType { 27 | 28 | private final AbstractSetupBuilder setup; 29 | 30 | private List extensions; 31 | 32 | private String name; 33 | 34 | private String mimetype; 35 | 36 | private String role = "Viewer"; 37 | 38 | private Object icons; 39 | 40 | DocumentType( AbstractSetupBuilder setup ) { 41 | this.setup = setup; 42 | } 43 | 44 | /** 45 | * Add one file extensions. 46 | * 47 | * @param extension the extension 48 | */ 49 | public void fileExtension( String extension ) { 50 | if( extension.startsWith( "*." ) ) { 51 | extension = extension.substring( 2 ); 52 | } 53 | if( extensions == null ) { 54 | extensions = new ArrayList<>(); 55 | } 56 | extensions.add( extension ); 57 | } 58 | 59 | /** 60 | * Add multiple file extensions. 61 | * 62 | * @param extensions the extensions 63 | */ 64 | public void fileExtension( List extensions ) { 65 | for( String extension : extensions ) { 66 | fileExtension( extension ); 67 | } 68 | } 69 | 70 | /** 71 | * Add one file extensions. 72 | * 73 | * @param extension the extension 74 | */ 75 | public void setFileExtension( String extension ) { 76 | extensions = null; 77 | fileExtension( extension ); 78 | } 79 | 80 | public List getFileExtension() { 81 | return extensions; 82 | } 83 | 84 | /** 85 | * Set multiple file extensions. 86 | * 87 | * @param extensions the extensions 88 | */ 89 | public void setFileExtension( List extensions ) { 90 | this.extensions = extensions; 91 | } 92 | 93 | public String getName() { 94 | if( name != null && !name.isEmpty() ) { 95 | return name; 96 | } 97 | return setup.getProject().getName() + " file"; 98 | } 99 | 100 | public void setName( String name ) { 101 | this.name = name; 102 | } 103 | 104 | /** 105 | * Returns the mime type for the document type. If none mime type was specified it will return 'application/<the first extension>'. 106 | * @return the mime type for the document type 107 | */ 108 | public String getMimetype() { 109 | if( mimetype != null && mimetype.trim().length() > 0) { 110 | return mimetype; 111 | } else { 112 | List ext = getFileExtension(); 113 | return "application/" + ext.get( 0 ); 114 | } 115 | } 116 | 117 | /** 118 | * Sets the mime type of the document type 119 | * @param mimetype the mime type 120 | */ 121 | public void setMimetype( String mimetype ) { 122 | this.mimetype = mimetype; 123 | } 124 | 125 | public String getRole() { 126 | return role; 127 | } 128 | 129 | /** 130 | * Set the role for OSX. 131 | * 132 | * @param role the role 133 | */ 134 | public void setRole( String role ) { 135 | this.role = role; 136 | } 137 | 138 | public Object getIcons() { 139 | if( icons != null ) { 140 | return icons; 141 | } 142 | return setup.getIcons(); 143 | } 144 | 145 | public void setIcons( Object icons ) { 146 | this.icons = icons; 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/unix/deb/Deb.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.unix.deb; 17 | 18 | import org.gradle.api.tasks.Input; 19 | import org.gradle.api.tasks.Optional; 20 | 21 | import com.inet.gradle.setup.unix.Unix; 22 | 23 | /** 24 | * The deb Gradle task. It build a deb package for Debian / Ubuntu. 25 | * 26 | * @author Stefan Heidrich 27 | */ 28 | public class Deb extends Unix { 29 | 30 | private String priority; 31 | 32 | private String installSize; 33 | 34 | private String recommends; 35 | 36 | private boolean checkPackage = false; 37 | 38 | private String lintianOptions = ""; 39 | 40 | private String maintainerEmail; 41 | 42 | private String changes; 43 | 44 | private String compression; 45 | 46 | public Deb() { 47 | super( "deb" ); 48 | } 49 | 50 | /** 51 | * {@inheritDoc} 52 | */ 53 | @Override 54 | public void build() { 55 | new DebBuilder( this, getSetupBuilder(), getFileResolver() ).build(); 56 | } 57 | 58 | @Input 59 | @Optional 60 | public String getPriority() { 61 | return priority; 62 | } 63 | 64 | public void setPriority( String priority ) { 65 | this.priority = priority; 66 | } 67 | 68 | @Input 69 | @Optional 70 | public String getInstallSize() { 71 | return installSize; 72 | } 73 | 74 | public void setInstallSize( String installSize ) { 75 | this.installSize = installSize; 76 | } 77 | 78 | @Input 79 | @Optional 80 | @Override 81 | public String getRecommends() { 82 | return recommends; 83 | } 84 | 85 | @Override 86 | public void setRecommends( String recommends ) { 87 | this.recommends = recommends; 88 | } 89 | 90 | public boolean shouldCheckPackage() { 91 | return checkPackage; 92 | } 93 | 94 | public void setCheckPackage( boolean checkPackage ) { 95 | this.checkPackage = checkPackage; 96 | } 97 | 98 | /** 99 | * Return the options used for the 'lintian' process. 100 | * They will only have impact when checkPackages is enabled. 101 | * @return the lintianOptions 102 | */ 103 | @Input 104 | public String getLintianOptions() { 105 | return lintianOptions; 106 | } 107 | 108 | /** 109 | * Set the options used for the 'linting' process. 110 | * They will only have impact when checkPackages is enabled. 111 | * @param lintianOptions the lintianOptions to set 112 | */ 113 | public void setLintianOptions( String lintianOptions ) { 114 | this.lintianOptions = lintianOptions; 115 | } 116 | 117 | @Input 118 | @Optional 119 | public String getMaintainerEmail() { 120 | return maintainerEmail; 121 | } 122 | 123 | public void setMaintainerEmail( String maintainerEmail ) { 124 | this.maintainerEmail = maintainerEmail; 125 | } 126 | 127 | @Input 128 | @Optional 129 | public String getChanges() { 130 | return changes; 131 | } 132 | 133 | public void setChanges( String changes ) { 134 | this.changes = changes; 135 | } 136 | 137 | @Input 138 | @Optional 139 | public String getCompression() { 140 | return compression; 141 | } 142 | 143 | public void setCompression( String compression ) { 144 | this.compression = compression; 145 | } 146 | 147 | @Input 148 | @Override 149 | public String getArchitecture() { 150 | String architecture = super.getArchitecture(); 151 | if( architecture == null || architecture.length() == 0 ) { 152 | architecture = "all"; 153 | } 154 | return architecture; 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/abstracts/AbstractSetupTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 - 2016 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.abstracts; 17 | 18 | import java.util.ArrayList; 19 | 20 | import com.inet.gradle.setup.SetupBuilder; 21 | import org.gradle.api.tasks.Input; 22 | import org.gradle.api.tasks.Internal; 23 | 24 | /** 25 | * Base task for all setup builder tasks. 26 | * 27 | * @author Volker Berlin 28 | */ 29 | public abstract class AbstractSetupTask extends AbstractTask { 30 | 31 | private ArrayList postinst = new ArrayList(); 32 | 33 | private ArrayList preinst = new ArrayList(); 34 | 35 | private ArrayList postrm = new ArrayList(); 36 | 37 | private ArrayList prerm = new ArrayList(); 38 | 39 | /** 40 | * Constructor with indication to artifact result Runs with the default SetupBuilder for dmg, msi ... 41 | * 42 | * @param extension of the setup 43 | */ 44 | public AbstractSetupTask( String extension ) { 45 | super( extension, SetupBuilder.class ); 46 | } 47 | 48 | /** 49 | * Get the setup builder extension. 50 | * 51 | * @return the instance of the SetupBuilder 52 | */ 53 | @Internal 54 | public SetupBuilder getSetupBuilder() { 55 | return (SetupBuilder)super.getAbstractSetupBuilder(); 56 | } 57 | 58 | /** 59 | * Returns the preinst that should be used in the 'preinst' config file. 60 | * 61 | * @return the preinst specified in the gradle script 62 | */ 63 | @Input 64 | public ArrayList getPreinst() { 65 | return preinst; 66 | } 67 | 68 | /** 69 | * Adds the content for the 'preinst' config file. On Windows this can be vbscript or jscript that should be executed. 70 | * 71 | * @param preinst the content for the entry 72 | */ 73 | public void setPreinst( String preinst ) { 74 | this.preinst.add( preinst ); 75 | } 76 | 77 | /** 78 | * Returns the postinst that should be used in the 'postinst' config file. 79 | * 80 | * @return the postinst specified in the gradle script 81 | */ 82 | @Input 83 | public ArrayList getPostinst() { 84 | return postinst; 85 | } 86 | 87 | /** 88 | * Adds the content for the 'postinst' config file. On Windows this can be vbscript or jscript that should be executed. 89 | * 90 | * @param postinst the value for the entry 91 | */ 92 | public void setPostinst( String postinst ) { 93 | this.postinst.add( postinst ); 94 | } 95 | 96 | /** 97 | * Returns the prerm that should be used in the 'prerm' config file. 98 | * 99 | * @return the prerm specified in the gradle script 100 | */ 101 | @Input 102 | public ArrayList getPrerm() { 103 | return prerm; 104 | } 105 | 106 | /** 107 | * Adds the content for the 'prerm' config file. On Windows this can be vbscript or jscript that should be executed. 108 | * 109 | * @param prerm the value for the entry 110 | */ 111 | public void setPrerm( String prerm ) { 112 | this.prerm.add( prerm ); 113 | } 114 | 115 | /** 116 | * Returns the postrm that should be used in the 'postrm' config file. 117 | * 118 | * @return the postrm specified in the gradle script 119 | */ 120 | @Input 121 | public ArrayList getPostrm() { 122 | return postrm; 123 | } 124 | 125 | /** 126 | * Adds the content for the 'postrm' config file. On Windows this can be vbscript or jscript that should be executed. 127 | * 128 | * @param postrm the value for the entry 129 | */ 130 | public void setPostrm( String postrm ) { 131 | this.postrm.add( postrm ); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # SetupBuilder Changelog 2 | 3 | ## 8.4.23 (Unreleased) 4 | 5 | ### Changed 6 | * **Version Management**: Simplified version management - version now read from `gradle.properties` instead of hardcoded `buildVersion` variable 7 | * Version format: `..` or `..-SNAPSHOT` 8 | * Version compatibility with Gradle version is automatically validated and adjusted if needed 9 | * **Build Process**: Removed conditional JPP (Java Preprocessor) execution - now always processes source files for Gradle version compatibility 10 | * Source files are always preprocessed to `buildDir/preparedSrc-${gradleVersion}` 11 | * Ensures consistent build behavior across all Gradle versions 12 | * **Publishing**: Replaced local `../repo` publishing with `mavenLocal()` for local development 13 | * Use `./gradlew publishToMavenLocal` for local development 14 | * Snapshots are published to Sonatype snapshot repository 15 | * Releases are published to Maven Central via Sonatype 16 | * **CI/CD**: Migrated from Travis CI to GitHub Actions 17 | * CI workflow tests with multiple Gradle versions (7.6, 8.4, 8.14.2, 9.2.1) across multiple platforms (Ubuntu, Windows, macOS) 18 | * Release workflow automatically publishes to Sonatype and Gradle Plugin Portal 19 | 20 | ### Added 21 | * **Sonatype Publishing**: Added full Sonatype/Maven Central publishing support 22 | * Snapshots automatically published to `https://oss.sonatype.org/content/repositories/snapshots/` 23 | * Releases go through staging → close → release process 24 | * Signing support for both snapshots and releases 25 | * **Configuration Files**: 26 | * Created `gradle.properties` for centralized version management 27 | * Added GitHub Actions workflows (`.github/workflows/ci.yml` and `release.yml`) 28 | * **Documentation**: Added "Using Snapshots" section to README.md 29 | * Instructions for adding Sonatype snapshot repository 30 | * Instructions for using `mavenLocal()` for local development 31 | 32 | ### Fixed 33 | * Fixed Gradle 8.4 compatibility issues with `CopyProcessingSpec` interface methods 34 | * `getDirMode()`, `setDirMode()`, `getFileMode()`, `setFileMode()` methods properly handled 35 | * Fixed syntax error in `nexusPublishing` configuration block 36 | * Updated test builds to use `mavenLocal()` and Sonatype snapshot repository instead of `../../repo` 37 | 38 | ## 8.4.22 (v22) 39 | 40 | ### Changed 41 | * Gradle 9 now requires Java 17 42 | * Adaptations for Gradle 9 compatibility 43 | * Current version of `com.gradle.plugin-publish` plugin only compatible with Gradle >= 7.6 44 | * Removed support for older Gradle versions 45 | * Made Gradle script fit for Gradle 9 46 | * Replaced missing `VersionNumber` with own implementation 47 | * Updated `com.gradle.plugin-publish` plugin 48 | 49 | ### Fixed 50 | * `java.net.URL` is not allowed as `@Input` anymore (#132) 51 | * With Gradle 9 only the file name `build.gradle` is supported 52 | * Replaced internal API `ConfigureUtil` with public API 53 | * Removed reference to internal class `ProjectInternal` 54 | * Made compatible with Gradle 8.12/8.13 through a more generic solution (#132) 55 | * Fixed `gradlePlugin` settings 56 | * Added hack for Eclipse `.classpath` file 57 | 58 | ## 8.4.21 (v21) 59 | 60 | ### Changed 61 | * Build for Gradle version 8.4 because there are API changes since Gradle 8.0 (#125) 62 | * Build also version 8.0 of SetupBuilder (#125) 63 | 64 | ### Added 65 | * Added getter and setter methods for compression to use for Debian package 66 | * Default compression is now xzip on newer Debian systems 67 | * Can change compression for older systems (e.g., `compression="gzip"`) 68 | 69 | ### Fixed 70 | * Debian package: skip Recommends when empty (#128) 71 | * MSI installer: Does not use HKLM registry keys for installer with perUser scope (#127) 72 | * RTF file must not be quoted 73 | 74 | ## 8.4.20 (v20) 75 | 76 | ### Changed 77 | * Updated plugin dependencies 78 | * Library updates 79 | 80 | ## 8.4.18 (v18) 81 | 82 | ### Changed 83 | * Updates for Gradle 7 84 | 85 | ## 8.4.17 (v17) 86 | 87 | ### Changed 88 | * Library updates 89 | 90 | ## 8.4.16 (v16) 91 | 92 | ### Changed 93 | * Library updates 94 | 95 | ## 8.4.15 (v15) 96 | 97 | ### Changed 98 | * Library updates 99 | 100 | ## 8.4.13 (v13) 101 | 102 | ### Changed 103 | * Library updates 104 | 105 | ## 8.4.12 (v12) 106 | 107 | ### Changed 108 | * Library updates 109 | 110 | ## 8.4.11 (v11) 111 | 112 | ### Changed 113 | * Initial version tracking 114 | 115 | --- 116 | 117 | **Note:** Version history prior to v11 may not be fully documented. This changelog tracks significant changes from version 8.4.11 onwards. 118 | 119 | -------------------------------------------------------------------------------- /src/com/oracle/appbundler/TypeDeclaration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015, Quality First Software GmbH and/or its affiliates. All rights reserved. 3 | * 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 | * 6 | * This code is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 only, as 8 | * published by the Free Software Foundation. Oracle designates this 9 | * particular file as subject to the "Classpath" exception as provided 10 | * by Oracle in the LICENSE file that accompanied this code. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * version 2 for more details (a copy is included in the LICENSE file that 16 | * accompanied this code). 17 | * 18 | * You should have received a copy of the GNU General Public License version 19 | * 2 along with this work; if not, write to the Free Software Foundation, 20 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 | * 22 | */ 23 | 24 | package com.oracle.appbundler; 25 | 26 | import static com.oracle.appbundler.BundleDocument.getListFromCommaSeparatedString; 27 | 28 | import java.io.File; 29 | import java.util.Arrays; 30 | import java.util.List; 31 | 32 | /** 33 | * Class representing an UTExportedTypeDeclaration or UTImportedTypeDeclaration in Info.plist 34 | */ 35 | public class TypeDeclaration implements IconContainer { 36 | 37 | private boolean imported = false; 38 | private String identifier = null; 39 | private String referenceUrl = null; 40 | private String description = null; 41 | private String icon = null; 42 | private List conformsTo = null; 43 | private List osTypes = null; 44 | private List mimeTypes = null; 45 | private List extensions = null; 46 | 47 | public TypeDeclaration() { 48 | this.conformsTo = Arrays.asList(new String[]{"public.data"}); 49 | } 50 | 51 | public boolean isImported() { 52 | return imported; 53 | } 54 | 55 | public void setImported(boolean imported) { 56 | this.imported = imported; 57 | } 58 | 59 | public String getIdentifier() { 60 | return identifier; 61 | } 62 | 63 | public void setIdentifier(String identifier) { 64 | this.identifier = identifier; 65 | } 66 | 67 | public String getReferenceUrl() { 68 | return referenceUrl; 69 | } 70 | 71 | public void setReferenceUrl(String referenceUrl) { 72 | this.referenceUrl = referenceUrl; 73 | } 74 | 75 | public String getDescription() { 76 | return description; 77 | } 78 | 79 | public void setDescription(String description) { 80 | this.description = description; 81 | } 82 | 83 | public String getIcon() { 84 | return icon; 85 | } 86 | 87 | public void setIcon(String icon) { 88 | this.icon = icon; 89 | } 90 | 91 | public File getIconFile() { 92 | if (icon == null) { return null; } 93 | 94 | File ifile = new File (icon); 95 | 96 | if (! ifile.exists ( ) || ifile.isDirectory ( )) { return null; } 97 | 98 | return ifile; 99 | } 100 | 101 | public boolean hasIcon() { 102 | return icon != null; 103 | } 104 | 105 | public List getConformsTo() { 106 | return conformsTo; 107 | } 108 | 109 | public void setConformsTo(String conformsToAsString) { 110 | this.conformsTo = getListFromCommaSeparatedString(conformsToAsString, "Conforms To"); 111 | } 112 | 113 | public List getOsTypes() { 114 | return osTypes; 115 | } 116 | 117 | public void setOsTypes(String osTypesAsString) { 118 | this.osTypes = getListFromCommaSeparatedString(osTypesAsString, "OS Types"); 119 | } 120 | 121 | public List getMimeTypes() { 122 | return mimeTypes; 123 | } 124 | 125 | public void setMimeTypes(String mimeTypesAsString) { 126 | this.mimeTypes = getListFromCommaSeparatedString(mimeTypesAsString, "Mime Types", true); 127 | } 128 | 129 | public List getExtensions() { 130 | return extensions; 131 | } 132 | 133 | public void setExtensions(String extensionsAsString) { 134 | this.extensions = getListFromCommaSeparatedString(extensionsAsString, "Extensions", true); 135 | } 136 | 137 | @Override 138 | public String toString() { 139 | return "" + imported; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/com/inet/gradle/setup/msi/MsiLanguages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 i-net software 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.inet.gradle.setup.msi; 17 | 18 | /** 19 | * A mapping between Windows cultures and languages IDs 20 | * 21 | * @author Volker Berlin 22 | */ 23 | enum MsiLanguages { 24 | // Available Language Packs for Windows: https://technet.microsoft.com/en-us/library/hh825678.aspx 25 | // from WixUIExtension supported languages: https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib 26 | 27 | en_us( 1033 ), // this should be the default, that it is on position 0 28 | 29 | ar_sa( 1025 ), // 30 | bg_bg( 1026 ), // 31 | ca_es( 1027 ), // 32 | zh_tw( 1028 ), // 33 | cs_cz( 1029 ), // 34 | da_dk( 1030 ), // 35 | de_de( 1031 ), // 36 | el_gr( 1032 ), // 37 | fi_fi( 1035 ), // 38 | fr_fr( 1036 ), // 39 | he_IL( 1037 ), // 40 | hu_hu( 1038 ), // 41 | it_it( 1040 ), // 42 | ja_jp( 1041 ), // 43 | ko_kr( 1042 ), // 44 | nl_nl( 1043 ), // 45 | nb_no( 1044 ), // 46 | pl_pl( 1045 ), // 47 | pt_br( 1046 ), // 48 | ro_ro( 1048 ), // 49 | ru_ru( 1049 ), // 50 | hr_hr( 1050 ), // 51 | sk_sk( 1051 ), // 52 | sv_se( 1053 ), // 53 | th_th( 1054 ), // 54 | tr_tr( 1055 ), // 55 | uk_ua( 1058 ), // 56 | sl_si( 1060 ), // 57 | et_ee( 1061 ), // 58 | lv_lv( 1062 ), // 59 | lt_lt( 1063 ), // 60 | // hi_in( 1081 ), // error LGHT0311 : A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage. 61 | // kk_kz( 1087 ), // error LGHT0311 : A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage. 62 | zh_cn( 2052 ), // 63 | pt_pt( 2070 ), // 64 | sr_latn_cs( 2074 ), // 65 | zh_hk( 3076 ), // 66 | es_es( 3082 ), // 67 | ; 68 | 69 | private final String culture; 70 | 71 | private final int langID; 72 | 73 | /** 74 | * Create a instance of the enum. 75 | * @param langID the numeric language ID. 76 | */ 77 | private MsiLanguages( int langID ) { 78 | this.culture = name().replace( '_', '-' ); 79 | this.langID = langID; 80 | } 81 | 82 | /** 83 | * The culture like en-us. 84 | * @return the culture 85 | */ 86 | String getCulture() { 87 | return culture; 88 | } 89 | 90 | /** 91 | * The numeric language ID. 92 | * @return the id 93 | */ 94 | String getLangID() { 95 | return Integer.toString( langID ); 96 | } 97 | 98 | public static MsiLanguages getMsiLanguage( String input ) { 99 | 100 | String key = input.replace( '-', '_' ).toLowerCase(); 101 | MsiLanguages value = null; 102 | try { 103 | value = MsiLanguages.valueOf( key ); 104 | } catch( IllegalArgumentException ex ) { 105 | // The complete name was not found. 106 | // now we check if this is only a language without a country 107 | for( MsiLanguages msiLanguage : MsiLanguages.values() ) { 108 | if( msiLanguage.toString().startsWith( key ) ) { 109 | value = msiLanguage; 110 | break; 111 | } 112 | } 113 | if( value == null ) { 114 | throw ex; // not supported language 115 | } 116 | } 117 | return value; 118 | } 119 | } 120 | --------------------------------------------------------------------------------