src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java.html
author herrick
Mon, 17 Jun 2019 15:38:04 -0400
branchJDK-8200758-branch
changeset 57413 45c74e654794
permissions -rw-r--r--
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files) Submitted-by: asemenyuk Reviewed-by: herrick, almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57413
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     1
<?xml version="1.0"?>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     3
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     5
<head><meta charset="utf-8">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     6
<meta http-equiv="cache-control" content="no-cache" />
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     7
<meta http-equiv="Pragma" content="no-cache" />
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     8
<meta http-equiv="Expires" content="-1" />
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     9
<!--
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    10
   Note to customizers: the body of the webrev is IDed as SUNWwebrev
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    11
   to allow easy overriding by users of webrev via the userContent.css
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    12
   mechanism available in some browsers.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    13
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    14
   For example, to have all "removed" information be red instead of
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    15
   brown, set a rule in your userContent.css file like:
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    16
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    17
       body#SUNWwebrev span.removed { color: red ! important; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    18
-->
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    19
<style type="text/css" media="screen">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    20
body {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    21
    background-color: #eeeeee;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    22
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    23
hr {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    24
    border: none 0;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    25
    border-top: 1px solid #aaa;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    26
    height: 1px;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    27
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    28
div.summary {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    29
    font-size: .8em;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    30
    border-bottom: 1px solid #aaa;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    31
    padding-left: 1em;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    32
    padding-right: 1em;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    33
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    34
div.summary h2 {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    35
    margin-bottom: 0.3em;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    36
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    37
div.summary table th {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    38
    text-align: right;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    39
    vertical-align: top;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    40
    white-space: nowrap;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    41
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    42
span.lineschanged {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    43
    font-size: 0.7em;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    44
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    45
span.oldmarker {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    46
    color: red;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    47
    font-size: large;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    48
    font-weight: bold;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    49
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    50
span.newmarker {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    51
    color: green;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    52
    font-size: large;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    53
    font-weight: bold;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    54
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    55
span.removed {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    56
    color: brown;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    57
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    58
span.changed {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    59
    color: blue;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    60
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    61
span.new {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    62
    color: blue;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    63
    font-weight: bold;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    64
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    65
a.print { font-size: x-small; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    66
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    67
</style>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    68
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    69
<style type="text/css" media="print">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    70
pre { font-size: 0.8em; font-family: courier, monospace; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    71
span.removed { color: #444; font-style: italic }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    72
span.changed { font-weight: bold; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    73
span.new { font-weight: bold; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    74
span.newmarker { font-size: 1.2em; font-weight: bold; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    75
span.oldmarker { font-size: 1.2em; font-weight: bold; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    76
a.print {display: none}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    77
hr { border: none 0; border-top: 1px solid #aaa; height: 1px; }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    78
</style>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    79
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    80
<title>New src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java</title>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    81
<body id="SUNWwebrev">
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    82
<pre>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    83
   1 /*
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    84
   2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    85
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    86
   4  *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    87
   5  * This code is free software; you can redistribute it and/or modify it
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    88
   6  * under the terms of the GNU General Public License version 2 only, as
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    89
   7  * published by the Free Software Foundation.  Oracle designates this
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    90
   8  * particular file as subject to the "Classpath" exception as provided
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    91
   9  * by Oracle in the LICENSE file that accompanied this code.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    92
  10  *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    93
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    94
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    95
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    96
  14  * version 2 for more details (a copy is included in the LICENSE file that
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    97
  15  * accompanied this code).
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    98
  16  *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    99
  17  * You should have received a copy of the GNU General Public License version
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   100
  18  * 2 along with this work; if not, write to the Free Software Foundation,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   101
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   102
  20  *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   103
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   104
  22  * or visit www.oracle.com if you need additional information or have any
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   105
  23  * questions.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   106
  24  */
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   107
  25 package jdk.jpackage.internal;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   108
  26 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   109
  27 import java.io.*;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   110
  28 import java.nio.file.Files;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   111
  29 import java.nio.file.Path;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   112
  30 import java.nio.file.Paths;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   113
  31 import java.text.MessageFormat;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   114
  32 import java.util.*;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   115
  33 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   116
  34 public class WinExeBundler extends AbstractBundler {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   117
  35 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   118
  36     static {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   119
  37         System.loadLibrary("jpackage");
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   120
  38     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   121
  39 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   122
  40     private static final ResourceBundle I18N = ResourceBundle.getBundle(
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   123
  41             "jdk.jpackage.internal.resources.WinResources");
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   124
  42 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   125
  43     public static final BundlerParamInfo&lt;WinAppBundler&gt; APP_BUNDLER
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   126
  44             = new WindowsBundlerParam&lt;&gt;(
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   127
  45                     "win.app.bundler",
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   128
  46                     WinAppBundler.class,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   129
  47                     params -&gt; new WinAppBundler(),
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   130
  48                     null);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   131
  49 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   132
  50     public static final BundlerParamInfo&lt;File&gt; EXE_IMAGE_DIR
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   133
  51             = new WindowsBundlerParam&lt;&gt;(
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   134
  52                     "win.exe.imageDir",
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   135
  53                     File.class,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   136
  54                     params -&gt; {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   137
  55                         File imagesRoot = IMAGES_ROOT.fetchFrom(params);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   138
  56                         if (!imagesRoot.exists()) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   139
  57                             imagesRoot.mkdirs();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   140
  58                         }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   141
  59                         return new File(imagesRoot, "win-exe.image");
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   142
  60                     },
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   143
  61                     (s, p) -&gt; null);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   144
  62 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   145
  63     private final static String EXE_WRAPPER_NAME = "msiwrapper.exe";
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   146
  64 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   147
  65     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   148
  66     public String getName() {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   149
  67         return getString("exe.bundler.name");
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   150
  68     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   151
  69 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   152
  70     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   153
  71     public String getDescription() {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   154
  72         return getString("exe.bundler.description");
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   155
  73     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   156
  74 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   157
  75     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   158
  76     public String getID() {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   159
  77         return "exe";
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   160
  78     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   161
  79 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   162
  80     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   163
  81     public String getBundleType() {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   164
  82         return "INSTALLER";
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   165
  83     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   166
  84 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   167
  85     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   168
  86     public Collection&lt;BundlerParamInfo&lt;?&gt;&gt; getBundleParameters() {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   169
  87         return new WinMsiBundler().getBundleParameters();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   170
  88     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   171
  89 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   172
  90     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   173
  91     public File execute(Map&lt;String, ? super Object&gt; params,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   174
  92             File outputParentDir) throws PackagerException {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   175
  93         return bundle(params, outputParentDir);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   176
  94     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   177
  95 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   178
  96     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   179
  97     public boolean supported(boolean platformInstaller) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   180
  98         return (Platform.getPlatform() == Platform.WINDOWS);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   181
  99     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   182
 100 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   183
 101     @Override
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   184
 102     public boolean validate(Map&lt;String, ? super Object&gt; params)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   185
 103             throws UnsupportedPlatformException, ConfigException {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   186
 104         return new WinMsiBundler().validate(params);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   187
 105     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   188
 106 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   189
 107     public File bundle(Map&lt;String, ? super Object&gt; params, File outdir)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   190
 108             throws PackagerException {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   191
 109 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   192
 110         File exeImageDir = EXE_IMAGE_DIR.fetchFrom(params);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   193
 111 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   194
 112         // Write msi to temporary directory.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   195
 113         File msi = new WinMsiBundler().bundle(params, exeImageDir);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   196
 114 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   197
 115         try {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   198
 116             return buildEXE(msi, outdir);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   199
 117         } catch (IOException ex) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   200
 118             Log.verbose(ex);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   201
 119             throw new PackagerException(ex);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   202
 120         }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   203
 121     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   204
 122 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   205
 123     private File buildEXE(File msi, File outdir)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   206
 124             throws IOException {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   207
 125 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   208
 126         Log.verbose(MessageFormat.format(
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   209
 127                 getString("message.outputting-to-location"),
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   210
 128                 outdir.getAbsolutePath()));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   211
 129 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   212
 130         // Copy template msi wrapper next to msi file
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   213
 131         String exePath = msi.getAbsolutePath();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   214
 132         exePath = exePath.substring(0, exePath.lastIndexOf('.')) + ".exe";
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   215
 133         try (InputStream is = getResourceAsStream(EXE_WRAPPER_NAME)) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   216
 134             Files.copy(is, Path.of(exePath));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   217
 135         }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   218
 136         // Embed msi in msi wrapper exe.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   219
 137         embedMSI(exePath, msi.getAbsolutePath());
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   220
 138 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   221
 139         Path dstExePath = Paths.get(outdir.getAbsolutePath(), Path.of(exePath).getFileName().toString());
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   222
 140         Files.deleteIfExists(dstExePath);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   223
 141 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   224
 142         Files.copy(Path.of(exePath), dstExePath);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   225
 143 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   226
 144         Log.verbose(MessageFormat.format(
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   227
 145                 getString("message.output-location"),
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   228
 146                 outdir.getAbsolutePath()));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   229
 147 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   230
 148         return dstExePath.toFile();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   231
 149     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   232
 150 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   233
 151     private static String getString(String key)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   234
 152             throws MissingResourceException {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   235
 153         return I18N.getString(key);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   236
 154     }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   237
 155 
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   238
 156     private static native int embedMSI(String exePath, String msiPath);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   239
 157 }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   240
</pre></body></html>