diff --git a/build.gradle b/build.gradle deleted file mode 100644 index ae7170ab..00000000 --- a/build.gradle +++ /dev/null @@ -1,257 +0,0 @@ -plugins { - id 'java' - id 'maven' - id 'maven-publish' - id 'java-gradle-plugin' - id 'com.gradle.plugin-publish' version '0.12.0' - id 'io.codearte.nexus-staging' version '0.21.2' - id 'eclipse' - id 'de.undercouch.download' version '5.0.4' -} - -repositories { - mavenLocal() - mavenCentral() - maven { - url 'https://plugins.gradle.org/m2/' - } -} - -gradlePlugin { - plugins { - javaPackagerPlugin { - id = 'io.github.fvarrui.javapackager.plugin' - implementationClass = 'io.github.fvarrui.javapackager.gradle.PackagePlugin' - } - } -} - -pluginBundle { - website = 'http://github.com/fvarrui/JavaPackager' - vcsUrl = 'http://github.com/fvarrui/JavaPackager.git' - description = 'Packages Java applications as native Windows, MacOS or GNU/Linux executables and creates installers for them' - tags = ['java', 'packager', 'gradle-plugin', 'maven-plugin', 'native', 'installer', 'debian-packages', 'rpm-packages', 'dmg', 'maven', 'gradle', 'distribution', 'javapackager', 'linux-executables', 'deb', 'rpm', 'native-windows', 'java-applications', 'pkg', 'msi'] - plugins { - javaPackagerPlugin { - displayName = 'JavaPackager' - } - } -} - -configurations { - mavenEmbedder -} - -dependencies { - implementation 'org.apache.maven:maven-plugin-api:3.6.0' - implementation 'org.codehaus.plexus:plexus-utils:3.1.1' - implementation 'org.twdata.maven:mojo-executor:2.3.0' - implementation 'commons-io:commons-io:2.11.0' - implementation 'org.apache.commons:commons-lang3:3.9' - implementation 'org.apache.commons:commons-collections4:4.1' - implementation 'org.apache.commons:commons-compress:1.21' - implementation 'org.apache.velocity:velocity-engine-core:2.3' - implementation 'org.vafer:jdeb:1.9' - implementation 'net.jsign:jsign-core:3.1' - implementation 'org.redline-rpm:redline:1.2.10' - implementation 'io.github.fvarrui:launch4j:2.5.2' - - testImplementation 'junit:junit:4.13.1' - - compileOnly 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.6.0' - - mavenEmbedder 'org.apache.maven:maven-embedder:3.6.0' - mavenEmbedder 'org.apache.maven:maven-compat:3.6.0' - mavenEmbedder 'org.slf4j:slf4j-simple:1.7.30' - mavenEmbedder 'org.eclipse.aether:aether-connector-basic:1.1.0' - mavenEmbedder 'org.eclipse.aether:aether-transport-wagon:1.1.0' - mavenEmbedder 'org.apache.maven.wagon:wagon-http:3.4.1' - mavenEmbedder 'org.apache.maven.wagon:wagon-provider-api:3.4.1' -} - -group = 'io.github.fvarrui' -version = '1.7.0' -description = 'Hybrid Maven/Gradle plugin to package Java applications as native Windows, Mac OS X or GNU/Linux executables and create installers for them' - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - -compileJava.options.encoding = 'UTF-8' - -publishing { - publications { - mavenJava(MavenPublication) { - from(components.java) - } - } -} - -java { - withSourcesJar() - // and/or analogously use "withJavadocJar()" to get a "javadocJar" task -} - -install.repositories.mavenInstaller.pom.with { - groupId = project.group - artifactId = project.name - version = project.version - description = project.description - packaging = 'maven-plugin' -} - -build.dependsOn ':winrun4j-launcher:build' - -// runs the plugin description generator -task generatePluginDescriptor(type: JavaExec, dependsOn: compileJava) { - - def pomFile = file("$buildDir/pom.xml") - def pluginDescriptorFile = new File(project.compileJava.destinationDir, 'META-INF/maven/plugin.xml') - def directory = buildDir.canonicalPath - def outputDirectory = compileJava.destinationDir.canonicalPath - - // FIXME: this does not seem to be working - inputs.files project.compileJava.outputs.files - outputs.file pluginDescriptorFile - - classpath = configurations.mavenEmbedder - main = 'org.apache.maven.cli.MavenCli' - systemProperties['maven.multiModuleProjectDirectory'] = projectDir - args = [ - '--errors', - '--batch-mode', - '--file', "${buildDir}/pom.xml", - 'org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor', - '-Dproject.build.sourceEncoding=' + compileJava.options.encoding - ] - - doFirst { - install.repositories - .mavenInstaller - .pom - .withXml { - asNode().appendNode('repositories').appendNode('repository') - .with { - appendNode('id', 'gradle') - appendNode('name', 'Gradle Plugin Portal') - appendNode('url', 'https://plugins.gradle.org/m2/') - } - asNode().appendNode('build') - .with { - appendNode('directory', directory) - appendNode('outputDirectory', outputDirectory) - } - } - .writeTo(pomFile) - - assert pomFile.file, "${pomFile.canonicalPath}: was not generated" - logger.info("POM is generated in ${pomFile.canonicalPath}") - } - - doLast { - assert pluginDescriptorFile.file, "${pluginDescriptorFile.canonicalPath}: was not generated" - logger.info("Plugin descriptor is generated in ${pluginDescriptorFile.canonicalPath}") - } -} - -project.jar.dependsOn(generatePluginDescriptor) -publishToMavenLocal.dependsOn(build) - -if (project.hasProperty('release')) { - - apply plugin: 'signing' - apply plugin: 'maven' - - task deployingJavadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc - } - - task deployingSourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource - } - - artifacts { - archives deployingJavadocJar, deployingSourcesJar - } - - // Signature of artifacts - signing { - sign configurations.archives - } - - // OSSRH publication - uploadArchives { - repositories { - mavenDeployer { - // POM signature - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - // Target repository - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUser, password: ossrhPassword) - } - pom.project { - name project.name - description project.description - packaging = 'maven-plugin' - url 'https://github.com/fvarrui/JavaPackager' - - scm { - connection 'scm:git:git://github.com/fvarrui/JavaPackager.git' - developerConnection 'scm:git:git@github.com:fvarrui/fvarrui.git' - url 'https://github.com/fvarrui/JavaPackager' - } - - licenses { - license { - name 'GPL-v3.0' - url 'http://www.gnu.org/licenses/gpl-3.0.txt' - distribution 'repo' - } - } - - developers { - developer { - id = 'fvarrui' - name = 'Francisco Vargas Ruiz' - url = 'https://github.com/fvarrui' - } - } - } - } - } - } - -} - -nexusStaging { - username = project.findProperty('ossrhUser') ?: '' - password = project.findProperty('ossrhPassword') ?: '' -} - - -task updateUniversalJavaApplicationStub(type : Download) { - def version = '20220410.162252' - group 'Update assets' - description 'Downloads compiled and scripted versions of universalJavaApplicationStub to src/main/resources/mac overriding the existing ones.' - src([ - "https://github.com/fvarrui/universalJavaApplicationStub/releases/download/${version}/universalJavaApplicationStub.sh", - "https://github.com/fvarrui/universalJavaApplicationStub/releases/download/${version}/universalJavaApplicationStub.x86_64", - "https://github.com/fvarrui/universalJavaApplicationStub/releases/download/${version}/universalJavaApplicationStub.arm64", - "https://github.com/fvarrui/universalJavaApplicationStub/releases/download/${version}/universalJavaApplicationStub" - ]) - dest file('src/main/resources/mac') - overwrite true -} - -task updateWhyJavaLauncher(type : Download) { - def version = '1.1.2' - group 'Update assets' - description 'Downloads JavaLauncher.exe to src/main/resources/windows and overwrites the existing one.' - src([ - "https://github.com/AstroImageJ/Why/releases/download/${version}/JavaLauncher.exe" - ]) - dest file('src/main/resources/windows') - overwrite true -} - diff --git a/docs/windows-specific-properties.md b/docs/windows-specific-properties.md index 9aac4ac5..f0f86e7b 100644 --- a/docs/windows-specific-properties.md +++ b/docs/windows-specific-properties.md @@ -10,7 +10,7 @@ true|false - gui + gui|console true|false ${organizationName} 1.0.0.0 diff --git a/src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java b/src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java deleted file mode 100644 index 0a3c9076..00000000 --- a/src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java +++ /dev/null @@ -1,292 +0,0 @@ -package io.github.fvarrui.javapackager.model; - -import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; - -import java.io.File; -import java.io.Serializable; - -import io.github.fvarrui.javapackager.packagers.Packager; - -/** - * JavaPackager MacOS specific configuration - */ -public class MacConfig implements Serializable { - private static final long serialVersionUID = -2268944961932941577L; - - private File icnsFile; - private File backgroundImage; - private Integer windowWidth; - private Integer windowHeight; - private Integer windowX; - private Integer windowY; - private Integer iconSize; - private Integer textSize; - private Integer iconX; - private Integer iconY; - private Integer appsLinkIconX; - private Integer appsLinkIconY; - private File volumeIcon; - private String volumeName; - private boolean generateDmg = true; - private boolean generatePkg = true; - private boolean relocateJar = true; - private String appId; - private String developerId = "-"; - private File entitlements; - private File provisionProfile; - private File customLauncher; - private File customInfoPlist; - private boolean codesignApp = true; - private InfoPlist infoPlist = new InfoPlist(); - private boolean hardenedCodesign = true; - private MacStartup macStartup = MacStartup.SCRIPT; - - public File getIcnsFile() { - return icnsFile; - } - - public void setIcnsFile(File icnsFile) { - this.icnsFile = icnsFile; - } - - public File getBackgroundImage() { - return backgroundImage; - } - - public void setBackgroundImage(File backgroundImage) { - this.backgroundImage = backgroundImage; - } - - public Integer getWindowWidth() { - return windowWidth; - } - - public void setWindowWidth(Integer windowWidth) { - this.windowWidth = windowWidth; - } - - public Integer getWindowHeight() { - return windowHeight; - } - - public void setWindowHeight(Integer windowHeight) { - this.windowHeight = windowHeight; - } - - public Integer getWindowX() { - return windowX; - } - - public void setWindowX(Integer windowX) { - this.windowX = windowX; - } - - public Integer getWindowY() { - return windowY; - } - - public void setWindowY(Integer windowY) { - this.windowY = windowY; - } - - public Integer getIconSize() { - return iconSize; - } - - public void setIconSize(Integer iconSize) { - this.iconSize = iconSize; - } - - public Integer getTextSize() { - return textSize; - } - - public void setTextSize(Integer textSize) { - this.textSize = textSize; - } - - public Integer getIconX() { - return iconX; - } - - public void setIconX(Integer iconX) { - this.iconX = iconX; - } - - public Integer getIconY() { - return iconY; - } - - public void setIconY(Integer iconY) { - this.iconY = iconY; - } - - public Integer getAppsLinkIconX() { - return appsLinkIconX; - } - - public void setAppsLinkIconX(Integer appsLinkIconX) { - this.appsLinkIconX = appsLinkIconX; - } - - public Integer getAppsLinkIconY() { - return appsLinkIconY; - } - - public void setAppsLinkIconY(Integer appsLinkIconY) { - this.appsLinkIconY = appsLinkIconY; - } - - public File getVolumeIcon() { - return volumeIcon; - } - - public void setVolumeIcon(File volumeIcon) { - this.volumeIcon = volumeIcon; - } - - public String getVolumeName() { - return volumeName; - } - - public void setVolumeName(String volumeName) { - this.volumeName = volumeName; - } - - public boolean isGenerateDmg() { - return generateDmg; - } - - public void setGenerateDmg(boolean generateDmg) { - this.generateDmg = generateDmg; - } - - public boolean isGeneratePkg() { - return generatePkg; - } - - public void setGeneratePkg(boolean generatePkg) { - this.generatePkg = generatePkg; - } - - public boolean isRelocateJar() { - return relocateJar; - } - - public void setRelocateJar(boolean relocateJar) { - this.relocateJar = relocateJar; - } - - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - public String getDeveloperId() { - return developerId; - } - - public void setDeveloperId(String developerId) { - this.developerId = developerId; - } - - public File getCustomLauncher() { - return customLauncher; - } - - public void setCustomLauncher(File customLauncher) { - this.customLauncher = customLauncher; - } - - public File getCustomInfoPlist() { - return customInfoPlist; - } - - public void setCustomInfoPlist(File customInfoPlist) { - this.customInfoPlist = customInfoPlist; - } - - public File getProvisionProfile() { - return provisionProfile; - } - - public void setProvisionProfile(File provisionProfile) { - this.provisionProfile = provisionProfile; - } - - public File getEntitlements() { - return entitlements; - } - - public void setEntitlements(File entitlements) { - this.entitlements = entitlements; - } - - public boolean isCodesignApp() { - return codesignApp; - } - - public void setCodesignApp(boolean codesignApp) { - this.codesignApp = codesignApp; - } - - public InfoPlist getInfoPlist() { - return infoPlist; - } - - public void setInfoPlist(InfoPlist infoPlist) { - this.infoPlist = infoPlist; - } - - public void setHardenedCodesign(boolean hardenedCodesign) { - this.hardenedCodesign = hardenedCodesign; - } - - public boolean isHardenedCodesign() { - return hardenedCodesign; - } - - public MacStartup getMacStartup() { - return macStartup; - } - - public void setMacStartup(MacStartup macStartup) { - this.macStartup = macStartup; - } - - @Override - public String toString() { - return "MacConfig [icnsFile=" + icnsFile + ", backgroundImage=" + backgroundImage + ", windowWidth=" - + windowWidth + ", windowHeight=" + windowHeight + ", windowX=" + windowX + ", windowY=" + windowY - + ", iconSize=" + iconSize + ", textSize=" + textSize + ", iconX=" + iconX + ", iconY=" + iconY - + ", appsLinkIconX=" + appsLinkIconX + ", appsLinkIconY=" + appsLinkIconY + ", volumeIcon=" + volumeIcon - + ", volumeName=" + volumeName + ", generateDmg=" + generateDmg + ", generatePkg=" + generatePkg - + ", relocateJar=" + relocateJar + ", appId=" + appId + ", developerId=" + developerId - + ", entitlements=" + entitlements + ", provisionProfile=" + provisionProfile + ", customLauncher=" - + customLauncher + ", customInfoPlist=" + customInfoPlist + ", codesignApp=" + codesignApp - + ", infoPlist=" + infoPlist + ", hardenedCodesign=" + hardenedCodesign + ", macStartup=" + macStartup - + "]"; - } - - /** - * Tests MacOS specific config and set defaults if not specified - * - * @param packager Packager - */ - public void setDefaults(Packager packager) { - this.setWindowX(defaultIfNull(this.getWindowX(), 10)); - this.setWindowY(defaultIfNull(this.getWindowY(), 60)); - this.setWindowWidth(defaultIfNull(this.getWindowWidth(), 540)); - this.setWindowHeight(defaultIfNull(this.getWindowHeight(), 360)); - this.setIconSize(defaultIfNull(this.getIconSize(), 128)); - this.setTextSize(defaultIfNull(this.getTextSize(), 16)); - this.setIconX(defaultIfNull(this.getIconX(), 52)); - this.setIconY(defaultIfNull(this.getIconY(), 116)); - this.setAppsLinkIconX(defaultIfNull(this.getAppsLinkIconX(), 360)); - this.setAppsLinkIconY(defaultIfNull(this.getAppsLinkIconY(), 116)); - this.setAppId(defaultIfNull(this.getAppId(), packager.getMainClass())); - } -} diff --git a/src/main/java/io/github/fvarrui/javapackager/model/WindowsConfig.java b/src/main/java/io/github/fvarrui/javapackager/model/WindowsConfig.java deleted file mode 100644 index b47ff16f..00000000 --- a/src/main/java/io/github/fvarrui/javapackager/model/WindowsConfig.java +++ /dev/null @@ -1,353 +0,0 @@ -package io.github.fvarrui.javapackager.model; - -import static org.apache.commons.lang3.StringUtils.defaultIfBlank; - -import java.io.File; -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.UUID; - -import io.github.fvarrui.javapackager.packagers.Packager; -import io.github.fvarrui.javapackager.utils.ObjectUtils; - -/** - * JavaPackager Windows specific configuration - */ -public class WindowsConfig implements Serializable { - private static final long serialVersionUID = 2106752412224694318L; - - private File icoFile; - private HeaderType headerType; - private String companyName; - private String copyright; - private String fileDescription; - private String fileVersion; - private String internalName; - private String language; - private String originalFilename; - private String productName; - private String productVersion; - private String trademarks; - private String txtFileVersion; - private String txtProductVersion; - private boolean disableDirPage = true; - private boolean disableProgramGroupPage = true; - private boolean disableFinishedPage = true; - private boolean disableRunAfterInstall = true; - private boolean disableWelcomePage = true; - private boolean createDesktopIconTask = true; - private boolean generateSetup = true; - private boolean generateMsi = true; - private boolean generateMsm = false; - private boolean setupMutex = true; - private String msiUpgradeCode; - private boolean wrapJar = true; - private LinkedHashMap setupLanguages = new LinkedHashMap<>(); - private SetupMode setupMode = SetupMode.installForAllUsers; - private WindowsSigning signing; - private Registry registry = new Registry(); - private boolean removeOldLibs = false; - private WindowsExeCreationTool exeCreationTool = WindowsExeCreationTool.launch4j; - private String vmLocation; - - public File getIcoFile() { - return icoFile; - } - - public void setIcoFile(File icoFile) { - this.icoFile = icoFile; - } - - public HeaderType getHeaderType() { - return headerType; - } - - public void setHeaderType(HeaderType headerType) { - this.headerType = headerType; - } - - public String getCompanyName() { - return companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public String getCopyright() { - return copyright; - } - - public void setCopyright(String copyright) { - this.copyright = copyright; - } - - public String getFileDescription() { - return fileDescription; - } - - public void setFileDescription(String fileDescription) { - this.fileDescription = fileDescription; - } - - public String getFileVersion() { - return fileVersion; - } - - public void setFileVersion(String fileVersion) { - this.fileVersion = fileVersion; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getOriginalFilename() { - return originalFilename; - } - - public void setOriginalFilename(String originalFilename) { - this.originalFilename = originalFilename; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProductVersion() { - return productVersion; - } - - public void setProductVersion(String productVersion) { - this.productVersion = productVersion; - } - - public String getTrademarks() { - return trademarks; - } - - public void setTrademarks(String trademarks) { - this.trademarks = trademarks; - } - - public String getTxtFileVersion() { - return txtFileVersion; - } - - public void setTxtFileVersion(String txtFileVersion) { - this.txtFileVersion = txtFileVersion; - } - - public String getTxtProductVersion() { - return txtProductVersion; - } - - public void setTxtProductVersion(String txtProductVersion) { - this.txtProductVersion = txtProductVersion; - } - - public String getInternalName() { - return internalName; - } - - public void setInternalName(String internalName) { - this.internalName = internalName; - } - - public boolean isDisableDirPage() { - return disableDirPage; - } - - public void setDisableDirPage(boolean disableDirPage) { - this.disableDirPage = disableDirPage; - } - - public boolean isDisableProgramGroupPage() { - return disableProgramGroupPage; - } - - public void setDisableProgramGroupPage(boolean disableProgramGroupPage) { - this.disableProgramGroupPage = disableProgramGroupPage; - } - - public boolean isDisableFinishedPage() { - return disableFinishedPage; - } - - public void setDisableFinishedPage(boolean disableFinishedPage) { - this.disableFinishedPage = disableFinishedPage; - } - - public boolean isCreateDesktopIconTask() { - return createDesktopIconTask; - } - - public void setCreateDesktopIconTask(boolean createDesktopIconTask) { - this.createDesktopIconTask = createDesktopIconTask; - } - - public boolean isGenerateSetup() { - return generateSetup; - } - - public void setGenerateSetup(boolean generateSetup) { - this.generateSetup = generateSetup; - } - - public boolean isGenerateMsi() { - return generateMsi; - } - - public void setGenerateMsi(boolean generateMsi) { - this.generateMsi = generateMsi; - } - - public boolean isGenerateMsm() { - return generateMsm; - } - - public void setGenerateMsm(boolean generateMsm) { - this.generateMsm = generateMsm; - } - - public String getMsiUpgradeCode() { - return msiUpgradeCode; - } - - public void setMsiUpgradeCode(String msiUpgradeCode) { - this.msiUpgradeCode = msiUpgradeCode; - } - - public boolean isWrapJar() { - return wrapJar; - } - - public void setWrapJar(boolean wrapJar) { - this.wrapJar = wrapJar; - } - - public LinkedHashMap getSetupLanguages() { - return setupLanguages; - } - - public void setSetupLanguages(LinkedHashMap setupLanguages) { - this.setupLanguages = setupLanguages; - } - - public SetupMode getSetupMode() { - return setupMode; - } - - public void setSetupMode(SetupMode setupMode) { - this.setupMode = setupMode; - } - - public WindowsSigning getSigning() { - return signing; - } - - public void setSigning(WindowsSigning signing) { - this.signing = signing; - } - - public Registry getRegistry() { - return registry; - } - - public void setRegistry(Registry registry) { - this.registry = registry; - } - - public boolean isDisableRunAfterInstall() { - return disableRunAfterInstall; - } - - public void setDisableRunAfterInstall(boolean disableRunAfterInstall) { - this.disableRunAfterInstall = disableRunAfterInstall; - } - - public void setDisableWelcomePage(boolean disableWelcomePage) { - this.disableWelcomePage = disableWelcomePage; - } - - public boolean isDisableWelcomePage() { - return disableWelcomePage; - } - - public boolean isSetupMutex() { - return setupMutex; - } - - public void setSetupMutex(boolean setupMutex) { - this.setupMutex = setupMutex; - } - - public boolean isRemoveOldLibs() { - return removeOldLibs; - } - - public void setRemoveOldLibs(boolean removeOldLibs) { - this.removeOldLibs = removeOldLibs; - } - - public WindowsExeCreationTool getExeCreationTool() { - return exeCreationTool; - } - - public void setExeCreationTool(WindowsExeCreationTool exeCreationTool) { - this.exeCreationTool = exeCreationTool; - } - - public String getVmLocation() { - return vmLocation; - } - - public void setVmLocation(String vmLocation) { - this.vmLocation = vmLocation; - } - - @Override - public String toString() { - return "WindowsConfig [icoFile=" + icoFile + ", headerType=" + headerType + ", companyName=" + companyName - + ", copyright=" + copyright + ", fileDescription=" + fileDescription + ", fileVersion=" + fileVersion - + ", internalName=" + internalName + ", language=" + language + ", originalFilename=" + originalFilename - + ", productName=" + productName + ", productVersion=" + productVersion + ", trademarks=" + trademarks - + ", txtFileVersion=" + txtFileVersion + ", txtProductVersion=" + txtProductVersion - + ", disableDirPage=" + disableDirPage + ", disableProgramGroupPage=" + disableProgramGroupPage - + ", disableFinishedPage=" + disableFinishedPage + ", disableRunAfterInstall=" + disableRunAfterInstall - + ", disableWelcomePage=" + disableWelcomePage + ", createDesktopIconTask=" + createDesktopIconTask - + ", generateSetup=" + generateSetup + ", generateMsi=" + generateMsi + ", generateMsm=" + generateMsm - + ", msiUpgradeCode=" + msiUpgradeCode + ", wrapJar=" + wrapJar + ", setupLanguages=" + setupLanguages - + ", setupMode=" + setupMode + ", signing=" + signing + ", registry=" + registry + ", removeOldLibs=" - + removeOldLibs + ", exeCreationTool=" + exeCreationTool + ", vmLocation=" + vmLocation + "]"; - } - - /** - * Tests Windows specific config and set defaults if not specified - * - * @param packager Packager - */ - public void setDefaults(Packager packager) { - this.setHeaderType(ObjectUtils.defaultIfNull(this.getHeaderType(), HeaderType.gui)); - this.setFileVersion(defaultIfBlank(this.getFileVersion(), "1.0.0.0")); - this.setTxtFileVersion(defaultIfBlank(this.getTxtFileVersion(), "" + packager.getVersion())); - this.setProductVersion(defaultIfBlank(this.getProductVersion(), "1.0.0.0")); - this.setTxtProductVersion(defaultIfBlank(this.getTxtProductVersion(), "" + packager.getVersion())); - this.setCompanyName(defaultIfBlank(this.getCompanyName(), packager.getOrganizationName())); - this.setCopyright(defaultIfBlank(this.getCopyright(), packager.getOrganizationName())); - this.setFileDescription(defaultIfBlank(this.getFileDescription(), packager.getDescription())); - this.setProductName(defaultIfBlank(this.getProductName(), packager.getName())); - this.setInternalName(defaultIfBlank(this.getInternalName(), packager.getName())); - this.setOriginalFilename(defaultIfBlank(this.getOriginalFilename(), packager.getName() + ".exe")); - this.setMsiUpgradeCode(defaultIfBlank(this.getMsiUpgradeCode(), UUID.randomUUID().toString())); - } - -} diff --git a/src/main/resources/windows/iss.vtl b/src/main/resources/windows/iss.vtl deleted file mode 100644 index 51686b1a..00000000 --- a/src/main/resources/windows/iss.vtl +++ /dev/null @@ -1,136 +0,0 @@ -\#define MyAppName "${info.name}" -\#define MyAppVersion "${info.version}" -\#define MyAppPublisher "${info.organizationName}" -\#define MyAppURL "$!{info.organizationUrl}" -\#define MyAppExeName "${info.executable.name}" -\#define MyAppFolder "${info.name}" -\#define MyAppLicense "$!{info.licenseFile.absolutePath}" -\#define MyAppIcon "${info.iconFile.absolutePath}" - -[Setup] -AppId={{{#MyAppName}}} -AppName={#MyAppName} -AppVersion={#MyAppVersion} -AppVerName={#MyAppName} {#MyAppVersion} -AppPublisher={#MyAppPublisher} -AppPublisherURL={#MyAppURL} -AppSupportURL={#MyAppURL} -AppUpdatesURL={#MyAppURL} -DefaultDirName={autopf}\{#MyAppFolder} -#if ($info.winConfig.disableDirPage) -DisableDirPage=yes -#else -DisableDirPage=no -#end -#if ($info.winConfig.disableProgramGroupPage) -DisableProgramGroupPage=yes -#else -DefaultGroupName={#MyAppName} -DisableProgramGroupPage=no -#end -#if ($info.winConfig.disableFinishedPage) -DisableFinishedPage=yes -#else -DisableFinishedPage=no -#end -#if ($info.winConfig.disableWelcomePage) -DisableWelcomePage=yes -#else -DisableWelcomePage=no -#end -#if ($info.winConfig.setupMode.name() == "installForAllUsers") -PrivilegesRequired=admin -PrivilegesRequiredOverridesAllowed=commandline -#elseif ($info.winConfig.setupMode.name() == "installForCurrentUser") -PrivilegesRequired=lowest -PrivilegesRequiredOverridesAllowed=commandline -#else -PrivilegesRequiredOverridesAllowed=commandline dialog -#end -#if ($info.winConfig.setupMutex) -SetupMutex=SetupMutex{#SetupSetting("AppId")} -#end -LicenseFile={#MyAppLicense} -SetupIconFile={#MyAppIcon} -UninstallDisplayIcon={app}\{#MyAppExeName} -Compression=lzma -SolidCompression=yes -ArchitecturesInstallIn64BitMode=x64 - -[Languages] -#foreach ($language in $info.winConfig.setupLanguages.entrySet()) -Name: "${language.key}"; MessagesFile: "${language.value}" -#end - -[Tasks] -#if ($info.winConfig.createDesktopIconTask) -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked -#end - -[Registry] -#if ($info.winConfig.registry) -#foreach ($entry in $info.winConfig.registry.entries) -Root: ${entry.root}; Subkey: "${entry.subkey}"; ValueType: ${entry.valueTypeAsInnoSetupString}; ValueName: "${entry.valueName}"; ValueData: "${entry.valueData}"; Flags: uninsdeletevalue -#end -#end -#foreach ($fileAssociation in $info.fileAssociations) -; ${fileAssociation.extension} extension file association -Root: HKA; Subkey: "Software\Classes\.${fileAssociation.extension}\OpenWithProgids"; ValueType: string; ValueName: "${info.name}.${fileAssociation.extension}"; ValueData: ""; Flags: uninsdeletevalue -Root: HKA; Subkey: "Software\Classes\\${info.name}.${fileAssociation.extension}"; ValueType: string; ValueName: ""; ValueData: "${fileAssociation.description}"; Flags: uninsdeletekey -Root: HKA; Subkey: "Software\Classes\\${info.name}.${fileAssociation.extension}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\\${info.executable.name},0"; Flags: uninsdeletevalue -Root: HKA; Subkey: "Software\Classes\\${info.name}.${fileAssociation.extension}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\\${info.executable.name}"" ""%1"""; Flags: uninsdeletevalue -Root: HKA; Subkey: "Software\Classes\Applications\\${info.executable.name}\SupportedTypes"; ValueType: string; ValueName: ".${fileAssociation.extension}"; ValueData: ""; Flags: uninsdeletevalue -#end - -[Files] -Source: "${info.appFolder}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs - -[Icons] -Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}" -#if ($info.winConfig.createDesktopIconTask) -Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\\${info.iconFile.name}"; Tasks: desktopicon -#end - -[Run] -#if (!$info.winConfig.disableRunAfterInstall) -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runascurrentuser -#end - -[Code] - -function GetInstallLocation(): String; -var - unInstPath: String; - installLocation: String; -begin - unInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); - installLocation := ''; - if not RegQueryStringValue(HKLM, unInstPath, 'InstallLocation', installLocation) then - RegQueryStringValue(HKCU, unInstPath, 'InstallLocation', installLocation); - Result := RemoveQuotes(installLocation); -end; - -#if ($info.winConfig.removeOldLibs) -procedure RemoveOldLibs(); -var - installLocation: String; - libsLocation: String; -begin - installLocation := GetInstallLocation(); - if installLocation <> '' then - begin - libsLocation := installLocation + '${info.libsFolder.name}'; - DelTree(libsLocation, True, True, True); - end; -end; -#end - -procedure CurStepChanged(CurStep: TSetupStep); -begin - if CurStep = ssInstall then - begin -#if ($info.winConfig.removeOldLibs) - RemoveOldLibs(); -#end - end; -end;