Skip to content

Commit

Permalink
Merge pull request #6869 from neilcsmith-net/windows-launchers
Browse files Browse the repository at this point in the history
Merge back Windows launcher code and add release workflow
  • Loading branch information
neilcsmith-net authored Jan 3, 2024
2 parents 46477fc + b8e969a commit 011c1cc
Show file tree
Hide file tree
Showing 38 changed files with 6,442 additions and 0 deletions.
210 changes: 210 additions & 0 deletions .github/workflows/native-binary-build-launcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.


# ----------------------
#
# This workflow builds the native Windows launchers for the IDE and platform.
#
# The result of the build are files 'launcher-external-sources.zip'
# and 'launcher-external-binaries.zip' which can be downloaded from
# the GitHub Actions UI and prepared for release to be used by the Ant build
# scripts for the NetBeans distribution.
#
# ----------------------


name: NetBeans Native Launcher


on:
push:
# Triggers the workflow on push or pull request events but only for
# relevant paths
paths:
- .github/workflows/native-binary-build-launcher.y*
- platform/o.n.bootstrap/launcher/windows/**
- harness/apisupport.harness/windows-launcher-src/**
- nb/ide.launcher/windows/**

pull_request:
paths:
- .github/workflows/native-binary-build-launcher.y*
- platform/o.n.bootstrap/launcher/windows/**
- harness/apisupport.harness/windows-launcher-src/**
- nb/ide.launcher/windows/**

# Allows you to run this workflow manually from the Actions tab in GitHub UI
workflow_dispatch:

# cancel other PR workflow run in the same head-base group if it exists (e.g. during PR syncs)
# if this is not a PR run (no github.head_ref and github.base_ref defined), use an UID as group
concurrency:
group: launcher-${{ github.head_ref || github.run_id }}-${{ github.base_ref }}
cancel-in-progress: true

jobs:

source:

name: Package Sources
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: false
show-progress: false

- name: Generate source bundle
run: |
SOURCES="nbbuild/build/native/launcher/sources"
mkdir -p ${SOURCES}/platform/o.n.bootstrap/launcher/
cp -r platform/o.n.bootstrap/launcher/windows/ ${SOURCES}/platform/o.n.bootstrap/launcher/
mkdir -p ${SOURCES}/harness/apisupport.harness/
cp -r harness/apisupport.harness/windows-launcher-src/ ${SOURCES}/harness/apisupport.harness/
mkdir -p ${SOURCES}/nb/ide.launcher/
cp -r nb/ide.launcher/windows/ ${SOURCES}/nb/ide.launcher/
cp LICENSE ${SOURCES}/LICENSE
cp NOTICE ${SOURCES}/NOTICE
ls -l -R ${SOURCES}
- name: Upload native sources
uses: actions/upload-artifact@v3
with:
name: launcher-external-sources
path: nbbuild/build/native/launcher/sources/
if-no-files-found: error


build-linux:

name: Build with MinGW
runs-on: ubuntu-latest
needs: source

steps:

- name: Install MinGW
run: sudo apt install mingw-w64 mingw-w64-tools

- name: Download sources
uses: actions/download-artifact@v3
with:
name: launcher-external-sources

- name: Build bootstrap binaries
run: |
echo "Building bootstrap binaries"
rm -rf ./build/
make -f Makefile.mingw
ls -l -R ./build/
echo "done"
working-directory: platform/o.n.bootstrap/launcher/windows/

- name: Upload bootstrap artifacts
uses: actions/upload-artifact@v3
with:
name: launcher-bootstrap-bin
path: platform/o.n.bootstrap/launcher/windows/build/
if-no-files-found: error

- name: Build harness binaries
run: |
echo "Building harness binaries"
rm -rf ./build/
make -f Makefile.mingw
ls -l -R ./build/
echo "done"
working-directory: harness/apisupport.harness/windows-launcher-src

- name: Upload harness artifacts
uses: actions/upload-artifact@v3
with:
name: launcher-harness-bin
path: harness/apisupport.harness/windows-launcher-src/build/
if-no-files-found: error

- name: Build IDE binaries
run: |
echo "Building IDE binaries"
rm -rf ./build/
make -f Makefile.mingw
ls -l -R ./build/
echo "done"
working-directory: nb/ide.launcher/windows

- name: Upload IDE artifacts
uses: actions/upload-artifact@v3
with:
name: launcher-ide-bin
path: nb/ide.launcher/windows/build/
if-no-files-found: error

build-zip-with-build-artifacts:

name: Package Binaries
runs-on: ubuntu-latest

# Only run when the platform specific builds are finished
needs: [build-linux]

steps:

- name: Create dir structure
run: mkdir -p myfiles/

- name: Download artifacts from predecessor jobs
uses: actions/download-artifact@v3
with:
path: myfiles/

- name: Tidy up and display artifacts
run: |
cp myfiles/launcher-external-sources/LICENSE myfiles/LICENSE
cp myfiles/launcher-external-sources/NOTICE myfiles/NOTICE
cp myfiles/*bin/*.exe myfiles/
cp myfiles/*bin/*.dll myfiles/
rm -rf myfiles/*-sources/
rm -rf myfiles/*-bin/
ls -l -R
- name: Create BUILDINFO
run: |
BUILDINFO="myfiles/BUILDINFO.txt"
touch "$BUILDINFO"
echo "Apache NetBeans" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Binaries in this ZIP are..." >> "$BUILDINFO"
echo "Build by GitHub Actions Workflow: ${GITHUB_WORKFLOW}" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Build from:" >> "$BUILDINFO"
echo " Git repo : ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> "$BUILDINFO"
echo " Git commit SHA : ${GITHUB_SHA}" >> "$BUILDINFO"
echo " Git ref : ${GITHUB_REF}" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Build time UTC : $(date --rfc-3339=seconds --utc)" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
- name: Upload bundle
uses: actions/upload-artifact@v3
with:
name: launcher-external-binaries
path: myfiles/
if-no-files-found: error
41 changes: 41 additions & 0 deletions harness/apisupport.harness/windows-launcher-src/Makefile.mingw
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

TMPFLD = ./build/
OFLD = ./build/

all: prepfolder app64.exe app.exe

prepfolder:
mkdir -p $(TMPFLD)
mkdir -p $(OFLD)

clean:
rm -f *.res *.exe

app64.res: app.rc app.exe.manifest
x86_64-w64-mingw32-windres -o$(TMPFLD)app64.res -Ocoff -DMANIFEST_FILE=app.exe.manifest app.rc

app64.exe: app.cpp applauncher.cpp app64.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp
x86_64-w64-mingw32-gcc -s -DNBEXEC_DLL='"/lib/nbexec64.dll"' -DARCHITECTURE=64 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh app.cpp -mwindows applauncher.cpp $(TMPFLD)app64.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp ../../../nb/ide.launcher/windows/nblauncher.cpp -I ../../../platform/o.n.bootstrap/launcher/windows/ -o$(OFLD)app64.exe -static -lstdc++ -static-libstdc++ -static-libgcc

app.res: app.rc app.exe.manifest
i686-w64-mingw32-windres -o$(TMPFLD)app.res -Ocoff -DMANIFEST_FILE=app.exe.manifest app.rc

app.exe: app.cpp applauncher.cpp app.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp
i686-w64-mingw32-gcc -s -DNBEXEC_DLL='"/lib/nbexec.dll"' -DARCHITECTURE=32 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -mwindows app.cpp applauncher.cpp $(TMPFLD)app.res ../../../platform/o.n.bootstrap/launcher/windows/utilsfuncs.cpp ../../../nb/ide.launcher/windows/nblauncher.cpp -I ../../../platform/o.n.bootstrap/launcher/windows/ -o$(OFLD)app.exe -static -lstdc++ -static-libstdc++ -static-libgcc

29 changes: 29 additions & 0 deletions harness/apisupport.harness/windows-launcher-src/app.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Author: Tomas Holy
*/


#include "applauncher.h"

int main(int argc, char *argv[]) {
AppLauncher launcher;
return launcher.start(argc - 1, argv + 1);
}
75 changes: 75 additions & 0 deletions harness/apisupport.harness/windows-launcher-src/app.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="101.1.0.0"
processorArchitecture="x86"
name="app.exe"
type="win32"/>

<description>NBP application process</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<!-- See https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page -->
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
<!-- NETBEANS-1227: Indicate the same HiDPI capabilities as javaw.exe from JDK 11. -->
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns:dpi1="http://schemas.microsoft.com/SMI/2005/WindowsSettings" xmlns:dpi2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<dpi1:dpiAware>true/PM</dpi1:dpiAware>
<dpi2:dpiAwareness>PerMonitorV2, PerMonitor, system</dpi2:dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
<!-- List of explicitly supported Windows versions. This is the list from
javaw.exe on JDK 8.0.172, which is the same as that of JDK 11ea. -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
Binary file not shown.
26 changes: 26 additions & 0 deletions harness/apisupport.harness/windows-launcher-src/app.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.

#include <winuser.h>

100 ICON "app.ico"

// Value MANIFEST_FILE id taken from windres parameter -DMANIFEST_FILE
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST MANIFEST_FILE
Loading

0 comments on commit 011c1cc

Please sign in to comment.