127 Log.info(MessageFormat.format(I18N.getString("message.building-bundle"), APP_NAME.fetchFrom(p))); 128 if (!outdir.isDirectory() && !outdir.mkdirs()) { 129 throw new RuntimeException(MessageFormat.format(I18N.getString("error.cannot-create-output-dir"), outdir.getAbsolutePath())); 130 } 131 if (!outdir.canWrite()) { 132 throw new RuntimeException(MessageFormat.format(I18N.getString("error.cannot-write-to-output-dir"), outdir.getAbsolutePath())); 133 } 134 135 // first, load in some overrides 136 // icns needs @2 versions, so load in the @2 default 137 p.put(DEFAULT_ICNS_ICON.getID(), TEMPLATE_BUNDLE_ICON_HIDPI); 138 139 // next we need to change the jdk/jre stripping to strip gstreamer 140 // p.put(MAC_RULES.getID(), createMacAppStoreRuntimeRules(p)); 141 142 // now we create the app 143 File appImageDir = APP_IMAGE_BUILD_ROOT.fetchFrom(p); 144 try { 145 appImageDir.mkdirs(); 146 147 // first, make sure we don't use the local signing key 148 p.put(DEVELOPER_ID_APP_SIGNING_KEY.getID(), null); 149 File appLocation = prepareAppBundle(p); 150 151 prepareEntitlements(p); 152 153 String signingIdentity = MAC_APP_STORE_APP_SIGNING_KEY.fetchFrom(p); 154 String identifierPrefix = BUNDLE_ID_SIGNING_PREFIX.fetchFrom(p); 155 String entitlementsFile = getConfig_Entitlements(p).toString(); 156 String inheritEntitlements = getConfig_Inherit_Entitlements(p).toString(); 157 158 MacAppImageBuilder.signAppBundle(p, appLocation.toPath(), signingIdentity, identifierPrefix, entitlementsFile, inheritEntitlements); 159 ProcessBuilder pb; 160 161 // create the final pkg file 162 File finalPKG = new File(outdir, INSTALLER_NAME.fetchFrom(p) 163 + INSTALLER_SUFFIX.fetchFrom(p) 164 + ".pkg"); 165 outdir.mkdirs(); 166 167 String installIdentify = MAC_APP_STORE_PKG_SIGNING_KEY.fetchFrom(p); 168 169 List<String> buildOptions = new ArrayList<>(); 170 buildOptions.add("productbuild"); 171 buildOptions.add("--component"); 172 buildOptions.add(appLocation.toString()); 173 buildOptions.add("/Applications"); 174 buildOptions.add("--sign"); 175 buildOptions.add(installIdentify); 176 buildOptions.add("--product"); 177 buildOptions.add(appLocation + "/Contents/Info.plist"); 178 String keychainName = SIGNING_KEYCHAIN.fetchFrom(p); | 127 Log.info(MessageFormat.format(I18N.getString("message.building-bundle"), APP_NAME.fetchFrom(p))); 128 if (!outdir.isDirectory() && !outdir.mkdirs()) { 129 throw new RuntimeException(MessageFormat.format(I18N.getString("error.cannot-create-output-dir"), outdir.getAbsolutePath())); 130 } 131 if (!outdir.canWrite()) { 132 throw new RuntimeException(MessageFormat.format(I18N.getString("error.cannot-write-to-output-dir"), outdir.getAbsolutePath())); 133 } 134 135 // first, load in some overrides 136 // icns needs @2 versions, so load in the @2 default 137 p.put(DEFAULT_ICNS_ICON.getID(), TEMPLATE_BUNDLE_ICON_HIDPI); 138 139 // next we need to change the jdk/jre stripping to strip gstreamer 140 // p.put(MAC_RULES.getID(), createMacAppStoreRuntimeRules(p)); 141 142 // now we create the app 143 File appImageDir = APP_IMAGE_BUILD_ROOT.fetchFrom(p); 144 try { 145 appImageDir.mkdirs(); 146 147 try { 148 MacAppImageBuilder.addNewKeychain(p); 149 } catch (InterruptedException e) { 150 Log.error(e.getMessage()); 151 } 152 // first, make sure we don't use the local signing key 153 p.put(DEVELOPER_ID_APP_SIGNING_KEY.getID(), null); 154 File appLocation = prepareAppBundle(p); 155 156 prepareEntitlements(p); 157 158 String signingIdentity = MAC_APP_STORE_APP_SIGNING_KEY.fetchFrom(p); 159 String identifierPrefix = BUNDLE_ID_SIGNING_PREFIX.fetchFrom(p); 160 String entitlementsFile = getConfig_Entitlements(p).toString(); 161 String inheritEntitlements = getConfig_Inherit_Entitlements(p).toString(); 162 163 MacAppImageBuilder.signAppBundle(p, appLocation.toPath(), signingIdentity, identifierPrefix, entitlementsFile, inheritEntitlements); 164 MacAppImageBuilder.restoreKeychainList(p); 165 166 ProcessBuilder pb; 167 168 // create the final pkg file 169 File finalPKG = new File(outdir, INSTALLER_NAME.fetchFrom(p) 170 + INSTALLER_SUFFIX.fetchFrom(p) 171 + ".pkg"); 172 outdir.mkdirs(); 173 174 String installIdentify = MAC_APP_STORE_PKG_SIGNING_KEY.fetchFrom(p); 175 176 List<String> buildOptions = new ArrayList<>(); 177 buildOptions.add("productbuild"); 178 buildOptions.add("--component"); 179 buildOptions.add(appLocation.toString()); 180 buildOptions.add("/Applications"); 181 buildOptions.add("--sign"); 182 buildOptions.add(installIdentify); 183 buildOptions.add("--product"); 184 buildOptions.add(appLocation + "/Contents/Info.plist"); 185 String keychainName = SIGNING_KEYCHAIN.fetchFrom(p); |