-
Notifications
You must be signed in to change notification settings - Fork 874
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy Windows launcher sources back from https://github.com/apache/net…
- Loading branch information
1 parent
9a00dd2
commit df96b9b
Showing
37 changed files
with
6,232 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
harness/apisupport.harness/windows-launcher-src/Makefile.mingw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ../../../../target/tmp/ | ||
OFLD = ../../../../target/harness/ | ||
|
||
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 ../bootstrap/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 ../bootstrap/utilsfuncs.cpp ../ide/nblauncher.cpp -I ../bootstrap/ -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 ../bootstrap/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 ../bootstrap/utilsfuncs.cpp ../ide/nblauncher.cpp -I ../bootstrap/ -o$(OFLD)app.exe -static -lstdc++ -static-libstdc++ -static-libgcc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
75
harness/apisupport.harness/windows-launcher-src/app.exe.manifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="9.0.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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
141 changes: 141 additions & 0 deletions
141
harness/apisupport.harness/windows-launcher-src/applauncher.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/* | ||
* 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" | ||
#include "../bootstrap/utilsfuncs.h" | ||
#include "../bootstrap/argnames.h" | ||
|
||
using namespace std; | ||
|
||
const char *AppLauncher::OPT_DEFAULT_USER_DIR = "default_userdir="; | ||
const char *AppLauncher::OPT_DEFAULT_CACHE_DIR = "default_cachedir="; | ||
const char *AppLauncher::OPT_DEFAULT_OPTIONS = "default_options="; | ||
const char *AppLauncher::OPT_EXTRA_CLUSTERS = "extra_clusters="; | ||
const char *AppLauncher::OPT_JDK_HOME = "jdkhome="; | ||
const char *AppLauncher::APPNAME_TOKEN = "${APPNAME}"; | ||
const char *AppLauncher::CACHE_SUFFIX = "\\Cache\\"; | ||
|
||
AppLauncher::AppLauncher() { | ||
} | ||
|
||
AppLauncher::AppLauncher(const AppLauncher& orig) { | ||
} | ||
|
||
AppLauncher::~AppLauncher() { | ||
} | ||
|
||
bool AppLauncher::initBaseNames() { | ||
if (!NbLauncher::initBaseNames()) { | ||
return false; | ||
} | ||
|
||
string pattern = baseDir + "\\platform*"; | ||
WIN32_FIND_DATA fd = {0}; | ||
HANDLE hFind; | ||
hFind = FindFirstFile(pattern.c_str(), &fd); | ||
if (hFind == INVALID_HANDLE_VALUE) { | ||
logErr(false, true, "Cannot find 'platform*' folder!"); | ||
return false; | ||
} | ||
|
||
do { | ||
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) | ||
&& fileExists((baseDir + '\\' + fd.cFileName + NbLauncher::NBEXEC_FILE_PATH).c_str())) { | ||
platformDir = baseDir + '\\' + fd.cFileName; | ||
break; | ||
} | ||
} while (FindNextFile(hFind, &fd)); | ||
|
||
FindClose(hFind); | ||
|
||
if (platformDir.empty()) { | ||
logErr(false, true, "Cannot find valid 'platform*' folder!"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
bool AppLauncher::findUserDir(const char *str) { | ||
logMsg("AppLauncher::findUserDir()"); | ||
if (!NbLauncher::findUserDir(str)) { // will set userDir and possibly userHome. | ||
return false; | ||
} | ||
int pos = userDir.find(APPNAME_TOKEN); | ||
if (pos != string::npos) { | ||
userDir.replace(pos, strlen(APPNAME_TOKEN), appName); | ||
} | ||
return true; | ||
} | ||
|
||
bool AppLauncher::findCacheDir(const char *str) { | ||
logMsg("AppLauncher::findCacheDir"); | ||
if (!NbLauncher::findCacheDir(str)) { // will set userDir and possibly userHome. | ||
return false; | ||
} | ||
int pos = cacheDir.find(APPNAME_TOKEN); | ||
if (pos != string::npos) { | ||
cacheDir.replace(pos, strlen(APPNAME_TOKEN), appName); | ||
} | ||
return true; | ||
} | ||
|
||
const char * AppLauncher::getAppName() { | ||
return appName.c_str(); | ||
} | ||
|
||
void AppLauncher::addSpecificOptions(CmdArgs &args) { | ||
} | ||
|
||
void AppLauncher::adjustHeapSize() { | ||
} | ||
|
||
const char * AppLauncher::getDefUserDirOptName() { | ||
return OPT_DEFAULT_USER_DIR; | ||
} | ||
|
||
const char * AppLauncher::getDefCacheDirOptName() { | ||
return OPT_DEFAULT_CACHE_DIR; | ||
} | ||
|
||
const char * AppLauncher::getDefOptionsOptName() { | ||
return OPT_DEFAULT_OPTIONS; | ||
} | ||
|
||
const char * AppLauncher::getExtraClustersOptName() { | ||
return OPT_EXTRA_CLUSTERS; | ||
} | ||
|
||
const char * AppLauncher::getJdkHomeOptName() { | ||
return OPT_JDK_HOME; | ||
} | ||
|
||
const char * AppLauncher::getCurrentDir() { | ||
return baseDir.c_str(); | ||
} | ||
|
||
std::string AppLauncher::constructApplicationDir(const std::string& dir, bool cache) { | ||
if (cache) { | ||
return dir + "\\" + getAppName() + CACHE_SUFFIX; | ||
} else { | ||
return dir + "\\" + getAppName() + "\\"; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
harness/apisupport.harness/windows-launcher-src/applauncher.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
#ifndef _APPLAUNCHER_H | ||
#define _APPLAUNCHER_H | ||
|
||
#include <string> | ||
#include <windows.h> | ||
|
||
#include "shlobj.h" | ||
#include "../ide/nblauncher.h" | ||
|
||
class AppLauncher : public NbLauncher { | ||
|
||
static const char *OPT_DEFAULT_USER_DIR; | ||
static const char *OPT_DEFAULT_CACHE_DIR; | ||
static const char *OPT_DEFAULT_OPTIONS; | ||
static const char *OPT_EXTRA_CLUSTERS; | ||
static const char *OPT_JDK_HOME; | ||
static const char *APPNAME_TOKEN; | ||
static const char *REG_APPDATA_NAME; | ||
static const char *CACHE_SUFFIX; | ||
|
||
public: | ||
AppLauncher(); | ||
virtual ~AppLauncher(); | ||
|
||
protected: | ||
virtual bool initBaseNames(); | ||
virtual const char * getAppName(); | ||
virtual void addSpecificOptions(CmdArgs &args); | ||
virtual void adjustHeapSize(); | ||
virtual bool findUserDir(const char *str); | ||
virtual bool findCacheDir(const char *str); | ||
virtual const char * getDefUserDirOptName(); | ||
virtual const char * getDefCacheDirOptName(); | ||
virtual const char * getDefOptionsOptName(); | ||
virtual const char * getExtraClustersOptName(); | ||
virtual const char * getJdkHomeOptName(); | ||
virtual const char * getCurrentDir(); | ||
virtual std::string constructApplicationDir(const std::string& dir, bool cache); | ||
|
||
private: | ||
AppLauncher(const AppLauncher& orig); | ||
}; | ||
|
||
#endif /* _NBLAUNCHER_H */ | ||
|
Oops, something went wrong.