Skip to content

Commit fe6690c

Browse files
authored
Merge pull request #244 from kerner1000/feature/custom-info-plist
Feature: custom info plist
2 parents 7fa71b3 + 82ce97a commit fe6690c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class MacConfig implements Serializable {
3535
private File entitlements;
3636
private File provisionProfile;
3737
private File customLauncher;
38+
private File customInfoPlist;
3839
private boolean codesignApp = true;
3940
private InfoPlist infoPlist = new InfoPlist();
4041
private boolean hardenedCodesign = true;
@@ -200,6 +201,14 @@ public void setCustomLauncher(File customLauncher) {
200201
this.customLauncher = customLauncher;
201202
}
202203

204+
public File getCustomInfoPlist() {
205+
return customInfoPlist;
206+
}
207+
208+
public void setCustomInfoPlist(File customInfoPlist) {
209+
this.customInfoPlist = customInfoPlist;
210+
}
211+
203212
public File getProvisionProfile() {
204213
return provisionProfile;
205214
}

src/main/java/io/github/fvarrui/javapackager/packagers/MacPackager.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ private void processClasspath() {
144144
}
145145

146146
/**
147-
* Creates and writes the Info.plist file
147+
* Creates and writes the Info.plist file if no custom file is specified.
148148
* @throws Exception if anything goes wrong
149149
*/
150150
private void processInfoPlistFile() throws Exception {
151151
File infoPlistFile = new File(contentsFolder, "Info.plist");
152-
VelocityUtils.render("mac/Info.plist.vtl", infoPlistFile, this);
153-
XMLUtils.prettify(infoPlistFile);
152+
if(macConfig.getCustomInfoPlist() != null && macConfig.getCustomInfoPlist().isFile() && macConfig.getCustomInfoPlist().canRead()){
153+
FileUtils.copyFileToFile(macConfig.getCustomInfoPlist(), infoPlistFile);
154+
} else {
155+
VelocityUtils.render("mac/Info.plist.vtl", infoPlistFile, this);
156+
XMLUtils.prettify(infoPlistFile);
157+
}
154158
Logger.info("Info.plist file created in " + infoPlistFile.getAbsolutePath());
155159
}
156160

@@ -165,7 +169,7 @@ private void codesign() throws Exception {
165169
}
166170

167171
private void processProvisionProfileFile() throws Exception {
168-
if (macConfig.getProvisionProfile() != null) {
172+
if (macConfig.getProvisionProfile() != null && macConfig.getProvisionProfile().isFile() && macConfig.getProvisionProfile().canRead()) {
169173
// file name must be 'embedded.provisionprofile'
170174
File provisionProfile = new File(contentsFolder, "embedded.provisionprofile");
171175
FileUtils.copyFileToFile(macConfig.getProvisionProfile(), provisionProfile);

0 commit comments

Comments
 (0)