Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiX 3.14.1 #4

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.3.2
11 changes: 11 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: windows
on:
pull_request:
push:
jobs:
bazel-test:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Build and test all targets
run: bazelisk test //...
11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module(name = "mjbots_rules_wix")

bazel_dep(name = "bazel_skylib", version = "1.7.1")

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_wixtoolset_wix3",
urls = ["https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip"],
integrity = "sha256-asgk4WQtb3J30O1+oJQRpQj2EWum+uCqXyx9qi/0PTE=",
build_file = "//:wix3.BUILD",
)
111 changes: 111 additions & 0 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 13 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,29 @@
# WiX Toolset support for Bazel #
# Bazel Rules for the WiX Toolset

This package provides bazel (https://bazel.build) rules for building
Microsoft Windows .msi installers using the WiX Toolset.
This package provides [Bazel](https://bazel.build) rules for building
Windows `.msi` installers using the [WiX Toolset](https://wixtoolset.org).

* License: Apache 2.0
## Usage

## Usage ##

In `WORKSPACE` add this:
In `MODULE.bazel` add:

```
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

RULES_WIX_COMMIT = "XXX"

http_archive(
name = "rules_wix",
url = "https://github.com/mjbots/rules_wix/archive/{}.zip".format(RULES_WIX_COMMIT),

# Replace this with the value from the bazel error message.
sha256 = "0000000000000000000000000000000000000000000000000000000000000000",

strip_prefix = "rules_wix-{}".format(RULES_WIX_COMMIT),
bazel_dep(name = "mjbots_rules_wix")
git_override(
module_name = "mjbots_rules_wix",
remote = "https://github.com/kleinpa/rules_wix",
commit = "...",
)

load("@rules_wix//:deps.bzl", "add_wix_deps")
add_wix_deps()
```

Then in a BUILD file you can use:
Then in a `BUILD` file:

```
load("@rules_wix//:rules.bzl", "pkg_msi")
load("@mjbots_rules_wix//:defs.bzl", "pkg_msi")

pkg_msi(
name = "example.msi",
src = "example.wxs",
deps = [
# ...
],
arch = "x64",
exts = [
"WixUiExtension",
# ...
],
# ...
)
```
23 changes: 0 additions & 23 deletions WORKSPACE

This file was deleted.

32 changes: 7 additions & 25 deletions rules.bzl → defs.bzl
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
# -*- python -*-

# Copyright 2020 Josh Pieper, [email protected].
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

def _pkg_msi_impl(ctx):
obj = ctx.actions.declare_file(ctx.label.name + ".obj")
out = ctx.actions.declare_file(ctx.label.name)

my_deps = []
for x in ctx.attr.deps:
my_deps += x.files.to_list()

exts = []
for x in ctx.attr.exts:
exts += ["-ext", x]

ctx.actions.run(
outputs = [obj],
inputs = [ctx.file.src] + my_deps,
executable = ctx.executable._candle,
arguments = [
"-nologo",
"-arch", ctx.attr.arch,
"-o", obj.path,
ctx.file.src.path],
arguments = ["-nologo", "-arch", ctx.attr.arch] +
exts + ["-o", obj.path, ctx.file.src.path],
)

exts = []
for x in ctx.attr.exts:
exts += ["-ext", x]

ctx.actions.run(
outputs = [out],
inputs = [obj] + my_deps,
Expand Down
26 changes: 0 additions & 26 deletions deps.bzl

This file was deleted.

28 changes: 9 additions & 19 deletions example/BUILD
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
# -*- python -*-

# Copyright 2020 Josh Pieper, [email protected].
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:rules.bzl", "pkg_msi")

package(default_visibility = ["//visibility:public"])
load("//:defs.bzl", "pkg_msi")
load("@bazel_skylib//rules:build_test.bzl", "build_test")

cc_binary(
name = "example",
Expand All @@ -29,3 +12,10 @@ pkg_msi(
deps = [":example"],
exts = ["WixUiExtension"],
)

build_test(
name = "build_test",
targets = [
":rules_msi_example.msi",
],
)
6 changes: 3 additions & 3 deletions example/example.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='rules_wix example' Id='YOURGUID-40f0-441e-800e-6b8ba6f2f197' UpgradeCode='YOURGUID-22ee-4545-9598-3541e2f2eac2'
<Product Name='rules_wix example' Id='28b2ba3a-fba6-47d9-934f-1c86d91ef4c2' UpgradeCode='19d8a2bb-a46f-4f1d-b1d0-152ec05022aa'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='mjbots Robotic Systems'>

<Package Id='*' Keywords='Installer'
Expand All @@ -17,7 +17,7 @@
<Directory Id='mjbots' Name='mjbots'>
<Directory Id='INSTALLDIR' Name='pkg_msi_example'>

<Component Id='MainExecutable' Guid='YOURGUID-02d8-408e-b7c4-6557a8bdeac5'>
<Component Id='MainExecutable' Guid='f98b9319-3327-4fa0-aa61-06e3105179cb'>
<File Id='ExampleEXE' Name='example.exe' DiskId='1' Source='example.exe' KeyPath='yes'>
<Shortcut Id="startmenuExample" Directory="ProgramMenuDir" Name="Example" WorkingDirectory='INSTALLDIR' Icon="example.exe" IconIndex="0" Advertise="yes" />
<Shortcut Id="desktopExample" Directory="DesktopFolder" Name="Example" WorkingDirectory='INSTALLDIR' Icon="example.exe" IconIndex="0" Advertise="yes" />
Expand All @@ -30,7 +30,7 @@

<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="mjbots">
<Component Id="ProgramMenuDir" Guid="YOURGUID-d8db-44ba-a679-aea11eb41f69">
<Component Id="ProgramMenuDir" Guid="5cbb8027-51d0-40a5-9409-989dcd26d829">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
Expand Down