< prev index next >

src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacAppImageBuilder.java

Print this page

        

*** 367,377 **** } String signingIdentity = DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); if (signingIdentity != null) { signAppBundle(params, root, signingIdentity, ! BUNDLE_ID_SIGNING_PREFIX.fetchFrom(params), null, null); } restoreKeychainList(params); } } --- 367,377 ---- } String signingIdentity = DEVELOPER_ID_APP_SIGNING_KEY.fetchFrom(params); if (signingIdentity != null) { signAppBundle(params, root, signingIdentity, ! BUNDLE_ID_SIGNING_PREFIX.fetchFrom(params)); } restoreKeychainList(params); } }
*** 735,752 **** IOUtils.exec(pb); } public static void signAppBundle( Map<String, ? super Object> params, Path appLocation, ! String signingIdentity, String identifierPrefix, ! String entitlementsFile, String inheritedEntitlements) throws IOException { AtomicReference<IOException> toThrow = new AtomicReference<>(); String appExecutable = "/Contents/MacOS/" + APP_NAME.fetchFrom(params); String keyChain = SIGNING_KEYCHAIN.fetchFrom(params); ! // sign all dylibs and jars try (Stream<Path> stream = Files.walk(appLocation)) { stream.peek(path -> { // fix permissions try { Set<PosixFilePermission> pfp = Files.getPosixFilePermissions(path); --- 735,751 ---- IOUtils.exec(pb); } public static void signAppBundle( Map<String, ? super Object> params, Path appLocation, ! String signingIdentity, String identifierPrefix) throws IOException { AtomicReference<IOException> toThrow = new AtomicReference<>(); String appExecutable = "/Contents/MacOS/" + APP_NAME.fetchFrom(params); String keyChain = SIGNING_KEYCHAIN.fetchFrom(params); ! // sign all dylibs and executables try (Stream<Path> stream = Files.walk(appLocation)) { stream.peek(path -> { // fix permissions try { Set<PosixFilePermission> pfp = Files.getPosixFilePermissions(path);
*** 756,771 **** Files.setPosixFilePermissions(path, pfp); } } catch (IOException e) { Log.verbose(e); } ! }).filter(p -> Files.isRegularFile(p) ! && !(p.toString().contains("/Contents/MacOS/libjli.dylib") ! || p.toString().endsWith(appExecutable) || p.toString().contains("/Contents/runtime") ! || p.toString().contains("/Contents/Frameworks"))).forEach(p -> { ! //noinspection ThrowableResultOfMethodCallIgnored if (toThrow.get() != null) return; // If p is a symlink then skip the signing process. if (Files.isSymbolicLink(p)) { if (VERBOSE.fetchFrom(params)) { --- 755,771 ---- Files.setPosixFilePermissions(path, pfp); } } catch (IOException e) { Log.verbose(e); } ! }).filter(p -> Files.isRegularFile(p) && ! (Files.isExecutable(p) || p.toString().endsWith(".dylib")) ! && !(p.toString().endsWith(appExecutable) || p.toString().contains("/Contents/runtime") ! || p.toString().contains("/Contents/Frameworks")) ! ).forEach(p -> { ! // noinspection ThrowableResultOfMethodCallIgnored if (toThrow.get() != null) return; // If p is a symlink then skip the signing process. if (Files.isSymbolicLink(p)) { if (VERBOSE.fetchFrom(params)) {
*** 776,803 **** if (p.toString().endsWith(LIBRARY_NAME)) { if (isFileSigned(p)) { return; } } - List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "-s", signingIdentity, // sign with this key "--prefix", identifierPrefix, - // use the identifier as a prefix "-vvvv")); - if (entitlementsFile != null && - (p.toString().endsWith(".jar") - || p.toString().endsWith(".dylib"))) { - args.add("--entitlements"); - args.add(entitlementsFile); // entitlements - } else if (inheritedEntitlements != null && - Files.isExecutable(p)) { - args.add("--entitlements"); - args.add(inheritedEntitlements); - // inherited entitlements for executable processes - } if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(p.toString()); --- 776,792 ---- if (p.toString().endsWith(LIBRARY_NAME)) { if (isFileSigned(p)) { return; } } List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "--timestamp", ! "--options", "runtime", ! "-s", signingIdentity, "--prefix", identifierPrefix, "-vvvv")); if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(p.toString());
*** 807,816 **** --- 796,806 ---- Files.getPosixFilePermissions(p); File f = p.toFile(); f.setWritable(true, true); ProcessBuilder pb = new ProcessBuilder(args); + IOUtils.exec(pb); Files.setPosixFilePermissions(p, oldPermissions); } catch (IOException ioe) { toThrow.set(ioe);
*** 829,864 **** if (toThrow.get() != null) return; try { List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "-f", "-s", signingIdentity, // sign with this key "--prefix", identifierPrefix, // use the identifier as a prefix "-vvvv")); if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(path.toString()); ProcessBuilder pb = new ProcessBuilder(args); - IOUtils.exec(pb); - args = new ArrayList<>(); - args.addAll(Arrays.asList("codesign", - "-s", signingIdentity, // sign with this key - "--prefix", identifierPrefix, - // use the identifier as a prefix - "-vvvv")); - if (keyChain != null && !keyChain.isEmpty()) { - args.add("--keychain"); - args.add(keyChain); - } - args.add(path.toString() - + "/Contents/_CodeSignature/CodeResources"); - pb = new ProcessBuilder(args); IOUtils.exec(pb); } catch (IOException e) { toThrow.set(e); } }; --- 819,844 ---- if (toThrow.get() != null) return; try { List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "--timestamp", ! "--options", "runtime", ! "--deep", ! "--force", "-s", signingIdentity, // sign with this key "--prefix", identifierPrefix, // use the identifier as a prefix "-vvvv")); + if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(path.toString()); ProcessBuilder pb = new ProcessBuilder(args); IOUtils.exec(pb); } catch (IOException e) { toThrow.set(e); } };
*** 884,907 **** } // sign the app itself List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "-s", signingIdentity, // sign with this key ! "-vvvv")); // super verbose output ! if (entitlementsFile != null) { ! args.add("--entitlements"); ! args.add(entitlementsFile); // entitlements ! } if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(appLocation.toString()); ProcessBuilder pb = new ProcessBuilder(args.toArray(new String[args.size()])); IOUtils.exec(pb); } private static boolean isFileSigned(Path file) { ProcessBuilder pb = --- 864,888 ---- } // sign the app itself List<String> args = new ArrayList<>(); args.addAll(Arrays.asList("codesign", ! "--timestamp", ! "--options", "runtime", ! "--deep", ! "--force", ! "-s", signingIdentity, ! "-vvvv")); if (keyChain != null && !keyChain.isEmpty()) { args.add("--keychain"); args.add(keyChain); } args.add(appLocation.toString()); ProcessBuilder pb = new ProcessBuilder(args.toArray(new String[args.size()])); + IOUtils.exec(pb); } private static boolean isFileSigned(Path file) { ProcessBuilder pb =
< prev index next >